Repository navigation
build: standardize container image - #371
Conversation
- Base the image on UBI 10.1 - Make the container image able to run with user 1001 so special security context change. Standard /app directory structure - Lock the uv version for reproducible builds - Ignore python caches Signed-off-by: Roy Golan <rgolan@redhat.com>
Review Summary by QodoStandardize container image with UBI 10.1 and non-root user
WalkthroughsDescription• Switch base image from Fedora 41 to UBI 10.1 minimal • Enable container to run as non-root user 1001 • Lock uv version to 0.10.9 for reproducible builds • Add Python cache prevention and logging environment variables • Replace dnf with microdnf and install uv via pip • Add proper group permissions for OpenShift compatibility Diagramflowchart LR
A["Fedora 41 Base Image"] -->|"Switch to"| B["UBI 10.1 Minimal"]
C["dnf Package Manager"] -->|"Replace with"| D["microdnf"]
E["Copy uv Binary"] -->|"Replace with"| F["pip install uv==0.10.9"]
G["Root User"] -->|"Change to"| H["User 1001"]
I["No Cache Control"] -->|"Add"| J["PYTHONDONTWRITEBYTECODE & PYTHONUNBUFFERED"]
B --> K["Optimized Container"]
D --> K
F --> K
H --> K
J --> K
File Changes1. Dockerfile
|
Code Review by Qodo
1. Mutable uv toolchain
|
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughSwitched the Docker base image to UBI minimal 10.1 (pinned by digest) and replaced Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Report bugs in Issues Welcome! 🎉This pull request will be automatically processed with the following features: 🔄 Automatic Actions
📋 Available CommandsPR Status Management
Review & Approval
Testing & Validation
Container Operations
Cherry-pick Operations
Label Management
✅ Merge RequirementsThis PR will be automatically approved when the following conditions are met:
📊 Review ProcessApprovers and ReviewersApprovers:
Reviewers:
Available Labels
💡 Tips
For more information, please refer to the project documentation or contact the maintainers. |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@Dockerfile`:
- Around line 19-29: The Dockerfile currently installs build-time packages (gcc,
clang, lib*-devel, git, python3-pip) in the final image within the RUN layer,
increasing image size and CVE surface; convert to a multi-stage build by moving
those build-only packages and any build artifacts into a builder stage
(installing libxml2-devel, libcurl-devel, openssl-devel, gcc, clang, git,
python3-pip there), produce the built artifacts/wheels, and in the final stage
only install runtime packages (openssl, python3-devel if needed) and COPY the
outputs from the builder stage so the final RUN that currently lists
libxml2-devel, libcurl-devel, openssl-devel, gcc, clang, git, python3-pip is
removed and replaced with minimal runtime packages.
- Line 1: Replace the mutable tag in the Dockerfile's FROM instruction
(currently "registry.access.redhat.com/ubi10/ubi-minimal:10.1") with a pinned
digest form ("registry.access.redhat.com/ubi10/ubi-minimal@sha256:<DIGEST>");
obtain the correct sha256 digest for that tag (e.g., via podman inspect or the
registry UI) and update the FROM line to use the `@sha256` value to ensure
reproducible builds.
- Line 31: The RUN pip install --no-cache-dir uv==0.10.9 invocation should
explicitly use the same Python interpreter referenced by UV_PYTHON=python3.12;
update the Dockerfile to call the interpreter from UV_PYTHON with the -m pip
module (so the install runs with the exact python used elsewhere) rather than
relying on the implicit pip on PATH.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: bde3f4fe-1aef-41f2-a6f8-78438c91f0fb
📒 Files selected for processing (1)
Dockerfile
- Pin ubi-minimal:10.1 by sha256 digest for reproducible builds - Use python3 -m pip instead of bare pip for explicit interpreter binding - Remove redundant UV_CACHE_DIR (UV_NO_CACHE=1 already disables caching) - Remove unnecessary cache cleanup step
|
Persistent review updated to latest commit 88d05af |
|
/cherry-pick v2.11 v2.10 |
|
New container for ghcr.io/redhatqe/mtv-api-tests:latest published |
* Standardize container image - Base the image on UBI 10.1 - Make the container image able to run with user 1001 so special security context change. Standard /app directory structure - Lock the uv version for reproducible builds - Ignore python caches Signed-off-by: Roy Golan <rgolan@redhat.com> * fix: pin UBI base image by digest and use explicit pip invocation - Pin ubi-minimal:10.1 by sha256 digest for reproducible builds - Use python3 -m pip instead of bare pip for explicit interpreter binding - Remove redundant UV_CACHE_DIR (UV_NO_CACHE=1 already disables caching) - Remove unnecessary cache cleanup step * docs: add non-root container guidance for bind-mount permissions Document that the container runs as UID 1001 and provide guidance for writable bind mounts across podman rootless, rootful, and OpenShift. * fix: add --no-run-if-empty flag to xargs in Dockerfile Prevents build failure when no __pycache__ directories exist, which is more likely with PYTHONDONTWRITEBYTECODE=1 set. * fix: install uv via COPY --from instead of pip Use COPY --from=ghcr.io/astral-sh/uv:latest for cleaner uv installation. Drop python3-pip dependency since pip is no longer needed. --------- Signed-off-by: Roy Golan <rgolan@redhat.com>
|
Cherry-pick branch created, but PR creation failed |
* Standardize container image - Base the image on UBI 10.1 - Make the container image able to run with user 1001 so special security context change. Standard /app directory structure - Lock the uv version for reproducible builds - Ignore python caches Signed-off-by: Roy Golan <rgolan@redhat.com> * fix: pin UBI base image by digest and use explicit pip invocation - Pin ubi-minimal:10.1 by sha256 digest for reproducible builds - Use python3 -m pip instead of bare pip for explicit interpreter binding - Remove redundant UV_CACHE_DIR (UV_NO_CACHE=1 already disables caching) - Remove unnecessary cache cleanup step * docs: add non-root container guidance for bind-mount permissions Document that the container runs as UID 1001 and provide guidance for writable bind mounts across podman rootless, rootful, and OpenShift. * fix: add --no-run-if-empty flag to xargs in Dockerfile Prevents build failure when no __pycache__ directories exist, which is more likely with PYTHONDONTWRITEBYTECODE=1 set. * fix: install uv via COPY --from instead of pip Use COPY --from=ghcr.io/astral-sh/uv:latest for cleaner uv installation. Drop python3-pip dependency since pip is no longer needed. --------- Signed-off-by: Roy Golan <rgolan@redhat.com>
|
Cherry-pick branch created, but PR creation failed |
|
/cherry-pick v2.11 v2.10 |
* Standardize container image - Base the image on UBI 10.1 - Make the container image able to run with user 1001 so special security context change. Standard /app directory structure - Lock the uv version for reproducible builds - Ignore python caches Signed-off-by: Roy Golan <rgolan@redhat.com> * fix: pin UBI base image by digest and use explicit pip invocation - Pin ubi-minimal:10.1 by sha256 digest for reproducible builds - Use python3 -m pip instead of bare pip for explicit interpreter binding - Remove redundant UV_CACHE_DIR (UV_NO_CACHE=1 already disables caching) - Remove unnecessary cache cleanup step * docs: add non-root container guidance for bind-mount permissions Document that the container runs as UID 1001 and provide guidance for writable bind mounts across podman rootless, rootful, and OpenShift. * fix: add --no-run-if-empty flag to xargs in Dockerfile Prevents build failure when no __pycache__ directories exist, which is more likely with PYTHONDONTWRITEBYTECODE=1 set. * fix: install uv via COPY --from instead of pip Use COPY --from=ghcr.io/astral-sh/uv:latest for cleaner uv installation. Drop python3-pip dependency since pip is no longer needed. --------- Signed-off-by: Roy Golan <rgolan@redhat.com>
|
Cherry-pick branch created, but PR creation failed |
* Standardize container image - Base the image on UBI 10.1 - Make the container image able to run with user 1001 so special security context change. Standard /app directory structure - Lock the uv version for reproducible builds - Ignore python caches Signed-off-by: Roy Golan <rgolan@redhat.com> * fix: pin UBI base image by digest and use explicit pip invocation - Pin ubi-minimal:10.1 by sha256 digest for reproducible builds - Use python3 -m pip instead of bare pip for explicit interpreter binding - Remove redundant UV_CACHE_DIR (UV_NO_CACHE=1 already disables caching) - Remove unnecessary cache cleanup step * docs: add non-root container guidance for bind-mount permissions Document that the container runs as UID 1001 and provide guidance for writable bind mounts across podman rootless, rootful, and OpenShift. * fix: add --no-run-if-empty flag to xargs in Dockerfile Prevents build failure when no __pycache__ directories exist, which is more likely with PYTHONDONTWRITEBYTECODE=1 set. * fix: install uv via COPY --from instead of pip Use COPY --from=ghcr.io/astral-sh/uv:latest for cleaner uv installation. Drop python3-pip dependency since pip is no longer needed. --------- Signed-off-by: Roy Golan <rgolan@redhat.com>
|
Cherry-pick branch created, but PR creation failed |
* Standardize container image - Base the image on UBI 10.1 - Make the container image able to run with user 1001 so special security context change. Standard /app directory structure - Lock the uv version for reproducible builds - Ignore python caches Signed-off-by: Roy Golan <rgolan@redhat.com> * fix: pin UBI base image by digest and use explicit pip invocation - Pin ubi-minimal:10.1 by sha256 digest for reproducible builds - Use python3 -m pip instead of bare pip for explicit interpreter binding - Remove redundant UV_CACHE_DIR (UV_NO_CACHE=1 already disables caching) - Remove unnecessary cache cleanup step * docs: add non-root container guidance for bind-mount permissions Document that the container runs as UID 1001 and provide guidance for writable bind mounts across podman rootless, rootful, and OpenShift. * fix: add --no-run-if-empty flag to xargs in Dockerfile Prevents build failure when no __pycache__ directories exist, which is more likely with PYTHONDONTWRITEBYTECODE=1 set. * fix: install uv via COPY --from instead of pip Use COPY --from=ghcr.io/astral-sh/uv:latest for cleaner uv installation. Drop python3-pip dependency since pip is no longer needed. --------- Signed-off-by: Roy Golan <rgolan@redhat.com>
## Summary
- Remove `--assignee` flag from `gh pr create` command in cherry-pick
flow
- Add post-creation assignee logic via PyGithub `add_to_assignees()`
- If PR author cannot be assigned (not a collaborator), fall back to
first root approver from OWNERS file
- Assignment failure no longer blocks cherry-pick PR creation
## Root Cause
When cherry-picking a PR, the `gh pr create --assignee {pr_author}`
command would fail entirely if the PR author wasn't a collaborator on
the target repo (e.g., fork contributors). Error: `could not assign
user: 'username' not found`
Triggered by: RedHatQE/mtv-api-tests#371
Closes #1050
## Test plan
- [x] Updated `test_cherry_pick_assigns_pr_author` to verify
post-creation assignment
- [x] Updated `test_cherry_pick_requested_by_uses_pr_owner` to verify no
`--assignee` in command
- [x] Added `test_cherry_pick_assignee_fallback_to_approver` for
fallback path
- [x] All 139 runner handler tests pass
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
## Release Notes
* **Bug Fixes**
* Cherry-pick pull requests now attempt to assign ownership to the
original PR author after creation, with automatic fallback to the first
root approver from the OWNERS configuration if the primary assignment
fails.
* Improved error handling and logging for pull request assignment
failures during cherry-pick operations.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
context change. Standard /app directory structure
Signed-off-by: Roy Golan rgolan@redhat.com
Summary by CodeRabbit