From 00851978d6ba889d4766de0a5b9ebec5f386d2c8 Mon Sep 17 00:00:00 2001 From: Matthias Dellweg Date: Thu, 13 Aug 2026 10:47:28 +0200 Subject: [PATCH] Added kwargs to views for apiv4 --- .ci/ansible/Containerfile.j2 | 2 +- .ci/assets/ci_constraints.txt | 4 ++++ .github/workflows/build.yml | 11 +++++++++-- .github/workflows/ci.yml | 15 +++++++++++++-- .github/workflows/create-branch.yml | 7 ++++++- .github/workflows/docs.yml | 9 ++++++++- .github/workflows/lint.yml | 9 ++++++++- .github/workflows/nightly.yml | 9 ++++++++- .github/workflows/pr_checks.yml | 9 ++++++++- .github/workflows/publish.yml | 9 ++++++++- .github/workflows/release.yml | 9 ++++++++- .github/workflows/sanity.yml | 9 ++++++++- .github/workflows/scripts/before_install.sh | 2 +- .github/workflows/scripts/before_script.sh | 8 ++++---- .github/workflows/scripts/install.sh | 6 +++--- .github/workflows/scripts/script.sh | 4 ++-- .github/workflows/test.yml | 8 +++++--- .github/workflows/update-labels.yml | 9 ++++++++- .github/workflows/update_ci.yml | 9 ++++++++- CHANGES/+apiv4_compatibility.feature | 1 + pulp_gem/app/viewsets.py | 4 ++-- pyproject.toml | 1 + template_config.yml | 1 + 23 files changed, 125 insertions(+), 30 deletions(-) create mode 100644 CHANGES/+apiv4_compatibility.feature diff --git a/.ci/ansible/Containerfile.j2 b/.ci/ansible/Containerfile.j2 index 13b5ff05..69c62ba0 100644 --- a/.ci/ansible/Containerfile.j2 +++ b/.ci/ansible/Containerfile.j2 @@ -9,7 +9,7 @@ ADD ./{{ plugin_name }}/{{ plugin_name | replace("-", "_") }}/app/webserver_snip ADD ./{{ item.origin }} {{ item.destination }} {%- endfor %} -# This MUST be the ONLY call to pip install in inside the container. +# This MUST be the ONLY package install inside the container. RUN --mount=type=cache,target=/root/.cache/uv uv pip install --upgrade setuptools wheel && \ uv pip install {{ image.source }} {%- if image.upperbounds | default(false) -%} diff --git a/.ci/assets/ci_constraints.txt b/.ci/assets/ci_constraints.txt index c9198f19..3380502b 100644 --- a/.ci/assets/ci_constraints.txt +++ b/.ci/assets/ci_constraints.txt @@ -17,3 +17,7 @@ azure-storage-blob!=12.28.* pycares<5 # older aiodns versions don't pin pycares UB, and are broken by pycares>=5 + + +pytest-django!=4.13.0 +# This version seems not to not have a proper requirement on Django. diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 549697a8..cbc14887 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,6 +10,9 @@ name: "Build" on: workflow_call: +env: + UV_SYSTEM_PYTHON: "1" + defaults: run: working-directory: "pulp_gem" @@ -31,16 +34,20 @@ jobs: - uses: "actions/setup-python@v6" with: python-version: "3.11" + - name: "Install uv" + uses: "astral-sh/setup-uv@v7" + with: + enable-cache: true - name: "Install python dependencies" run: | - pip install build packaging twine wheel mkdocs jq + uv pip install build packaging twine wheel mkdocs jq - name: "Build package" run: | python3 -m build twine check dist/* - name: "Install built packages" run: | - pip install dist/pulp_gem-*-py3-none-any.whl -c .ci/assets/ci_constraints.txt + uv pip install dist/pulp_gem-*-py3-none-any.whl -c .ci/assets/ci_constraints.txt - name: "Generate api specs" run: | pulpcore-manager openapi --file "api.json" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f2b4f502..ddbf5613 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,6 +9,9 @@ name: "Gem CI" on: {pull_request: {branches: ['*']}} +env: + UV_SYSTEM_PYTHON: "1" + concurrency: group: ${{ github.ref_name }}-${{ github.workflow }} cancel-in-progress: true @@ -28,9 +31,13 @@ jobs: - uses: "actions/setup-python@v6" with: python-version: "3.11" + - name: "Install uv" + uses: "astral-sh/setup-uv@v7" + with: + enable-cache: true - name: "Install python dependencies" run: | - pip install requests pygithub pyyaml + uv pip install requests pygithub pyyaml - name: "Check commit message" if: github.event_name == 'pull_request' env: @@ -55,10 +62,14 @@ jobs: - uses: "actions/setup-python@v6" with: python-version: "3.12" + - name: "Install uv" + uses: "astral-sh/setup-uv@v7" + with: + enable-cache: true - name: "Install python dependencies" run: | - pip install gitpython + uv pip install gitpython - name: "Analyze changed files" id: "check" diff --git a/.github/workflows/create-branch.yml b/.github/workflows/create-branch.yml index c5207c77..2a641bbe 100644 --- a/.github/workflows/create-branch.yml +++ b/.github/workflows/create-branch.yml @@ -12,6 +12,7 @@ on: env: RELEASE_WORKFLOW: true + UV_SYSTEM_PYTHON: "1" jobs: create-branch: @@ -38,10 +39,14 @@ jobs: - uses: "actions/setup-python@v6" with: python-version: "3.11" + - name: "Install uv" + uses: "astral-sh/setup-uv@v7" + with: + enable-cache: true - name: "Install python dependencies" run: | - pip install bump-my-version packaging -r plugin_template/requirements.txt + uv pip install bump-my-version packaging -r plugin_template/requirements.txt - name: "Setting secrets" working-directory: "pulp_gem" diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 7b0d423e..a963ce1e 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -15,6 +15,9 @@ on: required: true type: "string" +env: + UV_SYSTEM_PYTHON: "1" + jobs: changelog: runs-on: "ubuntu-latest" @@ -29,9 +32,13 @@ jobs: - uses: "actions/setup-python@v6" with: python-version: "3.12" + - name: "Install uv" + uses: "astral-sh/setup-uv@v7" + with: + enable-cache: true - name: "Install python dependencies" run: | - pip install towncrier + uv pip install towncrier - name: "Build changelog" run: | towncrier build --yes --version 4.0.0.ci diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 4c74d9da..4075c445 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -10,6 +10,9 @@ name: "Lint" on: workflow_call: +env: + UV_SYSTEM_PYTHON: "1" + defaults: run: working-directory: "pulp_gem" @@ -27,10 +30,14 @@ jobs: - uses: "actions/setup-python@v6" with: python-version: "3.11" + - name: "Install uv" + uses: "astral-sh/setup-uv@v7" + with: + enable-cache: true - name: "Install python dependencies" run: | - pip install -r lint_requirements.txt + uv pip install -r lint_requirements.txt - name: "Lint workflow files" run: | diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index e7e50719..f19b020a 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -14,6 +14,9 @@ on: - cron: "00 3 * * *" workflow_dispatch: +env: + UV_SYSTEM_PYTHON: "1" + defaults: run: working-directory: "pulp_gem" @@ -44,10 +47,14 @@ jobs: - uses: "actions/setup-python@v6" with: python-version: "3.13" + - name: "Install uv" + uses: "astral-sh/setup-uv@v7" + with: + enable-cache: true - name: "Install python dependencies" run: | - pip install gitpython packaging toml + uv pip install gitpython packaging toml - name: "Configure Git with pulpbot name and email" run: | diff --git a/.github/workflows/pr_checks.yml b/.github/workflows/pr_checks.yml index 5dffce5c..ec4e16ab 100644 --- a/.github/workflows/pr_checks.yml +++ b/.github/workflows/pr_checks.yml @@ -17,6 +17,9 @@ on: - "main" - "[0-9]+.[0-9]+" +env: + UV_SYSTEM_PYTHON: "1" + # This workflow runs with elevated permissions. # Do not even think about running a single bit of code from the PR. # Static analysis should be fine however. @@ -38,9 +41,13 @@ jobs: - uses: "actions/setup-python@v6" with: python-version: "3.11" + - name: "Install uv" + uses: "astral-sh/setup-uv@v7" + with: + enable-cache: true - name: "Determine PR labels" run: | - pip install GitPython==3.1.42 + uv pip install GitPython==3.1.42 git fetch origin ${{ github.event.pull_request.head.sha }} python .ci/scripts/pr_labels.py "origin/${{ github.base_ref }}" "${{ github.event.pull_request.head.sha }}" >> "$GITHUB_ENV" - uses: "actions/github-script@v8" diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 0d158601..faab11e2 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -12,6 +12,9 @@ on: tags: - "[0-9]+.[0-9]+.[0-9]+" +env: + UV_SYSTEM_PYTHON: "1" + defaults: run: working-directory: "pulp_gem" @@ -125,10 +128,14 @@ jobs: - uses: "actions/setup-python@v6" with: python-version: "3.11" + - name: "Install uv" + uses: "astral-sh/setup-uv@v7" + with: + enable-cache: true - name: "Install towncrier" run: | - pip install towncrier + uv pip install towncrier - name: "Get release notes" id: "get_release_notes" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ead02a7a..2cbbe56e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,6 +10,9 @@ name: Gem Release Pipeline on: workflow_dispatch: +env: + UV_SYSTEM_PYTHON: "1" + defaults: run: working-directory: "pulp_gem" @@ -31,10 +34,14 @@ jobs: - uses: "actions/setup-python@v6" with: python-version: "3.11" + - name: "Install uv" + uses: "astral-sh/setup-uv@v7" + with: + enable-cache: true - name: "Install python dependencies" run: | - pip install bump-my-version towncrier + uv pip install bump-my-version towncrier - name: "Configure Git with pulpbot name and email" run: | diff --git a/.github/workflows/sanity.yml b/.github/workflows/sanity.yml index ef6d97b9..661276ab 100644 --- a/.github/workflows/sanity.yml +++ b/.github/workflows/sanity.yml @@ -13,6 +13,9 @@ name: "Sanity" on: workflow_call: +env: + UV_SYSTEM_PYTHON: "1" + defaults: run: working-directory: "pulp_gem" @@ -30,10 +33,14 @@ jobs: - uses: "actions/setup-python@v6" with: python-version: "3.11" + - name: "Install uv" + uses: "astral-sh/setup-uv@v7" + with: + enable-cache: true - name: "Install python dependencies" run: | - pip install -r lint_requirements.txt + uv pip install -r lint_requirements.txt - name: "Verify bump version config" run: | diff --git a/.github/workflows/scripts/before_install.sh b/.github/workflows/scripts/before_install.sh index 878db187..cf7c5fa7 100755 --- a/.github/workflows/scripts/before_install.sh +++ b/.github/workflows/scripts/before_install.sh @@ -88,7 +88,7 @@ if [ "$TEST" = "s3" ]; then s3_test: true minio_access_key: "${MINIO_ACCESS_KEY}" minio_secret_key: "${MINIO_SECRET_KEY}" -pulp_scenario_settings: {"MEDIA_ROOT": "", "STORAGES": {"default": {"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"}}, "staticfiles": {"BACKEND": "django.contrib.staticfiles.storage.StaticFilesStorage"}}, "allowed_content_checksums": ["md5", "sha224", "sha256", "sha384", "sha512"], "api_root": "/rerouted/djnd/", "domain_enabled": true} +pulp_scenario_settings: {"ENABLE_API_V4": true, "MEDIA_ROOT": "", "STORAGES": {"default": {"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"}}, "staticfiles": {"BACKEND": "django.contrib.staticfiles.storage.StaticFilesStorage"}}, "allowed_content_checksums": ["md5", "sha224", "sha256", "sha384", "sha512"], "api_root": "/rerouted/djnd/", "domain_enabled": true} pulp_scenario_env: {} VARSYAML fi diff --git a/.github/workflows/scripts/before_script.sh b/.github/workflows/scripts/before_script.sh index 5d538510..aa423805 100755 --- a/.github/workflows/scripts/before_script.sh +++ b/.github/workflows/scripts/before_script.sh @@ -39,12 +39,12 @@ echo "# Constraints Files:" tail -v -n +1 ../*/*constraints.txt || true echo -echo "# pip list outside the container" -pip list +echo "# package list outside the container" +uv pip list echo -echo "# pip list inside the container" -cmd_prefix bash -c "pip3 list" +echo "# package list inside the container" +cmd_prefix bash -c "uv pip list" echo echo "# State of the containers" diff --git a/.github/workflows/scripts/install.sh b/.github/workflows/scripts/install.sh index bc04508c..b926449f 100755 --- a/.github/workflows/scripts/install.sh +++ b/.github/workflows/scripts/install.sh @@ -17,8 +17,8 @@ source .github/workflows/scripts/utils.sh PIP_REQUIREMENTS=("pulp-cli-gem" "yq") -# This must be the **only** call to "pip install" on the test runner. -pip install ${PIP_REQUIREMENTS[*]} +# This must be the **only** package install on the test runner. +uv pip install ${PIP_REQUIREMENTS[*]} if [[ "$TEST" = "s3" ]]; then for i in {1..3} @@ -33,7 +33,7 @@ fi fi # Check out the pulp-cli-gem branch matching the installed version. -PULP_CLI_VERSION="$(pip freeze | sed -n -e 's/pulp-cli-gem==//p')" +PULP_CLI_VERSION="$(uv pip freeze | sed -n -e 's/pulp-cli-gem==//p')" git clone --depth 1 --branch "$PULP_CLI_VERSION" https://github.com/pulp/pulp-cli-gem.git ../pulp-cli-gem PULP_API_ROOT="$(yq -r '.pulp_scenario_settings.api_root // .pulp_settings.api_root // "/pulp/"' < .ci/ansible/vars/main.yaml)" diff --git a/.github/workflows/scripts/script.sh b/.github/workflows/scripts/script.sh index fbeed628..cd36a2ae 100755 --- a/.github/workflows/scripts/script.sh +++ b/.github/workflows/scripts/script.sh @@ -109,7 +109,7 @@ cmd_stdin_prefix bash -c "cat > /tmp/unittest_requirements.txt" < unittest_requi cmd_stdin_prefix bash -c "cat > /tmp/functest_requirements.txt" < functest_requirements.txt cmd_stdin_prefix bash -c "cat > /tmp/bindings_requirements.txt" < bindings_requirements.txt cmd_stdin_prefix bash -c "cat > /tmp/bindings_constraints.txt" < bindings_constraints.txt -cmd_prefix pip3 install -r /tmp/unittest_requirements.txt -r /tmp/functest_requirements.txt -r /tmp/bindings_requirements.txt -c /tmp/bindings_constraints.txt +cmd_prefix uv pip install -r /tmp/unittest_requirements.txt -r /tmp/functest_requirements.txt -r /tmp/bindings_requirements.txt -c /tmp/bindings_constraints.txt CERTIFI=$(cmd_prefix python3 -c 'import certifi; print(certifi.where())') cmd_prefix bash -c "cat /etc/pulp/certs/pulp_webserver.crt >> '$CERTIFI'" @@ -147,7 +147,7 @@ export PULP_API_ROOT="$(EDITOR=cat pulp config edit 2>/dev/null | awk -F'"' '/ap pushd ../pulp-cli-gem if [[ -f "test_requirements.txt" ]] then - pip install -r test_requirements.txt + uv pip install -r test_requirements.txt pytest -v tests -m "pulp_gem" else PULP_CA_BUNDLE="/usr/local/share/ca-certificates/pulp_webserver.crt" make livetest PYTEST_MARK="live and (pulp_gem)" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 70194f5e..f40e311c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,6 +14,9 @@ on: required: true type: "string" +env: + UV_SYSTEM_PYTHON: "1" + defaults: run: working-directory: "pulp_gem" @@ -41,7 +44,6 @@ jobs: - uses: "actions/setup-python@v6" with: python-version: "3.11" - - name: "Install uv" uses: "astral-sh/setup-uv@v7" with: @@ -75,7 +77,7 @@ jobs: - name: "Install python dependencies" run: | - pip install build towncrier twine wheel httpie docker netaddr boto3 'ansible~=10.3.0' mkdocs jq jsonpatch bump-my-version + uv pip install build towncrier twine wheel httpie docker netaddr boto3 'ansible~=10.3.0' mkdocs jq jsonpatch bump-my-version echo "HTTPIE_CONFIG_DIR=$GITHUB_WORKSPACE/pulp_gem/.ci/assets/httpie/" >> $GITHUB_ENV - name: "Set environment variables" @@ -145,5 +147,5 @@ jobs: docker logs pulp || true docker exec pulp ls -latr /etc/yum.repos.d/ || true docker exec pulp cat /etc/yum.repos.d/* || true - docker exec pulp bash -c "pip3 list" || true + docker exec pulp bash -c "uv pip list" || true ... diff --git a/.github/workflows/update-labels.yml b/.github/workflows/update-labels.yml index 9d20a50d..327f7424 100644 --- a/.github/workflows/update-labels.yml +++ b/.github/workflows/update-labels.yml @@ -15,6 +15,9 @@ on: paths: - "template_config.yml" +env: + UV_SYSTEM_PYTHON: "1" + jobs: update_backport_labels: runs-on: "ubuntu-latest" @@ -22,13 +25,17 @@ jobs: - uses: "actions/setup-python@v6" with: python-version: "3.11" + - name: "Install uv" + uses: "astral-sh/setup-uv@v7" + with: + enable-cache: true - name: "Configure Git with pulpbot name and email" run: | git config --global user.name 'pulpbot' git config --global user.email 'pulp-infra@redhat.com' - name: "Install python dependencies" run: | - pip install requests pyyaml + uv pip install requests pyyaml - uses: "actions/checkout@v6" - name: "Update labels" run: | diff --git a/.github/workflows/update_ci.yml b/.github/workflows/update_ci.yml index 4e66128f..8dc78564 100644 --- a/.github/workflows/update_ci.yml +++ b/.github/workflows/update_ci.yml @@ -15,6 +15,9 @@ on: - cron: "30 1 * * 0" workflow_dispatch: +env: + UV_SYSTEM_PYTHON: "1" + jobs: update: runs-on: "ubuntu-latest" @@ -32,10 +35,14 @@ jobs: - uses: "actions/setup-python@v6" with: python-version: "3.11" + - name: "Install uv" + uses: "astral-sh/setup-uv@v7" + with: + enable-cache: true - name: "Install python dependencies" run: | - pip install gitpython packaging -r plugin_template/requirements.txt + uv pip install gitpython packaging -r plugin_template/requirements.txt - name: "Configure Git with pulpbot name and email" run: | diff --git a/CHANGES/+apiv4_compatibility.feature b/CHANGES/+apiv4_compatibility.feature new file mode 100644 index 00000000..c2cbcbb6 --- /dev/null +++ b/CHANGES/+apiv4_compatibility.feature @@ -0,0 +1 @@ +Added api/v4 compatibility. diff --git a/pulp_gem/app/viewsets.py b/pulp_gem/app/viewsets.py index 19540191..20c6b187 100644 --- a/pulp_gem/app/viewsets.py +++ b/pulp_gem/app/viewsets.py @@ -219,7 +219,7 @@ class GemPublicationViewSet(PublicationViewSet, RolesMixin): description="Trigger an asynchronous task to publish gem content", responses={202: AsyncOperationResponseSerializer}, ) - def create(self, request): + def create(self, request, **kwargs): """ Publishes a repository. @@ -339,7 +339,7 @@ class GemRepositoryViewSet(RepositoryViewSet, ModifyRepositoryActionMixin, Roles responses={202: AsyncOperationResponseSerializer}, ) @action(detail=True, methods=["post"], serializer_class=RepositorySyncURLSerializer) - def sync(self, request, pk): + def sync(self, request, pk, **kwargs): """ Dispatches a sync task. """ diff --git a/pyproject.toml b/pyproject.toml index 32cd062b..f0ab23c0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -93,6 +93,7 @@ filename = "./pyproject.toml" search = "version = \"{current_version}\"" replace = "version = \"{new_version}\"" + [tool.towncrier] package = "pulp_gem" filename = "CHANGES.md" diff --git a/template_config.yml b/template_config.yml index ff0cd5d8..cd14b873 100644 --- a/template_config.yml +++ b/template_config.yml @@ -67,6 +67,7 @@ pulp_settings_gcp: BACKEND: "django.contrib.staticfiles.storage.StaticFilesStorage" domain_enabled: true pulp_settings_s3: + ENABLE_API_V4: true MEDIA_ROOT: "" STORAGES: default: