diff --git a/.ci/scripts/check_release.py b/.ci/scripts/check_release.py index 611c882ca..6e0799952 100755 --- a/.ci/scripts/check_release.py +++ b/.ci/scripts/check_release.py @@ -99,9 +99,9 @@ def main(options: argparse.Namespace, template_config: dict[str, t.Any]) -> int: # Warning: This will not work if branch names contain "/" but we don't really care here. heads = [h.split("/")[-1] for h in repo.git.branch("--remote").split("\n")] - available_branches = [h for h in heads if re.fullmatch(RELEASE_BRANCH_REGEX, h)] - available_branches.sort(key=lambda ver: Version(ver)) - available_branches.append(DEFAULT_BRANCH) + available_branches = sorted( + {h for h in heads if re.fullmatch(RELEASE_BRANCH_REGEX, h)}, key=lambda ver: Version(ver) + ) + [DEFAULT_BRANCH] branches = options.branches if branches == "supported": diff --git a/.ci/scripts/check_requirements.py b/.ci/scripts/check_requirements.py index c0c883a9d..0a309798e 100755 --- a/.ci/scripts/check_requirements.py +++ b/.ci/scripts/check_requirements.py @@ -9,7 +9,6 @@ import warnings from packaging.requirements import Requirement - CHECK_MATRIX = [ ("pyproject.toml", True, True, True), ("requirements.txt", True, True, True), diff --git a/.ci/scripts/collect_changes.py b/.ci/scripts/collect_changes.py index f8a5446b5..f5c6b71a2 100755 --- a/.ci/scripts/collect_changes.py +++ b/.ci/scripts/collect_changes.py @@ -25,7 +25,6 @@ from git import GitCommandError, Repo from packaging.version import parse as parse_version - PYPI_PROJECT = "pulp_container" # Read Towncrier settings diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ebdea47c8..8077ff2dc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -46,7 +46,7 @@ jobs: pulpcore-manager openapi --file "api.json" pulpcore-manager openapi --bindings --component "container" --file "container-api.json" - name: "Upload Package whl" - uses: "actions/upload-artifact@v5" + uses: "actions/upload-artifact@v7" with: name: "plugin_package" path: "pulp_container/dist/" @@ -54,7 +54,7 @@ jobs: retention-days: 5 overwrite: true - name: "Upload API specs" - uses: "actions/upload-artifact@v5" + uses: "actions/upload-artifact@v7" with: name: "api_spec" path: | @@ -73,7 +73,7 @@ jobs: GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" GITHUB_CONTEXT: "${{ github.event.pull_request.commits_url }}" - name: "Upload python client packages" - uses: "actions/upload-artifact@v5" + uses: "actions/upload-artifact@v7" with: name: "python-client.tar" path: | @@ -82,7 +82,7 @@ jobs: retention-days: 5 overwrite: true - name: "Upload python client docs" - uses: "actions/upload-artifact@v5" + uses: "actions/upload-artifact@v7" with: name: "python-client-docs.tar" path: | @@ -100,7 +100,7 @@ jobs: GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" GITHUB_CONTEXT: "${{ github.event.pull_request.commits_url }}" - name: "Upload Ruby client" - uses: "actions/upload-artifact@v5" + uses: "actions/upload-artifact@v7" with: name: "ruby-client.tar" path: | diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 3133808d2..8c28873f2 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -30,7 +30,7 @@ jobs: id-token: "write" steps: - - uses: "actions/download-artifact@v4" + - uses: "actions/download-artifact@v8" with: name: "plugin_package" path: "dist/" @@ -53,7 +53,7 @@ jobs: path: "pulp_container" - name: "Download Python client" - uses: "actions/download-artifact@v4" + uses: "actions/download-artifact@v8" with: name: "python-client.tar" path: "pulp_container/" @@ -82,7 +82,7 @@ jobs: path: "pulp_container" - name: "Download Ruby client" - uses: "actions/download-artifact@v4" + uses: "actions/download-artifact@v8" with: name: "ruby-client.tar" path: "pulp_container/" diff --git a/.github/workflows/scripts/stage-changelog-for-default-branch.py b/.github/workflows/scripts/stage-changelog-for-default-branch.py index dd0a0247b..515ef60fc 100755 --- a/.github/workflows/scripts/stage-changelog-for-default-branch.py +++ b/.github/workflows/scripts/stage-changelog-for-default-branch.py @@ -12,16 +12,13 @@ from git import Repo from git.exc import GitCommandError - -helper = textwrap.dedent( - """\ +helper = textwrap.dedent("""\ Stage the changelog for a release on main branch. Example: $ python .github/workflows/scripts/stage-changelog-for-default-branch.py 3.4.0 - """ -) + """) parser = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter, description=helper) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index fb596b03b..662b3038f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -122,7 +122,7 @@ jobs: docker logs pulp 2>&1 | grep -i pulpcore.deprecation | tee deprecations-${{ matrix.env.TEST }}.txt - name: "Upload Deprecations" - uses: "actions/upload-artifact@v5" + uses: "actions/upload-artifact@v7" with: name: "deprecations-${{ matrix.env.TEST }}" path: "pulp_container/deprecations-${{ matrix.env.TEST }}.txt" diff --git a/lint_requirements.txt b/lint_requirements.txt index 959a5fc2d..06aee86c5 100644 --- a/lint_requirements.txt +++ b/lint_requirements.txt @@ -5,7 +5,7 @@ # # For more info visit https://github.com/pulp/plugin_template -black==24.3.0 +black~=26.3 # Pin style to the year. https://black.readthedocs.io/en/stable/faq.html#how-stable-is-black-s-style bump-my-version check-manifest flake8 diff --git a/pulp_container/app/models.py b/pulp_container/app/models.py index d4e440a63..fa80c2909 100644 --- a/pulp_container/app/models.py +++ b/pulp_container/app/models.py @@ -41,7 +41,6 @@ SIGNATURE_TYPE, ) - logger = getLogger(__name__) diff --git a/pulp_container/app/serializers.py b/pulp_container/app/serializers.py index 6ebca247b..f096c87f9 100644 --- a/pulp_container/app/serializers.py +++ b/pulp_container/app/serializers.py @@ -34,7 +34,6 @@ from pulp_container.constants import SIGNATURE_TYPE from pulp_container.app.utils import get_full_path - VALID_SIGNATURE_NAME_REGEX = r"^sha256:[0-9a-f]{64}@[0-9a-f]{32}$" VALID_TAG_REGEX = r"^[A-Za-z0-9][A-Za-z0-9._-]*$" VALID_BASE_PATH_REGEX_COMPILED = re.compile(r"^[a-z0-9]+(?:(?:[._]|__|[-]*)[a-z0-9])*$") @@ -299,25 +298,21 @@ class ContainerRemoteSerializer(RemoteSerializer): child=serializers.CharField(max_length=255), allow_null=True, required=False, - help_text=_( - """ + help_text=_(""" A list of tags to include during sync. Wildcards *, ? are recognized. 'include_tags' is evaluated before 'exclude_tags'. - """ - ), + """), ) exclude_tags = serializers.ListField( child=serializers.CharField(max_length=255), allow_null=True, required=False, - help_text=_( - """ + help_text=_(""" A list of tags to exclude during sync. Wildcards *, ? are recognized. 'exclude_tags' is evaluated after 'include_tags'. - """ - ), + """), ) policy = serializers.ChoiceField( @@ -357,25 +352,21 @@ class ContainerPullThroughRemoteSerializer(RemoteSerializer): child=serializers.CharField(max_length=255), allow_null=True, required=False, - help_text=_( - """ + help_text=_(""" A list of remotes to include during pull-through caching. Wildcards *, ? are recognized. 'includes' is evaluated before 'excludes'. - """ - ), + """), ) excludes = serializers.ListField( child=serializers.CharField(max_length=255), allow_null=True, required=False, - help_text=_( - """ + help_text=_(""" A list of remotes to exclude during pull-through caching. Wildcards *, ? are recognized. 'excludes' is evaluated after 'includes'. - """ - ), + """), ) class Meta: diff --git a/pulp_container/app/tasks/synchronize.py b/pulp_container/app/tasks/synchronize.py index c2b4a422b..bec51e984 100644 --- a/pulp_container/app/tasks/synchronize.py +++ b/pulp_container/app/tasks/synchronize.py @@ -13,7 +13,6 @@ from .sync_stages import ContainerFirstStage, ContainerContentSaver from pulp_container.app.models import ContainerRemote, ContainerRepository - log = logging.getLogger(__name__) diff --git a/pulp_container/app/viewsets.py b/pulp_container/app/viewsets.py index 9e9ff46f8..44e34968d 100644 --- a/pulp_container/app/viewsets.py +++ b/pulp_container/app/viewsets.py @@ -45,7 +45,6 @@ from pulp_container.app import models, serializers, tasks - log = logging.getLogger(__name__) diff --git a/pulp_container/constants.py b/pulp_container/constants.py index ecb48edab..df9381b83 100644 --- a/pulp_container/constants.py +++ b/pulp_container/constants.py @@ -1,6 +1,5 @@ from types import SimpleNamespace - MEDIA_TYPE = SimpleNamespace( MANIFEST_V1="application/vnd.docker.distribution.manifest.v1+json", MANIFEST_V1_SIGNED="application/vnd.docker.distribution.manifest.v1+prettyjws", diff --git a/pulp_container/tests/functional/api/test_build_images.py b/pulp_container/tests/functional/api/test_build_images.py index 6acd66132..23523c935 100644 --- a/pulp_container/tests/functional/api/test_build_images.py +++ b/pulp_container/tests/functional/api/test_build_images.py @@ -10,13 +10,11 @@ def containerfile_name(): """A fixture for a basic container file used for building images.""" with NamedTemporaryFile() as containerfile: - containerfile.write( - b"""FROM quay.io/quay/busybox:latest + containerfile.write(b"""FROM quay.io/quay/busybox:latest # Copy a file using COPY statement. Use the relative path specified in the 'artifacts' parameter. COPY foo/bar/example.txt /tmp/inside-image.txt # Print the content of the file when the container starts -CMD ["cat", "/tmp/inside-image.txt"]""" - ) +CMD ["cat", "/tmp/inside-image.txt"]""") containerfile.flush() yield containerfile.name @@ -215,11 +213,9 @@ def test_without_build_context( def containerfile_without_context_files(): with NamedTemporaryFile() as containerfile: - containerfile.write( - b"""FROM quay.io/quay/busybox:latest + containerfile.write(b"""FROM quay.io/quay/busybox:latest # Print the content of the file when the container starts -CMD ["ls", "/"]""" - ) +CMD ["ls", "/"]""") containerfile.flush() yield containerfile.name diff --git a/pulp_container/tests/functional/api/test_crud_remotes.py b/pulp_container/tests/functional/api/test_crud_remotes.py index 14bb3636e..1347df4ec 100644 --- a/pulp_container/tests/functional/api/test_crud_remotes.py +++ b/pulp_container/tests/functional/api/test_crud_remotes.py @@ -6,7 +6,6 @@ from pulp_container.tests.functional.conftest import gen_container_remote - ON_DEMAND_DOWNLOAD_POLICIES = ("on_demand", "streamed") diff --git a/pulp_container/tests/functional/api/test_flatpak.py b/pulp_container/tests/functional/api/test_flatpak.py index ba20bb8d0..a9c2e6fa0 100644 --- a/pulp_container/tests/functional/api/test_flatpak.py +++ b/pulp_container/tests/functional/api/test_flatpak.py @@ -5,7 +5,6 @@ from pulp_container.tests.functional.constants import REGISTRY_V2 - pytestmark = pytest.mark.skip(reason="TLS is broken currently. TODO: Fix")