Skip to content

Commit

Permalink
Use .statement.predicate everywhere instead of just .predicate
Browse files Browse the repository at this point in the history
Signed-off-by: Mark Bestavros <mbestavr@redhat.com>
  • Loading branch information
mbestavros committed Oct 18, 2023
1 parent c676e75 commit d6f3546
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions policy/lib/tekton/task_test.rego
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ test_tasks_from_attestation if {
git_clone := {"name": "ignored", "ref": {"name": "git-clone"}}
buildah := {"name": "ignored", "ref": {"name": "buildah"}}

attestation := {"predicate": {"buildConfig": {"tasks": [git_clone, buildah]}}}
attestation := {"statement": {"predicate": {"buildConfig": {"tasks": [git_clone, buildah]}}}}
expected := {git_clone, buildah}
lib.assert_equal(expected, tkn.tasks(attestation))
}
Expand All @@ -42,13 +42,13 @@ test_tasks_from_slsav1_tekton_attestation if {
"content": content,
}

attestation := {
attestation := {"statement": {
"predicateType": "https://slsa.dev/provenance/v1",
"predicate": {"buildDefinition": {
"buildType": "https://tekton.dev/chains/v2/slsa-tekton",
"externalParameters": {"runSpec": {"pipelineSpec": {}}},
"resolvedDependencies": [task],
}},
}}},
}
expected := {{
"params": [
Expand Down Expand Up @@ -120,14 +120,14 @@ test_tasks_from_slsav1_tekton_mixture_attestation if {
"content": task3,
}

attestation := {"predicate": {"buildDefinition": {
attestation := {"statement": {"predicate": {"buildDefinition": {
"buildType": "https://tekton.dev/chains/v2/slsa-tekton",
"resolvedDependencies": [
git_init,
git_init_pipeline,
git_init_bad,
],
}}}
}}}}
expected := {
{
"params": [
Expand Down Expand Up @@ -181,10 +181,10 @@ test_tasks_from_slsav1_attestation if {
"uri": "oci://gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/git-init",
"digest": {"sha256": "28ff94e63e4058afc3f15b4c11c08cf3b54fa91faa646a4bbac90380cd7158df"},
}
attestation := {"predicate": {"buildDefinition": {
attestation := {"statement": {"predicate": {"buildDefinition": {
"buildType": "https://tekton.dev/chains/v2/slsa-tekton",
"resolvedDependencies": [git_init],
}}}
}}}}
lib.assert_equal(set(), tkn.tasks(attestation))
}

Expand Down Expand Up @@ -253,7 +253,7 @@ test_tasks_from_attestation_with_spam if {
{"ref": {"name": "summary", "kind": "Task", "bundle": _bundle}},
}

attestation := {"predicate": {"buildConfig": {"tasks": expected_tasks}}}
attestation := {"statement": {"predicate": {"buildConfig": {"tasks": expected_tasks}}}}

lib.assert_equal(expected_tasks, tkn.tasks(attestation))

Expand Down Expand Up @@ -449,10 +449,10 @@ _good_git_clone_task := {
"ref": {"kind": "Task", "name": "git-clone", "bundle": _bundle},
}

_good_attestation := {"predicate": {
_good_attestation := {"statement": {"predicate": {
"buildType": lib.tekton_pipeline_run,
"buildConfig": {"tasks": [_good_build_task, _good_git_clone_task]},
}}
}}}

slsav1_attestation_local_spec := {
"params": [
Expand Down

0 comments on commit d6f3546

Please sign in to comment.