Skip to content

Commit d9b5735

Browse files
committed
refactor: use runner context
1 parent ad28b37 commit d9b5735

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

.test/provenance/test.jq

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ include "jenkins";
2424
workflow_ref: "docker-library/meta/.github/workflows/build.yml@refs/heads/\($payload.ref)",
2525
workflow_sha: "0123456789abcdef0123456789abcdef01234567",
2626
} as $github
27+
| {
28+
environment: "github-hosted",
29+
} as $runner
2730

28-
| github_actions_provenance($github; $digest)
31+
| github_actions_provenance($github; $runner; $digest)
2932
]

provenance.jq

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
# input: "build" object with platform and image digest
22
# $github: "github" context; CONTAINS SENSITIVE INFORMATION (https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/accessing-contextual-information-about-workflow-runs#github-context)
3+
# $runner: "runner" context; https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/accessing-contextual-information-about-workflow-runs#runner-context
34
# $digest: the OCI image digest for the just-built image (normally in .build.resolved.annotations["org.opencontainers.image.ref.name"] but only post-push/regeneration and we haven't pushed yet)
45
#
56
# output: in-toto provenance statement (https://slsa.dev/spec/v1.0/provenance)
67
# see also: https://github.com/actions/buildtypes/tree/main/workflow/v1
7-
def github_actions_provenance($github; $digest):
8+
def github_actions_provenance($github; $runner; $digest):
89
if $github.event_name != "workflow_dispatch" then error("error: '\($github.event_name)' is not a supported event type for provenance generation") else
910
{
1011
_type: "https://in-toto.io/Statement/v1",
@@ -48,7 +49,7 @@ def github_actions_provenance($github; $digest):
4849
event_name: $github.event_name,
4950
repository_id: $github.repository_id,
5051
repository_owner_id: $github.repository_owner_id,
51-
runner_environment: "github-hosted",
52+
runner_environment: $runner.environment,
5253
},
5354
},
5455
resolvedDependencies: [

0 commit comments

Comments
 (0)