diff --git a/.ci/ansible/start_container.yaml b/.ci/ansible/start_container.yaml index b19a2054..47e5221e 100644 --- a/.ci/ansible/start_container.yaml +++ b/.ci/ansible/start_container.yaml @@ -83,22 +83,14 @@ command: "docker logs pulp" failed_when: true - - block: - - name: "Check version of component being tested" - assert: - that: - - (result.json.versions | items2dict(key_name="component", value_name="version"))[component_name] | canonical_semver == (component_version | canonical_semver) - fail_msg: | - Component {{ component_name }} was expected to be installed in version {{ component_version }}. - Instead it is reported as version {{ (result.json.versions | items2dict(key_name="component", value_name="version"))[component_name] }}. - rescue: - - name: "Check version of component being tested (legacy)" - assert: - that: - - (result.json.versions | items2dict(key_name="component", value_name="version"))[legacy_component_name] | canonical_semver == (component_version | canonical_semver) - fail_msg: | - Component {{ legacy_component_name }} was expected to be installed in version {{ component_version }}. - Instead it is reported as version {{ (result.json.versions | items2dict(key_name="component", value_name="version"))[legacy_component_name] }}. + - name: "Check version of component being tested" + assert: + that: + - (result.json.versions | items2dict(key_name="component", value_name="version"))[item.app_label] | canonical_semver == (component_version | canonical_semver) + fail_msg: | + Component {{ item.app_label }} was expected to be installed in version {{ component_version }}. + Instead it is reported as version {{ (result.json.versions | items2dict(key_name="component", value_name="version"))[item.app_label] }}. + loop: "{{ 'plugins' | ansible.builtin.extract(lookup('ansible.builtin.file', '../../template_config.yml') | from_yaml) }}" - name: "Set pulp password in .netrc" copy: diff --git a/.ci/scripts/check_release.py b/.ci/scripts/check_release.py index 2a2ad11b..fed91f42 100755 --- a/.ci/scripts/check_release.py +++ b/.ci/scripts/check_release.py @@ -65,7 +65,7 @@ def main(): if branch != DEFAULT_BRANCH: # Check if a Z release is needed changes = repo.git.ls_tree("-r", "--name-only", f"origin/{branch}", "CHANGES/") - z_release = False + z_changelog = False for change in changes.split("\n"): # Check each changelog file to make sure everything checks out _, ext = os.path.splitext(change) @@ -75,18 +75,48 @@ def main(): f"{branch} release branch!" ) elif ext in Z_CHANGELOG_EXTS: - z_release = True - if z_release: + z_changelog = True + + last_tag = repo.git.describe("--tags", "--abbrev=0", f"origin/{branch}") + req_txt_diff = repo.git.diff( + f"{last_tag}", f"origin/{branch}", "--name-only", "--", "requirements.txt" + ) + if z_changelog or req_txt_diff: # Blobless clone does not have file contents for Z branches, # check commit message for last Z bump git_branch = f"origin/{branch}" - next_version = repo.git.log( - "--oneline", "--grep=Bump to", "-n 1", git_branch, "--", ".bumpversion.cfg" - ).split("to")[-1] + next_version = None + bump_commit = repo.git.log( + "--oneline", + "--grep=Bump version", + "-n 1", + git_branch, + "--", + ".bumpversion.cfg", + ) + if bump_commit: + next_version = bump_commit.split("→ ")[-1] + # If not found - try old-commit-msg + if not next_version: + bump_commit = repo.git.log( + "--oneline", + "--grep=Bump to", + "-n 1", + git_branch, + "--", + ".bumpversion.cfg", + ) + next_version = bump_commit.split("to ")[-1] if bump_commit else None + + # You could, theoretically, be next_vers==None here - but that's always + # been true for this script. next_version = Version(next_version) + reason = "CHANGES" if z_changelog else "requirements.txt" print( f"A Z-release is needed for {branch}, " - f"New Version: {next_version.base_version}" + f"Prev: {last_tag}, " + f"Next: {next_version.base_version}, " + f"Reason: {reason}" ) releases.append(next_version) else: diff --git a/.ci/scripts/collect_changes.py b/.ci/scripts/collect_changes.py index 22f36aea..e7d24c81 100755 --- a/.ci/scripts/collect_changes.py +++ b/.ci/scripts/collect_changes.py @@ -11,7 +11,7 @@ import toml from git import GitCommandError, Repo -from pkg_resources import parse_version +from packaging.version import parse as parse_version # Read Towncrier settings tc_settings = toml.load("pyproject.toml")["tool"]["towncrier"] @@ -28,8 +28,12 @@ TITLE_FORMAT = tc_settings.get("title_format", "{name} {version} ({project_date})") +# Build a regex to find the header of a changelog section. +# It must have a single capture group to single out the version. +# see help(re.split) for more info. NAME_REGEX = r".*" -VERSION_REGEX = r"([0-9]+\.[0-9]+\.[0-9][0-9ab]*)" +VERSION_REGEX = r"[0-9]+\.[0-9]+\.[0-9][0-9ab]*" +VERSION_CAPTURE_REGEX = rf"({VERSION_REGEX})" DATE_REGEX = r"[0-9]{4}-[0-9]{2}-[0-9]{2}" TITLE_REGEX = ( "(" @@ -37,6 +41,7 @@ TITLE_FORMAT.format(name="NAME_REGEX", version="VERSION_REGEX", project_date="DATE_REGEX") ) .replace("NAME_REGEX", NAME_REGEX) + .replace("VERSION_REGEX", VERSION_CAPTURE_REGEX, 1) .replace("VERSION_REGEX", VERSION_REGEX) .replace("DATE_REGEX", DATE_REGEX) + ")" diff --git a/.github/template_gitref b/.github/template_gitref index e456a48e..9ec4e6fe 100644 --- a/.github/template_gitref +++ b/.github/template_gitref @@ -1 +1 @@ -2021.08.26-316-g69ef1f6 +2021.08.26-326-ge5addc7 diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index e77588c4..4c661ab8 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -31,7 +31,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Initialize CodeQL uses: github/codeql-action/init@v2 diff --git a/.github/workflows/create-branch.yml b/.github/workflows/create-branch.yml index 4c8b3463..45153c52 100644 --- a/.github/workflows/create-branch.yml +++ b/.github/workflows/create-branch.yml @@ -72,7 +72,7 @@ jobs: find CHANGES -type f -regex ".*\.\(bugfix\|doc\|feature\|misc\|deprecation\|removal\)" -exec git rm {} + - name: Checkout plugin template - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: pulp/plugin_template path: plugin_template @@ -85,7 +85,7 @@ jobs: git add -A - name: Make a PR with version bump and without CHANGES/* - uses: peter-evans/create-pull-request@v4 + uses: peter-evans/create-pull-request@v6 with: path: pulp_ostree token: ${{ secrets.RELEASE_TOKEN }} diff --git a/.github/workflows/kanban.yml b/.github/workflows/kanban.yml index 61fc1bf5..09554117 100644 --- a/.github/workflows/kanban.yml +++ b/.github/workflows/kanban.yml @@ -61,7 +61,7 @@ jobs: linked-issues: ${{ steps.linked-issues.outputs.issues }} steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Get Linked Issues Action uses: kin/gh-action-get-linked-issues@v1.0 id: linked-issues diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 008329bf..946bd25f 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -45,7 +45,7 @@ jobs: - name: "Install python dependencies" run: | echo ::group::PYDEPS - pip install gitpython toml + pip install gitpython packaging toml echo ::endgroup:: - name: "Configure Git with pulpbot name and email" @@ -57,7 +57,7 @@ jobs: run: python .ci/scripts/collect_changes.py - name: Create Pull Request - uses: peter-evans/create-pull-request@v4 + uses: peter-evans/create-pull-request@v6 with: token: ${{ secrets.RELEASE_TOKEN }} title: "Update Changelog" diff --git a/.github/workflows/scripts/install.sh b/.github/workflows/scripts/install.sh index 01c41c0c..234b4995 100755 --- a/.github/workflows/scripts/install.sh +++ b/.github/workflows/scripts/install.sh @@ -16,7 +16,7 @@ set -euv source .github/workflows/scripts/utils.sh PLUGIN_VERSION="$(sed -n -e 's/^\s*current_version\s*=\s*//p' .bumpversion.cfg | python -c 'from packaging.version import Version; print(Version(input()))')" -PLUGIN_NAME="./pulp_ostree/dist/pulp_ostree-${PLUGIN_VERSION}-py3-none-any.whl" +PLUGIN_SOURCE="./pulp_ostree/dist/pulp_ostree-${PLUGIN_VERSION}-py3-none-any.whl" export PULP_API_ROOT="/pulp/" @@ -35,7 +35,6 @@ then fi cd .ci/ansible/ -PLUGIN_SOURCE="${PLUGIN_NAME}" if [ "$TEST" = "s3" ]; then PLUGIN_SOURCE="${PLUGIN_SOURCE} pulpcore[s3]" fi @@ -127,7 +126,7 @@ if [ "${PULP_API_ROOT:-}" ]; then sed -i -e '$a api_root: "'"$PULP_API_ROOT"'"' vars/main.yaml fi -pulp config create --base-url https://pulp --api-root "$PULP_API_ROOT" +pulp config create --base-url https://pulp --api-root "$PULP_API_ROOT" --username "admin" --password "password" if [[ "$TEST" != "docs" ]]; then cp ~/.config/pulp/cli.toml "${REPO_ROOT}/../pulp-cli-ostree/tests/cli.toml" fi diff --git a/.github/workflows/scripts/script.sh b/.github/workflows/scripts/script.sh index 5a3e022b..8f55ed7c 100755 --- a/.github/workflows/scripts/script.sh +++ b/.github/workflows/scripts/script.sh @@ -31,6 +31,7 @@ if [[ "$TEST" = "docs" ]]; then if [[ "$GITHUB_WORKFLOW" == "Ostree CI" ]]; then towncrier build --yes --version 4.0.0.ci fi + # Legacy Docs Build cd docs make PULP_URL="$PULP_URL" diagrams html tar -cvf docs.tar ./_build @@ -130,7 +131,6 @@ cmd_user_prefix bash -c "django-admin makemigrations ostree --check --dry-run" # Run unit tests. cmd_user_prefix bash -c "PULP_DATABASES__default__USER=postgres pytest -v -r sx --color=yes --suppress-no-test-exit-code -p no:pulpcore --pyargs pulp_ostree.tests.unit" - # Run functional tests if [[ "$TEST" == "performance" ]]; then if [[ -z ${PERFORMANCE_TEST+x} ]]; then @@ -155,7 +155,7 @@ else fi pushd ../pulp-cli-ostree pip install -r test_requirements.txt -pytest -v -m pulp_ostree +pytest -v -m "pulp_ostree" popd if [ -f "$POST_SCRIPT" ]; then diff --git a/.github/workflows/update-labels.yml b/.github/workflows/update-labels.yml index d13c6cd4..94a6a8c9 100644 --- a/.github/workflows/update-labels.yml +++ b/.github/workflows/update-labels.yml @@ -31,7 +31,7 @@ jobs: echo ::group::PYDEPS pip install requests pyyaml echo ::endgroup:: - - uses: "actions/checkout@v3" + - uses: "actions/checkout@v4" - name: "Update labels" run: | python3 .github/workflows/scripts/update_backport_labels.py diff --git a/.github/workflows/update_ci.yml b/.github/workflows/update_ci.yml index 16bfeadb..8790acc4 100644 --- a/.github/workflows/update_ci.yml +++ b/.github/workflows/update_ci.yml @@ -55,7 +55,7 @@ jobs: ../plugin_template/scripts/update_ci.sh - name: "Create Pull Request for CI files" - uses: "peter-evans/create-pull-request@v4" + uses: "peter-evans/create-pull-request@v6" with: token: "${{ secrets.RELEASE_TOKEN }}" path: "pulp_ostree" @@ -82,7 +82,7 @@ jobs: ../plugin_template/scripts/update_ci.sh - name: "Create Pull Request for CI files" - uses: "peter-evans/create-pull-request@v4" + uses: "peter-evans/create-pull-request@v6" with: token: "${{ secrets.RELEASE_TOKEN }}" path: "pulp_ostree" diff --git a/doc_requirements.txt b/doc_requirements.txt index 6ce3439d..0db7490f 100644 --- a/doc_requirements.txt +++ b/doc_requirements.txt @@ -5,11 +5,14 @@ # # For more info visit https://github.com/pulp/plugin_template -r requirements.txt +towncrier + +# Legacy docs plantuml sphinx~=7.1.2 sphinx-rtd-theme==1.3.0 sphinxcontrib-jquery sphinxcontrib-openapi -towncrier mistune<4.0.0 Jinja2<3.2 +# Extra requirements diff --git a/docs/template_gitref b/docs/template_gitref index e456a48e..9ec4e6fe 100644 --- a/docs/template_gitref +++ b/docs/template_gitref @@ -1 +1 @@ -2021.08.26-316-g69ef1f6 +2021.08.26-326-ge5addc7 diff --git a/lint_requirements.txt b/lint_requirements.txt index 9d0baf8f..c579bcb0 100644 --- a/lint_requirements.txt +++ b/lint_requirements.txt @@ -6,7 +6,7 @@ # For more info visit https://github.com/pulp/plugin_template # python packages handy for developers, but not required by pulp -black==23.12.1 +black==24.3.0 check-manifest flake8 flake8-black diff --git a/template_config.yml b/template_config.yml index a897a6ad..4f4834be 100644 --- a/template_config.yml +++ b/template_config.yml @@ -1,7 +1,7 @@ # This config represents the latest values used when running the plugin-template. Any settings that # were not present before running plugin-template have been added with their default values. -# generated with plugin_template@2021.08.26-316-g69ef1f6 +# generated with plugin_template@2021.08.26-326-ge5addc7 api_root: /pulp/ black: true @@ -52,7 +52,6 @@ pulp_settings_azure: null pulp_settings_gcp: null pulp_settings_s3: domain_enabled: true -pulpprojectdotorg_key_id: null pydocstyle: true release_email: pulp-infra@redhat.com release_user: pulpbot @@ -72,4 +71,6 @@ test_performance: false test_reroute: true test_s3: true use_issue_template: true +use_legacy_docs: true +use_unified_docs: false