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
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