Skip to content

Commit 9e424af

Browse files
committed
e2e: update to use compose v2, and don't depend on distro-packages
We were depending on alpine's package repository to install compose, but for debian we used compose's GitHub releases. Depending on distro packages means that we don't know when updates will happen, and versions may diverge because of that; for example, alpine 3.18 updated to compose v2; On alpine 3.17: make -f docker.Makefile build-e2e-image docker run --rm docker-cli-e2e docker-compose --version docker-compose version 1.29.2, build unknown On alpine 3.18: make -f docker.Makefile build-e2e-image docker run --rm docker-cli-e2e docker-compose --version Docker Compose version v2.17.3 This caused our e2e script to fail, as it made assumptions about the name format created by compose, which changed from underscores to hyphens in v2; Container cliendtoendsuite-engine-1 Running Error: No such object: cliendtoendsuite_engine_1 This patch: - updates the Dockerfile to install compose from the compose-bin image - adjusts the e2e script for the new naming scheme format - removes the version field from the compose-files used in e2e, as they are no longer used by compose. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
1 parent 8d1ddff commit 9e424af

5 files changed

Lines changed: 9 additions & 17 deletions

File tree

Dockerfile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ ARG XX_VERSION=1.2.1
77
ARG GOVERSIONINFO_VERSION=v1.3.0
88
ARG GOTESTSUM_VERSION=v1.10.0
99
ARG BUILDX_VERSION=0.11.2
10+
ARG COMPOSE_VERSION=v2.22.0
1011

1112
FROM --platform=$BUILDPLATFORM tonistiigi/xx:${XX_VERSION} AS xx
1213

@@ -98,15 +99,13 @@ RUN --mount=ro --mount=type=cache,target=/root/.cache \
9899
TARGET=/out ./scripts/build/plugins e2e/cli-plugins/plugins/*
99100

100101
FROM build-base-alpine AS e2e-base-alpine
101-
RUN apk add --no-cache build-base curl docker-compose openssl openssh-client
102+
RUN apk add --no-cache build-base curl openssl openssh-client
102103

103104
FROM build-base-bullseye AS e2e-base-bullseye
104105
RUN apt-get update && apt-get install -y build-essential curl openssl openssh-client
105-
ARG COMPOSE_VERSION=1.29.2
106-
RUN curl -fsSL https://github.com/docker/compose/releases/download/${COMPOSE_VERSION}/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose && \
107-
chmod +x /usr/local/bin/docker-compose
108106

109-
FROM docker/buildx-bin:${BUILDX_VERSION} AS buildx
107+
FROM docker/buildx-bin:${BUILDX_VERSION} AS buildx
108+
FROM docker/compose-bin:${COMPOSE_VERSION} AS compose
110109

111110
FROM e2e-base-${BASE_VARIANT} AS e2e
112111
ARG NOTARY_VERSION=v0.6.1
@@ -116,7 +115,8 @@ RUN echo 'notary.cert' >> /etc/ca-certificates.conf && update-ca-certificates
116115
COPY --link --from=gotestsum /out/gotestsum /usr/bin/gotestsum
117116
COPY --link --from=build /out ./build/
118117
COPY --link --from=build-plugins /out ./build/
119-
COPY --link --from=buildx /buildx /usr/libexec/docker/cli-plugins/docker-buildx
118+
COPY --link --from=buildx /buildx /usr/libexec/docker/cli-plugins/docker-buildx
119+
COPY --link --from=compose /docker-compose /usr/libexec/docker/cli-plugins/docker-compose
120120
COPY --link . .
121121
ENV DOCKER_BUILDKIT=1
122122
ENV PATH=/go/src/github.com/docker/cli/build:$PATH

e2e/compose-env.connhelper-ssh.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
version: '2.1'
2-
31
services:
42
engine:
53
build:

e2e/compose-env.experimental.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
version: '2.1'
2-
31
services:
42
engine:
53
command: ["--insecure-registry=registry:5000", "--experimental"]
6-

e2e/compose-env.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
version: '2.1'
2-
31
services:
42
registry:
53
image: 'registry:2'
@@ -25,4 +23,3 @@ services:
2523
ports:
2624
- 4444:4443
2725
command: ['notary-server', '-config=/fixtures/notary-config.json']
28-

scripts/test/e2e/run

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ setup() {
2626
export TEST_CONNHELPER_SSH_ID_RSA_PUB
2727
file="${file}:./e2e/compose-env.connhelper-ssh.yaml"
2828
fi
29-
COMPOSE_PROJECT_NAME=$project COMPOSE_FILE=$file docker-compose up --build -d >&2
29+
COMPOSE_PROJECT_NAME=$project COMPOSE_FILE=$file docker compose up --build -d >&2
3030

3131
local network="${project}_default"
3232
# TODO: only run if inside a container
3333
docker network connect "$network" "$(hostname)"
3434

35-
engine_ip="$(container_ip "${project}_engine_1" "$network")"
35+
engine_ip="$(container_ip "${project}-engine-1" "$network")"
3636
engine_host="tcp://$engine_ip:2375"
3737
if [ "${TEST_CONNHELPER:-}" = "ssh" ];then
3838
engine_host="ssh://penguin@${engine_ip}"
@@ -54,7 +54,7 @@ cleanup() {
5454
local project=$1
5555
local network="${project}_default"
5656
docker network disconnect "$network" "$(hostname)"
57-
COMPOSE_PROJECT_NAME=$1 COMPOSE_FILE=$2 docker-compose down -v --rmi local >&2
57+
COMPOSE_PROJECT_NAME=$1 COMPOSE_FILE=$2 docker compose down -v --rmi local >&2
5858
}
5959

6060
runtests() {

0 commit comments

Comments
 (0)