diff --git a/.drone.yml b/.drone.yml index fc7c9791ea1f..f95efdf39829 100644 --- a/.drone.yml +++ b/.drone.yml @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/Dockerfile.test.dapper b/Dockerfile.test similarity index 62% rename from Dockerfile.test.dapper rename to Dockerfile.test index a2f1d60c93a6..427167928089 100644 --- a/Dockerfile.test.dapper +++ b/Dockerfile.test @@ -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 @@ -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"] \ No newline at end of file diff --git a/Dockerfile.test.mod.dapper b/Dockerfile.test.mod.dapper deleted file mode 100644 index 9eb7186aae7d..000000000000 --- a/Dockerfile.test.mod.dapper +++ /dev/null @@ -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"]