Skip to content

Commit 162be1f

Browse files
leodidoona-agent
andcommitted
refactor: remove provenance from tar.gz packaging
Remove provenanceBundleFilename from tar packaging commands in buildYarn, buildDocker, and buildGeneric. Provenance is now written alongside artifacts as <artifact>.provenance.jsonl (outside tar.gz) to maintain artifact determinism. Co-authored-by: Ona <no-reply@ona.com>
1 parent c9c3898 commit 162be1f

File tree

1 file changed

+5
-14
lines changed

1 file changed

+5
-14
lines changed

pkg/leeway/build.go

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1445,9 +1445,8 @@ func (p *Package) buildYarn(buildctx *buildContext, wd, result string) (bld *pac
14451445
packageJSONFiles = fs
14461446
}
14471447
packageJSONFiles = append(packageJSONFiles, pkgYarnLock)
1448-
if p.C.W.Provenance.Enabled {
1449-
packageJSONFiles = append(packageJSONFiles, provenanceBundleFilename)
1450-
}
1448+
// Note: provenance bundle is written alongside the artifact as <artifact>.provenance.jsonl
1449+
// (outside tar.gz) to maintain artifact determinism
14511450
if p.C.W.SBOM.Enabled {
14521451
packageJSONFiles = append(packageJSONFiles, sbomBaseFilename+sbomCycloneDXFileExtension)
14531452
packageJSONFiles = append(packageJSONFiles, sbomBaseFilename+sbomSPDXFileExtension)
@@ -2136,9 +2135,7 @@ func (p *Package) buildDocker(buildctx *buildContext, wd, result string) (res *p
21362135

21372136
// Prepare for packaging
21382137
sourcePaths := []string{fmt.Sprintf("./%s", dockerImageNamesFiles), fmt.Sprintf("./%s", dockerMetadataFile)}
2139-
if p.C.W.Provenance.Enabled {
2140-
sourcePaths = append(sourcePaths, fmt.Sprintf("./%s", provenanceBundleFilename))
2141-
}
2138+
21422139
if p.C.W.SBOM.Enabled {
21432140
sourcePaths = append(sourcePaths, fmt.Sprintf("./%s", sbomBaseFilename+sbomCycloneDXFileExtension))
21442141
sourcePaths = append(sourcePaths, fmt.Sprintf("./%s", sbomBaseFilename+sbomSPDXFileExtension))
@@ -2196,9 +2193,7 @@ func (p *Package) buildDocker(buildctx *buildContext, wd, result string) (res *p
21962193
if len(cfg.Metadata) > 0 {
21972194
sourcePaths = append(sourcePaths, fmt.Sprintf("./%s", dockerMetadataFile))
21982195
}
2199-
if p.C.W.Provenance.Enabled {
2200-
sourcePaths = append(sourcePaths, fmt.Sprintf("./%s", provenanceBundleFilename))
2201-
}
2196+
22022197
if p.C.W.SBOM.Enabled {
22032198
sourcePaths = append(sourcePaths,
22042199
fmt.Sprintf("./%s", sbomBaseFilename+sbomCycloneDXFileExtension),
@@ -2495,13 +2490,9 @@ func (p *Package) buildGeneric(buildctx *buildContext, wd, result string) (res *
24952490

24962491
// Use buildTarCommand directly which will handle compression internally
24972492
var tarCmd []string
2498-
if p.C.W.Provenance.Enabled || p.C.W.SBOM.Enabled {
2493+
if p.C.W.SBOM.Enabled {
24992494
var sourcePaths []string
25002495

2501-
if p.C.W.Provenance.Enabled {
2502-
sourcePaths = append(sourcePaths, fmt.Sprintf("./%s", provenanceBundleFilename))
2503-
}
2504-
25052496
if p.C.W.SBOM.Enabled {
25062497
sourcePaths = append(sourcePaths, fmt.Sprintf("./%s", sbomBaseFilename+sbomCycloneDXFileExtension))
25072498
sourcePaths = append(sourcePaths, fmt.Sprintf("./%s", sbomBaseFilename+sbomSPDXFileExtension))

0 commit comments

Comments
 (0)