feat: Woodpecker-Plugin deploy für oumta-deploy
Schreibt dev- und beta-Images mit Digest nach tanztee/oumta-deploy über dessen ci/deploy-image.sh. Gebaut per .woodpecker/plugins.yaml, Release über Tag deploy-vX.Y.Z. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
662db558bd
commit
b8445a83c4
4 files changed
+124
No files matched your search
@@ -0,0 +1,5 @@
|
||||
# Woodpecker plugin: writes dev and beta image tags with digest to oumta-deploy
|
||||
FROM alpine:3.20
|
||||
RUN apk add --no-cache bash git ca-certificates crane
|
||||
COPY deploy.sh /usr/local/bin/deploy.sh
|
||||
ENTRYPOINT ["/usr/local/bin/deploy.sh"]
|
||||
Executable
+35
@@ -0,0 +1,35 @@
|
||||
#!/usr/bin/env bash
|
||||
# Woodpecker plugin "deploy": writes the pushed image with its digest to
|
||||
# oumta-deploy. ci/deploy-image.sh there decides the environment from the tag
|
||||
# (-dev. -> dev, -beta. -> beta, anything else -> nothing).
|
||||
set -euo pipefail
|
||||
|
||||
die() { echo "deploy: $*" >&2; exit 1; }
|
||||
|
||||
VAR=${PLUGIN_VAR:?settings.var is missing}
|
||||
REGISTRY=${PLUGIN_REGISTRY:-git.uesome.de}
|
||||
IMAGE=${PLUGIN_IMAGE:-$REGISTRY/${CI_REPO:?CI_REPO is missing}}
|
||||
TAG=${PLUGIN_TAG:-${CI_COMMIT_TAG:-}}
|
||||
DEPLOY_USER=${PLUGIN_DEPLOY_USER:-oumta-ci}
|
||||
DEPLOY_REPO=${PLUGIN_DEPLOY_REPO:-https://git.uesome.de/tanztee/oumta-deploy.git}
|
||||
[[ -n $TAG ]] || die "no tag (settings.tag or tag event)"
|
||||
[[ -n ${PLUGIN_DEPLOY_TOKEN:-} ]] || die "settings.deploy_token is missing"
|
||||
|
||||
major=${TAG#v}; major=${major%%.*}
|
||||
VAR=${VAR//\{major\}/$major}
|
||||
|
||||
if [[ -n ${PLUGIN_REGISTRY_USERNAME:-} ]]; then
|
||||
crane auth login "$REGISTRY" -u "$PLUGIN_REGISTRY_USERNAME" --password-stdin \
|
||||
<<<"${PLUGIN_REGISTRY_PASSWORD:?settings.registry_password is missing}" >/dev/null
|
||||
fi
|
||||
|
||||
# Token only via credential helper, never in a URL or config, so no log shows it
|
||||
helper='!f() { echo "username=$DEPLOY_USER"; echo "password=$PLUGIN_DEPLOY_TOKEN"; }; f'
|
||||
export DEPLOY_USER PLUGIN_DEPLOY_TOKEN
|
||||
work=$(mktemp -d)
|
||||
git -c credential.helper="$helper" clone --quiet "$DEPLOY_REPO" "$work/oumta-deploy"
|
||||
git -C "$work/oumta-deploy" config credential.helper "$helper"
|
||||
|
||||
export DEPLOY_ENVS=${PLUGIN_ENVS:-}
|
||||
export SOURCE_REPO=${CI_REPO:-} SOURCE_COMMIT=${CI_COMMIT_SHA:-}
|
||||
"$work/oumta-deploy/ci/deploy-image.sh" "$VAR" "${IMAGE,,}:$TAG"
|
||||
Reference in new issue
Block a user