Skip to content

Commit ada5fa8

Browse files
raballewclaude
andauthored
fix(renovate): store exact Python version, migrate devfile images to uv (#804)
## Summary - Switch `.py-version` from `MAJOR.MINOR` (`3.12`) to `MAJOR.MINOR.PATCH` (`3.12.11`) and update the Renovate regex to match three version segments -- fixes the `renovate/python-3.x` branch creation failure where the two-segment regex couldn't verify a three-segment replacement (`expectedValue: "3.14.6", foundValue: "14.6"`) - Migrate both devfile Containerfiles from `dnf install python3.X` / `pip install` to `uv python install` / `uv pip install`, reading the Python version from `.py-version` instead of hardcoding it - Add `python-base` intermediary stage in `Containerfile.client` for layer caching (system deps cached separately from wheel installation) - Replace bash alias (`alias python='uv run python'`) with `uv venv` + `ENV PATH` so `python` is available in all contexts (scripts, podman exec, Makefiles), not just interactive bash shells - Pin the builder stage to the same `.py-version` Python via `uv python install` + `UV_PYTHON_PREFERENCE=only-managed` so wheels are built with the same interpreter as the runtime - Set group ownership (GID 0) on `.local`, `.cache`, and `.venv` in both Containerfiles for OpenShift arbitrary UID support - Update `name` labels from `udi9` to `udi10` to match the `ubi10-latest` base image ## Test plan - [x] Validated `renovate.jsonc` parses correctly (`npx json5`) - [x] Ran Renovate v43.218.0 dry-run against fork -- confirmed `.py-version` matched, `currentValue: "3.12.11"` extracted, and `DRY-RUN: Would commit files to branch renovate/python-3.x` (no "Value is not updated" error) - [x] Build `python/.devfile/Containerfile.client` and verify `uv python install` succeeds - [x] Build `python/.devfile/Containerfile.client` and verify wheel + pytest installation into venv - [x] `podman run --rm jumpstarter-client:test python --version` returns Python 3.12.11 - [x] `podman run --rm jumpstarter-client:test uv pip list --python /home/user/.venv/bin/python | grep jumpstarter` lists all packages - [x] Verified builder stage uses Python 3.12.11 (via `UV_VERBOSE=1`) with and without `UV_PYTHON_PREFERENCE=only-managed` 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 89f4e97 commit ada5fa8

6 files changed

Lines changed: 29 additions & 29 deletions

File tree

.py-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.12
1+
3.12.11

e2e/compat/setup.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ install_dependencies() {
6363
export PATH="$HOME/.cargo/bin:$PATH"
6464
fi
6565

66-
grep -qxE '[0-9]+\.[0-9]+' "$REPO_ROOT/.py-version" || { log_error "Invalid .py-version"; exit 1; }
66+
grep -qxE '[0-9]+\.[0-9]+\.[0-9]+' "$REPO_ROOT/.py-version" || { log_error "Invalid .py-version"; exit 1; }
6767
PY_VERSION="$(cat "$REPO_ROOT/.py-version")"
6868
log_info "Installing Python ${PY_VERSION}..."
6969
uv python install "$PY_VERSION"

e2e/setup-e2e.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ install_dependencies() {
4848
export PATH="$HOME/.cargo/bin:$PATH"
4949
fi
5050

51-
grep -qxE '[0-9]+\.[0-9]+' "$REPO_ROOT/.py-version" || { log_error "Invalid .py-version"; exit 1; }
51+
grep -qxE '[0-9]+\.[0-9]+\.[0-9]+' "$REPO_ROOT/.py-version" || { log_error "Invalid .py-version"; exit 1; }
5252
PY_VERSION="$(cat "$REPO_ROOT/.py-version")"
5353
log_info "Installing Python ${PY_VERSION}..."
5454
uv python install "$PY_VERSION"

python/.devfile/Containerfile

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,25 @@
11
FROM quay.io/devfile/base-developer-image:ubi10-latest@sha256:6b9d2a3b90798e6d92c1c6b05cd2ce733b989cc6f0b3ff4e0820b45ad19fe474
22
LABEL maintainer="Jumpstarter.dev"
33

4-
LABEL name="devfile/udi9/jumpstarter"
4+
LABEL name="devfile/udi10/jumpstarter"
55

6-
#labels for container catalog
76
LABEL summary="devfile jumpstarter developer image"
87
LABEL description="Image with developers tools."
98
LABEL io.k8s.display-name="jumpstarter-developer-universal"
109

11-
USER root
12-
1310
COPY --from=ghcr.io/astral-sh/uv:0.11.21@sha256:ff07b86af50d4d9391d9daf4ff89ce427bc544f9aae87057e69a1cc0aa369946 /uv /uvx /bin/
1411

12+
USER root
1513
COPY .py-version /tmp/.py-version
16-
RUN grep -qxE '[0-9]+\.[0-9]+' /tmp/.py-version && \
17-
PY=$(cat /tmp/.py-version) && \
18-
dnf -y install make git "python${PY}" libusbx python3-pyusb golang podman && dnf clean all
14+
RUN dnf -y install make git libusbx golang podman && dnf clean all
1915

2016
USER 10001
17+
ENV UV_PYTHON_PREFERENCE=only-managed
18+
RUN uv python install "$(cat /tmp/.py-version)" && \
19+
uv venv /home/user/.venv
20+
ENV PATH="/home/user/.venv/bin:${PATH}"
2121

22-
RUN echo "alias python='uv run python'" >> /home/user/.bashrc
22+
USER root
23+
RUN chown 10001:0 -R /home/user/{.local,.cache,.venv} && chmod g+rwx -R /home/user/{.local,.cache,.venv}
24+
25+
USER 10001

python/.devfile/Containerfile.client

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,41 +3,38 @@ COPY --from=ghcr.io/astral-sh/uv:0.11.21@sha256:ff07b86af50d4d9391d9daf4ff89ce42
33
RUN dnf install -y make git && \
44
dnf clean all && \
55
rm -rf /var/cache/dnf
6+
COPY .py-version /tmp/.py-version
7+
RUN uv python install "$(cat /tmp/.py-version)"
8+
ENV UV_PYTHON_PREFERENCE=only-managed
69
ADD . /src
710
RUN make -C /src/python build
811

9-
10-
FROM quay.io/devfile/base-developer-image:ubi10-latest@sha256:6b9d2a3b90798e6d92c1c6b05cd2ce733b989cc6f0b3ff4e0820b45ad19fe474
12+
FROM quay.io/devfile/base-developer-image:ubi10-latest@sha256:6b9d2a3b90798e6d92c1c6b05cd2ce733b989cc6f0b3ff4e0820b45ad19fe474 AS python-base
1113
LABEL maintainer="jumpstarter.dev"
1214

13-
LABEL name="devfile/udi9/jumpstarter-client"
15+
LABEL name="devfile/udi10/jumpstarter-client"
1416

15-
#labels for container catalog
1617
LABEL summary="devfile jumpstarter developer image"
1718
LABEL description="Devspaces image for consuming jumpstarter as a client"
1819
LABEL io.k8s.display-name="jumpstarter-client-developer"
1920

20-
USER root
21+
COPY --from=ghcr.io/astral-sh/uv:0.11.21@sha256:ff07b86af50d4d9391d9daf4ff89ce427bc544f9aae87057e69a1cc0aa369946 /uv /uvx /bin/
2122

23+
USER root
2224
COPY .py-version /tmp/.py-version
23-
RUN grep -qxE '[0-9]+\.[0-9]+' /tmp/.py-version && \
24-
PY=$(cat /tmp/.py-version) && \
25-
rm -rf /usr/bin/python && ln -s "/usr/bin/python${PY}" /usr/bin/python
26-
27-
RUN PY=$(cat /tmp/.py-version) && \
28-
dnf -y install make git "python${PY}" libusbx python3-pyusb "python${PY}-pip" golang && dnf clean all
25+
RUN dnf -y install make git libusbx golang && dnf clean all
2926

3027
USER 10001
28+
RUN uv python install "$(cat /tmp/.py-version)"
3129

30+
FROM python-base
3231
RUN --mount=from=builder,source=/src/python/dist,target=/dist \
33-
PY=$(cat /tmp/.py-version) && "python${PY}" -m pip install /dist/*.whl
34-
35-
RUN PY=$(cat /tmp/.py-version) && \
36-
"python${PY}" -m pip install pytest
32+
uv venv /home/user/.venv && \
33+
VIRTUAL_ENV=/home/user/.venv uv pip install /dist/*.whl pyusb pytest
34+
ENV PATH="/home/user/.venv/bin:$PATH"
3735

3836
USER root
39-
4037
RUN mkdir -p /home/user/.config/jumpstarter/clients
41-
RUN chown 10001:0 -R /home/user/{.config,.local,.cache} && chmod g+rwx -R /home/user/{.config,.local,.cache}
38+
RUN chown 10001:0 -R /home/user/{.config,.local,.cache,.venv} && chmod g+rwx -R /home/user/{.config,.local,.cache,.venv}
4239

4340
USER 10001

renovate.jsonc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
"/(^|/)\\.py-version$/"
5151
],
5252
"matchStrings": [
53-
"(?<currentValue>\\d+\\.\\d+)\\n"
53+
"(?<currentValue>\\d+\\.\\d+\\.\\d+)\\n"
5454
],
5555
"depNameTemplate": "python",
5656
"datasourceTemplate": "python-version",

0 commit comments

Comments
 (0)