Skip to content
Merged
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
3 changes: 2 additions & 1 deletion .ci/assets/ci_constraints.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Pulpcore versions without the openapi command do no longer work in the CI
pulpcore>=3.21.30,!=3.23.*,!=3.24.*,!=3.25.*,!=3.26.*,!=3.27.*,!=3.29.*,!=3.30.*,!=3.31.*,!=3.32.*,!=3.33.*,!=3.34.*,!=3.35.*,!=3.36.*,!=3.37.*,!=3.38.*,!=3.40.*,!=3.41.*,!=3.42.*,!=3.43.*,!=3.44.*,!=3.45.*,!=3.46.*,!=3.47.*,!=3.48.*,!=3.50.*,!=3.51.*,!=3.52.*,!=3.53.*,!=3.54.*
# Pulpcore versions without the django 5 storage compatibility will fail, >3.63,<3.70
pulpcore>=3.21.30,!=3.23.*,!=3.24.*,!=3.25.*,!=3.26.*,!=3.27.*,!=3.29.*,!=3.30.*,!=3.31.*,!=3.32.*,!=3.33.*,!=3.34.*,!=3.35.*,!=3.36.*,!=3.37.*,!=3.38.*,!=3.40.*,!=3.41.*,!=3.42.*,!=3.43.*,!=3.44.*,!=3.45.*,!=3.46.*,!=3.47.*,!=3.48.*,!=3.50.*,!=3.51.*,!=3.52.*,!=3.53.*,!=3.54.*,!=3.64.*,!=3.65.*,!=3.66.*,!=3.67.*,!=3.68.*,!=3.69.*


tablib!=3.6.0
Expand Down
11 changes: 10 additions & 1 deletion .ci/scripts/check_release.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
#!/usr/bin/env python
# /// script
# requires-python = ">=3.13"
# dependencies = [
# "gitpython>=3.1.46,<3.2.0",
# "packaging>=26.0,<26.1",
# "pyyaml>=6.0.3,<6.1.0",
# ]
# ///

import argparse
import re
import os
import tomllib
import yaml
from pathlib import Path

import yaml
from packaging.version import Version
from git import Repo

Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,13 @@ jobs:
run_docs: ${{ needs.check-changes.outputs.run_docs }}

lint:
needs:
- "check-changes"
if: needs.check-changes.outputs.run_tests == '1'
uses: "./.github/workflows/lint.yml"

build:
needs: "lint"
needs:
- "check-changes"
- "lint"
if: needs.check-changes.outputs.run_tests == '1'
uses: "./.github/workflows/build.yml"

test:
Expand Down
3 changes: 3 additions & 0 deletions CHANGES/+imp_exp_4_prep.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Teach modelresource.render it might get a `value` of None.

This prepares us to handle a django-import-export/4 codepath.
1 change: 1 addition & 0 deletions CHANGES/+import_export_domain_enable.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Allow pulp-import-export when domains are enabled.
29 changes: 21 additions & 8 deletions pulp_deb/app/modelresource.py
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

from pulpcore.plugin.importexport import BaseContentResource
from pulpcore.plugin.modelresources import RepositoryResource
from pulpcore.plugin.util import get_domain

