Template
feat(ci): layered promotion-gated test pipeline (build once → dev → rc → prod) [DRAFT] #6
Reference in New Issue
Block a user
Delete Branch "feat/tiered-test-pipeline"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Adds
.mokogitea/workflows/test-pipeline.yml— a single workflow implementing the build once → test at dev → promote the tested artifact to rc → gate prod on RC health model from #4. Pairs with the deploy workflows in PR #5 (deploy-dev.yml/deploy-rc.yml/deploy-prod.yml) and reuses theirDEV_*/RC_*/PROD_*variables and sharedsecrets.DEPLOY_SSH_KEY+secrets.MOKOGITEA_TOKEN.Tier model
devvars.TEST_CMD, defaultgo test ./...) → push the tested artifact → deploy tested image to devdev-testedpointer → eligible for rcrc(promote-rc)dev-testedartifact (no rebuild), promote it to the RC registry, deploy that exact digest, run suite + smoke vs the live RC instancerc-healthypointer → eligible for mainmainrc-healthyartifact exists (fail closed), promote the same digest to prod:version+:latest, deployBuild once, promote the artifact
The promotable artifact is a content-addressed image tag
sha-<shortsha>built only at the dev tier. Promotion never rebuilds:rcandproddocker pullthe exact tested image and re-tag it, so the bits that ship to prod are the bits that passed dev and rc.Durable, registry-native promotion pointers carry state across workflow runs:
<IMAGE>:dev-tested→ digest that passed the dev suite (moved by the dev job)<IMAGE>:rc-healthy→ digest that passed rc suite + smoke (moved by the rc job)Gitea commit statuses
pipeline/devandpipeline/rcare also published per tier (the "status/label the promotion checks read" from #4), so branch-protection / the UI get a green check per tier.Prod gates on RC, not dev
The prod job fails closed if no
rc-healthyartifact exists — an image that never passed the RC tier can't reach prod. This replaces the old "verify dev healthy" gate removed in MokoGitea-Fork#758.Avoids the Gitea needs-chain scheduler bug
Three independent jobs (
dev,rc,prod), each gated byif:on the pushed branch, with noneeds:between them. The Gitea Actions scheduler doesn't reliably start the dependent 2nd job of aneeds:chain (it stalls inwaiting— see MokoGitea-Fork#756, which made the Tests job independent). Each tier is one self-contained job whose steps run sequentially (build → test → promote → deploy); cross-tier ordering is the natural git flow (dev → rc → main), not an in-workflow dependency.Config
All tier config from
vars.*/secrets.*, consistent with PR #5's naming. Pipeline-specific (optional) vars:TEST_CMD(defaultgo test ./...),SMOKE_CMD(default curlsRC_HEALTH_URL),GO_VERSION(default: readsgo.mod, elsestable).Open questions / assumptions
dev-tested/rc-healthy). These are last-wins pointers, not per-commit — fine for a linear dev→rc→main flow, but concurrent branches could race. A per-commit coupling (commit-status keyed by SHA) is the alternative; happy to switch if preferred.docker pullinstead ofdocker build). Alternative is to hand off todeploy-*.yml— but those rebuild from source, which would defeat "promote the tested artifact." Flagged in the header TODO.setup-go(TEST_CMD). Could instead run inside the built image (docker run … go test) for true artifact-parity; noted as a header TODO.Dockerfileand theDEV_*/RC_*/PROD_*vars are populated.Refs #4
Claude-Session: https://claude.ai/code/session_01Wsno14cxE49MstXFs9G5KT
Add .mokogitea/workflows/test-pipeline.yml implementing the tiered "build once, test, promote the artifact" model from Template-Go#4: - dev (push dev): build the image ONCE, run the suite, push the tested artifact, move the `dev-tested` pointer, deploy to dev. - rc (push rc): PULL the dev-tested artifact (no rebuild), promote it to the RC registry, deploy that exact digest, run suite + smoke vs the live RC instance, move `rc-healthy`. - prod (push main): gate on an `rc-healthy` artifact existing (fail closed), then promote the SAME digest to prod :version + :latest and deploy — replacing the removed "verify dev healthy" gate (MokoGitea-Fork#758). Three independent `if:`-gated jobs, no `needs:` chain, so it avoids the Gitea scheduler stall on dependent 2nd jobs (MokoGitea-Fork#756). All tier config is driven from repo vars.*/secrets.*, reusing the DEV_*/RC_*/PROD_* variables and shared DEPLOY_SSH_KEY/MOKOGITEA_TOKEN secrets from the deploy workflows (PR#5). Gitea commit statuses pipeline/dev + pipeline/rc are published per tier. First draft for review; env-specific wiring left as TODO in the header. Refs #4 Claude-Session: https://claude.ai/code/session_01Wsno14cxE49MstXFs9G5KTView command line instructions
Checkout
From your project repository, check out a new branch and test the changes.