Files
archie/.woodpecker/canary.yaml
T
sam 73860b26d2
Quality / check (pull_request) Canceled after 0s
ci/woodpecker/pr/quality Pipeline was canceled
ci(woodpecker): build once, keep Go's caches, fetch archied for the canary
The same changes as the Actions workflows: a release gate runs
`task check dist` and the dist step only packages; canary and promote copy
archied out of archied:edge instead of compiling it.

The gate and the pull-request check keep Go's module, build and lint caches
on the host, in separate directories so a pull request cannot write into the
cache a release build reads.

Fixes: notes wait for the signed release and carry the prerelease flag;
the canary clones with tags, which its rollback needs to diff migrations;
release puts HEAD on main before `task release`, which refuses anything else.
2026-11-10 10:57:59 +00:00

68 lines
2.6 KiB
YAML

# Canary judge: check the release the canary is running, then promote it, pick
# up a newer `next`, or roll it back. Every fifteen minutes, and on demand.
#
# Requires repo secrets canary_url, canary_token and deploy_token (the registry
# credentials the `-latest` re-tagging needs). canary_window is optional.
# Shell-side references are written $$name (see the note in deploy.yaml).
#
# Written to fail loudly when canary_url is missing: the schedule only exists
# because the maintainer asked for one, so a canary nobody configured is a
# misconfiguration, not a quiet skip.
when:
- event: [cron]
- event: [manual]
# A judging run takes longer than the interval when the canary is unhealthy;
# overlapping runs would judge the same release twice.
concurrency: 1
clone:
git:
image: woodpeckerci/plugin-git:2.8.0
settings:
# A rollback compares the migrations between two release tags, so the
# checkout needs the tags and the trees behind them.
tags: true
partial: false
steps:
- name: judge
image: docker:29-cli
volumes:
- /var/run/docker.sock:/var/run/docker.sock
environment:
DOCKER_HOST: unix:///var/run/docker.sock
CANARY_URL:
from_secret: canary_url
CANARY_WINDOW:
from_secret: canary_window
ARCHIE_CANARY_TOKEN:
from_secret: canary_token
DEPLOY_TOKEN:
from_secret: deploy_token
commands:
- '[ -n "$$CANARY_URL" ] || { echo "repo secret canary_url is not set, so there is no canary to judge"; exit 1; }'
- '[ -n "$$ARCHIE_CANARY_TOKEN" ] || { echo "repo secret canary_token is not set, so the canary cannot be reached"; exit 1; }'
- '[ -n "$$DEPLOY_TOKEN" ] || { echo "repo secret deploy_token is not set, so the registry cannot be tagged"; exit 1; }'
- apk add --no-cache git
# archied reads the registry credentials this login writes.
- printf '%s' "$$DEPLOY_TOKEN" | docker login git.catlow.cloud -u "$$CI_REPO_OWNER" --password-stdin
# The deploy pipeline already built this binary. edge is the newest main
# that passed the gate.
- |
set -eu
image=git.catlow.cloud/sam/archied:edge
docker pull -q "$$image"
container=$(docker create "$$image")
docker cp "$$container:/usr/local/bin/archied" /tmp/archied
docker rm "$$container" >/dev/null
- |
set -eu
set --
if [ -n "$$CANARY_WINDOW" ]; then
set -- -window "$$CANARY_WINDOW"
fi
/tmp/archied release canary check -dashboard "$$CANARY_URL" "$$@" \
-latest git.catlow.cloud/sam/archied,git.catlow.cloud/sam/archie-agent