Skip to content

Commit 956d15c

Browse files
krissettovvoland
authored andcommitted
Cleanup of dockerfiles, compose files and env vars
Signed-off-by: Christopher Petito <chrisjpetito@gmail.com> (cherry picked from commit 69ed658) Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
1 parent 5a942fa commit 956d15c

7 files changed

Lines changed: 30 additions & 9 deletions

File tree

.github/workflows/e2e.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
make -f docker.Makefile test-e2e-${{ matrix.target }}
5656
env:
5757
BASE_VARIANT: ${{ matrix.base }}
58-
E2E_ENGINE_VERSION: ${{ matrix.engine-version }}
58+
ENGINE_VERSION: ${{ matrix.engine-version }}
5959
TESTFLAGS: -coverprofile=/tmp/coverage/coverage.txt
6060
-
6161
name: Send to Codecov

docker.Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ PACKAGER_NAME ?=
1414

1515
DEV_DOCKER_IMAGE_NAME = docker-cli-dev$(IMAGE_TAG)
1616
E2E_IMAGE_NAME = docker-cli-e2e
17-
E2E_ENGINE_VERSION ?=
17+
ENGINE_VERSION ?=
1818
CACHE_VOLUME_NAME := docker-cli-dev-cache
1919
ifeq ($(DOCKER_CLI_GO_BUILD_CACHE),y)
2020
DOCKER_CLI_MOUNTS += -v "$(CACHE_VOLUME_NAME):/root/.cache/go-build"
2121
endif
2222
VERSION = $(shell cat VERSION)
23-
ENVVARS = -e VERSION=$(VERSION) -e GITCOMMIT -e PLATFORM -e TESTFLAGS -e TESTDIRS -e GOOS -e GOARCH -e GOARM -e TEST_ENGINE_VERSION=$(E2E_ENGINE_VERSION)
23+
ENVVARS = -e VERSION=$(VERSION) -e GITCOMMIT -e PLATFORM -e TESTFLAGS -e TESTDIRS -e GOOS -e GOARCH -e GOARM -e ENGINE_VERSION
2424

2525
# Some Dockerfiles use features that are only supported with BuildKit enabled
2626
export DOCKER_BUILDKIT=1
@@ -132,21 +132,21 @@ test-e2e: test-e2e-non-experimental test-e2e-experimental test-e2e-connhelper-ss
132132

133133
.PHONY: test-e2e-experimental
134134
test-e2e-experimental: build-e2e-image # run experimental e2e tests
135-
docker run --rm $(ENVVARS) -e DOCKERD_EXPERIMENTAL=1 -e TEST_ENGINE_VERSION=$(E2E_ENGINE_VERSION) \
135+
docker run --rm $(ENVVARS) -e DOCKERD_EXPERIMENTAL=1 \
136136
--mount type=bind,src=$(CURDIR)/build/coverage,dst=/tmp/coverage \
137137
--mount type=bind,src=/var/run/docker.sock,dst=/var/run/docker.sock \
138138
$(E2E_IMAGE_NAME)
139139

140140
.PHONY: test-e2e-non-experimental
141141
test-e2e-non-experimental: build-e2e-image # run non-experimental e2e tests
142-
docker run --rm $(ENVVARS) -e TEST_ENGINE_VERSION=$(E2E_ENGINE_VERSION) \
142+
docker run --rm $(ENVVARS) \
143143
--mount type=bind,src=$(CURDIR)/build/coverage,dst=/tmp/coverage \
144144
--mount type=bind,src=/var/run/docker.sock,dst=/var/run/docker.sock \
145145
$(E2E_IMAGE_NAME)
146146

147147
.PHONY: test-e2e-connhelper-ssh
148148
test-e2e-connhelper-ssh: build-e2e-image # run experimental SSH-connection helper e2e tests
149-
docker run --rm $(ENVVARS) -e DOCKERD_EXPERIMENTAL=1 -e TEST_ENGINE_VERSION=$(E2E_ENGINE_VERSION) -e TEST_CONNHELPER=ssh \
149+
docker run --rm $(ENVVARS) -e DOCKERD_EXPERIMENTAL=1 -e TEST_CONNHELPER=ssh \
150150
--mount type=bind,src=$(CURDIR)/build/coverage,dst=/tmp/coverage \
151151
--mount type=bind,src=/var/run/docker.sock,dst=/var/run/docker.sock \
152152
$(E2E_IMAGE_NAME)

e2e/compose-env.connhelper-ssh.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,7 @@ services:
33
build:
44
context: ./testdata
55
dockerfile: Dockerfile.connhelper-ssh
6+
args:
7+
- ENGINE_VERSION
68
environment:
79
- TEST_CONNHELPER_SSH_ID_RSA_PUB

e2e/compose-env.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
services:
2+
23
registry:
34
image: 'registry:2'
45

56
engine:
6-
image: 'docker:${TEST_ENGINE_VERSION:-stable-dind}'
7+
image: 'docker:${ENGINE_VERSION:-25.0}-dind'
78
privileged: true
89
command: ['--insecure-registry=registry:5000']
910
environment:
@@ -16,6 +17,7 @@ services:
1617
ports:
1718
- 4443:4443
1819
command: ['notary-server', '-config=/fixtures/notary-config.json']
20+
1921
evil-notary-server:
2022
build:
2123
context: ./testdata

e2e/testdata/Dockerfile.connhelper-ssh

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
1-
FROM docker:test-dind
2-
RUN apk --no-cache add shadow openssh-server && \
1+
# syntax=docker/dockerfile:1
2+
3+
# ENGINE_VERSION is the version of the (docker-in-docker) Docker Engine to
4+
# test against.
5+
ARG ENGINE_VERSION=25.0
6+
7+
FROM docker:${ENGINE_VERSION}-dind
8+
9+
# the openssh-client update is needed for security reasons when using docker:23.0-dind, currently maintained as an lts by mirantis
10+
RUN apk --no-cache upgrade openssh-client && \
11+
apk --no-cache add shadow openssh-server && \
12+
# TODO(krissetto): `groupadd` can be removed once we only test against moby >= v24
13+
# see https://github.com/docker-library/docker/pull/470
314
groupadd -f docker && \
415
useradd --create-home --shell /bin/sh --password $(head -c32 /dev/urandom | base64) penguin && \
516
usermod -aG docker penguin && \
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1+
# syntax=docker/dockerfile:1
2+
13
ARG NOTARY_VERSION=0.6.1
4+
25
FROM notary:server-${NOTARY_VERSION}
36

47
COPY ./notary-evil/ /fixtures/
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1+
# syntax=docker/dockerfile:1
2+
13
ARG NOTARY_VERSION=0.6.1
4+
25
FROM notary:server-${NOTARY_VERSION}
36

47
COPY ./notary/ /fixtures/

0 commit comments

Comments
 (0)