From d7c5b348da80178898347ead18fae5f71052d00a Mon Sep 17 00:00:00 2001 From: Dennis Kliban Date: Mon, 24 Feb 2025 15:47:06 -0500 Subject: [PATCH] Adds initial domain support. This adds domain support for the Pulp REST API. However, we still need to add domain support for the maven deploy API. closes: #244 --- .github/template_gitref | 2 +- .github/workflows/docs.yml | 4 ++-- .github/workflows/scripts/install.sh | 2 +- CHANGES/244.feature | 1 + pulp_maven/app/__init__.py | 1 + pulp_maven/app/models.py | 14 ++++++++++++-- template_config.yml | 3 ++- 7 files changed, 20 insertions(+), 7 deletions(-) create mode 100644 CHANGES/244.feature diff --git a/.github/template_gitref b/.github/template_gitref index 4630e6c..201b085 100644 --- a/.github/template_gitref +++ b/.github/template_gitref @@ -1 +1 @@ -2021.08.26-421-g204a709 +2021.08.26-426-g3a3f8a1 diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 118ffae..09d9d66 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -13,7 +13,7 @@ on: jobs: test: if: "endsWith(github.base_ref, 'main')" - runs-on: "ubuntu-20.04" + runs-on: "ubuntu-latest" defaults: run: working-directory: "pulp_maven" @@ -48,7 +48,7 @@ jobs: no-test: if: "!endsWith(github.base_ref, 'main')" - runs-on: "ubuntu-20.04" + runs-on: "ubuntu-latest" steps: - run: | echo "Skip docs testing on non-main branches." diff --git a/.github/workflows/scripts/install.sh b/.github/workflows/scripts/install.sh index eaf249a..f62fca2 100755 --- a/.github/workflows/scripts/install.sh +++ b/.github/workflows/scripts/install.sh @@ -93,7 +93,7 @@ if [ "$TEST" = "s3" ]; then sed -i -e '$a s3_test: true\ minio_access_key: "'$MINIO_ACCESS_KEY'"\ minio_secret_key: "'$MINIO_SECRET_KEY'"\ -pulp_scenario_settings: null\ +pulp_scenario_settings: {"domain_enabled": true}\ pulp_scenario_env: {}\ test_storages_compat_layer: true\ ' vars/main.yaml diff --git a/CHANGES/244.feature b/CHANGES/244.feature new file mode 100644 index 0000000..4c3061d --- /dev/null +++ b/CHANGES/244.feature @@ -0,0 +1 @@ +Adds domain support for the Pulp API. No support for maven deploy (yet). diff --git a/pulp_maven/app/__init__.py b/pulp_maven/app/__init__.py index 24b56cb..8367ee9 100644 --- a/pulp_maven/app/__init__.py +++ b/pulp_maven/app/__init__.py @@ -8,3 +8,4 @@ class PulpMavenPluginAppConfig(PulpPluginAppConfig): label = "maven" version = "0.9.0.dev" python_package_name = "pulp-maven" + domain_compatible = True diff --git a/pulp_maven/app/models.py b/pulp_maven/app/models.py index 52998fd..a8d3368 100644 --- a/pulp_maven/app/models.py +++ b/pulp_maven/app/models.py @@ -6,6 +6,7 @@ from django.db import models from pulpcore.plugin.models import Content, Remote, Repository, Distribution +from pulpcore.plugin.util import get_domain_pk logger = getLogger(__name__) @@ -46,6 +47,7 @@ class MavenArtifact(MavenContentMixin, Content): TYPE = "artifact" + _pulp_domain = models.ForeignKey("core.Domain", default=get_domain_pk, on_delete=models.PROTECT) group_id = models.CharField(max_length=255, null=False) artifact_id = models.CharField(max_length=255, null=False) version = models.CharField(max_length=255, null=False) @@ -53,7 +55,7 @@ class MavenArtifact(MavenContentMixin, Content): class Meta: default_related_name = "%(app_label)s_%(model_name)s" - unique_together = ("group_id", "artifact_id", "version", "filename") + unique_together = ("group_id", "artifact_id", "version", "filename", "_pulp_domain") @staticmethod def init_from_artifact_and_relative_path(artifact, relative_path): @@ -86,6 +88,7 @@ class MavenMetadata(MavenContentMixin, Content): TYPE = "metadata" + _pulp_domain = models.ForeignKey("core.Domain", default=get_domain_pk, on_delete=models.PROTECT) group_id = models.CharField(max_length=255, null=False) artifact_id = models.CharField(max_length=255, null=False) version = models.CharField(max_length=255, null=True) @@ -94,7 +97,14 @@ class MavenMetadata(MavenContentMixin, Content): class Meta: default_related_name = "%(app_label)s_%(model_name)s" - unique_together = ("group_id", "artifact_id", "version", "filename", "sha256") + unique_together = ( + "group_id", + "artifact_id", + "version", + "filename", + "sha256", + "_pulp_domain", + ) @staticmethod def init_from_artifact_and_relative_path(artifact, relative_path): diff --git a/template_config.yml b/template_config.yml index ecb27ca..67f382e 100644 --- a/template_config.yml +++ b/template_config.yml @@ -44,7 +44,8 @@ pulp_scheme: https pulp_settings: null pulp_settings_azure: null pulp_settings_gcp: null -pulp_settings_s3: null +pulp_settings_s3: + domain_enabled: true pydocstyle: true release_email: pulp-infra@redhat.com release_user: pulpbot