-
Notifications
You must be signed in to change notification settings - Fork 70
[WIP] konflux: use RHAI base image #1074
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
WalkthroughAdds a Tekton pipeline parameter Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Dev as Developer / CI trigger
participant Tekton as Tekton Pipeline
participant Build as Build Task (buildah/kaniko)
participant Repo as RPM repos (redhat.repo / rpms.lock)
participant Registry as Image Registry
Dev->>Tekton: push PR / start Pipeline (params incl. build-args-file)
Tekton->>Build: start build task with matrix (BUILD_ARGS_FILE -> build-args-konflux.conf)
Build->>Repo: resolve RPMs using `redhat.repo` and `rpms.lock`
Build->>Build: use Containerfile ARGs (BUILDER_BASE_IMAGE, RUNTIME_BASE_IMAGE, DNF commands)
Build->>Registry: push built images (using runtime/base images)
Registry-->>Dev: build completed / image available
Note: colored rectangles not used because sequence diagram focuses on interactions. Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested reviewers
🚥 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
Containerfile (1)
57-85: Add ARG RUNTIME_DNF_COMMAND to the final stage to fix empty variable expansion.ARGs declared before the first
FROM(line 3) have global scope but are not automatically available inside build stages. At line 85,${RUNTIME_DNF_COMMAND}expands to empty, causing the command to fail withinstall: invalid option -- 'y'. Re-declare the ARG in the final stage.Fix
FROM ${RUNTIME_BASE_IMAGE} +ARG RUNTIME_DNF_COMMAND ARG APP_ROOT=/app-root WORKDIR /app-root
Signed-off-by: Haoyu Sun <hasun@redhat.com>
6f0def9 to
5b1c8c8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
Containerfile (1)
59-87:⚠️ Potential issue | 🔴 CriticalCritical: Same ARG scoping issue in the runtime stage.
RUNTIME_DNF_COMMANDis undefined afterFROM ${RUNTIME_BASE_IMAGE}. This will cause the same pipeline failure at line 87.🐛 Proposed fix to re-declare ARG in runtime stage
FROM ${RUNTIME_BASE_IMAGE} +ARG RUNTIME_DNF_COMMAND=microdnf ARG APP_ROOT=/app-root WORKDIR /app-root
🤖 Fix all issues with AI agents
In `@Containerfile`:
- Around line 2-7: The build ARGs declared before the first FROM (ARG
BUILDER_BASE_IMAGE, ARG BUILDER_DNF_COMMAND, ARG RUNTIME_BASE_IMAGE, ARG
RUNTIME_DNF_COMMAND) are not available inside the builder stage, causing
${BUILDER_DNF_COMMAND} to be empty; re-declare the required ARGs immediately
after the corresponding FROM lines (e.g., after "FROM ${BUILDER_BASE_IMAGE} AS
builder" add "ARG BUILDER_DNF_COMMAND" and any other builder ARGs you need) so
RUN steps that reference ${BUILDER_DNF_COMMAND} resolve correctly, and likewise
re-declare runtime ARGs after the runtime FROM if used in that stage.
| ARG BUILDER_BASE_IMAGE=registry.access.redhat.com/ubi9/python-312 | ||
| ARG BUILDER_DNF_COMMAND=dnf | ||
| ARG RUNTIME_BASE_IMAGE=registry.access.redhat.com/ubi9/python-312-minimal | ||
| ARG RUNTIME_DNF_COMMAND=microdnf | ||
|
|
||
| FROM ${BUILDER_BASE_IMAGE} AS builder |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Critical: ARGs must be re-declared after FROM to be available in the build stage.
The pipeline failure (install: invalid option -- 'y') occurs because BUILDER_DNF_COMMAND is undefined inside the builder stage. In Docker/Podman, ARGs declared before the first FROM are only available for use in FROM instructions themselves. To use them in subsequent RUN commands, they must be re-declared after FROM.
When ${BUILDER_DNF_COMMAND} is empty, the command becomes install -y ..., invoking the shell's install utility instead of dnf.
🐛 Proposed fix to re-declare ARGs after FROM
ARG BUILDER_BASE_IMAGE=registry.access.redhat.com/ubi9/python-312
ARG BUILDER_DNF_COMMAND=dnf
ARG RUNTIME_BASE_IMAGE=registry.access.redhat.com/ubi9/python-312-minimal
ARG RUNTIME_DNF_COMMAND=microdnf
FROM ${BUILDER_BASE_IMAGE} AS builder
+ARG BUILDER_DNF_COMMAND=dnf
ARG APP_ROOT=/app-root
ARG LSC_SOURCE_DIR=.📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| ARG BUILDER_BASE_IMAGE=registry.access.redhat.com/ubi9/python-312 | |
| ARG BUILDER_DNF_COMMAND=dnf | |
| ARG RUNTIME_BASE_IMAGE=registry.access.redhat.com/ubi9/python-312-minimal | |
| ARG RUNTIME_DNF_COMMAND=microdnf | |
| FROM ${BUILDER_BASE_IMAGE} AS builder | |
| ARG BUILDER_BASE_IMAGE=registry.access.redhat.com/ubi9/python-312 | |
| ARG BUILDER_DNF_COMMAND=dnf | |
| ARG RUNTIME_BASE_IMAGE=registry.access.redhat.com/ubi9/python-312-minimal | |
| ARG RUNTIME_DNF_COMMAND=microdnf | |
| FROM ${BUILDER_BASE_IMAGE} AS builder | |
| ARG BUILDER_DNF_COMMAND=dnf |
🤖 Prompt for AI Agents
In `@Containerfile` around lines 2 - 7, The build ARGs declared before the first
FROM (ARG BUILDER_BASE_IMAGE, ARG BUILDER_DNF_COMMAND, ARG RUNTIME_BASE_IMAGE,
ARG RUNTIME_DNF_COMMAND) are not available inside the builder stage, causing
${BUILDER_DNF_COMMAND} to be empty; re-declare the required ARGs immediately
after the corresponding FROM lines (e.g., after "FROM ${BUILDER_BASE_IMAGE} AS
builder" add "ARG BUILDER_DNF_COMMAND" and any other builder ARGs you need) so
RUN steps that reference ${BUILDER_DNF_COMMAND} resolve correctly, and likewise
re-declare runtime ARGs after the runtime FROM if used in that stage.
Description
use RHAI base image, that comes with dependant libraries such as openMPI already installed.
Type of change
Tools used to create PR
Identify any AI code assistants used in this PR (for transparency and review context)
Related Tickets & Documents
Checklist before requesting a review
Testing
Summary by CodeRabbit