Recently, initrd-related CI are failing frequently.
http://jenkins.katacontainers.io/job/kata-containers-runtime-ubuntu-18-04-PR-initrd/2843/
INFO: Image to generate: kata-containers-*default-initrd-name-*default-initrd-version-osbuilder-7526f49-agent-36b37f6.initrd
......
./rootfs-builder/rootfs.sh: line 280: /tmp/jenkins/workspace/kata-containers-runtime-ubuntu-18-04-PR-initrd/go/src/github.com/kata-containers/osbuilder/rootfs-builder/*default-initrd-name/config.sh: No such file or directory
Failed at 120: sudo -E AGENT_INIT="${AGENT_INIT}" AGENT_VERSION="${agent_commit}" GOPATH="$GOPATH" USE_DOCKER=true OS_VERSION=${os_version} ./rootfs-builder/rootfs.sh "${distro}"
Failed at 26: "${cidir}/install_kata_image.sh" "${tag}"
Debugging on the above output, the cause may come from that yq failed reading values from assets.initrd.architecture.$arch.name
Based on the latest yq spec, the read command could print out the anchors of a document and can also traverse them.
But when anchor refers to an scalar (string, integer etc), the latest yq could not traverse it.
e.g.
$ yq read versions.yaml "assets.initrd.architecture.ppc64le.name"
*default-initrd-name
@Pennyzct also see https://github.com/kata-containers/tests/pull/2275
/cc @chavafg @GabyCT
For ref, some yq docs referring to the difference between fetching an anchor and resolving (following) an anchor ... https://mikefarah.gitbook.io/yq/commands/read#anchors-and-aliases
I think some of this got 'added' in v3 - so, maybe we need to adapt to a new call?
I dug a fraction more (as this is something I don't know much about in yaml, and wanted to). I think the issue is when we have an anchor on something that has a value - I think that is called a 'scalar'?. So, with the yaml:
---
assets:
initrd:
architecture:
aarch64:
name: &default-initrd-name "alpine"
version: &default-initrd-version "3.7"
ppc64le:
name: *default-initrd-name
a2:
aarch64: &default-initrd
name: "alpine"
version: "3.7"
ppc64le: *default-initrd
and the code:
#!/bin/bash
set -x
yq2 read v2.yaml "assets.initrd.architecture.ppc64le.name"
yq3 read v2.yaml "assets.initrd.architecture.ppc64le.name"
yq2 read v2.yaml "assets.initrd.a2.ppc64le.name"
yq3 read v2.yaml "assets.initrd.a2.ppc64le.name"
I get:
./go.sh
+ yq2 read v2.yaml assets.initrd.architecture.ppc64le.name
alpine
+ yq3 read v2.yaml assets.initrd.architecture.ppc64le.name
*default-initrd-name
+ yq2 read v2.yaml assets.initrd.a2.ppc64le.name
alpine
+ yq3 read v2.yaml assets.initrd.a2.ppc64le.name
alpine
Looking around, I think what we have is valid YAML anchors - so, I suspect this is a yq issue.
/cc @jodh-intel for yaml expertise.... and tenacity....
I've raised https://github.com/mikefarah/yq/issues/340.
Most helpful comment
I've raised https://github.com/mikefarah/yq/issues/340.