Skip to content

fix(ci): report the commit a pinned maintenance checkout builds - #5556

Merged
shepherdjerred merged 1 commit into
mainfrom
fix/ci-pinned-checkout-commit
Dec 3, 2026
Merged

shepherdjerred merged 1 commit into
mainfrom
fix/ci-pinned-checkout-commit

Conversation

@shepherdjerred

@shepherdjerred shepherdjerred commented Dec 3, 2026 •

Copy link
Copy Markdown
Owner

Why

Maintenance pipeline #21090 checked out and built 133b052 (#5545), but its steps reported CI_COMMIT_SHA e8471e9 (#5538). The cause is not a stale cache. Woodpecker 3.20's manual pipeline API takes only a branch (PipelineOptions{branch, variables}), so CreatePipeline starts at main's tip from BranchHead. The coordinator then declares the newest verified main in CI_MAINTENANCE_SOURCE. The config extension (sourcePinnedEmitter → maintenanceSourcePipeline) checks out that verified commit in place of the tip, as designed. Woodpecker's record and every step's CI_COMMIT_SHA still named the tip, so the bootstrap diagnostic, image pins and toolkit ci maintenance all reported a commit that was never built.

For #21090, #5538 merged at 06:12:24Z. The coordinator submitted source 133b052 at 06:12:47.66Z, because push #21044 was the newest green main. Woodpecker created #21090 at the new tip, e8471e9, at 06:12:48Z.

Push and pull-request pipelines are not affected. Every pinned maintenance run is: the current ci/ci-image/STATE.json and ci/ci-playwright/STATE.json record sourceCommit f69a23f, but #19963 built e192613.

What

  • Extension emitter: every command container now sets CI_COMMIT_SHA to the commit its workflow checks out. Woodpecker applies step environment after its metadata, so this value wins. Push and PR values do not change, because their checkout commit is already Woodpecker's.
  • Clone check: the source-cache clone keeps Woodpecker's CI_COMMIT_SHA and fails unless the commit it was given is that value or the signed request's declared CI_MAINTENANCE_SOURCE / CI_EXTENDED_SOURCE (src/checkout/declared.ts). It already asserted HEAD equals that commit.
  • Toolkit: toolkit ci maintenance now reports the declared source as source and Woodpecker's tip as woodpeckerCommit.
  • Docs: the extension and toolkit READMEs describe the pinned identity.

Demo

Before: live #21090 evidence.

$ toolkit woodpecker pipeline log show shepherdjerred/monorepo 21090 3     # clone
… checkout.sh /woodpecker/source-cache /woodpecker/source-control 133b0528fd1a25ca4e5c4c9bd698f15f69eb79d8
CI_CHECKOUT_DIAGNOSTIC {"schemaVersion":1,"sourceSha":"133b0528fd1a25ca4e5c4c9bd698f15f69eb79d8",…}

$ toolkit woodpecker pipeline log show shepherdjerred/monorepo 21090 5     # maintenance-ci-images
CI_BOOTSTRAP_DIAGNOSTIC {"schemaVersion":1,"sourceSha":"e8471e9e22be34c8d2ee8ff2166005330f09cd86",…}

# Woodpecker API, GET /api/repos/1/pipelines/21090
commit    = e8471e9e22be34c8d2ee8ff2166005330f09cd86
variables = {"CI_MAINTENANCE_KIND":"ci-images","CI_MAINTENANCE_SOURCE":"133b0528fd1a25ca4e5c4c9bd698f15f69eb79d8",…}

# Temporal ci-maintenance-coordinator, submitCiMaintenance input (06:12:47.66Z)
{"kind":"ci-images","source":"133b0528fd1a25ca4e5c4c9bd698f15f69eb79d8","requestId":"ace479d6-…"}

$ toolkit ci maintenance --json   # before: reports the tip, not the built source
{"kind":"ci-images","pipeline":21090,"source":"e8471e9e22be34c8d2ee8ff2166005330f09cd86","status":"failure",…}

After: #21090's request replayed through this branch's emitter and clone check.

