Skip to content

Commit bec9736

Browse files
authored
Merge pull request #3729 from kolyshkin/1.1-f37
[1.1] Fix CI
2 parents bd4d05c + 53ceeea commit bec9736

12 files changed

+229
-36
lines changed

Vagrantfile.fedora

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
Vagrant.configure("2") do |config|
55
# Fedora box is used for testing cgroup v2 support
6-
config.vm.box = "fedora/35-cloud-base"
6+
config.vm.box = "fedora/37-cloud-base"
77
config.vm.provider :virtualbox do |v|
88
v.memory = 2048
99
v.cpus = 2

tests/integration/README.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ load helpers
6060

6161
# setup is called at the beginning of every test.
6262
function setup() {
63-
setup_hello
63+
setup_busybox
6464
}
6565

6666
# teardown is called at the end of every test.
@@ -77,5 +77,4 @@ function teardown() {
7777
# check expected output
7878
[[ "${output}" == *"Hello"* ]]
7979
}
80-
8180
```
+99
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
#!/usr/bin/env bash
2+
set -Eeuo pipefail
3+
4+
# This script generates "get-images.sh" using Official Images tooling.
5+
#
6+
# ./bootstrap-get-images.sh > get-images.sh
7+
#
8+
# This script requires "bashbrew". To get the latest version, visit
9+
# https://github.com/docker-library/bashbrew/releases
10+
11+
images=(
12+
# pinned to an older BusyBox (prior to 1.36 becoming "latest") because 1.36.0 has some unresolved bugs, especially around sha256sum
13+
'https://github.com/docker-library/official-images/raw/eaed422a86b43c885a0f980d48f4bbf346086a4a/library/busybox:glibc'
14+
15+
# pinned to an older Debian Buster which has more architectures than the latest does (Buster transitioned from the Debian Security Team to the LTS Team which supports a smaller set)
16+
'https://github.com/docker-library/official-images/raw/ce10f6b60289c0c0b5de6f785528b8725f225a58/library/debian:buster-slim'
17+
)
18+
19+
cat <<'EOH'
20+
#!/bin/bash
21+
22+
# DO NOT EDIT! Generated by "bootstrap-get-images.sh"
23+
24+
# This script checks if container images needed for tests (currently
25+
# busybox and Debian 10 "Buster") are available locally, and downloads
26+
# them to testdata directory if not.
27+
#
28+
# The script is self-contained/standalone and is used from a few places
29+
# that need to ensure the images are downloaded. Its output is suitable
30+
# for consumption by shell via eval (see helpers.bash).
31+
32+
set -e -u -o pipefail
33+
34+
# Root directory of integration tests.
35+
INTEGRATION_ROOT=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
36+
# Test data path.
37+
TESTDATA="${INTEGRATION_ROOT}/testdata"
38+
# Sanity check: $TESTDATA directory must exist.
39+
if [ ! -d "$TESTDATA" ]; then
40+
echo "Bad TESTDATA directory: $TESTDATA. Aborting" >&2
41+
exit 1
42+
fi
43+
44+
function get() {
45+
local dest="$1" url="$2"
46+
47+
[ -e "$dest" ] && return
48+
49+
# Sanity check: $TESTDATA directory must be writable.
50+
if [ ! -w "$TESTDATA" ]; then
51+
echo "TESTDATA directory ($TESTDATA) not writable. Aborting" >&2
52+
exit 1
53+
fi
54+
55+
if ! curl -o "$dest" -fsSL --retry 5 "$url"; then
56+
echo "Failed to get $url" 1>&2
57+
exit 1
58+
fi
59+
}
60+
61+
arch=$(go env GOARCH)
62+
if [ "$arch" = 'arm' ]; then
63+
arm=$(go env GOARM)
64+
: "${arm:=7}"
65+
arch=${arch}v$arm
66+
fi
67+
EOH
68+
69+
# shellcheck disable=SC2016 # this generates shell code intentionally (and many of the '$' in here are intended for "text/template" not the end shell anyhow)
70+
bashbrew cat --format '
71+
{{- "\n" -}}
72+
{{- "case $arch in\n" -}}
73+
74+
{{- range .TagEntry.Architectures -}}
75+
{{- $repo := $.TagEntry.ArchGitRepo . | trimSuffixes ".git" -}}
76+
{{- $branch := $.TagEntry.ArchGitFetch . | trimPrefixes "refs/heads/" -}}
77+
{{- $commit := $.TagEntry.ArchGitCommit . -}}
78+
{{- $dir := $.TagEntry.ArchDirectory . -}}
79+
{{- $tarball := eq $.RepoName "debian" | ternary "rootfs.tar.xz" "busybox.tar.xz" -}}
80+
81+
{{ . | replace "arm64v8" "arm64" "arm32" "arm" "i386" "386" }} {{- ")\n" -}}
82+
{{- "\t" -}}# {{ $repo }}/tree/{{ $branch }}{{- "\n" -}}
83+
{{- "\t" -}}# {{ $repo }}/tree/{{ $commit }}/{{ $dir }}{{- "\n" -}}
84+
{{- "\t" -}} url="{{ $repo }}/raw/{{ $commit }}/{{ $dir }}/{{ $tarball }}"{{- "\n" -}}
85+
{{- "\t" -}} ;; {{- "\n" -}}
86+
{{- "\n" -}}
87+
{{- end -}}
88+
89+
*){{- "\n" -}}
90+
{{- "\t" -}}echo >&2 "error: unsupported {{ $.RepoName }} architecture: $arch"{{- "\n" -}}
91+
{{- "\t" -}}exit 1{{- "\n" -}}
92+
{{- "\t" -}};;{{- "\n" -}}
93+
94+
{{- "esac\n" -}}
95+
{{- printf `rootfs="$TESTDATA/%s-${arch}.tar.xz"` $.RepoName -}}{{- "\n" -}}
96+
{{- `get "$rootfs" "$url"` -}}{{- "\n" -}}
97+
{{- printf "var=%s_image\n" $.RepoName -}}
98+
{{- `echo "${var^^}=$rootfs"` -}}
99+
' "${images[@]}"

tests/integration/debug.bats

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
load helpers
44

55
function setup() {
6-
setup_hello
6+
setup_busybox
7+
update_config '.process.args = ["/bin/echo", "Hello World"]'
78
}
89

910
function teardown() {

tests/integration/get-images.sh

+118-23
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
#!/bin/bash
22

3+
# DO NOT EDIT! Generated by "bootstrap-get-images.sh"
4+
35
# This script checks if container images needed for tests (currently
46
# busybox and Debian 10 "Buster") are available locally, and downloads
57
# them to testdata directory if not.
68
#
79
# The script is self-contained/standalone and is used from a few places
810
# that need to ensure the images are downloaded. Its output is suitable
911
# for consumption by shell via eval (see helpers.bash).
10-
#
11-
# XXX: Latest available images are fetched. Theoretically,
12-
# this can bring some instability in case of a broken image.
13-
# In this case, images will need to be pinned to a checksum
14-
# on a per-image and per-architecture basis.
1512

1613
set -e -u -o pipefail
1714

@@ -43,28 +40,126 @@ function get() {
4340
}
4441

4542
arch=$(go env GOARCH)
46-
# Convert from GOARCH to whatever the URLs below are using.
43+
if [ "$arch" = 'arm' ]; then
44+
arm=$(go env GOARM)
45+
: "${arm:=7}"
46+
arch=${arch}v$arm
47+
fi
48+
4749
case $arch in
50+
amd64)
51+
# https://github.com/docker-library/busybox/tree/dist-amd64
52+
# https://github.com/docker-library/busybox/tree/31d342ad033e27c18723a516a2274ab39547be27/stable/glibc
53+
url="https://github.com/docker-library/busybox/raw/31d342ad033e27c18723a516a2274ab39547be27/stable/glibc/busybox.tar.xz"
54+
;;
55+
56+
armv5)
57+
# https://github.com/docker-library/busybox/tree/dist-arm32v5
58+
# https://github.com/docker-library/busybox/tree/96ea82ea25565f78b50bd032d5768d64985d6e11/stable/glibc
59+
url="https://github.com/docker-library/busybox/raw/96ea82ea25565f78b50bd032d5768d64985d6e11/stable/glibc/busybox.tar.xz"
60+
;;
61+
62+
armv7)
63+
# https://github.com/docker-library/busybox/tree/dist-arm32v7
64+
# https://github.com/docker-library/busybox/tree/5cb6c347469e86e4468e5e248de751b3598bb577/stable/glibc
65+
url="https://github.com/docker-library/busybox/raw/5cb6c347469e86e4468e5e248de751b3598bb577/stable/glibc/busybox.tar.xz"
66+
;;
67+
4868
arm64)
49-
arch=arm64v8
69+
# https://github.com/docker-library/busybox/tree/dist-arm64v8
70+
# https://github.com/docker-library/busybox/tree/94c664b5ca464546266bce54be0082874a44c7b2/stable/glibc
71+
url="https://github.com/docker-library/busybox/raw/94c664b5ca464546266bce54be0082874a44c7b2/stable/glibc/busybox.tar.xz"
5072
;;
73+
5174
386)
52-
arch=i386
75+
# https://github.com/docker-library/busybox/tree/dist-i386
76+
# https://github.com/docker-library/busybox/tree/461a473aef31b7726ea99909a24551bf44565c05/stable/glibc
77+
url="https://github.com/docker-library/busybox/raw/461a473aef31b7726ea99909a24551bf44565c05/stable/glibc/busybox.tar.xz"
78+
;;
79+
80+
mips64le)
81+
# https://github.com/docker-library/busybox/tree/dist-mips64le
82+
# https://github.com/docker-library/busybox/tree/47f73f7c735dcd6760a976bfe0012d251b6ef0a9/stable/glibc
83+
url="https://github.com/docker-library/busybox/raw/47f73f7c735dcd6760a976bfe0012d251b6ef0a9/stable/glibc/busybox.tar.xz"
84+
;;
85+
86+
ppc64le)
87+
# https://github.com/docker-library/busybox/tree/dist-ppc64le
88+
# https://github.com/docker-library/busybox/tree/9ca13bc214717966383cf97e08606b444b7300e4/stable/glibc
89+
url="https://github.com/docker-library/busybox/raw/9ca13bc214717966383cf97e08606b444b7300e4/stable/glibc/busybox.tar.xz"
90+
;;
91+
92+
s390x)
93+
# https://github.com/docker-library/busybox/tree/dist-s390x
94+
# https://github.com/docker-library/busybox/tree/a03814d21bcf97767121bb9422a742ec237a09e2/stable/glibc
95+
url="https://github.com/docker-library/busybox/raw/a03814d21bcf97767121bb9422a742ec237a09e2/stable/glibc/busybox.tar.xz"
96+
;;
97+
98+
*)
99+
echo >&2 "error: unsupported busybox architecture: $arch"
100+
exit 1
53101
;;
54102
esac
103+
rootfs="$TESTDATA/busybox-${arch}.tar.xz"
104+
get "$rootfs" "$url"
105+
var=busybox_image
106+
echo "${var^^}=$rootfs"
107+
108+
case $arch in
109+
amd64)
110+
# https://github.com/debuerreotype/docker-debian-artifacts/tree/dist-amd64
111+
# https://github.com/debuerreotype/docker-debian-artifacts/tree/686d9f6eaada08a754bc7abf6f6184c65c5b378f/buster/slim
112+
url="https://github.com/debuerreotype/docker-debian-artifacts/raw/686d9f6eaada08a754bc7abf6f6184c65c5b378f/buster/slim/rootfs.tar.xz"
113+
;;
114+
115+
armv5)
116+
# https://github.com/debuerreotype/docker-debian-artifacts/tree/dist-arm32v5
117+
# https://github.com/debuerreotype/docker-debian-artifacts/tree/155640b6e2e249dfaeee8795d5de539ef3e49417/buster/slim
118+
url="https://github.com/debuerreotype/docker-debian-artifacts/raw/155640b6e2e249dfaeee8795d5de539ef3e49417/buster/slim/rootfs.tar.xz"
119+
;;
120+
121+
armv7)
122+
# https://github.com/debuerreotype/docker-debian-artifacts/tree/dist-arm32v7
123+
# https://github.com/debuerreotype/docker-debian-artifacts/tree/60ff0c2c6ce9556e5d8a2758dd2b3f3731716a6f/buster/slim
124+
url="https://github.com/debuerreotype/docker-debian-artifacts/raw/60ff0c2c6ce9556e5d8a2758dd2b3f3731716a6f/buster/slim/rootfs.tar.xz"
125+
;;
55126

56-
# busybox
57-
BUSYBOX_IMAGE="$TESTDATA/busybox-${arch}.tar.xz"
58-
get "$BUSYBOX_IMAGE" \
59-
"https://github.com/docker-library/busybox/raw/dist-${arch}/stable/glibc/busybox.tar.xz"
60-
echo "BUSYBOX_IMAGE=$BUSYBOX_IMAGE"
61-
62-
# debian
63-
DEBIAN_IMAGE="$TESTDATA/debian-${arch}.tar.xz"
64-
get "$DEBIAN_IMAGE" \
65-
"https://github.com/debuerreotype/docker-debian-artifacts/raw/dist-${arch}/buster/slim/rootfs.tar.xz"
66-
echo "DEBIAN_IMAGE=$DEBIAN_IMAGE"
67-
68-
# hello-world is local, no need to download.
69-
HELLO_IMAGE="$TESTDATA/hello-world-${arch}.tar"
70-
echo "HELLO_IMAGE=$HELLO_IMAGE"
127+
arm64)
128+
# https://github.com/debuerreotype/docker-debian-artifacts/tree/dist-arm64v8
129+
# https://github.com/debuerreotype/docker-debian-artifacts/tree/2f108af35e22064c848b8628a7cac56192246dba/buster/slim
130+
url="https://github.com/debuerreotype/docker-debian-artifacts/raw/2f108af35e22064c848b8628a7cac56192246dba/buster/slim/rootfs.tar.xz"
131+
;;
132+
133+
386)
134+
# https://github.com/debuerreotype/docker-debian-artifacts/tree/dist-i386
135+
# https://github.com/debuerreotype/docker-debian-artifacts/tree/e4db8aa97f4366e6f27ddbdeaed0773fe0288d47/buster/slim
136+
url="https://github.com/debuerreotype/docker-debian-artifacts/raw/e4db8aa97f4366e6f27ddbdeaed0773fe0288d47/buster/slim/rootfs.tar.xz"
137+
;;
138+
139+
mips64le)
140+
# https://github.com/debuerreotype/docker-debian-artifacts/tree/dist-mips64le
141+
# https://github.com/debuerreotype/docker-debian-artifacts/tree/e28cbd76dcfba10446b1722aebb5a996121e3d27/buster/slim
142+
url="https://github.com/debuerreotype/docker-debian-artifacts/raw/e28cbd76dcfba10446b1722aebb5a996121e3d27/buster/slim/rootfs.tar.xz"
143+
;;
144+
145+
ppc64le)
146+
# https://github.com/debuerreotype/docker-debian-artifacts/tree/dist-ppc64le
147+
# https://github.com/debuerreotype/docker-debian-artifacts/tree/3ba08903ca3fd48fe59ba92b02744a2f5d4d9d6f/buster/slim
148+
url="https://github.com/debuerreotype/docker-debian-artifacts/raw/3ba08903ca3fd48fe59ba92b02744a2f5d4d9d6f/buster/slim/rootfs.tar.xz"
149+
;;
150+
151+
s390x)
152+
# https://github.com/debuerreotype/docker-debian-artifacts/tree/dist-s390x
153+
# https://github.com/debuerreotype/docker-debian-artifacts/tree/2fddbf8fe632fc5865b140341b68a1358586fff2/buster/slim
154+
url="https://github.com/debuerreotype/docker-debian-artifacts/raw/2fddbf8fe632fc5865b140341b68a1358586fff2/buster/slim/rootfs.tar.xz"
155+
;;
156+
157+
*)
158+
echo >&2 "error: unsupported debian architecture: $arch"
159+
exit 1
160+
;;
161+
esac
162+
rootfs="$TESTDATA/debian-${arch}.tar.xz"
163+
get "$rootfs" "$url"
164+
var=debian_image
165+
echo "${var^^}=$rootfs"

tests/integration/helpers.bash

-5
Original file line numberDiff line numberDiff line change
@@ -569,11 +569,6 @@ function setup_busybox() {
569569
setup_bundle "$BUSYBOX_IMAGE"
570570
}
571571

572-
function setup_hello() {
573-
setup_bundle "$HELLO_IMAGE"
574-
update_config '(.. | select(.? == "sh")) |= "/hello"'
575-
}
576-
577572
function setup_debian() {
578573
setup_bundle "$DEBIAN_IMAGE"
579574
}

tests/integration/mounts_sshfs.bats

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ function setup() {
1616
skip "test requires working sshfs mounts"
1717
fi
1818

19-
setup_hello
19+
setup_busybox
20+
update_config '.process.args = ["/bin/echo", "Hello World"]'
2021
}
2122

2223
function teardown() {

tests/integration/run.bats

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
load helpers
44

55
function setup() {
6-
setup_hello
6+
setup_busybox
7+
update_config '.process.args = ["/bin/echo", "Hello World"]'
78
}
89

910
function teardown() {

tests/integration/spec.bats

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
load helpers
44

55
function setup() {
6-
setup_hello
6+
setup_busybox
7+
update_config '.process.args = ["/bin/echo", "Hello World"]'
78
}
89

910
function teardown() {

tests/integration/start_hello.bats

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
load helpers
44

55
function setup() {
6-
setup_hello
6+
setup_busybox
7+
update_config '.process.args = ["/bin/echo", "Hello World"]'
78
}
89

910
function teardown() {
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)