Skip to content

Commit c5bc286

Browse files
beraldolealzaymat
authored andcommitted
deps: bumping yq to v4.40.7
Since yq frequently updates, let's upgrade to a version from February to bypass potential issues with versions 4.41-4.43 for now. We can always upgrade to the newest version if necessary. Fixes kata-containers#9354 Depends-on:github.com/kata-containers/tests#5818 Signed-off-by: Beraldo Leal <bleal@redhat.com>
1 parent d229e89 commit c5bc286

47 files changed

Lines changed: 376 additions & 476 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

ci/install_libseccomp.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ workdir="$(mktemp -d --tmpdir build-libseccomp.XXXXX)"
2323
# Variables for libseccomp
2424
libseccomp_version="${LIBSECCOMP_VERSION:-""}"
2525
if [ -z "${libseccomp_version}" ]; then
26-
libseccomp_version=$(get_from_kata_deps "externals.libseccomp.version")
26+
libseccomp_version=$(get_from_kata_deps ".externals.libseccomp.version")
2727
fi
2828
libseccomp_url="${LIBSECCOMP_URL:-""}"
2929
if [ -z "${libseccomp_url}" ]; then
30-
libseccomp_url=$(get_from_kata_deps "externals.libseccomp.url")
30+
libseccomp_url=$(get_from_kata_deps ".externals.libseccomp.url")
3131
fi
3232
libseccomp_tarball="libseccomp-${libseccomp_version}.tar.gz"
3333
libseccomp_tarball_url="${libseccomp_url}/releases/download/v${libseccomp_version}/${libseccomp_tarball}"
@@ -36,11 +36,11 @@ cflags="-O2"
3636
# Variables for gperf
3737
gperf_version="${GPERF_VERSION:-""}"
3838
if [ -z "${gperf_version}" ]; then
39-
gperf_version=$(get_from_kata_deps "externals.gperf.version")
39+
gperf_version=$(get_from_kata_deps ".externals.gperf.version")
4040
fi
4141
gperf_url="${GPERF_URL:-""}"
4242
if [ -z "${gperf_url}" ]; then
43-
gperf_url=$(get_from_kata_deps "externals.gperf.url")
43+
gperf_url=$(get_from_kata_deps ".externals.gperf.url")
4444
fi
4545
gperf_tarball="gperf-${gperf_version}.tar.gz"
4646
gperf_tarball_url="${gperf_url}/${gperf_tarball}"

