From 5efe72415d975ec0d4e097cfc235bd6c6c62418b Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Fri, 25 Nov 2022 10:37:05 +0100 Subject: [PATCH] remove Dockerfile.e2e Dockerfile.e2e is not used anymore. Integration tests run through the main Dockerfile. Also removes the daemon OS/Arch detection script that is not necessary anymore. It was used to select the Dockerfile based on the arch like Dockerfile.arm64 but we don't have those anymore. Was also used to check referenced frozen images in the Dockerfile. Signed-off-by: CrazyMax --- Dockerfile.e2e | 84 ------------------------- Makefile | 6 +- hack/make/.detect-daemon-osarch | 43 ------------- hack/make/.integration-daemon-setup | 7 --- hack/make/.integration-daemon-start | 4 ++ hack/make/.integration-test-helpers | 1 - hack/make/build-integration-test-binary | 7 --- hack/make/test-integration | 1 - hack/make/test-integration-cli | 6 -- hack/make/test-integration-shell | 1 - hack/test/e2e-run.sh | 1 - 11 files changed, 5 insertions(+), 156 deletions(-) delete mode 100644 Dockerfile.e2e delete mode 100644 hack/make/.detect-daemon-osarch delete mode 100644 hack/make/.integration-daemon-setup delete mode 100755 hack/make/build-integration-test-binary delete mode 100755 hack/make/test-integration-cli diff --git a/Dockerfile.e2e b/Dockerfile.e2e deleted file mode 100644 index 2b41a7e65e..0000000000 --- a/Dockerfile.e2e +++ /dev/null @@ -1,84 +0,0 @@ -ARG GO_VERSION=1.20.4 - -FROM golang:${GO_VERSION}-alpine AS base -ENV GO111MODULE=off -RUN apk --no-cache add \ - bash \ - build-base \ - curl \ - lvm2-dev \ - jq - -RUN mkdir -p /build/ -RUN mkdir -p /go/src/github.com/docker/docker/ -WORKDIR /go/src/github.com/docker/docker/ - -FROM base AS frozen-images -# Get useful and necessary Hub images so we can "docker load" locally instead of pulling -COPY contrib/download-frozen-image-v2.sh / -RUN /download-frozen-image-v2.sh /build \ - busybox:latest@sha256:95cf004f559831017cdf4628aaf1bb30133677be8702a8c5f2994629f637a209 \ - busybox:latest@sha256:95cf004f559831017cdf4628aaf1bb30133677be8702a8c5f2994629f637a209 \ - debian:bullseye-slim@sha256:dacf278785a4daa9de07596ec739dbc07131e189942772210709c5c0777e8437 \ - hello-world:latest@sha256:d58e752213a51785838f9eed2b7a498ffa1cb3aa7f946dda11af39286c3db9a9 \ - arm32v7/hello-world:latest@sha256:50b8560ad574c779908da71f7ce370c0a2471c098d44d1c8f6b513c5a55eeeb1 -# See also frozenImages in "testutil/environment/protect.go" (which needs to be updated when adding images to this list) - -FROM base AS dockercli -COPY hack/dockerfile/install/install.sh ./install.sh -COPY hack/dockerfile/install/dockercli.installer ./ -RUN PREFIX=/build ./install.sh dockercli - -# TestDockerCLIBuildSuite dependency -FROM base AS contrib -COPY contrib/syscall-test /build/syscall-test -COPY contrib/httpserver/Dockerfile /build/httpserver/Dockerfile -COPY contrib/httpserver contrib/httpserver -RUN CGO_ENABLED=0 go build -buildmode=pie -o /build/httpserver/httpserver github.com/docker/docker/contrib/httpserver - -# Build the integration tests and copy the resulting binaries to /build/tests -FROM base AS builder - -# Set tag and add sources -COPY . . -# Copy test sources tests that use assert can print errors -RUN mkdir -p /build${PWD} && find integration integration-cli -name \*_test.go -exec cp --parents '{}' /build${PWD} \; -# Build and install test binaries -ARG DOCKER_GITCOMMIT=undefined -RUN hack/make.sh build-integration-test-binary -RUN mkdir -p /build/tests && find . -name test.main -exec cp --parents '{}' /build/tests \; - -## Generate testing image -FROM alpine:3.10 as runner - -ENV DOCKER_REMOTE_DAEMON=1 -ENV DOCKER_INTEGRATION_DAEMON_DEST=/ -ENTRYPOINT ["/scripts/run.sh"] - -# Add an unprivileged user to be used for tests which need it -RUN addgroup docker && adduser -D -G docker unprivilegeduser -s /bin/ash - -# GNU tar is used for generating the emptyfs image -RUN apk --no-cache add \ - bash \ - ca-certificates \ - g++ \ - git \ - inetutils-ping \ - iptables \ - libcap2-bin \ - pigz \ - tar \ - xz - -COPY hack/test/e2e-run.sh /scripts/run.sh -COPY hack/make/.build-empty-images /scripts/build-empty-images.sh - -COPY integration/testdata /tests/integration/testdata -COPY integration/build/testdata /tests/integration/build/testdata -COPY integration-cli/fixtures /tests/integration-cli/fixtures - -COPY --from=frozen-images /build/ /docker-frozen-images -COPY --from=dockercli /build/ /usr/bin/ -COPY --from=contrib /build/ /tests/contrib/ -COPY --from=builder /build/ / diff --git a/Makefile b/Makefile index 7d7f5404c2..593eaef02f 100644 --- a/Makefile +++ b/Makefile @@ -7,10 +7,6 @@ BUILDX ?= $(DOCKER) buildx DOCKER_GRAPHDRIVER := $(if $(DOCKER_GRAPHDRIVER),$(DOCKER_GRAPHDRIVER),$(shell docker info 2>&1 | grep "Storage Driver" | sed 's/.*: //')) export DOCKER_GRAPHDRIVER -# get OS/Arch of docker engine -DOCKER_OSARCH := $(shell bash -c 'source hack/make/.detect-daemon-osarch && echo $${DOCKER_ENGINE_OSARCH}') -DOCKERFILE := $(shell bash -c 'source hack/make/.detect-daemon-osarch && echo $${DOCKERFILE}') - DOCKER_GITCOMMIT := $(shell git rev-parse --short HEAD || echo unsupported) export DOCKER_GITCOMMIT @@ -140,7 +136,7 @@ ifdef DOCKER_SYSTEMD DOCKER_BUILD_ARGS += --build-arg=SYSTEMD=true endif -BUILD_OPTS := ${BUILD_APT_MIRROR} ${DOCKER_BUILD_ARGS} ${DOCKER_BUILD_OPTS} -f "$(DOCKERFILE)" +BUILD_OPTS := ${BUILD_APT_MIRROR} ${DOCKER_BUILD_ARGS} ${DOCKER_BUILD_OPTS} BUILD_CMD := $(BUILDX) build BAKE_CMD := $(BUILDX) bake diff --git a/hack/make/.detect-daemon-osarch b/hack/make/.detect-daemon-osarch deleted file mode 100644 index 9190cd0264..0000000000 --- a/hack/make/.detect-daemon-osarch +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/env bash -set -e - -docker-version-osarch() { - if ! type docker &> /dev/null; then - # docker is not installed - return - fi - local target="$1" # "Client" or "Server" - local fmtStr="{{.${target}.Os}}/{{.${target}.Arch}}" - if docker version -f "$fmtStr" 2> /dev/null; then - # if "docker version -f" works, let's just use that! - return - fi - docker version | awk ' - $1 ~ /^(Client|Server):$/ { section = 0 } - $1 == "'"$target"':" { section = 1; next } - section && $1 == "OS/Arch:" { print $2 } - - # old versions of Docker - $1 == "OS/Arch" && $2 == "('"${target,,}"'):" { print $3 } - ' -} - -# Retrieve OS/ARCH of docker daemon, e.g. linux/amd64 -export DOCKER_ENGINE_OSARCH="${DOCKER_ENGINE_OSARCH:=$(docker-version-osarch 'Server')}" -export DOCKER_ENGINE_GOOS="${DOCKER_ENGINE_OSARCH%/*}" -export DOCKER_ENGINE_GOARCH="${DOCKER_ENGINE_OSARCH##*/}" -DOCKER_ENGINE_GOARCH=${DOCKER_ENGINE_GOARCH:=amd64} - -# and the client, just in case -export DOCKER_CLIENT_OSARCH="$(docker-version-osarch 'Client')" -export DOCKER_CLIENT_GOOS="${DOCKER_CLIENT_OSARCH%/*}" -export DOCKER_CLIENT_GOARCH="${DOCKER_CLIENT_OSARCH##*/}" -DOCKER_CLIENT_GOARCH=${DOCKER_CLIENT_GOARCH:=amd64} - -DOCKERFILE='Dockerfile' - -if [ "${DOCKER_ENGINE_GOOS:-$DOCKER_CLIENT_GOOS}" = "windows" ]; then - DOCKERFILE='Dockerfile.windows' -fi - -export DOCKERFILE diff --git a/hack/make/.integration-daemon-setup b/hack/make/.integration-daemon-setup deleted file mode 100644 index 4bcc816c2c..0000000000 --- a/hack/make/.integration-daemon-setup +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env bash -set -e - -source "$MAKEDIR/.detect-daemon-osarch" -if [ "$DOCKER_ENGINE_GOOS" != "windows" ]; then - bundle .build-empty-images -fi diff --git a/hack/make/.integration-daemon-start b/hack/make/.integration-daemon-start index 766e09f7fb..8c315b6487 100644 --- a/hack/make/.integration-daemon-start +++ b/hack/make/.integration-daemon-start @@ -149,3 +149,7 @@ while ! ${TEST_CLIENT_BINARY} version &> /dev/null; do sleep 2 done printf "\n" + +if [ "$(docker version --format '{{ .Server.Os }}')" != 'windows' ]; then + bundle .build-empty-images +fi diff --git a/hack/make/.integration-test-helpers b/hack/make/.integration-test-helpers index b1c31b0b90..739c371e0a 100644 --- a/hack/make/.integration-test-helpers +++ b/hack/make/.integration-test-helpers @@ -160,7 +160,6 @@ test_env() { DOCKER_REMAP_ROOT="$DOCKER_REMAP_ROOT" \ DOCKER_REMOTE_DAEMON="$DOCKER_REMOTE_DAEMON" \ DOCKER_ROOTLESS="$DOCKER_ROOTLESS" \ - DOCKERFILE="$DOCKERFILE" \ GITHUB_ACTIONS="$GITHUB_ACTIONS" \ GOCACHE="$GOCACHE" \ GOPATH="$GOPATH" \ diff --git a/hack/make/build-integration-test-binary b/hack/make/build-integration-test-binary deleted file mode 100755 index 698717f0f5..0000000000 --- a/hack/make/build-integration-test-binary +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env bash -# required by https://github.com/AkihiroSuda/kube-moby-integration -set -e - -source hack/make/.integration-test-helpers - -build_test_suite_binaries diff --git a/hack/make/test-integration b/hack/make/test-integration index 199131c209..5cfbc89697 100755 --- a/hack/make/test-integration +++ b/hack/make/test-integration @@ -12,7 +12,6 @@ fi env build_test_suite_binaries bundle .integration-daemon-start - bundle .integration-daemon-setup testexit=0 (repeat run_test_integration) || testexit=$? diff --git a/hack/make/test-integration-cli b/hack/make/test-integration-cli deleted file mode 100755 index 480851e70f..0000000000 --- a/hack/make/test-integration-cli +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bash -set -e -echo "WARNING: test-integration-cli is DEPRECATED. Use test-integration." >&2 - -# TODO: remove this and exit 1 once CI has changed to use test-integration -bundle test-integration diff --git a/hack/make/test-integration-shell b/hack/make/test-integration-shell index bcfa4682eb..1ee23b3806 100644 --- a/hack/make/test-integration-shell +++ b/hack/make/test-integration-shell @@ -1,7 +1,6 @@ #!/usr/bin/env bash bundle .integration-daemon-start -bundle .integration-daemon-setup export ABS_DEST bash +e diff --git a/hack/test/e2e-run.sh b/hack/test/e2e-run.sh index 545504fa0e..5e4d8f2154 100755 --- a/hack/test/e2e-run.sh +++ b/hack/test/e2e-run.sh @@ -59,7 +59,6 @@ test_env() { DOCKER_HOST="$DOCKER_HOST" \ DOCKER_REMAP_ROOT="$DOCKER_REMAP_ROOT" \ DOCKER_REMOTE_DAEMON="$DOCKER_REMOTE_DAEMON" \ - DOCKERFILE="$DOCKERFILE" \ GOPATH="$GOPATH" \ GOTRACEBACK=all \ HOME="$ABS_DEST/fake-HOME" \