generator: estimator-driven on-demand CI pipeline (estimate→order→provide→build→reap) (oleks/ci-scripts#25)
ci/woodpecker/cron/drift Pipeline was successful
ci/woodpecker/cron/drift Pipeline was successful
Add generator/render_ondemand.py rendering a kind: ondemand pipeline whose pre-step runs nix-estimate --json (asserts sizing.version==1), orders an EphemeralBuilder class:ci via nix-estimate --provision ci | kubectl apply, waits Ready, builds pinned via backend_options.kubernetes.nodeSelector (Option B plain-worker), and reaps the CR (runs_on success+failure). Keeps the GENERATED header + arch banner, no || true (reap uses --ignore-not-found). Adds manifests/ondemand-release-amd64.yaml + rendered example; render is pure and deterministic. render_thin_quartet skips kind: ondemand by design.
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
# GENERATED by oleks/ci-scripts — do not hand-edit.
|
||||
# Source: oleks/ci-scripts manifests/ondemand-release-amd64.yaml + generator/render_ondemand.py (oleks/ci-scripts#25).
|
||||
# Re-render with: python3 generator/render_ondemand.py --out <repo>
|
||||
|
||||
labels:
|
||||
arch: amd64
|
||||
|
||||
when:
|
||||
- event: tag
|
||||
ref: "refs/tags/v*"
|
||||
|
||||
steps:
|
||||
# 1) ESTIMATE + ORDER + PROVIDE (oleks/ci-scripts#25): size the build, order
|
||||
# an on-demand EphemeralBuilder of class ci, wait for the node to join.
|
||||
- name: provision
|
||||
image: git.oleks.space/oleks/nix-ci:latest
|
||||
commands:
|
||||
- echo "▸ arch=$(uname -m)"
|
||||
- ATTR=".#release"
|
||||
- SYS="x86_64-linux"
|
||||
- echo "▸ estimating sizing for $ATTR ($SYS)"
|
||||
- nix-estimate "$ATTR" --system "$SYS" --json > estimate.json
|
||||
- jq -e ".sizing.version == 1" estimate.json > /dev/null
|
||||
- SIZING=$(jq -c ".sizing" estimate.json)
|
||||
- echo "▸ sizing: $SIZING"
|
||||
- echo "▸ ordering on-demand builder(s) (class ci)"
|
||||
- nix-estimate "$ATTR" --system "$SYS" --provision ci | kubectl apply -f - -o name | tee ordered-builders.txt
|
||||
- echo "▸ waiting for ordered builder(s) to become Ready"
|
||||
- while read -r cr; do echo "▸ waiting $cr"; kubectl wait --for=condition=Ready "$cr" --timeout=1200s; done < ordered-builders.txt
|
||||
|
||||
# 2) BUILD on the freshly-joined ephemeral node. Pinned via nodeSelector; the
|
||||
# existing k8s-backend Woodpecker agent schedules this step-pod there.
|
||||
- name: build
|
||||
image: git.oleks.space/oleks/nix-ci:latest
|
||||
depends_on:
|
||||
- provision
|
||||
backend_options:
|
||||
kubernetes:
|
||||
nodeSelector:
|
||||
kubernetes.io/arch: amd64
|
||||
resources:
|
||||
requests:
|
||||
memory: 8Gi
|
||||
limits:
|
||||
memory: 32Gi
|
||||
commands:
|
||||
- echo "▸ arch=$(uname -m)"
|
||||
- nixos-ci-entrypoint true
|
||||
- PUBLISH=1 nix run .#publish
|
||||
|
||||
# 3) REAP: delete the ordered CR(s) to tear the node down at end of window.
|
||||
# runs_on success+failure so a failed build never strands a paid node.
|
||||
- name: reap
|
||||
image: git.oleks.space/oleks/nix-ci:latest
|
||||
depends_on:
|
||||
- build
|
||||
runs_on:
|
||||
- success
|
||||
- failure
|
||||
commands:
|
||||
- echo "▸ arch=$(uname -m)"
|
||||
- if [ -f ordered-builders.txt ]; then while read -r cr; do echo "▸ reaping $cr"; kubectl delete "$cr" --ignore-not-found; done < ordered-builders.txt; else echo "▸ no ordered-builders.txt; nothing to reap"; fi
|
||||
Reference in New Issue
Block a user