Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable the fetching of only the OCI descriptor #2220

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions docs/modules/ROOT/pages/ec_oci_descriptor.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
= ec.oci.descriptor

Fetch a raw Image from an OCI registry.

== Usage

object = ec.oci.descriptor(ref: string)

== Parameters

* `ref` (`string`): OCI descriptor reference

== Return

`object` (`object`): the OCI descriptor object

The object contains the following attributes:

* `mediaType` (`string`)
2 changes: 2 additions & 0 deletions docs/modules/ROOT/pages/rego_builtins.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ information.
|===
|xref:ec_oci_blob.adoc[ec.oci.blob]
|Fetch a blob from an OCI registry.
|xref:ec_oci_descriptor.adoc[ec.oci.descriptor]
|Fetch a raw Image from an OCI registry.
|xref:ec_oci_image_files.adoc[ec.oci.image_files]
|Fetch structured files (YAML or JSON) from within an image.
|xref:ec_oci_image_manifest.adoc[ec.oci.image_manifest]
Expand Down
1 change: 1 addition & 0 deletions docs/modules/ROOT/partials/rego_nav.adoc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
* xref:rego_builtins.adoc[Rego Reference]
** xref:ec_oci_blob.adoc[ec.oci.blob]
** xref:ec_oci_descriptor.adoc[ec.oci.descriptor]
** xref:ec_oci_image_files.adoc[ec.oci.image_files]
** xref:ec_oci_image_manifest.adoc[ec.oci.image_manifest]
** xref:ec_purl_is_valid.adoc[ec.purl.is_valid]
Expand Down
353 changes: 353 additions & 0 deletions internal/rego/oci/__snapshots__/oci_test.snap
Original file line number Diff line number Diff line change
Expand Up @@ -867,3 +867,356 @@
]
}
---

[TestOCIDescriptorManifest/complete_image_manifest - 1]
{
"type": "object",
"value": [
[
{
"type": "string",
"value": "annotations"
},
{
"type": "object",
"value": [
[
{
"type": "string",
"value": "config.annotation.1"
},
{
"type": "string",
"value": "config.annotation.value.1"
}
],
[
{
"type": "string",
"value": "config.annotation.2"
},
{
"type": "string",
"value": "config.annotation.value.2"
}
]
]
}
],
[
{
"type": "string",
"value": "artifactType"
},
{
"type": "string",
"value": "artifact-type"
}
],
[
{
"type": "string",
"value": "data"
},
{
"type": "string",
"value": "{\"data\": \"config\"}"
}
],
[
{
"type": "string",
"value": "digest"
},
{
"type": "string",
"value": "sha256:4e388ab32b10dc8dbc7e28144f552830adc74787c1e2c0824032078a79f227fb"
}
],
[
{
"type": "string",
"value": "mediaType"
},
{
"type": "string",
"value": "application/vnd.oci.image.manifest.v1+json"
}
],
[
{
"type": "string",
"value": "platform"
},
{
"type": "object",
"value": [
[
{
"type": "string",
"value": "architecture"
},
{
"type": "string",
"value": "arch"
}
],
[
{
"type": "string",
"value": "features"
},
{
"type": "array",
"value": [
{
"type": "string",
"value": "feature-1"
},
{
"type": "string",
"value": "feature-2"
}
]
}
],
[
{
"type": "string",
"value": "os"
},
{
"type": "string",
"value": "os"
}
],
[
{
"type": "string",
"value": "os.features"
},
{
"type": "array",
"value": [
{
"type": "string",
"value": "os-feature-1"
},
{
"type": "string",
"value": "os-feature-2"
}
]
}
],
[
{
"type": "string",
"value": "os.version"
},
{
"type": "string",
"value": "os-version"
}
],
[
{
"type": "string",
"value": "variant"
},
{
"type": "string",
"value": "variant"
}
]
]
}
],
[
{
"type": "string",
"value": "size"
},
{
"type": "number",
"value": 123
}
],
[
{
"type": "string",
"value": "urls"
},
{
"type": "array",
"value": [
{
"type": "string",
"value": "https://config-1.local/spam"
},
{
"type": "string",
"value": "https://config-2.local/spam"
}
]
}
]
]
}
---

[TestOCIDescriptorManifest/minimal_image_manifest - 1]
{
"type": "object",
"value": [
[
{
"type": "string",
"value": "annotations"
},
{
"type": "object",
"value": []
}
],
[
{
"type": "string",
"value": "artifactType"
},
{
"type": "string",
"value": ""
}
],
[
{
"type": "string",
"value": "data"
},
{
"type": "string",
"value": ""
}
],
[
{
"type": "string",
"value": "digest"
},
{
"type": "string",
"value": "sha256:4e388ab32b10dc8dbc7e28144f552830adc74787c1e2c0824032078a79f227fb"
}
],
[
{
"type": "string",
"value": "mediaType"
},
{
"type": "string",
"value": "application/vnd.oci.image.manifest.v1+json"
}
],
[
{
"type": "string",
"value": "size"
},
{
"type": "number",
"value": 123
}
],
[
{
"type": "string",
"value": "urls"
},
{
"type": "array",
"value": []
}
]
]
}
---

[TestOCIDescriptorManifest/minimal_image_index - 1]
{
"type": "object",
"value": [
[
{
"type": "string",
"value": "annotations"
},
{
"type": "object",
"value": []
}
],
[
{
"type": "string",
"value": "artifactType"
},
{
"type": "string",
"value": ""
}
],
[
{
"type": "string",
"value": "data"
},
{
"type": "string",
"value": ""
}
],
[
{
"type": "string",
"value": "digest"
},
{
"type": "string",
"value": "sha256:4e388ab32b10dc8dbc7e28144f552830adc74787c1e2c0824032078a79f227fb"
}
],
[
{
"type": "string",
"value": "mediaType"
},
{
"type": "string",
"value": "application/vnd.oci.image.index.v1+json"
}
],
[
{
"type": "string",
"value": "size"
},
{
"type": "number",
"value": 123
}
],
[
{
"type": "string",
"value": "urls"
},
{
"type": "array",
"value": []
}
]
]
}
---
Loading
Loading