diff --git a/.drone.yml b/.drone.yml index a533a5c442..284ef69296 100644 --- a/.drone.yml +++ b/.drone.yml @@ -259,17 +259,20 @@ platform: steps: - name: manifest - image: rancher/dapper:v0.4.2 + image: plugins/docker environment: - USERNAME: + DOCKER_USERNAME: from_secret: docker_username - PASSWORD: + DOCKER_PASSWORD: from_secret: docker_password - commands: - - export DOCKER_TAG=$(echo "${DRONE_TAG}" | sed -e 's/+/-/g') - - docker login -u $env:USERNAME -p $env:PASSWORD - - docker manifest create ${DOCKER_TAG} ${DOCKER_TAG}-amd64 ${DOCKER_TAG}-arm64 ${DOCKER_TAG}-arm - - docker manifest push ${DOCKER_TAG} + settings: + dry_run: true + dockerfile: Dockerfile.manifest + repo: "rancher/k3s-manifest" + build_args_from_env: + - DOCKER_USERNAME + - DOCKER_PASSWORD + - DRONE_TAG when: instance: - drone-publish.rancher.io diff --git a/Dockerfile.manifest b/Dockerfile.manifest new file mode 100644 index 0000000000..8425739b09 --- /dev/null +++ b/Dockerfile.manifest @@ -0,0 +1,16 @@ +FROM golang:1.13.5-alpine3.10 + +COPY --from=plugins/manifest:1.2.3 /bin/* /bin/ + +ARG DOCKER_USERNAME +ENV DOCKER_USERNAME $DOCKER_USERNAME + +ARG DOCKER_PASSWORD +ENV DOCKER_PASSWORD $DOCKER_PASSWORD + +ARG DRONE_TAG +ENV DRONE_TAG $DRONE_TAG + +COPY ./scripts/manifest /bin/ + +RUN manifest diff --git a/scripts/manifest b/scripts/manifest new file mode 100755 index 0000000000..84fe197ba5 --- /dev/null +++ b/scripts/manifest @@ -0,0 +1,16 @@ +#!/bin/sh + +if [ -z "${DRONE_TAG}" ]; then + echo "DRONE_TAG not defined" >&2 + exit 1 +fi + +set -e -x + +export REPO="rancher/k3s" +export DRONE_TAG=$(echo "${DRONE_TAG}" | sed -e 's/+/-/g') +export PLUGIN_TARGET="${REPO}:${DRONE_TAG}" +export PLUGIN_TEMPLATE="${REPO}:${DRONE_TAG}-ARCH" +export PLUGIN_PLATFORMS="linux/amd64,linux/arm64,linux/arm" + +drone-manifest