Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update go and docker image version #421

Merged
merged 1 commit into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
FROM ubuntu:20.04
FROM ubuntu:22.04
ADD out/container-structure-test /container-structure-test
ENTRYPOINT ["/container-structure-test"]
ENTRYPOINT ["/container-structure-test"]
50 changes: 29 additions & 21 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ module github.com/GoogleContainerTools/container-structure-test
go 1.22

require (
github.com/GoogleContainerTools/container-diff v0.17.1-0.20230727210151-35d9770aeea3
github.com/fsouza/go-dockerclient v1.10.0
github.com/google/go-cmp v0.5.9
github.com/google/go-containerregistry v0.15.2
github.com/GoogleContainerTools/container-diff v0.19.0
github.com/fsouza/go-dockerclient v1.10.2
github.com/google/go-cmp v0.6.0
github.com/google/go-containerregistry v0.19.0
github.com/joho/godotenv v1.5.1
github.com/opencontainers/image-spec v1.1.0-rc5
github.com/opencontainers/image-spec v1.1.0
github.com/pkg/errors v0.9.1
github.com/sirupsen/logrus v1.9.3
github.com/spf13/cobra v1.8.0
Expand All @@ -19,34 +19,42 @@ require (
exclude github.com/docker/docker v24.0.6+incompatible // indirect

require (
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect
github.com/Microsoft/go-winio v0.6.1 // indirect
github.com/containerd/containerd v1.6.18 // indirect
github.com/containerd/stargz-snapshotter/estargz v0.14.3 // indirect
github.com/docker/cli v23.0.5+incompatible // indirect
github.com/docker/distribution v2.8.1+incompatible // indirect
github.com/docker/docker v23.0.5+incompatible // indirect
github.com/docker/docker-credential-helpers v0.7.0 // indirect
github.com/docker/go-connections v0.4.0 // indirect
github.com/containerd/containerd v1.7.13 // indirect
github.com/containerd/log v0.1.0 // indirect
github.com/containerd/stargz-snapshotter/estargz v0.15.1 // indirect
github.com/distribution/reference v0.5.0 // indirect
github.com/docker/cli v25.0.3+incompatible // indirect
github.com/docker/distribution v2.8.3+incompatible // indirect
github.com/docker/docker v25.0.3+incompatible // indirect
github.com/docker/docker-credential-helpers v0.8.1 // indirect
github.com/docker/go-connections v0.5.0 // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/go-logr/logr v1.4.1 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/klauspost/compress v1.16.5 // indirect
github.com/klauspost/compress v1.17.7 // indirect
github.com/kr/pretty v0.2.1 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/moby/patternmatcher v0.6.0 // indirect
github.com/moby/sys/sequential v0.5.0 // indirect
github.com/moby/term v0.0.0-20221205130635-1aeaba878587 // indirect
github.com/moby/sys/user v0.1.0 // indirect
github.com/moby/term v0.5.0 // indirect
github.com/morikuni/aec v1.0.0 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/runc v1.1.12 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/vbatts/tar-split v0.11.3 // indirect
golang.org/x/mod v0.10.0 // indirect
golang.org/x/net v0.10.0 // indirect
golang.org/x/sync v0.1.0 // indirect
github.com/vbatts/tar-split v0.11.5 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.48.0 // indirect
go.opentelemetry.io/otel v1.23.1 // indirect
go.opentelemetry.io/otel/metric v1.23.1 // indirect
go.opentelemetry.io/otel/trace v1.23.1 // indirect
golang.org/x/mod v0.15.0 // indirect
golang.org/x/sync v0.6.0 // indirect
golang.org/x/sys v0.17.0 // indirect
golang.org/x/term v0.17.0 // indirect
golang.org/x/tools v0.8.0 // indirect
golang.org/x/tools v0.18.0 // indirect
)
335 changes: 94 additions & 241 deletions go.sum

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions tests/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
FROM ubuntu:20.04
FROM ubuntu:22.04
ADD out/container-structure-test /container-structure-test
ENTRYPOINT ["/container-structure-test"]
ENTRYPOINT ["/container-structure-test"]
2 changes: 1 addition & 1 deletion tests/Dockerfile.cap
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
FROM ubuntu:20.04
FROM ubuntu:22.04
RUN apt-get update && apt-get install -y libcap2-bin
2 changes: 1 addition & 1 deletion tests/Dockerfile.metadata
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:20.04
FROM ubuntu:22.04

ENV SOME_KEY="SOME_VAL" \
EMPTY_VAR="" \
Expand Down
2 changes: 1 addition & 1 deletion tests/Dockerfile.unprivileged
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:20.04
FROM ubuntu:22.04

RUN useradd --create-home --uid 1001 nonroot

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
32 changes: 16 additions & 16 deletions tests/structure_test_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,14 @@ make DOCKER=$DOCKER
make DOCKER=$DOCKER cross
make DOCKER=$DOCKER image

# Run the ubuntu tests, they should always pass on 20.04
test_image="ubuntu:20.04"
# Run the ubuntu tests, they should always pass on 22.04
test_image="ubuntu:22.04"
docker pull "$test_image" > /dev/null


HEADER "Positive Test Case"

res=$(./out/container-structure-test test --image "$test_image" --config "${test_config_dir}/ubuntu_20_04_test.yaml")
res=$(./out/container-structure-test test --image "$test_image" --config "${test_config_dir}/ubuntu_22_04_test.yaml")
code=$?
if ! [[ ("$res" =~ "PASS" && "$code" == "0") ]];
then
Expand All @@ -96,7 +96,7 @@ fi
HEADER "Container Run Options Test Cases"
test_containeropts_user_image="test.local/ubuntu-unprivileged:latest"
build_image "Dockerfile.unprivileged" "$test_containeropts_user_image" "$test_dir"
res=$(./out/container-structure-test test --image "$test_containeropts_user_image" --config "${test_config_dir}/ubuntu_20_04_containeropts_user_test.yaml")
res=$(./out/container-structure-test test --image "$test_containeropts_user_image" --config "${test_config_dir}/ubuntu_22_04_containeropts_user_test.yaml")
code=$?
if ! [[ ("$res" =~ "PASS" && "$code" == "0") ]];
then
Expand All @@ -110,7 +110,7 @@ docker rmi "$test_containeropts_user_image" > /dev/null

test_containeropts_cap_image="test.local/ubuntu-cap:latest"
build_image "Dockerfile.cap" "$test_containeropts_cap_image" "$test_dir"
res=$(./out/container-structure-test test --image "$test_containeropts_cap_image" --config "${test_config_dir}/ubuntu_20_04_containeropts_test.yaml")
res=$(./out/container-structure-test test --image "$test_containeropts_cap_image" --config "${test_config_dir}/ubuntu_22_04_containeropts_test.yaml")
code=$?
if ! [[ ("$res" =~ "PASS" && "$code" == "0") ]];
then
Expand All @@ -122,7 +122,7 @@ else
fi
docker rmi "$test_containeropts_cap_image" > /dev/null

res=$(FOO='keepitsecret!' BAR='keepitsafe!' ./out/container-structure-test test --image "$test_image" --config "${test_config_dir}/ubuntu_20_04_containeropts_env_test.yaml")
res=$(FOO='keepitsecret!' BAR='keepitsafe!' ./out/container-structure-test test --image "$test_image" --config "${test_config_dir}/ubuntu_22_04_containeropts_env_test.yaml")
code=$?
if ! [[ ("$res" =~ "PASS" && "$code" == "0") ]];
then
Expand All @@ -133,7 +133,7 @@ else
echo "PASS: Run options (envVars) test case passed"
fi

res=$(./out/container-structure-test test --image "$test_image" --config "${test_config_dir}/ubuntu_20_04_containeropts_envfile_test.yaml")
res=$(./out/container-structure-test test --image "$test_image" --config "${test_config_dir}/ubuntu_22_04_containeropts_envfile_test.yaml")
code=$?
if ! [[ ("$res" =~ "PASS" && "$code" == "0") ]];
then
Expand All @@ -154,7 +154,7 @@ then
test_metadata_tar=debian8-with-metadata.tar
test_metadata_dir=debian8-with-metadata
build_image "Dockerfile.metadata" "$test_metadata_image" "$test_dir"
res=$(./out/container-structure-test test --image "$test_metadata_image" --config "${test_config_dir}/ubuntu_20_04_metadata_test.yaml")
res=$(./out/container-structure-test test --image "$test_metadata_image" --config "${test_config_dir}/ubuntu_22_04_metadata_test.yaml")
code=$?

if ! [[ ("$res" =~ "PASS" && "$code" == "0") ]];
Expand All @@ -167,7 +167,7 @@ then
fi

docker save "$test_metadata_image" -o "$test_metadata_tar" > /dev/null
res=$(./out/container-structure-test test --driver tar --image "$test_metadata_tar" --config "${test_config_dir}/ubuntu_20_04_metadata_test.yaml")
res=$(./out/container-structure-test test --driver tar --image "$test_metadata_tar" --config "${test_config_dir}/ubuntu_22_04_metadata_test.yaml")
code=$?
if ! [[ ("$res" =~ "PASS" && "$code" == "0") ]];
then
Expand All @@ -181,7 +181,7 @@ then
mkdir -p "$test_metadata_dir"
tar -C "$test_metadata_dir" -xf "$test_metadata_tar" > /dev/null
test_metadata_json=$(jq -r '.[0].Config' "$test_metadata_dir/manifest.json")
res=$(./out/container-structure-test test --driver host --force --metadata "$test_metadata_dir/$test_metadata_json" --config "${test_config_dir}/ubuntu_20_04_metadata_test.yaml")
res=$(./out/container-structure-test test --driver host --force --metadata "$test_metadata_dir/$test_metadata_json" --config "${test_config_dir}/ubuntu_22_04_metadata_test.yaml")
code=$?
if ! [[ ("$res" =~ "PASS" && "$code" == "0") ]];
then
Expand All @@ -201,7 +201,7 @@ fi
HEADER "Failure Test Case"

# Run some bogus tests, they should fail as expected
res=$(./out/container-structure-test test --image "$test_image" --config "${test_config_dir}/ubuntu_20_04_failure_test.yaml")
res=$(./out/container-structure-test test --image "$test_image" --config "${test_config_dir}/ubuntu_22_04_failure_test.yaml")
code=$?
if ! [[ ("$res" =~ "FAIL" && "$code" == "1") ]];
then
Expand All @@ -222,7 +222,7 @@ tmp="$(mktemp -d)"
crane pull "$test_image" --format=oci "$tmp" --platform="linux/$go_architecture"


res=$(./out/container-structure-test test --image-from-oci-layout="$tmp" --config "${test_config_dir}/ubuntu_20_04_test.yaml" 2>&1)
res=$(./out/container-structure-test test --image-from-oci-layout="$tmp" --config "${test_config_dir}/ubuntu_22_04_test.yaml" 2>&1)
code=$?
if ! [[ ("$res" =~ index\ does\ not\ contain\ a\ reference\ annotation\.\ \-\-default\-image\-tag\ must\ be\ provided\. && "$code" == "1") ]];
then
Expand All @@ -234,7 +234,7 @@ else
echo "PASS: oci failing test case"
fi

res=$(./out/container-structure-test test --image-from-oci-layout="$tmp" --default-image-tag="test.local/$test_image" --config "${test_config_dir}/ubuntu_20_04_test.yaml" 2>&1)
res=$(./out/container-structure-test test --image-from-oci-layout="$tmp" --default-image-tag="test.local/$test_image" --config "${test_config_dir}/ubuntu_22_04_test.yaml" 2>&1)
code=$?
if ! [[ ("$res" =~ "PASS" && "$code" == "0") ]];
then
Expand All @@ -249,7 +249,7 @@ fi
HEADER "Platform test cases"

docker run --rm --privileged tonistiigi/binfmt --install all > /dev/null
res=$(./out/container-structure-test test --image "$test_image" --platform="linux/$go_architecture" --config "${test_config_dir}/ubuntu_20_04_test.yaml" 2>&1)
res=$(./out/container-structure-test test --image "$test_image" --platform="linux/$go_architecture" --config "${test_config_dir}/ubuntu_22_04_test.yaml" 2>&1)
code=$?
if ! [[ ("$res" =~ "PASS" && "$code" == "0") ]];
then
Expand All @@ -261,7 +261,7 @@ else
echo "PASS: current host platform test case"
fi

res=$(./out/container-structure-test test --image "$test_image" --platform="linux/riscv64" --config "${test_config_dir}/ubuntu_20_04_test.yaml" 2>&1)
res=$(./out/container-structure-test test --image "$test_image" --platform="linux/riscv64" --config "${test_config_dir}/ubuntu_22_04_test.yaml" 2>&1)
code=$?
if ! [[ ("$res" =~ image\ with\ reference.+was\ found\ but\ does\ not\ match\ the\ specified\ platform:\ wanted\ linux\/\riscv64,\ actual:\ linux\/$go_architecture && "$code" == "1") ]];
then
Expand All @@ -274,7 +274,7 @@ else
fi

test_config_dir="${test_dir}/s390x"
res=$(./out/container-structure-test test --image "$test_image" --platform="linux/s390x" --pull --config "${test_config_dir}/ubuntu_20_04_test.yaml" 2>&1)
res=$(./out/container-structure-test test --image "$test_image" --platform="linux/s390x" --pull --config "${test_config_dir}/ubuntu_22_04_test.yaml" 2>&1)
code=$?
if ! [[ ("$res" =~ "PASS" && "$code" == "0") ]];
then
Expand Down
Loading