Skip to content

Commit 5cef73c

Browse files
committed
RHAIENG-304, RHAIENG-787: ci(gha): relock from the ground up and force --upgrades, uv by default prefers to change as little as possible to satisfy current pyproject.toml
1 parent 3c1eaeb commit 5cef73c

File tree

3 files changed

+33
-0
lines changed

3 files changed

+33
-0
lines changed

.github/workflows/piplock-renewal.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@ on: # yamllint disable-line rule:truthy
2323
- '["3.11"]'
2424
- '["3.9"]'
2525
- '["3.8"]'
26+
lockfiles_upgrade:
27+
description: 'Force full relock and upgrades for pylock.toml (manual runs)'
28+
required: false
29+
default: 'false'
30+
type: choice
31+
options:
32+
- 'true'
33+
- 'false'
2634
update_optional_dirs:
2735
description: 'Include optional directories in update'
2836
required: false
@@ -48,6 +56,8 @@ jobs:
4856
env:
4957
BRANCH: ${{ github.event.inputs.branch || 'main' }}
5058
INCLUDE_OPT_DIRS: ${{ github.event.inputs.update_optional_dirs || 'false' }}
59+
# Force full relock on scheduled runs. For manual runs, use the input toggle.
60+
FORCE_LOCKFILES_UPGRADE: ${{ github.event_name == 'schedule' && '1' || (github.event.inputs.lockfiles_upgrade == 'true' && '1' || '0') }}
5161

5262
steps:
5363
- name: Checkout code
@@ -75,6 +85,8 @@ jobs:
7585
- name: Run make refresh-pipfilelock-files
7686
run: |
7787
make refresh-pipfilelock-files PYTHON_VERSION=${{ matrix.python-version }} INCLUDE_OPT_DIRS=${{ env.INCLUDE_OPT_DIRS }}
88+
env:
89+
FORCE_LOCKFILES_UPGRADE: ${{ env.FORCE_LOCKFILES_UPGRADE }}
7890

7991
- name: Commit changes (if any)
8092
run: |

scripts/sync-python-lockfiles.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,25 @@ set -Eeuxo pipefail
44
# Red Hat's build tooling depends on requirements.txt files with hashes
55
# Namely, Konflux (https://konflux-ci.dev/), and Cachi2 (https://github.com/containerbuildsystem/cachi2).
66

7+
# Optional behavior:
8+
# - If FORCE_LOCKFILES_UPGRADE=1 (env) or --upgrade (arg) is provided, perform a
9+
# ground-up relock and force upgrades using `uv pip compile --upgrade`.
10+
# This is intended for scheduled runs, while manual runs should default to off.
11+
12+
ADDITIONAL_UV_FLAGS=""
13+
for arg in "$@"; do
14+
case "$arg" in
15+
--upgrade)
16+
FORCE_LOCKFILES_UPGRADE=1
17+
;;
18+
esac
19+
done
20+
21+
if [[ "${FORCE_LOCKFILES_UPGRADE:-0}" == "1" ]]; then
22+
ADDITIONAL_UV_FLAGS="--upgrade"
23+
fi
24+
export ADDITIONAL_UV_FLAGS
25+
726
# The following will create a pylock.toml file for every pyproject.toml we have.
827
uv --version || pip install "uv==0.8.12"
928
find . -name pylock.toml -execdir bash -c '
@@ -17,4 +36,5 @@ find . -name pylock.toml -execdir bash -c '
1736
--python-version="${PWD##*-}" \
1837
--python-platform linux \
1938
--no-annotate \
39+
${ADDITIONAL_UV_FLAGS:-} \
2040
--quiet' \;

tests/test_main.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
if TYPE_CHECKING:
1616
from typing import Any
17+
1718
import pytest_subtests
1819

1920
MAKE = shutil.which("gmake") or shutil.which("make")

0 commit comments

Comments
 (0)