Add a Rego builtin called `attest.internals.parse_library_definition` for parsing the DOI definition files in https://github.com/docker-library/official-images/tree/master/library. This will allow us to verify DOI provenance fields against these files which are the source of truth for DOI images. This function just defers to https://github.com/docker-library/bashbrew/blob/master/manifest/rfc2822.go.
19 lines
529 B
Rego
19 lines
529 B
Rego
package def_parse_test
|
|
|
|
import rego.v1
|
|
|
|
test_parse_library_definition if {
|
|
def := `Maintainers: me <me@example.com> (@me)
|
|
GitRepo: blah
|
|
|
|
Tags: 1, 2, 3
|
|
GitCommit: fa105cb3c26c8f0e87d7dbb1bf5293691ac2f688
|
|
File: Dockerfile.foo`
|
|
result := attest.internals.parse_library_definition(def)
|
|
definition := result.value
|
|
definition.Entries[0].GitRepo == "blah"
|
|
definition.Entries[0].GitCommit == "fa105cb3c26c8f0e87d7dbb1bf5293691ac2f688"
|
|
definition.Entries[0].Tags == ["1", "2", "3"]
|
|
definition.Entries[0].File == "Dockerfile.foo"
|
|
}
|