Skip to content

Commit de7dfb0

Browse files
authored
feat(attestation): Make attestation view URL clickable in CI/CD reports (#2677)
Signed-off-by: Miguel Martinez <miguel@chainloop.dev>
1 parent 23ee90e commit de7dfb0

20 files changed

Lines changed: 75 additions & 28 deletions

app/cli/cmd/attestation_push.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// Copyright 2024-2025 The Chainloop Authors.
2+
// Copyright 2024-2026 The Chainloop Authors.
33
//
44
// Licensed under the Apache License, Version 2.0 (the "License");
55
// you may not use this file except in compliance with the License.
@@ -120,7 +120,7 @@ func newAttestationPushCmd() *cobra.Command {
120120
if !deactivateCIReport && !res.Status.DryRun && res.Status.RunnerContext != nil {
121121
// Clean up possible ANSI characters from the output
122122
sanitizedOutput := removeAnsiCharactersFromBytes(res.Status.TerminalOutput)
123-
if err := res.Status.RunnerContext.RawRunner.Report(sanitizedOutput); err != nil {
123+
if err := res.Status.RunnerContext.RawRunner.Report(sanitizedOutput, res.Status.AttestationViewURL); err != nil {
124124
logger.Warn().Err(err).Msg("failed to write CI/CD platform report")
125125
} else {
126126
// Log success message based on runner type

app/cli/pkg/action/action.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,12 +176,12 @@ func fetchUIDashboardURL(ctx context.Context, cpConnection *grpc.ClientConn) str
176176

177177
// buildAttestationViewURL constructs the attestation view URL
178178
// Returns empty string if platformURL is not configured
179-
func buildAttestationViewURL(uiDashboardURL, digest string) string {
179+
func buildAttestationViewURL(uiDashboardURL, orgName, digest string) string {
180180
if uiDashboardURL == "" || digest == "" {
181181
return ""
182182
}
183183

184184
// Trim trailing slash from platform URL if present
185185
uiDashboardURL = strings.TrimRight(uiDashboardURL, "/")
186-
return fmt.Sprintf("%s/attestation/%s?tab=summary", uiDashboardURL, digest)
186+
return fmt.Sprintf("%s/u/%s/workflow-runs/%s", uiDashboardURL, orgName, digest)
187187
}

app/cli/pkg/action/attestation_push.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ func (action *AttestationPush) Run(ctx context.Context, attestationID string, ru
227227
}
228228

229229
// Build attestation view URL
230-
attestationResult.Status.AttestationViewURL = buildAttestationViewURL(crafter.CraftingState.UiDashboardUrl, attestationResult.Digest)
230+
attestationResult.Status.AttestationViewURL = buildAttestationViewURL(crafter.CraftingState.UiDashboardUrl, workflow.GetOrganization(), attestationResult.Digest)
231231

232232
action.Logger.Info().Msg("push completed")
233233

app/cli/pkg/action/workflow_run_describe.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ func (action *WorkflowRunDescribe) Run(ctx context.Context, opts *WorkflowRunDes
232232
var attestationViewURL string
233233
baseUIDashboardURL := fetchUIDashboardURL(ctx, action.cfg.CPConnection)
234234
if baseUIDashboardURL != "" {
235-
attestationViewURL = buildAttestationViewURL(baseUIDashboardURL, att.DigestInCasBackend)
235+
attestationViewURL = buildAttestationViewURL(baseUIDashboardURL, resp.GetResult().GetOrgName(), att.DigestInCasBackend)
236236
}
237237

238238
item.Attestation = &WorkflowRunAttestationItem{

app/controlplane/api/controlplane/v1/workflow_run.pb.go

Lines changed: 12 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/controlplane/api/controlplane/v1/workflow_run.proto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ message WorkflowRunServiceViewResponse {
244244
Result result = 1;
245245

246246
message Result {
247+
string org_name = 5;
247248
WorkflowRunItem workflow_run = 1;
248249
AttestationItem attestation = 2;
249250
// It will be nil if the verification is not possible (old or non-keyless attestations)

app/controlplane/api/gen/frontend/controlplane/v1/workflow_run.ts

Lines changed: 15 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/controlplane/api/gen/jsonschema/controlplane.v1.WorkflowRunServiceViewResponse.Result.jsonschema.json

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/controlplane/api/gen/jsonschema/controlplane.v1.WorkflowRunServiceViewResponse.Result.schema.json

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/controlplane/internal/service/workflowrun.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ func (s *WorkflowRunService) View(ctx context.Context, req *pb.WorkflowRunServic
186186
wr.ContractVersion = bizWorkFlowContractVersionToPb(contractAndVersion.Version, contractAndVersion.Contract)
187187
wr.ContractVersion.ContractName = contractAndVersion.Contract.Name
188188
res := &pb.WorkflowRunServiceViewResponse_Result{
189+
OrgName: currentOrg.Name,
189190
WorkflowRun: wr,
190191
Attestation: attestation,
191192
Verification: verificationResult,

0 commit comments

Comments
 (0)