ci/install_yq.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ die() {
1616
# Install via binary download, as we may not have golang installed at this point
1717
function install_yq() {
1818
local yq_pkg="github.com/mikefarah/yq"
19-
local yq_version=3.4.1
19+
local yq_version=v4.40.7
2020
local precmd=""
2121
INSTALL_IN_GOPATH=${INSTALL_IN_GOPATH:-true}
2222

docs/Developer-Guide.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ and repository utilized can be found by looking at the [versions file](../versio
461461
Find the correct version of QEMU from the versions file:
462462
```bash
463463
$ source kata-containers/tools/packaging/scripts/lib.sh
464-
$ qemu_version="$(get_from_kata_deps "assets.hypervisor.qemu.version")"
464+
$ qemu_version="$(get_from_kata_deps ".assets.hypervisor.qemu.version")"
465465
$ echo "${qemu_version}"
466466
```
467467
Get source from the matching branch of QEMU:

docs/how-to/how-to-pull-images-in-guest-with-kata.md

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -35,27 +35,23 @@ $ git clone -b "${nydus_snapshotter_version}" "${nydus_snapshotter_url}" "${nydu
3535
2. Configure DaemonSet file
3636
```bash
3737
$ pushd "$nydus_snapshotter_install_dir"
38-
$ yq write -i \
39-
> misc/snapshotter/base/nydus-snapshotter.yaml \
40-
> 'data.FS_DRIVER' \
41-
> "proxy" --style=double
38+
$ yq -i \
39+
> '.data.FS_DRIVER = "proxy"' -P \
40+
> misc/snapshotter/base/nydus-snapshotter.yaml
4241
# Disable to read snapshotter config from configmap
43-
$ yq write -i \
44-
> misc/snapshotter/base/nydus-snapshotter.yaml \
45-
> 'data.ENABLE_CONFIG_FROM_VOLUME' \
46-
> "false" --style=double
42+
$ yq -i \
43+
> 'data.ENABLE_CONFIG_FROM_VOLUME = "false"' -P \
44+
> misc/snapshotter/base/nydus-snapshotter.yaml
4745
# Enable to run snapshotter as a systemd service
4846
# (skip if you want to run nydus snapshotter as a standalone process)
49-
$ yq write -i \
50-
> misc/snapshotter/base/nydus-snapshotter.yaml \
51-
> 'data.ENABLE_SYSTEMD_SERVICE' \
52-
> "true" --style=double
47+
$ yq -i \
48+
> 'data.ENABLE_SYSTEMD_SERVICE = "true"' -P \
49+
> misc/snapshotter/base/nydus-snapshotter.yaml
5350
# Enable "runtime specific snapshotter" feature in containerd when configuring containerd for snapshotter
5451
# (skip if you want to configure nydus snapshotter as a global snapshotter in containerd)
55-
$ yq write -i \
56-
> misc/snapshotter/base/nydus-snapshotter.yaml \
57-
> 'data.ENABLE_RUNTIME_SPECIFIC_SNAPSHOTTER' \
58-
> "true" --style=double
52+
$ yq -i \
53+
> 'data.ENABLE_RUNTIME_SPECIFIC_SNAPSHOTTER = "true"' -P \
54+
> misc/snapshotter/base/nydus-snapshotter.yaml
5955
```
6056

6157
3. Install `nydus snapshotter` as a DaemonSet

docs/how-to/how-to-run-kata-containers-with-SNP-VMs.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ $ popd
4444
- Build a custom QEMU
4545
```bash
4646
$ source kata-containers/tools/packaging/scripts/lib.sh
47-
$ qemu_url="$(get_from_kata_deps "assets.hypervisor.qemu-snp-experimental.url")"
48-
$ qemu_tag="$(get_from_kata_deps "assets.hypervisor.qemu-snp-experimental.tag")"
47+
$ qemu_url="$(get_from_kata_deps ".assets.hypervisor.qemu-snp-experimental.url")"
48+
$ qemu_tag="$(get_from_kata_deps ".assets.hypervisor.qemu-snp-experimental.tag")"
4949
$ git clone "${qemu_url}"
5050
$ pushd qemu
5151
$ git checkout "${qemu_tag}"

src/runtime/golang.mk

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,17 @@ ifeq (,$(not_check_version))
2727
ifneq (,$(install_yq))
2828
$(error "ERROR: install yq failed")
2929
endif
30-
golang_version_min=$(shell $(GOPATH)/bin/yq r ../../versions.yaml languages.golang.version)
30+
31+
YQ_VERSION=$(shell $(GOPATH)/bin/yq --version | grep -oE "version v?[0-9]+" | grep -oE "[0-9]+")
32+
QUERY="languages.golang.version"
33+
34+
ifneq (,$(findstring 4,$(YQ_VERSION)))
35+
YQ_CMD=$(GOPATH)/bin/yq eval .$(QUERY) ../../versions.yaml
36+
else
37+
YQ_CMD=$(GOPATH)/bin/yq r ../../versions.yaml $(QUERY)
38+
endif
39+
40+
golang_version_min=$(shell $(YQ_CMD))
3141

3242
ifeq (,$(golang_version_min))
3343
$(error "ERROR: cannot determine minimum golang version")

src/runtime/virtcontainers/pkg/cloud-hypervisor/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ update-yaml:
2525
ifndef YQ
2626
$(MK_DIR)/../../../../../ci//install_yq.sh
2727
endif
28-
clh_version=$(shell yq r $(VERSIONS_FILE) assets.hypervisor.cloud_hypervisor.version); \
28+
clh_version=$(shell yq .assets.hypervisor.cloud_hypervisor.version $(VERSIONS_FILE)); \
2929
curl -OL https://raw.githubusercontent.com/cloud-hypervisor/cloud-hypervisor/$$clh_version/vmm/src/api/openapi/cloud-hypervisor.yaml
3030

3131
clean-generated-code:

tests/cmd/github-labels/github-labels.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ merge_yaml()
4848
[ -n "$out" ] || die "need output file"
4949

5050
need_yq
51-
yq merge "$file1" --append "$file2" > "$out"
51+
yq eval-all '. as $item ireduce ({}; . *+ $item)' "$file1" "$file2" > "$out"
5252
}
5353

5454
check_yaml()
@@ -58,7 +58,7 @@ check_yaml()
5858
[ -n "$file" ] || die "need file to check"
5959

6060
need_yq
61-
yq read "$file" >/dev/null
61+
yq "$file" >/dev/null
6262

6363
[ -z "$(command -v yamllint)" ] && die "need yamllint installed"
6464

tests/common.bash

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -497,11 +497,19 @@ function ensure_yq() {
497497

498498
# dependency: What we want to get the version from the versions.yaml file
499499
function get_from_kata_deps() {
500-
local dependency="$1"
501500
versions_file="${repo_root_dir}/versions.yaml"
502501

503502
command -v yq &>/dev/null || die 'yq command is not in your $PATH'
504-
result=$("yq" read -X "$versions_file" "$dependency")
503+
504+
yq_version=$(yq --version | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | cut -d. -f1)
505+
if [ "$yq_version" -eq 3 ]; then
506+
dependency=$(echo "$1" | sed "s/^\.//g")
507+
result=$("yq" read "$versions_file" "$dependency")
508+
else
509+
dependency=$1
510+
result=$("yq" "$dependency | explode (.)" "$versions_file")
511+
fi
512+
505513
[ "$result" = "null" ] && result=""
506514
echo "$result"
507515
}
@@ -743,7 +751,7 @@ function get_dep_from_yaml_db(){
743751

744752
"${repo_root_dir}/ci/install_yq.sh" >&2
745753

746-
result=$("${GOPATH}/bin/yq" r -X "$versions_file" "$dependency")
754+
result=$("${GOPATH}/bin/yq" "$dependency" "$versions_file")
747755
[ "$result" = "null" ] && result=""
748756
echo "$result"
749757
}
@@ -759,7 +767,7 @@ function get_test_version(){
759767

760768
db="${cidir}/../versions.yaml"
761769

762-
get_dep_from_yaml_db "${db}" "${dependency}"
770+
get_dep_from_yaml_db "${db}" ".${dependency}"
763771
}
764772

765773
# Load vhost, vhost_net, vhost_vsock modules.

tests/functional/kata-deploy/kata-deploy.bats

Lines changed: 30 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -29,40 +29,30 @@ setup() {
2929
sed -i -e "s|quay.io/kata-containers/kata-deploy:latest|${DOCKER_REGISTRY}/${DOCKER_REPO}:${DOCKER_TAG}|g" "tools/packaging/kata-deploy/kata-deploy/base/kata-deploy.yaml"
3030

3131
# Enable debug for Kata Containers
32-
yq write -i \
33-
"tools/packaging/kata-deploy/kata-deploy/base/kata-deploy.yaml" \
34-
'spec.template.spec.containers[0].env[1].value' \
35-
--tag '!!str' "true"
32+
yq -i \
33+
'.spec.template.spec.containers[0].env[1].value = "true"' \
34+
"tools/packaging/kata-deploy/kata-deploy/base/kata-deploy.yaml"
3635
# Create the runtime class only for the shim that's being tested
37-
yq write -i \
38-
"tools/packaging/kata-deploy/kata-deploy/base/kata-deploy.yaml" \
39-
'spec.template.spec.containers[0].env[2].value' \
40-
"${KATA_HYPERVISOR}"
36+
yq -i \
37+
".spec.template.spec.containers[0].env[2].value = \"${KATA_HYPERVISOR}\"" \
38+
"tools/packaging/kata-deploy/kata-deploy/base/kata-deploy.yaml"
4139
# Set the tested hypervisor as the default `kata` shim
42-
yq write -i \
43-
"tools/packaging/kata-deploy/kata-deploy/base/kata-deploy.yaml" \
44-
'spec.template.spec.containers[0].env[3].value' \
45-
"${KATA_HYPERVISOR}"
40+
yq -i \
41+
".spec.template.spec.containers[0].env[3].value = \"${KATA_HYPERVISOR}\"" \
42+
"tools/packaging/kata-deploy/kata-deploy/base/kata-deploy.yaml"
4643
# Let the `kata-deploy` script take care of the runtime class creation / removal
47-
yq write -i \
48-
"tools/packaging/kata-deploy/kata-deploy/base/kata-deploy.yaml" \
49-
'spec.template.spec.containers[0].env[4].value' \
50-
--tag '!!str' "true"
44+
yq -i \
45+
'.spec.template.spec.containers[0].env[4].value = "true"' \
46+
"tools/packaging/kata-deploy/kata-deploy/base/kata-deploy.yaml"
5147
# Let the `kata-deploy` create the default `kata` runtime class
52-
yq write -i \
53-
"tools/packaging/kata-deploy/kata-deploy/base/kata-deploy.yaml" \
54-
'spec.template.spec.containers[0].env[5].value' \
55-
--tag '!!str' "true"
48+
yq -i \
49+
'.spec.template.spec.containers[0].env[5].value = "true"' \
50+
"tools/packaging/kata-deploy/kata-deploy/base/kata-deploy.yaml"
5651

5752
if [ "${KATA_HOST_OS}" = "cbl-mariner" ]; then
58-
yq write -i \
59-
"tools/packaging/kata-deploy/kata-deploy/base/kata-deploy.yaml" \
60-
'spec.template.spec.containers[0].env[+].name' \
61-
"HOST_OS"
62-
yq write -i \
63-
"tools/packaging/kata-deploy/kata-deploy/base/kata-deploy.yaml" \
64-
'spec.template.spec.containers[0].env[-1].value' \
65-
"${KATA_HOST_OS}"
53+
yq -i \
54+
".spec.template.spec.containers[0].env += [{\"name\": \"HOST_OS\", \"value\": \"${KATA_HOST_OS}\"}]" \
55+
"tools/packaging/kata-deploy/kata-deploy/base/kata-deploy.yaml"
6656
fi
6757

6858
echo "::group::Final kata-deploy.yaml that is used in the test"
@@ -144,25 +134,21 @@ teardown() {
144134
kubectl -n kube-system wait --timeout=10m --for=delete -l name=kata-deploy pod
145135

146136
# Let the `kata-deploy` script take care of the runtime class creation / removal
147-
yq write -i \
148-
"tools/packaging/kata-deploy/kata-cleanup/base/kata-cleanup.yaml" \
149-
'spec.template.spec.containers[0].env[4].value' \
150-
--tag '!!str' "true"
137+
yq -i \
138+
'.spec.template.spec.containers[0].env[4].value = "true"' \
139+
"tools/packaging/kata-deploy/kata-cleanup/base/kata-cleanup.yaml"
151140
# Create the runtime class only for the shim that's being tested
152-
yq write -i \
153-
"tools/packaging/kata-deploy/kata-cleanup/base/kata-cleanup.yaml" \
154-
'spec.template.spec.containers[0].env[2].value' \
155-
"${KATA_HYPERVISOR}"
141+
yq -i \
142+
".spec.template.spec.containers[0].env[2].value = \"${KATA_HYPERVISOR}\"" \
143+
"tools/packaging/kata-deploy/kata-cleanup/base/kata-cleanup.yaml"
156144
# Set the tested hypervisor as the default `kata` shim
157-
yq write -i \
158-
"tools/packaging/kata-deploy/kata-cleanup/base/kata-cleanup.yaml" \
159-
'spec.template.spec.containers[0].env[3].value' \
160-
"${KATA_HYPERVISOR}"
145+
yq -i \
146+
".spec.template.spec.containers[0].env[3].value = \"${KATA_HYPERVISOR}\"" \
147+
"tools/packaging/kata-deploy/kata-cleanup/base/kata-cleanup.yaml"
161148
# Let the `kata-deploy` create the default `kata` runtime class
162-
yq write -i \
163-
"tools/packaging/kata-deploy/kata-deploy/base/kata-deploy.yaml" \
164-
'spec.template.spec.containers[0].env[5].value' \
165-
--tag '!!str' "true"
149+
yq -i \
150+
'.spec.template.spec.containers[0].env[5].value = "true"' \
151+
"tools/packaging/kata-deploy/kata-deploy/base/kata-deploy.yaml"
166152

167153
sed -i -e "s|quay.io/kata-containers/kata-deploy:latest|${DOCKER_REGISTRY}/${DOCKER_REPO}:${DOCKER_TAG}|g" "tools/packaging/kata-deploy/kata-cleanup/base/kata-cleanup.yaml"
168154
cat "tools/packaging/kata-deploy/kata-cleanup/base/kata-cleanup.yaml"

0 commit comments

Comments
 (0)