From 3ff57ee3a1857a223b25fc3e22a4e9540d368994 Mon Sep 17 00:00:00 2001 From: James Tanner Date: Mon, 10 Jun 2024 18:02:20 -0400 Subject: [PATCH 1/7] Update template files and disable pulp ci. No-Issue Signed-off-by: James Tanner --- .ci/ansible/start_container.yaml | 24 +-- .ci/scripts/check_release.py | 28 +-- .ci/scripts/collect_changes.py | 17 +- .ci/scripts/tweet.py | 16 -- .github/template_gitref | 2 +- .github/workflows/build.yml | 5 +- .github/workflows/changelog.yml | 2 +- .github/workflows/ci.yml | 2 +- .github/workflows/codeql-analysis.yml | 2 +- .github/workflows/create-branch.yml | 6 +- .github/workflows/lint.yml | 2 +- .github/workflows/nightly.yml | 10 +- .github/workflows/publish.yml | 17 +- .github/workflows/release.yml | 2 +- .github/workflows/scripts/before_script.sh | 6 - .../scripts/create_release_from_tag.sh | 11 -- .github/workflows/scripts/install.sh | 5 +- .../workflows/scripts/publish_client_pypi.sh | 10 +- .github/workflows/scripts/release.py | 177 ------------------ .github/workflows/scripts/script.sh | 2 +- .github/workflows/test.yml | 10 +- .github/workflows/update-labels.yml | 4 +- .github/workflows/update_ci.yml | 4 +- CHANGES/.TEMPLATE.rst | 47 ----- MANIFEST.in | 2 +- flake8.cfg | 42 ----- pyproject.toml | 10 +- template_config.yml | 7 +- 28 files changed, 93 insertions(+), 379 deletions(-) delete mode 100755 .ci/scripts/tweet.py delete mode 100755 .github/workflows/scripts/create_release_from_tag.sh delete mode 100755 .github/workflows/scripts/release.py delete mode 100644 CHANGES/.TEMPLATE.rst delete mode 100644 flake8.cfg diff --git a/.ci/ansible/start_container.yaml b/.ci/ansible/start_container.yaml index b19a2054fd..47e5221e58 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 c2a78dbbf0..9d0ed5f51a 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,24 @@ def main(): f"{branch} release branch!" ) elif ext in Z_CHANGELOG_EXTS: - z_release = True - if z_release: - # 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 = Version(next_version) + 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: + curr_version = Version(last_tag) + assert curr_version.base_version.startswith( + branch + ), "Current-version has to belong to the current branch!" + next_version = Version(f"{branch}.{curr_version.micro + 1}") + 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 3508fa54b4..18422fe63c 100755 --- a/.ci/scripts/collect_changes.py +++ b/.ci/scripts/collect_changes.py @@ -1,3 +1,4 @@ +#!/bin/env python3 # WARNING: DO NOT EDIT! # # This file was generated by plugin_template, and is managed by it. Please use @@ -8,13 +9,14 @@ import itertools import os import re +import tomllib -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"] +with open("pyproject.toml", "rb") as fp: + tc_settings = tomllib.load(fp)["tool"]["towncrier"] CHANGELOG_FILE = tc_settings.get("filename", "NEWS.rst") START_STRING = tc_settings.get( @@ -28,8 +30,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 +43,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) + ")" @@ -74,7 +81,7 @@ def main(): old_length = len(main_changes) for branch in branches: - print(f"Looking at branch {branch}") + print(f"Looking for './{CHANGELOG_FILE}' at branch {branch}") try: changelog = get_changelog(repo, branch) except GitCommandError: diff --git a/.ci/scripts/tweet.py b/.ci/scripts/tweet.py deleted file mode 100755 index bc232f6700..0000000000 --- a/.ci/scripts/tweet.py +++ /dev/null @@ -1,16 +0,0 @@ -import os -import sys -from tweepy import Client - -release_version = sys.argv[1] -if release_version.endswith(".0"): - client = Client( - consumer_key=os.getenv("TWITTER_API_KEY"), - consumer_secret=os.getenv("TWITTER_API_KEY_SECRET"), - access_token=os.getenv("TWITTER_ACCESS_TOKEN"), - access_token_secret=os.getenv("TWITTER_ACCESS_TOKEN_SECRET"), - ) - link = "https://docs.pulpproject.org/galaxy_ng/changes.html" - msg = f"galaxy_ng-{release_version} - Check out for more details: {link}" - release_msg = f"Hey! We've just released {msg}" - client.create_tweet(text=release_msg) diff --git a/.github/template_gitref b/.github/template_gitref index e456a48e1d..dadaa1c99c 100644 --- a/.github/template_gitref +++ b/.github/template_gitref @@ -1 +1 @@ -2021.08.26-316-g69ef1f6 +2021.08.26-338-g2237db8 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3a6f576419..0c14efb384 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -23,7 +23,7 @@ jobs: with: fetch-depth: 1 path: "galaxy_ng" - - uses: "actions/setup-python@v4" + - uses: "actions/setup-python@v5" with: python-version: "3.11" - name: "Install python dependencies" @@ -36,9 +36,10 @@ jobs: python3 setup.py sdist bdist_wheel --python-tag py3 twine check dist/* - name: "Upload Package whl" - uses: "actions/upload-artifact@v3" + uses: "actions/upload-artifact@v4" with: name: "plugin_package" path: "galaxy_ng/dist/" if-no-files-found: "error" retention-days: 5 + overwrite: true diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml index d64787ecea..82e641c1fe 100644 --- a/.github/workflows/changelog.yml +++ b/.github/workflows/changelog.yml @@ -28,7 +28,7 @@ jobs: with: fetch-depth: 1 - - uses: "actions/setup-python@v4" + - uses: "actions/setup-python@v5" with: python-version: "3.11" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 86a5894322..5fee7d06a8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,7 +7,7 @@ --- name: "Galaxy CI" -on: {pull_request: {branches: ['**']}, push: {branches: ['**']}} +on: workflow_dispatch concurrency: group: ${{ github.ref_name }}-${{ github.workflow }} diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 62187cb1e7..03b752012e 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 07a8045c7c..d36c10c662 100644 --- a/.github/workflows/create-branch.yml +++ b/.github/workflows/create-branch.yml @@ -26,7 +26,7 @@ jobs: fetch-depth: 0 path: "galaxy_ng" - - uses: "actions/setup-python@v4" + - uses: "actions/setup-python@v5" with: python-version: "3.11" @@ -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: galaxy_ng token: ${{ secrets.RELEASE_TOKEN }} diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index eabc5e1a41..e4ce5f42ce 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -24,7 +24,7 @@ jobs: fetch-depth: 1 path: "galaxy_ng" - - uses: "actions/setup-python@v4" + - uses: "actions/setup-python@v5" with: python-version: "3.11" diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index ea10379c49..e2402d4633 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -38,14 +38,14 @@ jobs: fetch-depth: 0 path: "galaxy_ng" - - uses: "actions/setup-python@v4" + - uses: "actions/setup-python@v5" with: python-version: "3.11" - name: "Install python dependencies" run: | echo ::group::PYDEPS - pip install gitpython toml + pip install gitpython packaging toml echo ::endgroup:: - name: "Configure Git with ansible 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" @@ -76,12 +76,12 @@ jobs: fetch-depth: 1 path: "galaxy_ng" - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: "plugin_package" path: "galaxy_ng/dist/" - - uses: "actions/setup-python@v4" + - uses: "actions/setup-python@v5" with: python-version: "3.11" diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 76c0260395..1f819e5ca3 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -39,11 +39,11 @@ jobs: repository: "pulp/pulp-openapi-generator" path: "pulp-openapi-generator" - - uses: "actions/setup-python@v4" + - uses: "actions/setup-python@v5" with: python-version: "3.11" - - uses: "actions/download-artifact@v3" + - uses: "actions/download-artifact@v4" with: name: "plugin_package" path: "galaxy_ng/dist/" @@ -83,19 +83,24 @@ jobs: run: | .github/workflows/scripts/install_python_client.sh shell: "bash" + - name: "Upload python client packages" - uses: "actions/upload-artifact@v3" + uses: "actions/upload-artifact@v4" with: name: "python-client.tar" - path: "galaxy_ng/galaxy-python-client.tar" + path: | + galaxy_ng/galaxy-python-client.tar if-no-files-found: "error" + overwrite: true - name: "Upload python client docs" - uses: "actions/upload-artifact@v3" + uses: "actions/upload-artifact@v4" with: name: "python-client-docs.tar" - path: "galaxy_ng/galaxy-python-client-docs.tar" + path: | + galaxy_ng/galaxy-python-client-docs.tar if-no-files-found: "error" + overwrite: true - name: "Logs" if: always() diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 841b32be42..a7ce5d0563 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -28,7 +28,7 @@ jobs: path: "galaxy_ng" token: ${{ secrets.RELEASE_TOKEN }} - - uses: "actions/setup-python@v4" + - uses: "actions/setup-python@v5" with: python-version: "3.11" diff --git a/.github/workflows/scripts/before_script.sh b/.github/workflows/scripts/before_script.sh index 715bde1836..5ddafb7193 100755 --- a/.github/workflows/scripts/before_script.sh +++ b/.github/workflows/scripts/before_script.sh @@ -36,12 +36,6 @@ tail -v -n +1 .ci/ansible/Containerfile cmd_prefix bash -c "echo '%wheel ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/nopasswd" cmd_prefix bash -c "usermod -a -G wheel pulp" -SCENARIOS=("pulp" "performance" "azure" "gcp" "s3" "generate-bindings" "lowerbounds") -if [[ " ${SCENARIOS[*]} " =~ " ${TEST} " ]]; then - # Many functional tests require these - cmd_prefix dnf install -yq lsof which -fi - if [[ "${REDIS_DISABLED:-false}" == true ]]; then cmd_prefix bash -c "s6-rc -d change redis" echo "The Redis service was disabled for $TEST" diff --git a/.github/workflows/scripts/create_release_from_tag.sh b/.github/workflows/scripts/create_release_from_tag.sh deleted file mode 100755 index 328454e0df..0000000000 --- a/.github/workflows/scripts/create_release_from_tag.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh -set -e - -curl -s -X POST https://api.github.com/repos/$GITHUB_REPOSITORY/releases \ --H "Authorization: token $RELEASE_TOKEN" \ --d @- << EOF -{ - "tag_name": "$1", - "name": "$1" -} -EOF diff --git a/.github/workflows/scripts/install.sh b/.github/workflows/scripts/install.sh index ca976daf67..2b368b1138 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="./galaxy_ng/dist/galaxy_ng-${PLUGIN_VERSION}-py3-none-any.whl" +PLUGIN_SOURCE="./galaxy_ng/dist/galaxy_ng-${PLUGIN_VERSION}-py3-none-any.whl" export PULP_API_ROOT="/api/galaxy/pulp/" @@ -31,7 +31,6 @@ pip install ${PIP_REQUIREMENTS[*]} cd .ci/ansible/ -PLUGIN_SOURCE="${PLUGIN_NAME}" if [ "$TEST" = "s3" ]; then PLUGIN_SOURCE="${PLUGIN_SOURCE} pulpcore[s3]" fi @@ -117,7 +116,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" ansible-playbook build_container.yaml diff --git a/.github/workflows/scripts/publish_client_pypi.sh b/.github/workflows/scripts/publish_client_pypi.sh index 331e53a3c0..bfd446e3f0 100755 --- a/.github/workflows/scripts/publish_client_pypi.sh +++ b/.github/workflows/scripts/publish_client_pypi.sh @@ -24,10 +24,8 @@ RESPONSE="$(curl --write-out '%{http_code}' --silent --output /dev/null "https:/ if [ "$RESPONSE" == "200" ]; then echo "galaxy_ng client $VERSION has already been released. Skipping." - exit +else + twine upload -u __token__ -p "$PYPI_API_TOKEN" \ + "dist/galaxy_ng_client-$VERSION-py3-none-any.whl" \ + "dist/galaxy_ng-client-$VERSION.tar.gz" fi - -twine upload -u __token__ -p "$PYPI_API_TOKEN" \ -"dist/galaxy_ng_client-$VERSION-py3-none-any.whl" \ -"dist/galaxy_ng-client-$VERSION.tar.gz" \ -; diff --git a/.github/workflows/scripts/release.py b/.github/workflows/scripts/release.py deleted file mode 100755 index d86490e40a..0000000000 --- a/.github/workflows/scripts/release.py +++ /dev/null @@ -1,177 +0,0 @@ -# WARNING: DO NOT EDIT! -# -# This file was generated by plugin_template, and is managed by it. Please use -# './plugin-template --github galaxy_ng' to update this file. -# -# For more info visit https://github.com/pulp/plugin_template - -import argparse -import re -import os -import textwrap -import requests -import subprocess - -from git import Repo -from pathlib import Path - - -def get_package_from_pypi(version, plugin_path): - """ - Download a package from PyPI. - - :param version: version of the package to download from PyPI - :return: True/False if download was successful - """ - os.makedirs(os.path.join(plugin_path, "dist"), exist_ok=True) - r = requests.get(f"https://pypi.org/pypi/galaxy-ng/{version}/json") - if r.status_code == 200: - metadata = r.json() - for url_data in metadata["urls"]: - filename = url_data["filename"] - r2 = requests.get(url_data["url"]) - if r2.status_code != 200: - raise RuntimeError(f"Failed to download released artifact {filename}") - with open(os.path.join(plugin_path, "dist", filename), "wb") as f: - f.write(r2.content) - return True - return False - - -def create_release_commits(repo, release_version, plugin_path): - """Build changelog, set version, commit, bump to next dev version, commit.""" - issues_to_close = set() - for filename in Path(f"{plugin_path}/CHANGES").rglob("*"): - if filename.stem.isdigit(): - issue = filename.stem - issues_to_close.add(issue) - - issues = ",".join(issues_to_close) - # First commit: changelog - os.system(f"towncrier --yes --version {release_version}") - git = repo.git - git.add("CHANGES.rst") - git.add("CHANGES/*") - git.commit("-m", f"Add changelog for {release_version}\n\n[noissue]") - - # Second commit: release version - os.system("bump2version release --allow-dirty") - - git.add(f"{plugin_path}") - git.commit("-m", f"Release {release_version}\nGH Issues: {issues}\n\n[noissue]") - sha = repo.head.object.hexsha - short_sha = git.rev_parse(sha, short=7) - - os.system("bump2version patch --allow-dirty") - - new_dev_version = None - with open(f"{plugin_path}/setup.py") as fp: - for line in fp.readlines(): - if "version=" in line: - new_dev_version = re.split("\"|'", line)[1] - if not new_dev_version: - raise RuntimeError("Could not detect new dev version ... aborting.") - - git.add(f"{plugin_path}") - git.commit("-m", f"Bump to {new_dev_version}\n\n[noissue]") - print(f"Release commit == {short_sha}") - print(f"All changes were committed on branch: release_{release_version}") - return sha - - -def create_tag_and_build_package(repo, desired_tag, commit_sha, plugin_path): - """Create a tag if one is needed and build a package if one is not on PyPI.""" - # Remove auth header config - with repo.config_writer() as conf: - conf.remove_section('http "https://github.com/"') - conf.release() - - # Determine if a tag exists and if it matches the specified commit sha - tag = None - for existing_tag in repo.tags: - if existing_tag.name == desired_tag: - if existing_tag.commit.hexsha == commit_sha: - tag = existing_tag - else: - raise RuntimeError( - f"The '{desired_tag}' tag already exists, but the commit sha does not match " - f"'{commit_sha}'." - ) - - # Create a tag if one does not exist - if not tag: - tag = repo.create_tag(desired_tag, ref=commit_sha) - - # Checkout the desired tag and reset the tree - repo.head.reference = tag.commit - repo.head.reset(index=True, working_tree=True) - - # Check if Package is available on PyPI - if not get_package_from_pypi(tag.name, plugin_path): - os.system("python3 setup.py sdist bdist_wheel --python-tag py3") - - -def main(): - helper = textwrap.dedent( - """\ - Start the release process. - - Example: - setup.py on plugin before script: - version="2.0.0.dev" - - $ python .ci/scripts/release.py - - setup.py on plugin after script: - version="2.0.1.dev" - - - """ - ) - parser = argparse.ArgumentParser( - formatter_class=argparse.RawTextHelpFormatter, description=helper - ) - - parser.add_argument( - "release_version", - type=str, - help="The version string for the release.", - nargs="?", - ) - - args = parser.parse_args() - - release_version_arg = args.release_version - - release_path = os.path.dirname(os.path.abspath(__file__)) - plugin_path = release_path.split("/.github")[0] - - output = subprocess.check_output(["bump2version", "--dry-run", "--list", "release"]) - release_version = re.findall(r"\nnew_version=([0-9.]*)\n", output.decode())[0] - - print(f"\n\nRepo path: {plugin_path}") - repo = Repo(plugin_path) - - release_commit = None - if release_version_arg and release_version != release_version_arg: - # Look for a commit with the requested release version - for commit in repo.iter_commits(): - if f"Release {release_version_arg}\n" in commit.message: - release_commit = commit - release_version = release_version_arg - break - if not release_commit: - raise RuntimeError( - f"The release version {release_version_arg} does not match the .dev version at " - "HEAD. A release commit for such version does not exist." - ) - - if not release_commit: - release_commit_sha = create_release_commits(repo, release_version, plugin_path) - else: - release_commit_sha = release_commit.hexsha - create_tag_and_build_package(repo, release_version, release_commit_sha, plugin_path) - - -if __name__ == "__main__": - main() diff --git a/.github/workflows/scripts/script.sh b/.github/workflows/scripts/script.sh index 4f3664b758..55dce7c4ee 100755 --- a/.github/workflows/scripts/script.sh +++ b/.github/workflows/scripts/script.sh @@ -31,6 +31,7 @@ if [[ "$TEST" = "docs" ]]; then if [[ "$GITHUB_WORKFLOW" == "Galaxy 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 galaxy --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 galaxy_ng.tests.unit" - # Run functional tests if [[ "$TEST" == "performance" ]]; then if [[ -z ${PERFORMANCE_TEST+x} ]]; then diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 70ed306e47..d556e83a84 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -37,11 +37,11 @@ jobs: repository: "pulp/pulp-openapi-generator" path: "pulp-openapi-generator" - - uses: "actions/setup-python@v4" + - uses: "actions/setup-python@v5" with: python-version: "3.11" - - uses: "actions/download-artifact@v3" + - uses: "actions/download-artifact@v4" with: name: "plugin_package" path: "galaxy_ng/dist/" @@ -108,21 +108,23 @@ jobs: GITHUB_USER: "${{ github.event.pull_request.user.login }}" - name: Upload python client packages if: ${{ env.TEST == 'pulp' }} - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: "python-client.tar" path: "galaxy_ng/galaxy-python-client.tar" if-no-files-found: "error" retention-days: 5 + overwrite: true - name: Upload python client docs if: ${{ env.TEST == 'pulp' }} - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: "python-client-docs.tar" path: "galaxy_ng/galaxy-python-client-docs.tar" if-no-files-found: "error" retention-days: 5 + overwrite: true - name: "Logs" if: always() diff --git a/.github/workflows/update-labels.yml b/.github/workflows/update-labels.yml index 91454891d6..5c37327279 100644 --- a/.github/workflows/update-labels.yml +++ b/.github/workflows/update-labels.yml @@ -19,7 +19,7 @@ jobs: update_backport_labels: runs-on: "ubuntu-latest" steps: - - uses: "actions/setup-python@v4" + - uses: "actions/setup-python@v5" with: python-version: "3.11" - name: "Configure Git with ansible name and email" @@ -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 40126b4aba..e132acf7db 100644 --- a/.github/workflows/update_ci.yml +++ b/.github/workflows/update_ci.yml @@ -25,7 +25,7 @@ jobs: repository: "pulp/plugin_template" path: "plugin_template" - - uses: "actions/setup-python@v4" + - uses: "actions/setup-python@v5" with: python-version: "3.11" @@ -51,7 +51,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: "galaxy_ng" diff --git a/CHANGES/.TEMPLATE.rst b/CHANGES/.TEMPLATE.rst deleted file mode 100644 index 49c2305d7b..0000000000 --- a/CHANGES/.TEMPLATE.rst +++ /dev/null @@ -1,47 +0,0 @@ -{% if render_title %} -{% if versiondata.name %} -{{ versiondata.name }} {{ versiondata.version }} ({{ versiondata.date }}) -{{ top_underline * ((versiondata.name + versiondata.version + versiondata.date)|length + 4)}} -{% else %} -{{ versiondata.version }} ({{ versiondata.date }}) -{{ top_underline * ((versiondata.version + versiondata.date)|length + 3)}} -{% endif %} -{% endif %} -{% for section, _ in sections.items() %} -{% set underline = underlines[0] %}{% if section %}{{section}} -{{ underline * section|length }}{% set underline = underlines[1] %} - -{% endif %} - -{% if sections[section] %} -{% for category, val in definitions.items() if category in sections[section]%} -{{ definitions[category]['name'] }} -{{ underline * definitions[category]['name']|length }} - -{% if definitions[category]['showcontent'] %} -{% for text, values in sections[section][category].items() %} -- {{ text }} - {{ values|join(',\n ') }} -{% endfor %} - -{% else %} -- {{ sections[section][category]['']|join(', ') }} - -{% endif %} -{% if sections[section][category]|length == 0 %} -No significant changes. - -{% else %} -{% endif %} - -{% endfor %} -{% else %} -No significant changes. - - -{% endif %} -{% endfor %} ----- - - - diff --git a/MANIFEST.in b/MANIFEST.in index 11a3a79ae4..7ffde11503 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,4 +1,4 @@ -include CHANGES.rst +include CHANGES.md include COMMITMENT include LICENSE include integration_requirements.txt diff --git a/flake8.cfg b/flake8.cfg deleted file mode 100644 index 548abd7e8b..0000000000 --- a/flake8.cfg +++ /dev/null @@ -1,42 +0,0 @@ -[flake8] -exclude = - ./.eggs/*, - ./build/*, - ./docs/*, - ./dist/* - ./galaxy_ng/tests/functional/*, - */migrations/*, - .ci/scripts/*, - .github/workflows/scripts/*, - .venv/*, - ./galaxy_ng/_vendor/automated_logging/*, - -ignore = BLK,W503,Q000,D,D100,D101,D102,D103,D104,D105,D106,D107,D200,D401,D402,E203 -max-line-length = 100 - -# Flake8 builtin codes -# -------------------- -# W503: This enforces operators before line breaks which is not pep8 or black compatible. -# E203: no whitespace around ':'. disabled until https://github.com/PyCQA/pycodestyle/issues/373 is fixed - -# Flake8-quotes extension codes -# ----------------------------- -# Q000: double or single quotes only, default is double (don't want to enforce this) - -# Flake8-docstring extension codes -# -------------------------------- -# D100: missing docstring in public module -# D101 Missing docstring in public class -# D102 Missing docstring in public method -# D103 Missing docstring in public function -# D104: missing docstring in public package -# D105 Missing docstring in magic method -# D106: missing docstring in public nested class (complains about "class Meta:" and documenting those is silly) -# D107 Missing docstring in __init__ -# D200: one-line docstring should fit on one line with quotes -# D401: first line should be imperative (nitpicky) -# D402: first line should not be the function’s “signature” (false positives) - -# Flake8-black -# ------------ -# BLK diff --git a/pyproject.toml b/pyproject.toml index 0d200c541e..aea1cbdb4c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,10 +1,12 @@ [tool.towncrier] package = "galaxy_ng" -filename = "CHANGES.rst" +filename = "CHANGES.md" directory = "CHANGES/" -title_format = "{version} ({project_date})" -template = "CHANGES/.TEMPLATE.rst" -issue_format = "`AAH-{issue} `_" +title_format = "## {version} ({project_date}) {{: #{version} }}" +template = "CHANGES/.TEMPLATE.md" +issue_format = "[#{issue}](https://github.com/ansible/galaxy_ng/issues/{issue})" +start_string = "[//]: # (towncrier release notes start)\n" +underlines = ["", "", ""] [tool.black] diff --git a/template_config.yml b/template_config.yml index 758a625ee2..be312f643d 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-338-g2237db8 api_root: /api/galaxy/pulp/ black: false @@ -12,7 +12,7 @@ check_stray_pulpcore_imports: true ci_base_image: ghcr.io/pulp/pulp-ci-centos9 ci_env: GITHUB_USER: ${{ github.event.pull_request.user.login }} -ci_trigger: '{pull_request: {branches: [''**'']}, push: {branches: [''**'']}}' +ci_trigger: workflow_dispatch ci_update_docs: false cli_package: pulp-cli cli_repo: https://github.com/pulp/pulp-cli.git @@ -65,7 +65,6 @@ pulp_settings: pulp_settings_azure: null pulp_settings_gcp: null pulp_settings_s3: null -pulpprojectdotorg_key_id: null pydocstyle: true release_email: ansible-infra@redhat.com release_user: ansible @@ -84,4 +83,6 @@ test_performance: false test_reroute: false test_s3: true use_issue_template: false +use_legacy_docs: true +use_unified_docs: false From 096bd4e68459018cc6dd60466070ab2a2fa31b9a Mon Sep 17 00:00:00 2001 From: James Tanner Date: Mon, 10 Jun 2024 18:45:24 -0400 Subject: [PATCH 2/7] Install pip stuff for template script. No-Issue Signed-off-by: James Tanner --- dev/common/check_pulp_template.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/dev/common/check_pulp_template.sh b/dev/common/check_pulp_template.sh index 4661187694..b5895af362 100755 --- a/dev/common/check_pulp_template.sh +++ b/dev/common/check_pulp_template.sh @@ -17,6 +17,7 @@ git clone https://github.com/pulp/plugin_template $BASEDIR/plugin_template cd $BASEDIR/plugin_template git checkout $PLUGIN_GIT_REF +pip install -r requirements.txt ./plugin-template --github galaxy_ng echo "Results ..." From af1bbd5a786a105fb9af9de17d923806b875561c Mon Sep 17 00:00:00 2001 From: James Tanner Date: Mon, 10 Jun 2024 19:02:42 -0400 Subject: [PATCH 3/7] Re-add flake8 config No-Issue Signed-off-by: James Tanner --- flake8.cfg | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 flake8.cfg diff --git a/flake8.cfg b/flake8.cfg new file mode 100644 index 0000000000..548abd7e8b --- /dev/null +++ b/flake8.cfg @@ -0,0 +1,42 @@ +[flake8] +exclude = + ./.eggs/*, + ./build/*, + ./docs/*, + ./dist/* + ./galaxy_ng/tests/functional/*, + */migrations/*, + .ci/scripts/*, + .github/workflows/scripts/*, + .venv/*, + ./galaxy_ng/_vendor/automated_logging/*, + +ignore = BLK,W503,Q000,D,D100,D101,D102,D103,D104,D105,D106,D107,D200,D401,D402,E203 +max-line-length = 100 + +# Flake8 builtin codes +# -------------------- +# W503: This enforces operators before line breaks which is not pep8 or black compatible. +# E203: no whitespace around ':'. disabled until https://github.com/PyCQA/pycodestyle/issues/373 is fixed + +# Flake8-quotes extension codes +# ----------------------------- +# Q000: double or single quotes only, default is double (don't want to enforce this) + +# Flake8-docstring extension codes +# -------------------------------- +# D100: missing docstring in public module +# D101 Missing docstring in public class +# D102 Missing docstring in public method +# D103 Missing docstring in public function +# D104: missing docstring in public package +# D105 Missing docstring in magic method +# D106: missing docstring in public nested class (complains about "class Meta:" and documenting those is silly) +# D107 Missing docstring in __init__ +# D200: one-line docstring should fit on one line with quotes +# D401: first line should be imperative (nitpicky) +# D402: first line should not be the function’s “signature” (false positives) + +# Flake8-black +# ------------ +# BLK From 5ad8fd433de325dc71f9c268f6d93e107003686b Mon Sep 17 00:00:00 2001 From: James Tanner Date: Mon, 10 Jun 2024 19:04:51 -0400 Subject: [PATCH 4/7] Fix lint errors. No-Issue Signed-off-by: James Tanner --- dev/common/poll.py | 2 +- galaxy_ng/app/utils/galaxy.py | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/dev/common/poll.py b/dev/common/poll.py index 99c7cf3bd3..46e306176c 100644 --- a/dev/common/poll.py +++ b/dev/common/poll.py @@ -48,7 +48,7 @@ def poll(url=None, attempts=100, wait_time=1): hostname = env['PULP_ANSIBLE_API_HOSTNAME'] for i in range(attempts): - print(f"Waiting for API to start (attempt {i+1} of {attempts})") + print(f"Waiting for API to start (attempt {i + 1} of {attempts})") # re request the api root each time because it's not alwasy available until the # app boots diff --git a/galaxy_ng/app/utils/galaxy.py b/galaxy_ng/app/utils/galaxy.py index 2c4f6e912a..8ca236ca89 100644 --- a/galaxy_ng/app/utils/galaxy.py +++ b/galaxy_ng/app/utils/galaxy.py @@ -182,9 +182,9 @@ def upstream_namespace_iterator( # Some upstream pages return ISEs for whatever reason. if page.status_code >= 500: if 'page=' in next_url: - next_url = next_url.replace(f'page={pagenum}', f'page={pagenum+1}') + next_url = next_url.replace(f'page={pagenum}', f'page={pagenum + 1}') else: - next_url = next_url.rstrip('/') + '/?page={pagenum+1}' + next_url = next_url.rstrip('/') + '/?page={pagenum + 1}' pagenum += 1 continue @@ -350,7 +350,7 @@ def upstream_collection_iterator( # Some upstream pages return ISEs for whatever reason. if page.status_code >= 500: if 'page=' in next_url: - next_url = next_url.replace(f'page={pagenum}', f'page={pagenum+1}') + next_url = next_url.replace(f'page={pagenum}', f'page={pagenum + 1}') else: next_url = next_url.rstrip('/') + '/?page={pagenum+1}' pagenum += 1 @@ -451,9 +451,9 @@ def upstream_role_iterator( if page.status_code >= 500: logger.error(f'{next_url} returned 500ISE. incrementing the page manually') if 'page=' in next_url: - next_url = next_url.replace(f'page={pagenum}', f'page={pagenum+1}') + next_url = next_url.replace(f'page={pagenum}', f'page={pagenum + 1}') else: - next_url = next_url.rstrip('/') + '/?page={pagenum+1}' + next_url = next_url.rstrip('/') + '/?page={pagenum + 1}' pagenum += 1 continue From 4848b87aee10ff1eee030305cf876dc904559910 Mon Sep 17 00:00:00 2001 From: James Tanner Date: Tue, 11 Jun 2024 06:54:15 -0400 Subject: [PATCH 5/7] Update sdist. No-Issue Signed-off-by: James Tanner --- MANIFEST.in | 1 + 1 file changed, 1 insertion(+) diff --git a/MANIFEST.in b/MANIFEST.in index 7ffde11503..09e9223f41 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,4 +1,5 @@ include CHANGES.md +include CHANGES.rst include COMMITMENT include LICENSE include integration_requirements.txt From b96707298e3fde5bd1fb413f515bd3bf754b7477 Mon Sep 17 00:00:00 2001 From: James Tanner Date: Tue, 11 Jun 2024 07:03:34 -0400 Subject: [PATCH 6/7] Show the diff for file. No-Issue Signed-off-by: James Tanner --- dev/common/check_pulp_template.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/dev/common/check_pulp_template.sh b/dev/common/check_pulp_template.sh index b5895af362..1ddfc2271b 100755 --- a/dev/common/check_pulp_template.sh +++ b/dev/common/check_pulp_template.sh @@ -26,6 +26,7 @@ MODIFIED_FILES=$(git status 2>/dev/null | grep 'modified:' | awk '{print $2}') EXIT_CODE=0 for MF in $MODIFIED_FILES; do echo "FAILURE template-plugin would modifiy $BASEDIR/galaxy_ng/$MF" + git diff $MF EXIT_CODE=1 done if [[ $EXIT_CODE == 0 ]]; then From b91b89ca0f549e67b1e49883175851194af3b438 Mon Sep 17 00:00:00 2001 From: James Tanner Date: Tue, 11 Jun 2024 07:06:30 -0400 Subject: [PATCH 7/7] Try this. No-Issue Signed-off-by: James Tanner --- CHANGES.rst => CHANGES.md | 0 MANIFEST.in | 1 - 2 files changed, 1 deletion(-) rename CHANGES.rst => CHANGES.md (100%) diff --git a/CHANGES.rst b/CHANGES.md similarity index 100% rename from CHANGES.rst rename to CHANGES.md diff --git a/MANIFEST.in b/MANIFEST.in index 09e9223f41..7ffde11503 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,5 +1,4 @@ include CHANGES.md -include CHANGES.rst include COMMITMENT include LICENSE include integration_requirements.txt