Update manifest

This commit is contained in:
Erik Wilson 2020-01-20 13:29:48 -07:00
parent 341a55536d
commit 211d735a08
3 changed files with 43 additions and 8 deletions

View File

@ -259,17 +259,20 @@ platform:
steps: steps:
- name: manifest - name: manifest
image: rancher/dapper:v0.4.2 image: plugins/docker
environment: environment:
USERNAME: DOCKER_USERNAME:
from_secret: docker_username from_secret: docker_username
PASSWORD: DOCKER_PASSWORD:
from_secret: docker_password from_secret: docker_password
commands: settings:
- export DOCKER_TAG=$(echo "${DRONE_TAG}" | sed -e 's/+/-/g') dry_run: true
- docker login -u $env:USERNAME -p $env:PASSWORD dockerfile: Dockerfile.manifest
- docker manifest create ${DOCKER_TAG} ${DOCKER_TAG}-amd64 ${DOCKER_TAG}-arm64 ${DOCKER_TAG}-arm repo: "rancher/k3s-manifest"
- docker manifest push ${DOCKER_TAG} build_args_from_env:
- DOCKER_USERNAME
- DOCKER_PASSWORD
- DRONE_TAG
when: when:
instance: instance:
- drone-publish.rancher.io - drone-publish.rancher.io

16
Dockerfile.manifest Normal file
View File

@ -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

16
scripts/manifest Executable file
View File

@ -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