Skip to content

Commit 0aa7c09

Browse files
committed
provenance: Retain platform information when overwriting internal params
Signed-off-by: Paulo Gomes <[email protected]>
1 parent 01c7908 commit 0aa7c09

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

buildtypes/buildkit-gha/v1/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ All internal parameters are REQUIRED.
1818

1919
| Parameter | Type | Description |
2020
| --------- | ---- | ----------- |
21+
| `platform` | string | The platform used to run BuildKit. This is equivalent to `environment.platform` from `buildkit@v1`. |
2122
| `trigger` | string | The GitHub Action event that caused the build to be executed. |
2223
| `invocationUri` | string | Resource URI for the GitHub action workflow instance. |
2324

internal/provenance/provenance.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,13 @@ func ConvertV02ToV1(v02Prov v02.ProvenancePredicate, override *v1.ProvenancePred
7070
override.BuildDefinition.ResolvedDependencies...)
7171
}
7272
if override.BuildDefinition.InternalParameters != nil {
73-
prov.BuildDefinition.InternalParameters = override.BuildDefinition.InternalParameters
73+
v := override.BuildDefinition.InternalParameters.(InternalParameters)
74+
env, ok := v02Prov.Invocation.Environment.(map[string]interface{})
75+
if ok && len(env) > 0 {
76+
v.Platform = env["platform"].(string)
77+
}
78+
79+
prov.BuildDefinition.InternalParameters = v
7480
}
7581
}
7682

0 commit comments

Comments
 (0)