Repository navigation
feat: introduce PR mode for attestations - #3268
Conversation
Add a --pr flag to chainloop attestation init that marks an attestation as originating from a pull/merge request build. When PR mode is active: - Sets the chainloop.dev/is-pull-request=true annotation on the attestation so downstream consumers can detect and skip processing. - Defaults mark-latest=false to skip latest version promotion, replacing the manual --mark-latest=false workaround. An explicit --mark-latest=true still wins. PR mode is auto-detected from the CI runner environment (GitHub Actions GITHUB_EVENT_NAME=pull_request, GitLab CI_PIPELINE_SOURCE=merge_request_event) and can be explicitly overridden via --pr/--pr=false. Fixes chainloop-dev#3265 Assisted-by: Claude Code Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev> Chainloop-Trace-Sessions: ses_0c7fc994cffe1d68UjAPS6QDNj
AI Session Analysis
|
| Status | Attribution | File | Lines |
|---|---|---|---|
| modified | ai | app/cli/pkg/action/attestation_init_test.go |
+120 / -3 |
| modified | ai | pkg/attestation/crafter/crafter_test.go |
+53 / -0 |
| modified | ai | app/cli/pkg/action/attestation_init.go |
+40 / -0 |
| modified | ai | pkg/attestation/crafter/crafter.go |
+18 / -0 |
| modified | ai | app/cli/cmd/attestation_init.go |
+8 / -0 |
| modified | ai | app/cli/pkg/action/attestation_push.go |
+7 / -0 |
| modified | human | app/cli/documentation/cli-reference.mdx |
+1 / -0 |
Policies (4)
| Status | Policy | Material | Messages |
|---|---|---|---|
| ✅ Passed | ai-config-ai-agents-allowed |
ai-coding-session-ses-0c |
- |
| ✅ Passed | ai-config-no-dangerous-commands |
ai-coding-session-ses-0c |
- |
| ✅ Passed | ai-config-no-secrets |
ai-coding-session-ses-0c |
- |
| ✅ Passed | ai-config-mcp-servers-allowed |
ai-coding-session-ses-0c |
- |
Powered by Chainloop and Chainloop Trace
…air newest pre-release version PR chainloop-dev#3289 removed PR mode's incomplete suppression of latest-version promotion. Restore that suppression in the CLI action (the PR chainloop-dev#3268 rule): when isPR is true, default --mark-latest to false unless the user explicitly passed --mark-latest=true. This preserves the three observable states — omitted becomes false in PR mode, explicit false stays false, explicit true remains the user override. Complete the behavior in the control plane: a later non-PR attestation against an existing pre-release version now repairs latest when that version is the newest active version by immutable created_at and is not already latest. PR runs and explicit --mark-latest=false opt-outs are not promoted. Released versions are never auto-promoted; only explicit true attempts promotion and is rejected for released versions. The nil/true/false contract is now described in the AttestationServiceInitRequest.mark_as_latest proto comment and regenerated artifacts. Added integration coverage for the repair lifecycle (v1 latest → PR-sim v2 not latest → non-PR v2 repaired to latest) and boundaries: older version not promoted over newer, explicit false suppression wins over automatic repair, and newest released version not auto-promoted. Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev>
chainloop-cli 1.104.0 Created-by: HarmonybrewBot Commit-by: HarmonybrewBot Merged-by: HarmonybrewBot Description: Created by `brew bump` --- Created with `brew bump-formula-pr`.<details> <summary>release notes</summary> <pre>## What's Changed * Bump Helm Chart and Dagger Version => v1.103.1 by @github-actions[bot] in chainloop-dev/chainloop#3259 * fix(ci): align secrets-scan material name with contract by @migmartri in chainloop-dev/chainloop#3262 * fix: harden GitHub Actions workflows against zizmor findings by @migmartri in chainloop-dev/chainloop#3260 * feat: add opencode chainloop-trace plugin by @migmartri in chainloop-dev/chainloop#3267 * ci: bump docker/login-action to v4.4.0 by @matiasinsaurralde in chainloop-dev/chainloop#3261 * fix(controlplane): restrict owner-role invitations to org owners (CP-1) by @migmartri in chainloop-dev/chainloop#3263 * feat: introduce PR mode for attestations by @migmartri in chainloop-dev/chainloop#3268 * docs: fix broken GUAC integration link in README by @tknura in chainloop-dev/chainloop#3272 * fix(cli): correct registered integration add usage string to --opt by @tknura in chainloop-dev/chainloop#3271 * fix: upgrade extras/dagger deps to resolve 4 security advisories by @migmartri in chainloop-dev/chainloop#3277 * fix(crafter): surface auto-discovery validation errors by @waveywaves in chainloop-dev/chainloop#2983 * docs: regenerate CLI reference for registered integration add usage by @matiasinsaurralde in chainloop-dev/chainloop#3279 * fix: upgrade Go toolchain to 1.26.5 for GO-2026-4970-stdlib by @chainloop-platform[bot] in chainloop-dev/chainloop#3278 * feat(cli): explode archive materials in chainloop att add by @javirln in chainloop-dev/chainloop#3254 * fix(materials): do not record container image digest as tag by @tknura in chainloop-dev/chainloop#3281 * fix(cli): accept matching --name and metadata.name in contract commands by @tknura in chainloop-dev/chainloop#3282 * fix(dispatcher): improve fanout delivery timeouts and retry budget by @migmartri in chainloop-dev/chainloop#3270 * refactor: remove the public attribute from workflows by @matiasinsaurralde in chainloop-dev/chainloop#3283 * fix(cli): preserve verbatim contract bytes when splitting apply documents by @javirln in chainloop-dev/chainloop#3233 **Full Changelog**: https://github.com/chainloop-dev/chainloop/compare/v1.103.1...v1.104.0</pre> <p>View the full release notes at <a href="https://github.com/chainloop-dev/chainloop/releases/tag/v1.104.0">https://github.com/chainloop-dev/chainloop/releases/tag/v1.104.0</a>.</p> </details> <hr> See merge request: Harmonybrew/homebrew-core!14158
What
Introduces a "PR mode" for attestations that captures and propagates the pull/merge request signal as a top-level annotation on the attestation.
Changes
--prflag onchainloop attestation init: explicitly marks the attestation as a PR/MR build. Auto-detected from the CI runner environment (GitHub ActionsGITHUB_EVENT_NAME=pull_request, GitLabCI_PIPELINE_SOURCE=merge_request_event) when not set.--pr=falseforces it off.chainloop.dev/is-pull-request=trueannotation: set on the attestation when in PR mode, so downstream consumers (e.g. findings processing) can detect PR-originated attestations and skip reprocessing.Skip latest promotion: when in PR mode,
mark-latestdefaults tofalse(replacing the manual--mark-latest=falseworkaround). An explicitly passed--mark-latest=truestill wins.Push annotation preservation: the push path now preserves existing attestation-level annotations (like the PR marker) alongside contract and runtime annotations, instead of overwriting them.
Fixes #3265
Assisted-by: Claude Code
🤖 Posted by Maximus bot (Claude Code) on behalf of @migmartri