Skip to content

Commit 7e41168

Browse files
leodidoona-agent
andcommitted
fix: upload SBOM files even when artifact already exists
When artifact and attestation already exist in cache, we were returning early without checking for SBOM files. This caused SBOM files to be missing when builds were re-run. Now we call uploadSBOMFiles in all code paths to ensure SBOM files are uploaded if they exist locally but are missing from the cache. Co-authored-by: Ona <no-reply@ona.com>
1 parent 5e90928 commit 7e41168

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

pkg/leeway/signing/upload.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,15 @@ func (u *ArtifactUploader) UploadArtifactWithAttestation(ctx context.Context, ar
108108
}
109109

110110
if attestationExists {
111-
// Both artifact and attestation exist, skip both uploads
111+
// Both artifact and attestation exist, but still check SBOM files
112112
log.WithFields(log.Fields{
113113
"artifact": artifactPath,
114114
"artifact_key": artifactKey,
115115
"att_key": attestationKey,
116-
}).Info("Skipping attestation upload (artifact and attestation already exist)")
116+
}).Info("Skipping artifact and attestation upload (already exist)")
117+
118+
// Still upload SBOM files if missing
119+
u.uploadSBOMFiles(ctx, artifactPath, artifactKey)
117120
return nil
118121
}
119122

@@ -133,6 +136,9 @@ func (u *ArtifactUploader) UploadArtifactWithAttestation(ctx context.Context, ar
133136
"artifact_key": artifactKey,
134137
"att_key": attestationKey,
135138
}).Info("Successfully uploaded attestation")
139+
140+
// Also upload SBOM files if missing
141+
u.uploadSBOMFiles(ctx, artifactPath, artifactKey)
136142
return nil
137143
}
138144

0 commit comments

Comments
 (0)