Something went wrong. Try again.
CMU Coding Bootcamp
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393#set page( margin: (top: 0.9in, bottom: 0.9in, left: 1.0in, right: 1.0in),)#set text(font: "Libertinus Serif", size: 11pt)#set par(leading: 1.1em)#set heading(numbering: "1.")#set outline(indent: 1.1em)
#let meta(label, value) = { table( columns: (22%, 78%), inset: (x: 6pt, y: 4pt), stroke: (paint: luma(220), thickness: 0.8pt), fill: luma(248), [*#label*], [#value], )}
#let tag(text) = { box( inset: (x: 6pt, y: 2pt), radius: 4pt, fill: luma(235), stroke: (paint: luma(210), thickness: 0.8pt), )[ `#text` ]}
#let callout(title, body) = { block( inset: 10pt, radius: 6pt, fill: luma(248), stroke: (paint: luma(220), thickness: 0.8pt), )[ *#title* \ #body ]}
#let gate(name, condition, on_fail) = { block[ \ == #name \ - *Pass condition:* #condition \ - *On failure:* #on_fail ]}
#let stage( name, purpose: "", triggers: [], inputs: [], steps: [], outputs: [], runtime: "", runner: "", gates: [],) = { heading(level: 2, name)
if purpose != "" { [*Purpose:* #purpose] linebreak() } if runtime != "" { [*Expected runtime:* #runtime] linebreak() } if runner != "" { [*Runner/agent:* #runner] linebreak() }
if triggers.len() > 0 { [*Triggers:*] for t in triggers { [- #t] } }
if inputs.len() > 0 { [*Inputs:*] for i in inputs { [- #i] } }
if steps.len() > 0 { [*Steps:*] for s in steps { [- #s] } }
if outputs.len() > 0 { [*Outputs:*] for o in outputs { [- #o] } }
if gates.len() > 0 { [*Quality gates:*] for g in gates { [- #g] } } linebreak()}
#let env_table(rows) = { table( columns: (18%, 16%, 26%, 40%), inset: (x: 6pt, y: 4pt), stroke: (paint: luma(220), thickness: 0.8pt), align: (left, left, left, left), [*Environment*], [*Type*], [*Promotion rule*], [*Notes*], ..rows.flatten(), )}
#let simple_pipeline_diagram(items) = { let n = items.len() if n == 0 { return } let elements = ()
for (i, item) in items.enumerate() { elements.push(box( inset: 8pt, radius: 6pt, fill: luma(245), stroke: (paint: luma(210), thickness: 0.8pt), )[ *#item* ])
if i < n - 1 { elements.push(align(center + horizon)[→]) } }
let box_width = 1fr let arrow_width = auto let columns = ()
for i in range(elements.len()) { if calc.even(i) { columns.push(box_width) } else { columns.push(arrow_width) } }
grid( columns: columns, column-gutter: 8pt, align: center + horizon, ..elements )}
= CI/CD Pipeline: [PacketMix]
#meta("Owner", "FreshlyBakedCake")#meta("Repository", "Patisserie (default branch: main)")#meta("CI/CD System", "Spindle a.k.a. Tangled Actions")
#callout( "Scope", [ This document describes the CI/CD pipeline for *PacketMix*, including triggers, stages, environments, artifacts, quality gates, and operational procedures. ],)
#outline()
= Overview
== Goals- Deliver *PacketMix* safely and repeatably.- Enforce quality gates (tests, approvals).- Provide auditable deployments and fast rollback.
== Non-goals- [e.g., Build system internals not covered]
== High-level flow#simple_pipeline_diagram(( "Commit/PR", "Test", "Build", "Deploy",))
= Triggers & Branching
== Trigger events- `push` to `[main]`- `pull_request` targeting `[main]`
== Branching strategy- Primary branch: `[main]`- Release branch: `[release]`
= Environments & Promotion
#env_table(( ([Development], [ephemeral], [On PR], [Runs in Nixery engine]), ([Staging], [ephemeral], [On merge to main], [Runs in Nixery engine]), ([Release], [shared], [Main passes checks], [Sets code for release to machines]),))
== Promotion rules- Development → Staging: automatic on successful PR to main pipeline.- Staging → Production: automatic on main checks passing.
= Secrets and Variables
== Secrets- Storage: Bitwarden vault- Access model: Provisioned on machine run.
== Key variables (examples)- `KEY_SSH_RELEASE`: SSH Key used for pushing to git- `KEY_SSH_REMOTE_BUILD`: SSH Key used for accessing the remote builder
= Pipeline Stages
#stage( "deadnix", purpose: "Check for dead nix expressions.", triggers: ("PR", "push to main"), inputs: ( "Source code", ), steps: ( "Check for unused nix bindings", ), outputs: (), runtime: "~5 seconds", runner: "linux-x64 via nixery container", gates: ( "No dead nix expressions.", ),)
#stage( "reuse", purpose: "Ensure all files are properly licensed", triggers: ("PR", "push to main"), inputs: ( "Source code", ), steps: ( "Check for REUSE compliance", ), outputs: (), runtime: "~5 seconds", runner: "linux-x64 via nixery container", gates: ( "All files are properly licensed.", ),)
#stage( "packetmix-npins-duplicate-check", purpose: "Catch duplicate npins keys.", triggers: ("PR", "push to main"), inputs: ( "Source code", ), steps: ( "Check for duplicate npins keys", ), outputs: (), runtime: "~5 seconds", runner: "linux-x64 via nixery container", gates: ( "No duplicate keys.", ),)
#stage( "packetmix-treefmt", purpose: "Check formatting of changed files.", triggers: ("PR", "push to main"), inputs: ("Source code", "KEY_SSH_REMOTE_BUILD secret"), steps: ( "Get remote builds ssh key.", "Add base system files.", "Ensure files are formatted.", ), outputs: (), runtime: "~30 seconds", runner: "linux-x64 via nixery container", gates: ("All files are formatted.",),)
#stage( "packetmix-build", purpose: "Build the project.", triggers: ("PR", "push to main"), inputs: ("Source code", "KEY_SSH_REMOTE_BUILD secret"), steps: ( "Get remote builds SSH key.", "Add base system files.", "Evaluate all systems", "Build all systems" ), outputs: ("Build artifacts",), runtime: "~1 hour", runner: "linux-x64 via nixery container", gates: ( "All systems evaluate successfully.", "All builds succeed.", ),)
#stage( "packetmix-release", purpose: "Release to systems.", triggers: ("push to main",), inputs: ("Source code", "KEY_SSH_REMOTE_BUILD secret", "KEY_SSH_REMOTE_RELEASE secret"), steps: ( "Get remote builds SSH key.", "Get release push SSH key.", "Add base system files.", "Evaluate all systems.", "Build all systems.", "Push to release", ), outputs: ("Build artifacts",), runtime: "~1 hour", runner: "linux-x64 via nixery container", gates: ( "All systems evaluate successfully.", "All builds succeed.", "Push to release succeeds.", ),)
#stage( "github", purpose: "Mirror to github.", triggers: ("push to release",), inputs: ("Source code", "KEY_SSH_GITHUB secret", "KEY_SSH_GITHUB_PACKETMIX secret", "KEY_SSH_GITHUB_SPRINKLES secret"), steps: ( "Write github SSH Key.", "Add base system files.", "Push * to GitHub.", "Write packetmix github SSH Key.", "Push packetmix to GitHub.", "Write sprinkles github SSH Key.", "Push sprinkles to GitHub." ), outputs: (), runtime: "~1 minute", runner: "linux-x64 via nixery container", gates: ("All pushes to github succeed",))
= Quality Gates (Centralized)
#gate( "Required checks on PR", [All checks succeed (see @ci_pass), Human review approved (if required).], "Block merge; require fix or approved exception.",)
= Rollback & Recovery
== Rollback strategy- Primary: Force push release branch to last known good image.
== When to rollback- Any system fails to start or crash loops.
= Appendix
== Reference links- #link("https://tangled.org/freshlybakedca.ke/patisserie/")[FreshlyBakedCake/Patisserie Repo]
== Images#figure( image("ci_success.png"), caption: "CI Pipeline Success.") <ci_pass>#figure( image("deploy_success.png", width: 125%), caption: "Deploy to machine successful.") <deploys>