clone checks out:                     133b0528fd1a25ca4e5c4c9bd698f15f69eb79d8
clone CI_COMMIT_SHA override:         (none; Woodpecker's tip e8471e9e22be34c8d2ee8ff2166005330f09cd86)
maintenance-ci-images CI_COMMIT_SHA: 133b0528fd1a25ca4e5c4c9bd698f15f69eb79d8
clone check, request declared the source: pass
clone check, undeclared commit: FAIL (Checkout commit 133b0528fd1a25ca4e5c4c9bd698f15f69eb79d8 is neither CI_COMMIT_SHA e8471e9e22be34c8d2ee8ff2166005330f09cd86 nor a declared request source)

Scope: each clone step's CI_CHECKOUT_DIAGNOSTIC.sourceSha compared with Woodpecker's commit (CI_COMMIT_SHA).

pipeline event woodpecker_commit clone_checkouts matching_CI_COMMIT_SHA mismatched_checkout
21090 manual (ci-images) e8471e9 1 0 133b052
21007 manual (workspace-golden) ababfe4 1 0 9d04858
20708 manual (ci-images) fa55ac5 1 0 39eb001
19963 manual (ci-images) f69a23f 1 0 e192613
18272 manual (ci-images) d612f1a 1 0 f0819b0
21060 push b41f1cb 18 18
21044 push 133b052 16 16
21009 push 93f5fee 16 16
21098 pull_request 1b78095 1 1
21097 pull_request 1ec25ac 1 1
21087 pull_request fe9d9b3 1 1
21086 pull_request 1c1a0e6 1 1
21061 pull_request 1b621fe 3 3
21059 pull_request dff6da5 3 3
21057 pull_request 54fd143 3 3
21051 pull_request b1eeb0c 4 4
21050 pull_request b60ffc1 3 3

Verification

  • New tests:
    • test/checkout/declared.test.ts covers the clone check.
    • A #21090 replay through the signed HTTP app (authorization-http.test.ts).
    • Every emitted command's CI_COMMIT_SHA (emit.test.ts).
    • The toolkit's reported source (test/lib/ci/maintenance.test.ts).
    • Both extension tests fail on main's emitter.
  • bunx turbo run typecheck lint test --filter=@shepherdjerred/woodpecker-config-extension --filter=@shepherdjerred/toolkit passed: 37/37 tasks, 492 extension tests.
  • bunx turbo run jscpd quality-ratchet knip --filter=// passed: 18/18.
  • bunx lefthook run pre-commit passed.
  • bunx turbo run test:extended --filter='...[origin/main...HEAD]' --continue passed: 53/53 tasks across 8 affected packages, including @shepherdjerred/temporal and @shepherdjerred/toolkit test:extended.
  • The focused checks were rerun after restacking onto main 13a59c3 and passed: 37/37.
  • Not verified: no live maintenance pipeline has run on the new extension image. That needs this to deploy, followed by the next coordinator ci-images or workspace-golden run.
  • Residual, tracked in Tracker AI-1219: Woodpecker's own pipeline record and the GitHub status it posts still name main's tip, because the 3.20 manual API cannot start at a commit.

🤖 Generated with Claude Code

@shepherdjerred

Copy link
Copy Markdown
Owner Author

This change is part of the following stack:

Change managed by git-spice.

@greptile-apps

greptile-apps Bot commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

Automatic reviews are disabled for this repository. Configure in Code Review Settings.

@coderabbitai

coderabbitai Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Why
Woodpecker starts a manual pipeline at main's tip, and the config extension
checks out the request's declared verified source (`CI_MAINTENANCE_SOURCE`,
`CI_EXTENDED_SOURCE`) in its place. Every command still saw Woodpecker's
`CI_COMMIT_SHA`, the tip. Maintenance pipeline #21090 cloned 133b052 (the
coordinator's verified source, #5545) while its bootstrap diagnostic,
`toolkit ci maintenance` and any image pin reported e8471e9 (#5538). The
current ci-base and ci-playwright pins record sourceCommit f69a23f although
#19963 built e192613. Push and pull-request pipelines never differed.

What
- Every emitted command container sets `CI_COMMIT_SHA` to the commit its
  workflow checks out. Step environment overrides Woodpecker's metadata, so
  builds, pins and diagnostics name the built commit. Push and PR values are
  unchanged because their checkout commit is Woodpecker's.
- The source-cache clone keeps Woodpecker's value and fails unless its commit
  is that `CI_COMMIT_SHA` or a declared request source.
- `toolkit ci maintenance` reports the declared source a run built as
  `source`, and Woodpecker's tip as `woodpeckerCommit`.

Verification
- New tests: the clone check (`test/checkout/declared.test.ts`), a #21090
  replay through the signed HTTP app, every emitted command's
  `CI_COMMIT_SHA`, and the toolkit's reported source. The extension tests fail
  without the environment change.
- `bunx turbo run typecheck lint test` for the extension and toolkit, root
  `jscpd quality-ratchet knip`, and `bunx lefthook run pre-commit` pass.
- Not run: a live maintenance pipeline on the new extension image.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@shepherdjerred
shepherdjerred force-pushed the fix/ci-pinned-checkout-commit branch from 071fa3a to 544ccf8 Compare December 3, 2026 07:28
@shepherdjerred
shepherdjerred marked this pull request as ready for review December 3, 2026 07:28
@shepherdjerred

Copy link
Copy Markdown
Owner Author

@codex review

Automated re-review request for 544ccf8 from the CI review gate.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Dec 3, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-12-03T07:32:00.240139Z 544ccf8 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

Reviewed commit: 544ccf8c67

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@shepherdjerred
shepherdjerred merged commit 8c8898a into main Dec 3, 2026
13 of 14 checks passed
@shepherdjerred
shepherdjerred deleted the fix/ci-pinned-checkout-commit branch December 3, 2026 08:39
shepherdjerred added a commit that referenced this pull request Dec 3, 2026
Why
Restacking onto #5556 brought a new emit test that calls cacheSourceSteps
without the `main` input this branch made required, so typecheck failed.

What
- The test now passes `main: true` for its trusted cached steps. #5556's
  assertDeclaredCheckout and this branch's tier and commit-lock setup are both
  kept in checkout/main.ts after resolving the restack conflict.

Verification
- bunx turbo run build typecheck test lint for the extension and
  @homelab/cdk8s: 40/40 tasks; extension 504 passed, 1 skipped (the
  Linux-only flock test on macOS); cdk8s 3194 passed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant