Browse Source

Replace dapper testing with regular docker (#5805)

* Replace dapper mod test with regular docker

Signed-off-by: Derek Nola <derek.nola@suse.com>
pull/5833/head
Derek Nola 2 years ago committed by GitHub
parent
commit
86fc940759
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 24
      .drone.yml
  2. 26
      Dockerfile.test
  3. 11
      Dockerfile.test.mod.dapper

24
.drone.yml

@ -94,7 +94,10 @@ steps:
GCLOUD_AUTH: GCLOUD_AUTH:
from_secret: gcloud_auth from_secret: gcloud_auth
commands: 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: volumes:
- name: docker - name: docker
path: /var/run/docker.sock path: /var/run/docker.sock
@ -190,7 +193,10 @@ steps:
GCLOUD_AUTH: GCLOUD_AUTH:
from_secret: gcloud_auth from_secret: gcloud_auth
commands: 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: volumes:
- name: docker - name: docker
path: /var/run/docker.sock path: /var/run/docker.sock
@ -269,7 +275,10 @@ steps:
GCLOUD_AUTH: GCLOUD_AUTH:
from_secret: gcloud_auth from_secret: gcloud_auth
commands: 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: volumes:
- name: docker - name: docker
path: /var/run/docker.sock path: /var/run/docker.sock
@ -365,7 +374,11 @@ steps:
GCLOUD_AUTH: GCLOUD_AUTH:
from_secret: gcloud_auth from_secret: gcloud_auth
commands: 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: volumes:
- name: docker - name: docker
path: /var/run/docker.sock path: /var/run/docker.sock
@ -387,7 +400,8 @@ steps:
- name: validate_go_mods - name: validate_go_mods
image: rancher/dapper:v0.5.0 image: rancher/dapper:v0.5.0
commands: commands:
- dapper -f Dockerfile.test.mod.dapper - docker build --target test-mods -t k3s:mod -f Dockerfile.test .
- docker run -i k3s:mod
volumes: volumes:
- name: docker - name: docker

26
Dockerfile.test.dapper → Dockerfile.test

@ -1,7 +1,21 @@
ARG GOLANG=golang:1.18.1-alpine3.15 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 ENV SONOBUOY_VERSION 0.56.5
@ -18,13 +32,5 @@ RUN OS=linux; \
ENV TEST_CLEANUP true 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"] ENTRYPOINT ["./scripts/entry.sh"]
CMD ["test"] CMD ["test"]

11
Dockerfile.test.mod.dapper

@ -1,11 +0,0 @@
ARG GOLANG=golang:1.18.1-alpine3.15
FROM ${GOLANG}
RUN apk -U --no-cache add bash jq
ENV DAPPER_SOURCE /go/src/github.com/k3s-io/k3s/
ENV HOME ${DAPPER_SOURCE}
WORKDIR ${DAPPER_SOURCE}
COPY ./scripts/test-mods /bin/
ENTRYPOINT ["/bin/test-mods"]
Loading…
Cancel
Save