Introduce a "PR mode" for attestations
Mantenedores costumam responder em até 1 dia
Avaliação
Esta issue ainda não foi avaliada.
Descrição
Context / problem
When an attestation runs as part of a pull request / merge request, Chainloop today treats it the same as a build on main/a release. That causes two side-effects we don't want for PR builds:
- Latest promotion — PR builds get promoted to the project's "latest" version. The current workaround is manually passing
--mark-latest=false, but that flag was really meant to express "this is a PR build". We're overloading a low-level flag to express a higher-level concept. - Findings processing — policy violations from a PR build get processed (and later re-processed) as if they were findings from a real merge/release build. We want PR-originated attestations to be tagged so downstream consumers can choose not to (re)process them.
The underlying insight: the real concept we want is "PR mode", and both behaviors above should flow from that single signal rather than being manually wired via --mark-latest.
Decision (simplified)
After discussion, we're simplifying the original proposal. Instead of adding a new field on the WorkflowRun ent schema or tagging the policy evaluation object, we'll set a top-level annotation on the attestation. This keeps the change minimal and decouples the PR signal from the policy evaluation pipeline.
Well-known annotation key: chainloop.dev/is-pull-request with value "true".
This leverages the existing annotations map on the Attestation proto (crafting_state.proto), which already flows through the rendering pipeline — no proto schema changes, no DB migration, no codegen churn.
Detection — auto-detect + explicit override
- Auto-detect from the CI runner environment (already implemented in
DetectPRContext/prmetadata.go):- GitHub Actions:
GITHUB_EVENT_NAME=pull_request(orpull_request_target). - GitLab:
CI_PIPELINE_SOURCE=merge_request_event/CI_MERGE_REQUEST_IID. - Dagger: delegates to the parent CI env vars.
- GitHub Actions:
- Explicit
--pr/--pr=falseflag onchainloop attestation initoverrides auto-detection (zero-config in CI, escapable for edge cases / self-hosted / generic runner).
Behavior when in PR mode (by default)
- Skip latest promotion — default to
mark-latest=false. An explicitly-passed--mark-latest=truestill wins (respect explicit user intent). This replaces the manual--mark-latest=falseworkaround. - Set the
chainloop.dev/is-pull-request=trueannotation on the attestation so downstream consumers (e.g. findings processing) can detect PR-originated attestations and skip (re)processing.
Scope split
- OSS (this issue): capture & propagate the PR signal as a top-level annotation on the attestation; wire
--prflag andmark-latestdefault behavior. - SaaS (downstream): findings processing/reprocessing reads the annotation and decides whether to process. Not in scope for this issue.
Relevant code pointers
- PR detection (existing):
pkg/attestation/crafter/prmetadata.go(DetectPRContext),pkg/attestation/crafter/collector_prmetadata.go. - Runner env vars:
pkg/attestation/crafter/runners/githubaction.go,gitlabpipeline.go,daggerpipeline.go. - CLI flags:
app/cli/cmd/attestation_init.go(--mark-latest). - Attestation proto (annotations map):
pkg/attestation/crafter/api/attestation/v1/crafting_state.proto(Attestation.annotations, field 5). - Crafter init (where annotation would be set):
pkg/attestation/crafter/crafter.go(initialCraftingState). - Action layer:
app/cli/pkg/action/attestation_init.go.
🤖 Posted by Maximus bot (Claude Code) on behalf of @migmartri
- Linguagem predominante
- Go
- Estrelas
- 582
- Forks
- 61
- Merge médio
- 12h 47min
- PRs com merge (30d)
- 137
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Sem modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de chainloop-dev/chainloop
-
feature-parity trace-provider
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 70/100
chainloop-dev/chainloop#3802 ·
Mantenedores costumam responder em até 1 dia
-
bug trace-provider
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 48/100
chainloop-dev/chainloop#3803 ·
Mantenedores costumam responder em até 1 dia
-
feat(trace): support GitHub Copilot (CLI and VS Code) in Chainloop TraceTalvez já em andamento @migmartri assumiu hoje. AbertaFeature spec trace-provider
chainloop-dev/chainloop#3800 · 1 comentário · 1 responsável ·
Mantenedores costumam responder em até 1 dia
-
Allow enabling policy enforcement at the workflow contract levelTalvez já em andamento @migmartri assumiu há 10 dias. Abertacomponent/backend new-policy spec
chainloop-dev/chainloop#3762 · 1 comentário · 1 responsável ·
Mantenedores costumam responder em até 1 dia
-
chainloop component/CLI performance trace-provider
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 62/100
chainloop-dev/chainloop#3756 ·
Mantenedores costumam responder em até 1 dia
Todas as issues de chainloop-dev/chainloop
Issues semelhantes
-
GitHub webhook is not subscribed to release events, so `event: release` never triggersTalvez já em andamento @qsun assumiu hoje. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
woodpecker-ci/woodpecker#7542 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 74/100
zilliztech/milvus-backup#1386 ·
Mantenedores costumam responder em até 1 dia
-
Pipelined flush no longer observes kill signals after #2042: flush backoffer is built with nil varsAberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
Mantenedores costumam responder em até 1 dia
-
model:sonnet runtime:claude security size:S
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
FootprintAI/Containarium#3624 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 86/100
Mantenedores costumam responder em até 1 dia