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

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