Skip to content

Commit

Permalink
Update CI
Browse files Browse the repository at this point in the history
  • Loading branch information
dralley committed Nov 20, 2024
1 parent c7e03c8 commit 262778e
Show file tree
Hide file tree
Showing 10 changed files with 93 additions and 84 deletions.
25 changes: 0 additions & 25 deletions .bumpversion.cfg

This file was deleted.

25 changes: 16 additions & 9 deletions .ci/scripts/check_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import argparse
import re
import os
import tomllib
import yaml
from tempfile import TemporaryDirectory
from packaging.version import Version
Expand All @@ -22,6 +23,17 @@
Z_CHANGELOG_EXTS = [".bugfix", ".doc", ".misc"]


def current_version(repo):
try:
pyproject_toml = tomllib.loads(repo.git.show(f"{DEFAULT_BRANCH}:pyproject.toml"))
current_version = pyproject_toml["project"]["version"]
except Exception:
current_version = repo.git.grep(
"current_version", DEFAULT_BRANCH, "--", ".bumpversion.cfg"
).split("=")[-1]
return Version(current_version)


def main():
"""Check which branches need a release."""
parser = argparse.ArgumentParser()
Expand Down Expand Up @@ -113,15 +125,10 @@ def main():
for change in changes.split("\n"):
_, ext = os.path.splitext(change)
if ext in Y_CHANGELOG_EXTS:
# We don't put Y release bumps in the commit message, check file instead
# The 'current_version' is always the next version to release
next_version = repo.git.grep(
"current_version", DEFAULT_BRANCH, "--", ".bumpversion.cfg"
).split("=")[-1]
next_version = Version(next_version)
print(
f"A new Y-release is needed! New Version: {next_version.base_version}"
)
# We don't put Y release bumps in the commit message, check file instead.
# The 'current_version' is always the dev of the next version to release.
next_version = current_version(repo).base_version
print(f"A new Y-release is needed! New Version: {next_version}")
releases.append(next_version)
break

