Skip to content

Commit

Permalink
Remove deprecated ADDITIONAL_OCI_ARTIFACT_TYPES
Browse files Browse the repository at this point in the history
closes: #1537
  • Loading branch information
git-hyagi committed Apr 15, 2024
1 parent 742acc5 commit 846807e
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 70 deletions.
1 change: 1 addition & 0 deletions CHANGES/1537.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Removed the deprecated `ADDITIONAL_OCI_ARTIFACT_TYPES` setting.
9 changes: 0 additions & 9 deletions pulp_container/app/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,3 @@ class PulpContainerPluginAppConfig(PulpPluginAppConfig):

def ready(self):
super().ready()
self.register_registry_types()

def register_registry_types(self):
# circular import avoidance
from pulp_container import constants
from django.conf import settings

for media_type, layer_types in settings.ADDITIONAL_OCI_ARTIFACT_TYPES.items():
constants.register_well_known_types(media_type, layer_types)
44 changes: 0 additions & 44 deletions pulp_container/app/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,50 +3,6 @@
"reusable_conditions": ["pulp_container.app.global_access_conditions"],
}

ADDITIONAL_OCI_ARTIFACT_TYPES = {
"application/vnd.oci.image.config.v1+json": [
# cosign signing and attestations
"application/vnd.dev.cosign.simplesigning.v1+json",
"application/vnd.dsse.envelope.v1+json",
# cosign SBOMS spdx and cyclonedx
"text/spdx",
"text/spdx+xml",
"text/spdx+json",
"application/vnd.cyclonedx",
"application/vnd.cyclonedx+xml",
"application/vnd.cyclonedx+json",
# syft SBOMS
"application/vnd.syft+json",
# cosign in-toto attestations
"application/vnd.in-toto+json",
],
# helm
"application/vnd.cncf.helm.config.v1+json": [
"application/tar+gzip",
"application/vnd.cncf.helm.chart.content.v1.tar+gzip",
"application/vnd.cncf.helm.chart.provenance.v1.prov",
],
# source containers
"application/vnd.oci.source.image.config.v1+json": [
"application/vnd.oci.image.layer.v1.tar+gzip",
],
# conftest policies
"application/vnd.cncf.openpolicyagent.config.v1+json": [
"application/vnd.cncf.openpolicyagent.policy.layer.v1+rego",
"application/vnd.cncf.openpolicyagent.data.layer.v1+json",
"application/vnd.cncf.openpolicyagent.manifest.layer.v1+json",
"application/vnd.cncf.openpolicyagent.rego.layer.v1+rego",
],
# singularity
"application/vnd.sylabs.sif.config.v1+json": [
"application/vnd.sylabs.sif.layer.v1.sif",
],
# wasm
"application/vnd.wasm.config.v1+json": [
"application/vnd.wasm.content.layer.v1+wasm",
],
}

FLATPAK_INDEX = False

# The number of allowed threads to sign manifests in parallel
Expand Down
8 changes: 4 additions & 4 deletions pulp_container/app/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

from pulpcore.plugin.models import Artifact, Task

from pulp_container.constants import ALLOWED_ARTIFACT_TYPES, MANIFEST_MEDIA_TYPES, MEDIA_TYPE
from pulp_container.constants import MANIFEST_MEDIA_TYPES, MEDIA_TYPE
from pulp_container.app.exceptions import ManifestInvalid
from pulp_container.app.json_schemas import (
OCI_INDEX_SCHEMA,
Expand Down Expand Up @@ -177,10 +177,10 @@ def determine_media_type_from_json(content_data):
else:
if config := content_data.get("config"):
config_media_type = config.get("mediaType")
if config_media_type in ALLOWED_ARTIFACT_TYPES:
return MEDIA_TYPE.MANIFEST_OCI
else:
if config_media_type == MEDIA_TYPE.CONFIG_BLOB:
return MEDIA_TYPE.MANIFEST_V2
else:
return MEDIA_TYPE.MANIFEST_OCI
else:
return MEDIA_TYPE.MANIFEST_V1

Expand Down
13 changes: 0 additions & 13 deletions pulp_container/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,3 @@
SIGNATURE_PAYLOAD_MAX_SIZE = 4 * MEGABYTE

SIGNATURE_API_EXTENSION_VERSION = 2


ALLOWED_ARTIFACT_TYPES = [MEDIA_TYPE.CONFIG_BLOB_OCI, MEDIA_TYPE.OCI_EMPTY_JSON]
ALLOWED_BLOB_CONTENT_TYPES = OCI_BLOB_MEDIA_TYPE


def register_well_known_types(artifact_config_type, artifact_layer_types):
if artifact_config_type not in ALLOWED_ARTIFACT_TYPES:
ALLOWED_ARTIFACT_TYPES.append(artifact_config_type)

for layer_type in artifact_layer_types:
if layer_type not in ALLOWED_BLOB_CONTENT_TYPES:
ALLOWED_BLOB_CONTENT_TYPES.append(layer_type)

0 comments on commit 846807e

Please sign in to comment.