Skip to content

Commit

Permalink
Fix find_pulpcore_version script and release's default python version
Browse files Browse the repository at this point in the history
[noissue]
  • Loading branch information
gerrod3 committed Mar 19, 2024
1 parent c3d5d9c commit 643222a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
14 changes: 11 additions & 3 deletions .ci/scripts/find_pulpcore_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,23 @@
)
opts = parser.parse_args()
version = ""

if opts.branch == "main":
# Used for nightly image, find the pulpcore version from @main
r = requests.get("https://raw.githubusercontent.com/pulp/pulpcore/main/.bumpversion.cfg")
if r.status_code != 200:
if r.status_code == 200:
config = configparser.ConfigParser()
config.read_string(r.text)
if "bumpversion" in config:
version = config["bumpversion"]["current_version"]
else:
print("Failed to find current version on main")
exit(1)
else:
print("Failed to download current version on main")
exit(1)
else:
r = requests.get("https://pypi.org/pypi/pulpcore/json")
if r.status_code != 200:
if r.status_code == 200:
metadata = r.json()
if opts.branch == "latest":
version = metadata["info"]["version"]
Expand All @@ -38,4 +43,7 @@
if version > max_z_version:
max_z_version = version
version = f"{max_z_version.major}.{max_z_version.minor}.{max_z_version.micro}"
else:
print("Failed to download pulpcore metadata")
exit(1)
print(version)
14 changes: 10 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,16 @@ jobs:
image_variants: ${{ steps.image_variants.outputs.image_variants }}

steps:
- name: Set Python Version variable
run: |
python_version=${{ inputs.python_version && inputs.python_version || '3.9' }}
echo "Using Python Version $python_version"
echo "PYTHON_VERSION=${python_version}" >> $GITHUB_ENV
- name: Check valid Python version
if: contains(fromJSON('["3.9", "3.10", "3.11", "3.12"]'), inputs.python_version)
if: !contains(fromJSON('["3.9", "3.10", "3.11", "3.12"]'), env.PYTHON_VERSION)
run: |
echo "Invalid Python Version (${{ inputs.python_version }}), must be 3.9-3.12"
echo "Invalid Python Version (${{ env.PYTHON_VERSION }}), must be 3.9-3.12"
exit 1
- uses: actions/checkout@v4
Expand Down Expand Up @@ -86,7 +92,7 @@ jobs:
id: build_base_images
uses: "./.github/actions/base_images"
with:
python_version: ${{ inputs.python_version }}
python_version: ${{ env.PYTHON_VERSION }}

# The published base images are tagged with the pulpcore version + python version, however
# the base images don't have Pulp installed. Will need to use our context clues of this run
Expand All @@ -112,7 +118,7 @@ jobs:
# to maintain our prior tagging scheme before customizable python versions
- name: Set image tags
run: |
python_version=${{ inputs.python_version }}
python_version=${{ env.PYTHON_VERSION }}
python_version="python${python_version//.}"
tags="${PULPCORE_VERSION}-${python_version} ${PULPCORE_BRANCH}-${python_version}"
if [ "${{ github.ref_name }}" == "latest" ]; then
Expand Down

0 comments on commit 643222a

Please sign in to comment.