from pulp_deb.app.models import (
AptRepository,
GenericContent,
Expand Down Expand Up @@ -53,6 +55,9 @@ def set_up_queryset(self):

return content

def dehydrate__pulp_domain(self, content):
return str(content._pulp_domain_id)


class InstallerFileIndexResource(DebContentResource):
"""
Expand Down Expand Up @@ -156,10 +161,12 @@ class ReleaseComponentForeignKeyWidget(ForeignKeyWidget):
str(<release_component.distribution>|<release_component.component>)
"""

def render(self, value, obj):
def render(self, value, obj=None, **kwargs):
"""Render formatted string to use as unique-identifier."""
rc_dist = obj.release_component.distribution
rc_comp = obj.release_component.component
if not value:
return ""
rc_dist = value.distribution
rc_comp = value.component
return f"{rc_dist}|{rc_comp}"

class PackageForeignKeyWidget(ForeignKeyWidget):
Expand All @@ -170,10 +177,12 @@ class PackageForeignKeyWidget(ForeignKeyWidget):
str(<package.relative_path>|<package.sha256>)
"""

def render(self, value, obj):
def render(self, value, obj=None, **kwargs):
"""Render formatted string to use as unique-identifier."""
pkg_relative_path = obj.package.relative_path
pkg_sha256 = obj.package.sha256
if not value:
return ""
pkg_relative_path = value.relative_path
pkg_sha256 = value.sha256
return f"{pkg_relative_path}|{pkg_sha256}"

release_component = fields.Field(
Expand All @@ -200,8 +209,12 @@ def before_import_row(self, row, **kwargs):

(rc_dist, rc_comp) = row["release_component"].split("|")
(pkg_relative_path, pkg_sha256) = row["package"].split("|")
rc = ReleaseComponent.objects.filter(distribution=rc_dist, component=rc_comp).first()
pkg = Package.objects.filter(relative_path=pkg_relative_path, sha256=pkg_sha256).first()
rc = ReleaseComponent.objects.filter(
distribution=rc_dist, component=rc_comp, pulp_domain=get_domain()
).first()
pkg = Package.objects.filter(
relative_path=pkg_relative_path, sha256=pkg_sha256, pulp_domain=get_domain()
).first()
row["release_component"] = str(rc.pulp_id)
row["package"] = str(pkg.pulp_id)

Expand Down
26 changes: 21 additions & 5 deletions pulp_deb/tests/functional/api/test_pulpexport_pulpimport.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,11 @@

from uuid import uuid4

from pulpcore.app import settings
from pulp_deb.tests.functional.constants import DEB_FIXTURE_SUMMARY
from pulp_deb.tests.functional.utils import get_counts_from_content_summary

NUM_REPOS = 2

if settings.DOMAIN_ENABLED:
pytest.skip("Domains do not support import.", allow_module_level=True)


@pytest.fixture
def deb_gen_import_export_repos(
Expand Down Expand Up @@ -200,9 +196,13 @@ def test_import(
deb_get_repository_by_href,
deb_importer_factory,
deb_perform_import,
has_pulp_plugin,
is_chunked,
pulp_settings,
):
"""Test a PulpImport."""
if pulp_settings.DOMAIN_ENABLED and not has_pulp_plugin("core", min="3.90.0"):
pytest.skip("Pulp Import/Export only supported under domains in core>=3.90")
import_repos, export_repos = deb_gen_import_export_repos()
importer = deb_importer_factory(import_repos, export_repos)
task_group = deb_perform_import(importer, import_repos, export_repos, is_chunked=is_chunked)
Expand All @@ -218,9 +218,13 @@ def test_double_import(
deb_get_repository_by_href,
deb_importer_factory,
deb_perform_import,
has_pulp_plugin,
pulpcore_bindings,
pulp_settings,
):
"""Test two PulpImports for a PulpExport."""
if pulp_settings.DOMAIN_ENABLED and not has_pulp_plugin("core", min="3.90.0"):
pytest.skip("Pulp Import/Export only supported under domains in core>=3.90")
import_repos, export_repos = deb_gen_import_export_repos()
importer = deb_importer_factory(import_repos, export_repos)
deb_perform_import(importer, import_repos, export_repos)
Expand All @@ -234,8 +238,16 @@ def test_double_import(
assert repo.latest_version_href.endswith("versions/1/")


def test_export(deb_create_exporter, deb_create_export, deb_gen_import_export_repos):
def test_export(
deb_create_exporter,
deb_create_export,
deb_gen_import_export_repos,
has_pulp_plugin,
pulp_settings,
):
"""Issue and evaluate a PulpExport."""
if pulp_settings.DOMAIN_ENABLED and not has_pulp_plugin("core", min="3.90.0"):
pytest.skip("Pulp Import/Export only supported under domains in core>=3.90")
import_repos, export_repos = deb_gen_import_export_repos()
exporter = deb_create_exporter(import_repos, export_repos)
export = deb_create_export(import_repos, export_repos, exporter)
Expand All @@ -256,11 +268,15 @@ def test_import_create_repos(
deb_importer_factory,
deb_init_and_sync,
deb_perform_import,
has_pulp_plugin,
pulpcore_bindings,
pulp_settings,
monitor_task,
delete_orphans_pre,
):
"""Test whether PulpImporter can create repositories."""
if pulp_settings.DOMAIN_ENABLED and not has_pulp_plugin("core", min="3.90.0"):
pytest.skip("Pulp Import/Export only supported under domains in core>=3.90")
entity_map = {}
repo, remote = deb_init_and_sync(remote_args={"policy": "immediate"})
entity_map["repo"] = repo
Expand Down
96 changes: 49 additions & 47 deletions template_config.yml
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,21 @@
# were not present before running plugin-template have been added with their default values.

# generated with plugin_template
#
# After editing this file please always reapply the plugin template before committing any changes.

api_root: /pulp/
---
api_root: "/pulp/"
black: true
check_commit_message: true
check_gettext: true
check_manifest: true
check_stray_pulpcore_imports: true
ci_base_image: ghcr.io/pulp/pulp-ci-centos9
ci_base_image: "ghcr.io/pulp/pulp-ci-centos9"
ci_env: {}
ci_trigger: '{pull_request: {branches: [''*'']}}'
cli_package: pulp-cli-deb
cli_repo: https://github.com/pulp/pulp-cli-deb.git
ci_trigger: "{pull_request: {branches: ['*']}}"
cli_package: "pulp-cli-deb"
cli_repo: "https://github.com/pulp/pulp-cli-deb.git"
core_import_allowed: []
deploy_client_to_pypi: true
deploy_client_to_rubygems: true
Expand All @@ -23,89 +26,88 @@ docker_fixtures: true
extra_files: []
flake8: true
flake8_ignore: []
github_org: pulp
latest_release_branch: '3.6'
github_org: "pulp"
latest_release_branch: "3.6"
lint_requirements: true
os_required_packages: []
parallel_test_workers: 8
plugin_app_label: deb
plugin_default_branch: main
plugin_name: pulp_deb
plugin_app_label: "deb"
plugin_default_branch: "main"
plugin_name: "pulp_deb"
plugins:
- app_label: deb
name: pulp_deb
post_job_template: null
pre_job_template: null
- app_label: "deb"
name: "pulp_deb"
pulp_env: {}
pulp_env_azure: {}
pulp_env_gcp: {}
pulp_env_s3: {}
pulp_scheme: https
pulp_scheme: "https"
pulp_settings:
allowed_content_checksums:
- md5
- sha1
- sha256
- sha512
- "md5"
- "sha1"
- "sha256"
- "sha512"
allowed_export_paths:
- /tmp
- "/tmp"
allowed_import_paths:
- /tmp
- "/tmp"
apt_by_hash: true
pulp_settings_azure:
MEDIA_ROOT: ''
MEDIA_ROOT: ""
STORAGES:
default:
BACKEND: storages.backends.azure_storage.AzureStorage
BACKEND: "storages.backends.azure_storage.AzureStorage"
OPTIONS:
account_key: Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==
account_name: devstoreaccount1
azure_container: pulp-test
connection_string: DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://ci-azurite:10000/devstoreaccount1;
account_key: "Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw=="
account_name: "devstoreaccount1"
azure_container: "pulp-test"
connection_string: "DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://ci-azurite:10000/devstoreaccount1;"
expiration_secs: 120
location: pulp3
location: "pulp3"
overwrite_files: true
staticfiles:
BACKEND: django.contrib.staticfiles.storage.StaticFilesStorage
BACKEND: "django.contrib.staticfiles.storage.StaticFilesStorage"
domain_enabled: true
pulp_settings_gcp: null
pulp_settings_s3:
MEDIA_ROOT: ''
MEDIA_ROOT: ""
STORAGES:
default:
BACKEND: storages.backends.s3boto3.S3Boto3Storage
BACKEND: "storages.backends.s3boto3.S3Boto3Storage"
OPTIONS:
access_key: AKIAIT2Z5TDYPX3ARJBA
addressing_style: path
bucket_name: pulp3
default_acl: '@none'
endpoint_url: http://minio:9000
region_name: eu-central-1
secret_key: fqRvjWaPU5o0fCqQuUWbj9Fainj2pVZtBCiDiieS
signature_version: s3v4
access_key: "AKIAIT2Z5TDYPX3ARJBA"
addressing_style: "path"
bucket_name: "pulp3"
default_acl: "@none"
endpoint_url: "http://minio:9000"
region_name: "eu-central-1"
secret_key: "fqRvjWaPU5o0fCqQuUWbj9Fainj2pVZtBCiDiieS"
signature_version: "s3v4"
staticfiles:
BACKEND: django.contrib.staticfiles.storage.StaticFilesStorage
BACKEND: "django.contrib.staticfiles.storage.StaticFilesStorage"
pydocstyle: true
release_email: pulp-infra@redhat.com
release_user: pulpbot
release_email: "pulp-infra@redhat.com"
release_user: "pulpbot"
stalebot: true
stalebot_days_until_close: 30
stalebot_days_until_stale: 90
stalebot_limit_to_pulls: true
supported_release_branches:
- '3.6'
- '3.5'
- "3.6"
- "3.5"
sync_ci: true
test_azure: true
test_cli: true
test_deprecations: true
test_gcp: false
test_lowerbounds: true
test_performance:
- sync
- publish
- pulp_to_pulp
- "sync"
- "publish"
- "pulp_to_pulp"
test_reroute: true
test_s3: true
use_issue_template: true
...