From 68447010dc1a029736ef80594f4781cc6b992735 Mon Sep 17 00:00:00 2001 From: pulpbot Date: Tue, 30 Jan 2024 18:15:53 +0000 Subject: [PATCH] Update CI files [noissue] --- .ci/scripts/check_release.py | 13 ++++++++----- .ci/scripts/collect_changes.py | 8 +++++--- .github/template_gitref | 2 +- .github/workflows/create-branch.yml | 13 +++++++++++++ .github/workflows/release.yml | 1 + .../workflows/scripts/update_backport_labels.py | 8 ++++++-- docs/template_gitref | 2 +- template_config.yml | 14 +++++++------- unittest_requirements.txt | 1 + 9 files changed, 43 insertions(+), 19 deletions(-) diff --git a/.ci/scripts/check_release.py b/.ci/scripts/check_release.py index d9f5c6912..ec9338fea 100755 --- a/.ci/scripts/check_release.py +++ b/.ci/scripts/check_release.py @@ -29,7 +29,7 @@ def main(): "--branches", default="supported", help="A comma separated list of branches to check for releases. Can also use keyword: " - "'supported'. Defaults to 'supported', see `ci_update_branches` in " + "'supported'. Defaults to 'supported', see `supported_release_branches` in " "`plugin_template.yml`.", ) opts = parser.parse_args() @@ -46,12 +46,15 @@ def main(): if branches == "supported": with open(f"{d}/template_config.yml", mode="r") as f: tc = yaml.safe_load(f) - branches = tc["ci_update_branches"] - branches.append(DEFAULT_BRANCH) + branches = set(tc["supported_release_branches"]) + latest_release_branch = tc["latest_release_branch"] + if latest_release_branch is not None: + branches.add(latest_release_branch) + branches.add(DEFAULT_BRANCH) else: - branches = branches.split(",") + branches = set(branches.split(",")) - if diff := set(branches) - set(available_branches): + if diff := branches - set(available_branches): print(f"Supplied branches contains non-existent branches! {diff}") exit(1) diff --git a/.ci/scripts/collect_changes.py b/.ci/scripts/collect_changes.py index 0ce1f71a4..d51b6a188 100755 --- a/.ci/scripts/collect_changes.py +++ b/.ci/scripts/collect_changes.py @@ -19,9 +19,11 @@ CHANGELOG_FILE = tc_settings.get("filename", "NEWS.rst") START_STRING = tc_settings.get( "start_string", - "\n" - if CHANGELOG_FILE.endswith(".md") - else ".. towncrier release notes start\n", + ( + "\n" + if CHANGELOG_FILE.endswith(".md") + else ".. towncrier release notes start\n" + ), ) TITLE_FORMAT = tc_settings.get("title_format", "{name} {version} ({project_date})") diff --git a/.github/template_gitref b/.github/template_gitref index 4720fb72a..6cfa2261f 100644 --- a/.github/template_gitref +++ b/.github/template_gitref @@ -1 +1 @@ -2021.08.26-307-gdfd2f01 +2021.08.26-312-ge121aa6 diff --git a/.github/workflows/create-branch.yml b/.github/workflows/create-branch.yml index c8e438265..fdd672bd2 100644 --- a/.github/workflows/create-branch.yml +++ b/.github/workflows/create-branch.yml @@ -71,6 +71,19 @@ jobs: run: | find CHANGES -type f -regex ".*\.\(bugfix\|doc\|feature\|misc\|deprecation\|removal\)" -exec git rm {} + + - name: Checkout plugin template + uses: actions/checkout@v3 + with: + repository: pulp/plugin_template + path: plugin_template + fetch-depth: 0 + + - name: Update CI branches in template_config + working-directory: plugin_template + run: | + python3 ./plugin-template pulp_container --github --latest-release-branch "${NEW_BRANCH}" + git add -A + - name: Make a PR with version bump and without CHANGES/* uses: peter-evans/create-pull-request@v4 with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b528f45a2..32033f1c6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -26,6 +26,7 @@ jobs: with: fetch-depth: 0 path: "pulp_container" + token: ${{ secrets.RELEASE_TOKEN }} - uses: "actions/setup-python@v4" with: diff --git a/.github/workflows/scripts/update_backport_labels.py b/.github/workflows/scripts/update_backport_labels.py index f66e53885..bff8b77ac 100755 --- a/.github/workflows/scripts/update_backport_labels.py +++ b/.github/workflows/scripts/update_backport_labels.py @@ -32,10 +32,14 @@ def random_color(): assert response.status_code == 200 old_labels = set([x["name"] for x in response.json() if x["name"].startswith("backport-")]) -# get ci_update_branches from template_config.yml +# get list of branches from template_config.yml with open("./template_config.yml", "r") as f: plugin_template = yaml.safe_load(f) -new_labels = set(["backport-" + x for x in plugin_template["ci_update_branches"]]) +branches = set(plugin_template["supported_release_branches"]) +latest_release_branch = plugin_template["latest_release_branch"] +if latest_release_branch is not None: + branches.add(latest_release_branch) +new_labels = {"backport-" + x for x in branches} # delete old labels that are not in new labels for label in old_labels.difference(new_labels): diff --git a/docs/template_gitref b/docs/template_gitref index 4720fb72a..6cfa2261f 100644 --- a/docs/template_gitref +++ b/docs/template_gitref @@ -1 +1 @@ -2021.08.26-307-gdfd2f01 +2021.08.26-312-ge121aa6 diff --git a/template_config.yml b/template_config.yml index 85398ed61..5e6781a6a 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-305-g4288910 +# generated with plugin_template@2021.08.26-312-ge121aa6 api_root: /pulp/ black: true @@ -11,13 +11,7 @@ check_manifest: true check_stray_pulpcore_imports: true ci_env: {} ci_trigger: '{pull_request: {branches: [''*'']}}' -ci_update_branches: -- '2.10' -- '2.14' -- '2.15' -- '2.16' ci_update_docs: true -ci_update_release_behavior: null cli_package: pulp-cli cli_repo: https://github.com/pulp/pulp-cli.git core_import_allowed: [] @@ -34,6 +28,7 @@ flake8_ignore: [] github_org: pulp issue_tracker: github kanban: true +latest_release_branch: null lint_requirements: true noissue_marker: '[noissue]' parallel_test_workers: 8 @@ -77,6 +72,11 @@ stalebot: true stalebot_days_until_close: 30 stalebot_days_until_stale: 90 stalebot_limit_to_pulls: true +supported_release_branches: +- '2.10' +- '2.14' +- '2.15' +- '2.16' sync_ci: true test_azure: true test_cli: true diff --git a/unittest_requirements.txt b/unittest_requirements.txt index 368588061..5187864f9 100644 --- a/unittest_requirements.txt +++ b/unittest_requirements.txt @@ -1,3 +1,4 @@ mock pytest-django pulp-smash @ git+https://github.com/pulp/pulp-smash.git +pytest<8