feat(pr-detection): Autodetect PR information#2617
Merged
Conversation
Signed-off-by: Javier Rodriguez <javier@chainloop.dev>
Signed-off-by: Javier Rodriguez <javier@chainloop.dev>
Signed-off-by: Javier Rodriguez <javier@chainloop.dev>
Signed-off-by: Javier Rodriguez <javier@chainloop.dev>
Member
|
Probably it's been already discussed:
|
jiparis
reviewed
Dec 15, 2025
| // Log warning but don't fail - will fall back to inline storage | ||
| action.Logger.Warn().Err(err).Msg("failed to get CAS credentials for PR metadata, will store inline") | ||
| } else { | ||
| b := creds.GetResult().GetBackend() |
Member
There was a problem hiding this comment.
don't we have this CAS logic already elsewhere?
Member
Author
There was a problem hiding this comment.
We have this logic on attestation push
Member
There was a problem hiding this comment.
I see it's also in attestation add, so maybe it can we moved to a common function and reuse it. Something like:
var casBackend = &casclient.CASBackend{Name: "not-set"}
if !action.dryRun && attestationID != "" {
casBackend, err = getCASBackend(ctx, attestationID)
...
}
Signed-off-by: Javier Rodriguez <javier@chainloop.dev>
Signed-off-by: Javier Rodriguez <javier@chainloop.dev>
Piskoo
reviewed
Dec 15, 2025
Signed-off-by: Javier Rodriguez <javier@chainloop.dev>
Signed-off-by: Javier Rodriguez <javier@chainloop.dev>
Signed-off-by: Javier Rodriguez <javier@chainloop.dev>
javirln
commented
Dec 15, 2025
|
|
||
| // getCASBackend tries to get CAS upload credentials and set up a CAS client | ||
| // If strict is true, errors are returned; if false, warnings are logged and nil error is returned | ||
| func getCASBackend(ctx context.Context, client pb.AttestationServiceClient, workflowRunID, casCAPath, casURI string, casConnectionInsecure bool, logger zerolog.Logger, casBackend *casclient.CASBackend) (func() error, error) { |
Signed-off-by: Javier Rodriguez <javier@chainloop.dev>
Signed-off-by: Javier Rodriguez <javier@chainloop.dev>
jiparis
reviewed
Dec 15, 2025
jiparis
approved these changes
Dec 15, 2025
Signed-off-by: Javier Rodriguez <javier@chainloop.dev>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implemented automatic detection and collection of Pull Request (GitHub) and Merge Request (GitLab) metadata during attestation initialization when running in CI/CD PR/MR contexts.
Key Features
Automatic PR/MR Detection
GITHUB_EVENT_NAMEandGITHUB_EVENT_PATHCI_PIPELINE_SOURCEand merge request environment variablesNew Material Type:
CHAINLOOP_PR_INFOCHAINLOOP_PR_INFOmaterial type to workflow contractsattestation initin PR/MR contextsSchema Generation & Validation
internal/prinfopackage with typed Go structsjsonschemaannotationshttps://schemas.chainloop.dev/prinfo/1.0/pr-info.schema.jsonImplementation Details
pkg/attestation/crafter/prmetadata.go: Detection logic for GitHub/GitLabpkg/attestation/crafter/materials/chainloop_pr_info.go: Material crafter with validationapp/cli/pkg/action/attestation_init.go: Auto-collection during init