Expand Down
2 changes: 1 addition & 1 deletion .github/template_gitref
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2021.08.26-394-gd21e6ea
2021.08.26-396-gde50fc9
2 changes: 1 addition & 1 deletion .github/workflows/scripts/build_python_client.sh
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ find ./docs/* -exec sed -i 's/\.md//g' {} \;

cat >> mkdocs.yml << DOCSYAML
---
site_name: Pulp-Certguard Client
site_name: PulpCertguard Client
site_description: Certguard bindings
site_author: Pulp Team
site_url: https://docs.pulpproject.org/pulp_certguard_client/
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,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_VERSION="$(bump-my-version show current_version | tail -n -1 | python -c 'from packaging.version import Version; print(Version(input()))')"
PLUGIN_SOURCE="./pulpcore/dist/pulpcore-${PLUGIN_VERSION}-py3-none-any.whl"

export PULP_API_ROOT="/pulp/"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/scripts/publish_client_pypi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ RESPONSE="$(curl --write-out '%{http_code}' --silent --output /dev/null "https:/

if [ "$RESPONSE" == "200" ];
then
echo "pulp-certguard client $VERSION has already been released. Skipping."
echo "pulp_certguard client $VERSION has already been released. Skipping."
else
twine upload -u __token__ -p "$PYPI_API_TOKEN" \
"dist/pulp_certguard_client-$VERSION-py3-none-any.whl" \
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ jobs:
- name: "Install python dependencies"
run: |
echo ::group::PYDEPS
pip install towncrier twine wheel httpie docker netaddr boto3 'ansible~=10.3.0' mkdocs jq jsonpatch
pip install towncrier twine wheel httpie docker netaddr boto3 'ansible~=10.3.0' mkdocs jq jsonpatch bump-my-version
echo "HTTPIE_CONFIG_DIR=$GITHUB_WORKSPACE/pulpcore/.ci/assets/httpie/" >> $GITHUB_ENV
echo ::endgroup::
Expand Down
66 changes: 22 additions & 44 deletions .github/workflows/update_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,50 +65,6 @@ jobs:
branch: "update-ci/main"
base: "main"
delete-branch: true
- uses: "actions/checkout@v4"
with:
fetch-depth: 0
path: "pulpcore"
ref: "3.68"

- name: "Run update"
working-directory: "pulpcore"
run: |
../plugin_template/scripts/update_ci.sh --release
- name: "Create Pull Request for CI files"
uses: "peter-evans/create-pull-request@v6"
with:
token: "${{ secrets.RELEASE_TOKEN }}"
path: "pulpcore"
committer: "pulpbot <[email protected]>"
author: "pulpbot <[email protected]>"
title: "Update CI files for branch 3.68"
branch: "update-ci/3.68"
base: "3.68"
delete-branch: true
- uses: "actions/checkout@v4"
with:
fetch-depth: 0
path: "pulpcore"
ref: "3.21"

- name: "Run update"
working-directory: "pulpcore"
run: |
../plugin_template/scripts/update_ci.sh --release
- name: "Create Pull Request for CI files"
uses: "peter-evans/create-pull-request@v6"
with:
token: "${{ secrets.RELEASE_TOKEN }}"
path: "pulpcore"
committer: "pulpbot <[email protected]>"
author: "pulpbot <[email protected]>"
title: "Update CI files for branch 3.21"
branch: "update-ci/3.21"
base: "3.21"
delete-branch: true
- uses: "actions/checkout@v4"
with:
fetch-depth: 0
Expand Down Expand Up @@ -219,4 +175,26 @@ jobs:
branch: "update-ci/3.63"
base: "3.63"
delete-branch: true
- uses: "actions/checkout@v4"
with:
fetch-depth: 0
path: "pulpcore"
ref: "3.68"

- name: "Run update"
working-directory: "pulpcore"
run: |
../plugin_template/scripts/update_ci.sh --release
- name: "Create Pull Request for CI files"
uses: "peter-evans/create-pull-request@v6"
with:
token: "${{ secrets.RELEASE_TOKEN }}"
path: "pulpcore"
committer: "pulpbot <[email protected]>"
author: "pulpbot <[email protected]>"
title: "Update CI files for branch 3.68"
branch: "update-ci/3.68"
base: "3.68"
delete-branch: true
...
49 changes: 49 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -202,3 +202,52 @@ ignore = [
".flake8",
"pulpcore/tests/functional/assets/**",
]

[tool.bumpversion]
# This section is managed by the plugin template. Do not edit manually.

current_version = "3.69.0.dev"
commit = false
tag = false
parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)(\\.(?P<release>[a-z]+))?"
serialize = [
"{major}.{minor}.{patch}.{release}",
"{major}.{minor}.{patch}",
]

[tool.bumpversion.parts.release]
# This section is managed by the plugin template. Do not edit manually.

optional_value = "prod"
values = [
"dev",
"prod",
]

[[tool.bumpversion.files]]
# This section is managed by the plugin template. Do not edit manually.

filename = "./pulpcore/app/apps.py"
search = "version = \"{current_version}\""
replace = "version = \"{new_version}\""

[[tool.bumpversion.files]]
# This section is managed by the plugin template. Do not edit manually.

filename = "./pulp_file/app/__init__.py"
search = "version = \"{current_version}\""
replace = "version = \"{new_version}\""

[[tool.bumpversion.files]]
# This section is managed by the plugin template. Do not edit manually.

filename = "./pulp_certguard/app/__init__.py"
search = "version = \"{current_version}\""
replace = "version = \"{new_version}\""

[[tool.bumpversion.files]]
# This section is managed by the plugin template. Do not edit manually.

filename = "./pyproject.toml"
search = "version = \"{current_version}\""
replace = "version = \"{new_version}\""
2 changes: 1 addition & 1 deletion template_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ plugins:
- app_label: file
name: pulp_file
- app_label: certguard
name: pulp-certguard
name: pulp_certguard
post_job_template: null
pre_job_template: null
pulp_env:
Expand Down

0 comments on commit 262778e

Please sign in to comment.