Skip to content

Commit

Permalink
Replace dapper testing with regular docker (#5805)
Browse files Browse the repository at this point in the history
* Replace dapper mod test with regular docker

Signed-off-by: Derek Nola <[email protected]>
  • Loading branch information
dereknola authored Jul 8, 2022
1 parent d208987 commit 86fc940
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 27 deletions.
24 changes: 19 additions & 5 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,10 @@ steps:
GCLOUD_AUTH:
from_secret: gcloud_auth
commands:
- dapper -f Dockerfile.test.dapper
- docker build --target test-k3s -t k3s:test-${DRONE_STAGE_ARCH}-${DRONE_COMMIT} -f Dockerfile.test .
- >
docker run -i -e REPO -e TAG -e DRONE_TAG -e DRONE_BUILD_EVENT -e IMAGE_NAME -e GCLOUD_AUTH -e SONOBUOY_VERSION -e ENABLE_REGISTRY
-v /var/run/docker.sock:/var/run/docker.sock --privileged --network host -v /tmp:/tmp k3s:test-${DRONE_STAGE_ARCH}-${DRONE_COMMIT}
volumes:
- name: docker
path: /var/run/docker.sock
Expand Down Expand Up @@ -190,7 +193,10 @@ steps:
GCLOUD_AUTH:
from_secret: gcloud_auth
commands:
- dapper -f Dockerfile.test.dapper
- docker build --target test-k3s -t k3s:test-${DRONE_STAGE_ARCH}-${DRONE_COMMIT} -f Dockerfile.test .
- >
docker run -i -e REPO -e TAG -e DRONE_TAG -e DRONE_BUILD_EVENT -e IMAGE_NAME -e GCLOUD_AUTH -e SONOBUOY_VERSION -e ENABLE_REGISTRY
-v /var/run/docker.sock:/var/run/docker.sock --privileged --network host -v /tmp:/tmp k3s:test-${DRONE_STAGE_ARCH}-${DRONE_COMMIT}
volumes:
- name: docker
path: /var/run/docker.sock
Expand Down Expand Up @@ -269,7 +275,10 @@ steps:
GCLOUD_AUTH:
from_secret: gcloud_auth
commands:
- dapper -f Dockerfile.test.dapper
- docker build --target test-k3s -t k3s:test-${DRONE_STAGE_ARCH}-${DRONE_COMMIT} -f Dockerfile.test .
- >
docker run -i -e REPO -e TAG -e DRONE_TAG -e DRONE_BUILD_EVENT -e IMAGE_NAME -e GCLOUD_AUTH -e SONOBUOY_VERSION -e ENABLE_REGISTRY
-v /var/run/docker.sock:/var/run/docker.sock --privileged --network host -v /tmp:/tmp k3s:test-${DRONE_STAGE_ARCH}-${DRONE_COMMIT}
volumes:
- name: docker
path: /var/run/docker.sock
Expand Down Expand Up @@ -365,7 +374,11 @@ steps:
GCLOUD_AUTH:
from_secret: gcloud_auth
commands:
- dapper -f Dockerfile.test.dapper
# we hardcode s390x as the arch because DRONE_STAGE_ARCH is set to amd64
- docker build --target test-k3s -t k3s:test-s390x-${DRONE_COMMIT} -f Dockerfile.test .
- >
docker run -i -e REPO -e TAG -e DRONE_TAG -e DRONE_BUILD_EVENT -e IMAGE_NAME -e GCLOUD_AUTH -e SONOBUOY_VERSION -e ENABLE_REGISTRY
-v /var/run/docker.sock:/var/run/docker.sock --privileged --network host -v /tmp:/tmp k3s:test-s390x-${DRONE_COMMIT}
volumes:
- name: docker
path: /var/run/docker.sock
Expand All @@ -387,7 +400,8 @@ steps:
- name: validate_go_mods
image: rancher/dapper:v0.5.0
commands:
- dapper -f Dockerfile.test.mod.dapper
- docker build --target test-mods -t k3s:mod -f Dockerfile.test .
- docker run -i k3s:mod

volumes:
- name: docker
Expand Down
28 changes: 17 additions & 11 deletions Dockerfile.test.dapper → Dockerfile.test
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
ARG GOLANG=golang:1.18.1-alpine3.15
FROM ${GOLANG}
FROM ${GOLANG} as test-base

RUN apk -U --no-cache add bash git gcc musl-dev docker curl jq coreutils python3 openssl py3-pip procps
RUN apk -U --no-cache add bash jq
ENV K3S_SOURCE /go/src/github.com/k3s-io/k3s/
WORKDIR ${K3S_SOURCE}

COPY . ${K3S_SOURCE}


From test-base as test-mods

COPY ./scripts/test-mods /bin/
ENTRYPOINT ["/bin/test-mods"]

From test-base as test-k3s

RUN apk -U --no-cache add git gcc musl-dev docker curl coreutils python3 openssl py3-pip procps

ENV SONOBUOY_VERSION 0.56.5

Expand All @@ -18,13 +32,5 @@ RUN OS=linux; \

ENV TEST_CLEANUP true

ENV DAPPER_RUN_ARGS --privileged --network host -v /tmp:/tmp
ENV DAPPER_ENV REPO TAG DRONE_TAG DRONE_BUILD_EVENT IMAGE_NAME GCLOUD_AUTH SONOBUOY_VERSION ENABLE_REGISTRY
ENV DAPPER_SOURCE /go/src/github.com/k3s-io/k3s/
ENV DAPPER_OUTPUT ./dist
ENV DAPPER_DOCKER_SOCKET true
ENV HOME ${DAPPER_SOURCE}
WORKDIR ${DAPPER_SOURCE}

ENTRYPOINT ["./scripts/entry.sh"]
CMD ["test"]
CMD ["test"]
11 changes: 0 additions & 11 deletions Dockerfile.test.mod.dapper

This file was deleted.

0 comments on commit 86fc940

Please sign in to comment.