-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Add ec.oci.image_files rego function
- Loading branch information
Showing
16 changed files
with
398 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package files | ||
|
||
import rego.v1 | ||
|
||
|
||
# METADATA | ||
# custom: | ||
# short_name: match | ||
deny contains result if { | ||
files := ec.oci.image_files(input.image.ref, ["manifests"]) | ||
not matches(files) | ||
result := { | ||
"code": "files.match", | ||
"msg": json.marshal(files) | ||
} | ||
} | ||
|
||
matches(files) if { | ||
files["manifests/some.crd.yaml"].kind == "CustomResourceDefinition" | ||
files["manifests/some.crd.yaml"].spec.names.singular == "memcached" | ||
|
||
files["manifests/some.clusterserviceversion.yaml"].kind == "ClusterServiceVersion" | ||
files["manifests/some.clusterserviceversion.yaml"].spec.displayName == "Memcached Operator" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
= ec.oci.image_files | ||
|
||
Fetch structured files (YAML or JSON) from within an image. | ||
|
||
== Usage | ||
|
||
files = ec.oci.image_files(ref: string, paths: array<string>) | ||
|
||
== Parameters | ||
|
||
* `ref` (`string`): OCI image reference | ||
* `paths` (`array<string>`): the list of paths | ||
|
||
== Return | ||
|
||
`files` (`object`): object representing the extracted files | ||
|
||
The object contains dynamic attributes. | ||
The attributes are of `string` type and represent the full path of the file within the image. | ||
The values are of `any` type and hold the file contents. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.