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..443d675ee 100644 --- a/.github/template_gitref +++ b/.github/template_gitref @@ -1 +1 @@ -2021.08.26-307-gdfd2f01 +2021.08.26-313-g0528507 diff --git a/.github/workflows/create-branch.yml b/.github/workflows/create-branch.yml index c8e438265..cdebcfa5d 100644 --- a/.github/workflows/create-branch.yml +++ b/.github/workflows/create-branch.yml @@ -33,7 +33,7 @@ jobs: - name: "Install python dependencies" run: | echo ::group::PYDEPS - pip install bump2version jinja2 pyyaml + pip install bump2version jinja2 pyyaml packaging echo ::endgroup:: - name: "Setting secrets" @@ -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/template_config.yml b/template_config.yml index 51872f082..96b5cea86 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-307-gdfd2f01 +# generated with plugin_template@2021.08.26-313-g0528507 api_root: /pulp/ black: true @@ -11,12 +11,7 @@ check_manifest: true check_stray_pulpcore_imports: true ci_env: {} ci_trigger: '{pull_request: {branches: [''*'']}}' -ci_update_branches: -- '2.9' -- '2.10' -- '2.14' ci_update_docs: false -ci_update_release_behavior: null cli_package: pulp-cli cli_repo: https://github.com/pulp/pulp-cli.git core_import_allowed: [] @@ -33,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 @@ -73,6 +69,10 @@ stalebot: true stalebot_days_until_close: 30 stalebot_days_until_stale: 90 stalebot_limit_to_pulls: true +supported_release_branches: +- '2.9' +- '2.10' +- '2.14' 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