From 4a0a7802dcfbc45db7440a2d9db70461bb7a5229 Mon Sep 17 00:00:00 2001 From: Ina Panova Date: Wed, 17 May 2023 11:55:18 +0200 Subject: [PATCH] Add pulpcore 3.25 compatibility closes #1277 --- .github/workflows/scripts/script.sh | 6 - CHANGES/1277.feature | 1 + .../0035_alter_blob_content_ptr_and_more.py | 152 ++++++++++++++++++ pulp_container/app/models.py | 4 +- pulp_container/tests/unit/test_serializers.py | 6 +- requirements.txt | 2 +- template_config.yml | 2 +- 7 files changed, 160 insertions(+), 13 deletions(-) create mode 100644 CHANGES/1277.feature create mode 100644 pulp_container/app/migrations/0035_alter_blob_content_ptr_and_more.py diff --git a/.github/workflows/scripts/script.sh b/.github/workflows/scripts/script.sh index c07d97348..939b0fcaa 100755 --- a/.github/workflows/scripts/script.sh +++ b/.github/workflows/scripts/script.sh @@ -123,17 +123,11 @@ else cmd_user_prefix bash -c "pytest -v -r sx --color=yes --pyargs pulp_container.tests.functional -m 'not parallel' --nightly" - cmd_user_prefix bash -c "pytest -v -r sx --color=yes --suppress-no-test-exit-code --pyargs pulpcore.tests.functional -m 'from_pulpcore_for_all_plugins and parallel' -n 8 --nightly" - cmd_user_prefix bash -c "pytest -v -r sx --color=yes --suppress-no-test-exit-code --pyargs pulpcore.tests.functional -m 'from_pulpcore_for_all_plugins and not parallel' --nightly" - else cmd_user_prefix bash -c "pytest -v -r sx --color=yes --suppress-no-test-exit-code --pyargs pulp_container.tests.functional -m parallel -n 8" cmd_user_prefix bash -c "pytest -v -r sx --color=yes --pyargs pulp_container.tests.functional -m 'not parallel'" - cmd_user_prefix bash -c "pytest -v -r sx --color=yes --suppress-no-test-exit-code --pyargs pulpcore.tests.functional -m 'from_pulpcore_for_all_plugins and parallel' -n 8" - cmd_user_prefix bash -c "pytest -v -r sx --color=yes --suppress-no-test-exit-code --pyargs pulpcore.tests.functional -m 'from_pulpcore_for_all_plugins and not parallel'" - fi fi diff --git a/CHANGES/1277.feature b/CHANGES/1277.feature new file mode 100644 index 000000000..ea3edd767 --- /dev/null +++ b/CHANGES/1277.feature @@ -0,0 +1 @@ +Updated compatibility for pulpcore 3.25 and Django 4.2. diff --git a/pulp_container/app/migrations/0035_alter_blob_content_ptr_and_more.py b/pulp_container/app/migrations/0035_alter_blob_content_ptr_and_more.py new file mode 100644 index 000000000..2d63445c5 --- /dev/null +++ b/pulp_container/app/migrations/0035_alter_blob_content_ptr_and_more.py @@ -0,0 +1,152 @@ +# Generated by Django 4.2.1 on 2023-05-17 09:51 + +from django.db import migrations, models +import django.db.models.deletion +import pulpcore.app.models.base + + +class Migration(migrations.Migration): + + dependencies = [ + ("core", "0106_alter_artifactdistribution_distribution_ptr_and_more"), + ("container", "0034_translate_signed_schema"), + ] + + operations = [ + migrations.AlterField( + model_name="blob", + name="content_ptr", + field=models.OneToOneField( + auto_created=True, + on_delete=django.db.models.deletion.CASCADE, + parent_link=True, + primary_key=True, + serialize=False, + to="core.content", + ), + ), + migrations.AlterField( + model_name="containerdistribution", + name="distribution_ptr", + field=models.OneToOneField( + auto_created=True, + on_delete=django.db.models.deletion.CASCADE, + parent_link=True, + primary_key=True, + serialize=False, + to="core.distribution", + ), + ), + migrations.AlterField( + model_name="containernamespace", + name="pulp_id", + field=models.UUIDField( + default=pulpcore.app.models.base.pulp_uuid, + editable=False, + primary_key=True, + serialize=False, + ), + ), + migrations.AlterField( + model_name="containerpushrepository", + name="manifest_signing_service", + field=models.ForeignKey( + null=True, + on_delete=django.db.models.deletion.SET_NULL, + to="container.manifestsigningservice", + ), + ), + migrations.AlterField( + model_name="containerpushrepository", + name="repository_ptr", + field=models.OneToOneField( + auto_created=True, + on_delete=django.db.models.deletion.CASCADE, + parent_link=True, + primary_key=True, + serialize=False, + to="core.repository", + ), + ), + migrations.AlterField( + model_name="containerremote", + name="remote_ptr", + field=models.OneToOneField( + auto_created=True, + on_delete=django.db.models.deletion.CASCADE, + parent_link=True, + primary_key=True, + serialize=False, + to="core.remote", + ), + ), + migrations.AlterField( + model_name="containerrepository", + name="manifest_signing_service", + field=models.ForeignKey( + null=True, + on_delete=django.db.models.deletion.SET_NULL, + to="container.manifestsigningservice", + ), + ), + migrations.AlterField( + model_name="containerrepository", + name="repository_ptr", + field=models.OneToOneField( + auto_created=True, + on_delete=django.db.models.deletion.CASCADE, + parent_link=True, + primary_key=True, + serialize=False, + to="core.repository", + ), + ), + migrations.AlterField( + model_name="manifest", + name="blobs", + field=models.ManyToManyField(through="container.BlobManifest", to="container.blob"), + ), + migrations.AlterField( + model_name="manifest", + name="content_ptr", + field=models.OneToOneField( + auto_created=True, + on_delete=django.db.models.deletion.CASCADE, + parent_link=True, + primary_key=True, + serialize=False, + to="core.content", + ), + ), + migrations.AlterField( + model_name="manifest", + name="listed_manifests", + field=models.ManyToManyField( + through="container.ManifestListManifest", to="container.manifest" + ), + ), + migrations.AlterField( + model_name="manifestsignature", + name="content_ptr", + field=models.OneToOneField( + auto_created=True, + on_delete=django.db.models.deletion.CASCADE, + parent_link=True, + primary_key=True, + serialize=False, + to="core.content", + ), + ), + migrations.AlterField( + model_name="tag", + name="content_ptr", + field=models.OneToOneField( + auto_created=True, + on_delete=django.db.models.deletion.CASCADE, + parent_link=True, + primary_key=True, + serialize=False, + to="core.content", + ), + ), + ] diff --git a/pulp_container/app/models.py b/pulp_container/app/models.py index 26fca20ab..39b8a47af 100644 --- a/pulp_container/app/models.py +++ b/pulp_container/app/models.py @@ -25,7 +25,7 @@ Upload as CoreUpload, ) from pulpcore.plugin.repo_version_utils import remove_duplicates, validate_repo_version -from pulpcore.plugin.util import verify_signature +from pulpcore.plugin.util import gpg_verify from . import downloaders @@ -458,7 +458,7 @@ def validate(self): manifest_file.name, env_vars={"REFERENCE": "test", "SIG_PATH": sig_path} ) - verify_signature(signed["signature_path"], self.public_key) + gpg_verify(self.public_key, signed["signature_path"]) class ContainerRepository( diff --git a/pulp_container/tests/unit/test_serializers.py b/pulp_container/tests/unit/test_serializers.py index 90288297d..7cdbbd493 100644 --- a/pulp_container/tests/unit/test_serializers.py +++ b/pulp_container/tests/unit/test_serializers.py @@ -2,7 +2,7 @@ from django.test import TestCase from django.conf import settings -from django_currentuser.middleware import _set_current_user +from pulpcore.plugin.util import set_current_user from pulp_container.app.serializers import ContainerDistributionSerializer, TagOperationSerializer from pulp_container.app.models import ContainerPushRepository, ContainerRepository @@ -28,13 +28,13 @@ def setUp(self): f"{V3_API_ROOT}repositories/container/container-push/{self.push_repository.pk}/" ) self.user = get_user_model().objects.create(username="user1", is_staff=False) - _set_current_user(self.user) + set_current_user(self.user) def tearDown(self): """Delete the user.""" super().tearDown() self.user.delete() - _set_current_user(None) + set_current_user(None) def test_valid_mirror_data(self): """Test that the ContainerDistributionSerializer accepts valid data.""" diff --git a/requirements.txt b/requirements.txt index e63a74f7a..a6299d942 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ ecdsa>=0.14,<=0.18.0 jsonschema>=4.4,<4.18 -pulpcore>=3.23.0,<3.25 +pulpcore>=3.25.0,<3.40 pyjwkest>=1.4,<=1.4.2 pyjwt[crypto]>=2.4,<2.8 diff --git a/template_config.yml b/template_config.yml index 76e42d0b3..00767f0e6 100644 --- a/template_config.yml +++ b/template_config.yml @@ -69,7 +69,7 @@ pypi_username: pulp python_version: '3.8' release_email: pulp-infra@redhat.com release_user: pulpbot -run_pulpcore_tests_for_plugins: true +run_pulpcore_tests_for_plugins: false single_commit_check: true stalebot: true stalebot_days_until_close: 30