OCPBUGS-87218: Updating ose-cluster-bootstrap-container image to be consistent with ART for 5.0 - #132
Conversation
|
Created by ART pipeline job run https://art-jenkins.apps.prod-stable-spoke1-dc-iad2.itup.redhat.com/job/aos-cd-builds/job/build%252Fsync-ci-images/201 |
WalkthroughThe pull request updates the CI operator and Dockerfile to use OpenShift 5.0 and Go 1.26 base images. The ChangesBuild and Runtime Image Versions
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes 🚥 Pre-merge checks | ✅ 15✅ Passed checks (15 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
@openshift-bot: This pull request references Jira Issue OCPBUGS-87218, which is valid. The bug has been moved to the POST state. 3 validation(s) were run on this bug
The bug has been updated to refer to the pull request using the external bug tracker. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
@openshift-bot: This pull request references Jira Issue OCPBUGS-87218, which is valid. 3 validation(s) were run on this bug
DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
Dockerfile (1)
7-12:⚠️ Potential issue | 🔴 Critical | ⚡ Quick winCritical: Container runs as root.
The runtime stage does not specify a USER directive, causing the container to run as root. This is a critical security violation per Trivy (DS-0002) and the coding guidelines which state "USER non-root; never run as root."
🔒 Proposed fix to run as non-root user
FROM registry.ci.openshift.org/ocp/5.0:base-rhel9 +RUN useradd -r -u 1001 -g 0 bootstrap COPY --from=builder /go/src/github.com/openshift/cluster-bootstrap/cluster-bootstrap / +RUN chown 1001:0 /cluster-bootstrap && chmod 755 /cluster-bootstrap +USER 1001 ENTRYPOINT ["/cluster-bootstrap"] COPY manifests /manifests +RUN chown -R 1001:0 /manifests LABEL io.openshift.release.operator trueNote: OpenShift containers typically use arbitrary UIDs with GID 0. Adjust user/group IDs based on your security requirements.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@Dockerfile` around lines 7 - 12, The Dockerfile runtime stage currently leaves the container running as root (no USER set); update the runtime stage (the final image built from FROM registry.ci.openshift.org/ocp/5.0:base-rhel9) to run as a non-root user by adding a non-root USER (or numeric UID such as 1001) and ensure the runtime files are owned/accessible by that UID (adjust ownership of /cluster-bootstrap and /manifests copied via COPY and keep ENTRYPOINT ["/cluster-bootstrap"] unchanged); if needed, add a chown step in the Dockerfile or create the user/group in the image before switching to USER so the process runs non-root on container start.
🧹 Nitpick comments (1)
Dockerfile (1)
7-12: ⚡ Quick winAdd HEALTHCHECK for container monitoring.
The Dockerfile lacks a HEALTHCHECK directive. As per coding guidelines, "HEALTHCHECK defined" is required for proper container health monitoring in orchestration platforms.
🏥 Proposed HEALTHCHECK addition
If the cluster-bootstrap binary supports a health endpoint or version command:
FROM registry.ci.openshift.org/ocp/5.0:base-rhel9 COPY --from=builder /go/src/github.com/openshift/cluster-bootstrap/cluster-bootstrap / ENTRYPOINT ["/cluster-bootstrap"] COPY manifests /manifests +HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ + CMD ["/cluster-bootstrap", "version"] || exit 1 LABEL io.openshift.release.operator trueAdjust the health check command based on the actual binary capabilities. If no suitable command exists, consider adding one.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@Dockerfile` around lines 7 - 12, Add a Docker HEALTHCHECK to the image so orchestration platforms can monitor /cluster-bootstrap; update the Dockerfile near the ENTRYPOINT/ LABEL lines to include a HEALTHCHECK that runs a lightweight command against the cluster-bootstrap binary (for example a HTTP probe if the binary exposes a health endpoint, or a short invocation like "/cluster-bootstrap --health" or "/cluster-bootstrap --version" with appropriate timeout/retries) and set sensible intervals, timeouts and start-period values; if the binary has no health command, add a small wrapper or implement a minimal health endpoint in the cluster-bootstrap binary and then reference that in the HEALTHCHECK.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@Dockerfile`:
- Line 3: Replace the broad COPY . . in the Dockerfile with explicit COPY
statements for only the needed files/directories (e.g., source dir,
package.json, lockfile, build artifacts) and ensure a .dockerignore exists to
exclude .git, node_modules, secrets, and other irrelevant files; update the
Dockerfile's build steps (the COPY instruction and any related RUN steps) to
reference those specific paths so the image context is minimal and
sensitive/unnecessary files are not included.
- Line 1: The Dockerfile uses base images from registry.ci.openshift.org; update
the FROM lines to use approved UBI minimal or distroless images from
catalog.redhat.com (or document an approved exception). Specifically replace the
builder stage image reference (the FROM line currently referencing
registry.ci.openshift.org/ocp/builder:rhel-9-golang-1.26-openshift-5.0) and any
runtime stage image (e.g., the one currently using
registry.ci.openshift.org/ocp/5.0:base-rhel9) with the equivalent
catalog.redhat.com UBI minimal or distroless tags, ensuring the Go toolchain and
runtime dependencies are present or installed as needed.
---
Outside diff comments:
In `@Dockerfile`:
- Around line 7-12: The Dockerfile runtime stage currently leaves the container
running as root (no USER set); update the runtime stage (the final image built
from FROM registry.ci.openshift.org/ocp/5.0:base-rhel9) to run as a non-root
user by adding a non-root USER (or numeric UID such as 1001) and ensure the
runtime files are owned/accessible by that UID (adjust ownership of
/cluster-bootstrap and /manifests copied via COPY and keep ENTRYPOINT
["/cluster-bootstrap"] unchanged); if needed, add a chown step in the Dockerfile
or create the user/group in the image before switching to USER so the process
runs non-root on container start.
---
Nitpick comments:
In `@Dockerfile`:
- Around line 7-12: Add a Docker HEALTHCHECK to the image so orchestration
platforms can monitor /cluster-bootstrap; update the Dockerfile near the
ENTRYPOINT/ LABEL lines to include a HEALTHCHECK that runs a lightweight command
against the cluster-bootstrap binary (for example a HTTP probe if the binary
exposes a health endpoint, or a short invocation like "/cluster-bootstrap
--health" or "/cluster-bootstrap --version" with appropriate timeout/retries)
and set sensible intervals, timeouts and start-period values; if the binary has
no health command, add a small wrapper or implement a minimal health endpoint in
the cluster-bootstrap binary and then reference that in the HEALTHCHECK.
🪄 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: Repository: openshift/coderabbit/.coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: f7e12b97-2a66-41a2-82e7-69d3f0647086
📒 Files selected for processing (2)
.ci-operator.yamlDockerfile
| @@ -1,10 +1,10 @@ | |||
| FROM registry.ci.openshift.org/ocp/builder:rhel-9-golang-1.25-openshift-4.22 AS builder | |||
| FROM registry.ci.openshift.org/ocp/builder:rhel-9-golang-1.26-openshift-5.0 AS builder | |||
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Description: Check if there are other Dockerfiles in the repository using catalog.redhat.com
# to understand if this registry choice is consistent with project standards
rg -n "FROM.*catalog\.redhat\.com" --type dockerfile -C2
rg -n "FROM.*registry\.ci\.openshift\.org" --type dockerfile -C2Repository: openshift/cluster-bootstrap
Length of output: 141
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Find all Docker-related files (Dockerfile/Containerfile and variants)
files="$( (git ls-files '**/Dockerfile' '**/Containerfile*' 2>/dev/null || true) | sort -u )"
if [ -z "$files" ]; then
# fallback if git ls-files patterns don't work in sandbox
files="$(fd -t f -a -E node_modules -E dist -E build -E .git Dockerfile Containerfile* 2>/dev/null | sort -u || true)"
fi
echo "DOCKERFILES:"
echo "$files"
echo "---- Matches for catalog.redhat.com ----"
echo "$files" | xargs -r rg -n "FROM[[:space:]]+.*catalog\.redhat\.com" -C2 || true
echo "---- Matches for registry.ci.openshift.org ----"
echo "$files" | xargs -r rg -n "FROM[[:space:]]+.*registry\.ci\.openshift\.org" -C2 || true
echo "---- Matches for the specific builder image line ----"
echo "$files" | xargs -r rg -n "FROM[[:space:]]+registry\.ci\.openshift\.org/ocp/builder" -C2 || trueRepository: openshift/cluster-bootstrap
Length of output: 268
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "=== Root listing ==="
ls -la
echo "=== Find Dockerfile/Containerfile candidates (broad) ==="
cand="$(fd -t f -a \
-e node_modules -e dist -e build -e .git \
-i "Dockerfile" "Containerfile" "Dockerfile.*" 2>/dev/null || true)"
# fd -i doesn't accept multiple name args reliably across versions; also do explicit patterns:
cand2="$( { fd -t f -a -i 'dockerfile*' -e node_modules -e dist -e build -e .git 2>/dev/null || true; } )"
cand3="$( { fd -t f -a -i 'containerfile*' -e node_modules -e dist -e build -e .git 2>/dev/null || true; } )"
# Union
files="$( (printf "%s\n" "$cand" "$cand2" "$cand3" | sed '/^$/d' | sort -u) )"
echo "$files" | sed -n '1,200p'
echo "Total candidates: $(echo "$files" | wc -l | tr -d ' ')"
echo "=== Search matches for registry sources in candidate set ==="
if [ -n "$files" ]; then
echo "---- Matches for specific builder image ----"
echo "$files" | xargs -r rg -n "FROM[[:space:]]+registry\.ci\.openshift\.org/ocp/builder" -C2 || true
echo "---- Matches for catalog.redhat.com ----"
echo "$files" | xargs -r rg -n "FROM[[:space:]]+.*catalog\.redhat\.com" -C2 || true
echo "---- Matches for registry.ci.openshift.org ----"
echo "$files" | xargs -r rg -n "FROM[[:space:]]+.*registry\.ci\.openshift\.org" -C2 || true
else
echo "No Dockerfile/Containerfile candidates found."
fi
echo "=== Search for 'FROM registry.ci.openshift.org/ocp/builder' anywhere (name-agnostic) ==="
rg -n "FROM[[:space:]]+registry\.ci\.openshift\.org/ocp/builder" -C2 . || trueRepository: openshift/cluster-bootstrap
Length of output: 1560
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "=== Dockerfile FROM lines ==="
rg -n "^FROM " Dockerfile || true
echo "=== Dockerfile first 220 lines (for final stage base image) ==="
nl -ba Dockerfile | sed -n '1,220p'Repository: openshift/cluster-bootstrap
Length of output: 367
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "=== Dockerfile (numbered) ==="
cat -n Dockerfile | sed -n '1,160p'Repository: openshift/cluster-bootstrap
Length of output: 764
Fix Dockerfile base image source to use catalog.redhat.com (UBI minimal/distroless)
The root Dockerfile pulls base images from registry.ci.openshift.org for both stages (registry.ci.openshift.org/ocp/builder:... and registry.ci.openshift.org/ocp/5.0:base-rhel9), which conflicts with the guideline requiring UBI minimal or distroless images from catalog.redhat.com. Update the base images (or use an approved exception).
🧰 Tools
🪛 Trivy (0.69.3)
[error] 1-1: Image user should not be 'root'
Specify at least 1 USER command in Dockerfile with non-root user as argument
Rule: DS-0002
(IaC/Dockerfile)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@Dockerfile` at line 1, The Dockerfile uses base images from
registry.ci.openshift.org; update the FROM lines to use approved UBI minimal or
distroless images from catalog.redhat.com (or document an approved exception).
Specifically replace the builder stage image reference (the FROM line currently
referencing
registry.ci.openshift.org/ocp/builder:rhel-9-golang-1.26-openshift-5.0) and any
runtime stage image (e.g., the one currently using
registry.ci.openshift.org/ocp/5.0:base-rhel9) with the equivalent
catalog.redhat.com UBI minimal or distroless tags, ensuring the Go toolchain and
runtime dependencies are present or installed as needed.
| FROM registry.ci.openshift.org/ocp/builder:rhel-9-golang-1.25-openshift-4.22 AS builder | ||
| FROM registry.ci.openshift.org/ocp/builder:rhel-9-golang-1.26-openshift-5.0 AS builder | ||
| WORKDIR /go/src/github.com/openshift/cluster-bootstrap | ||
| COPY . . |
There was a problem hiding this comment.
Copy specific files instead of entire context.
COPY . . copies the entire build context, which may include unnecessary files, .git directories, or sensitive data. As per coding guidelines, "COPY specific files, not entire context."
📦 Proposed fix to copy specific directories
-COPY . .
+COPY go.mod go.sum ./
+COPY cmd/ ./cmd/
+COPY pkg/ ./pkg/
+COPY vendor/ ./vendor/Adjust the paths based on your actual project structure. Consider using a .dockerignore file as an additional safeguard.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@Dockerfile` at line 3, Replace the broad COPY . . in the Dockerfile with
explicit COPY statements for only the needed files/directories (e.g., source
dir, package.json, lockfile, build artifacts) and ensure a .dockerignore exists
to exclude .git, node_modules, secrets, and other irrelevant files; update the
Dockerfile's build steps (the COPY instruction and any related RUN steps) to
reference those specific paths so the image context is minimal and
sensitive/unnecessary files are not included.
|
ART wants to connect issue OCPBUGS-87557 to this PR, but found it is currently hooked up to ['OCPBUGS-87218']. Please consult with #forum-ocp-art if it is not clear what there is to do. |
|
@openshift-bot: This pull request references Jira Issue OCPBUGS-87218, which is invalid:
Comment DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
1 similar comment
|
@openshift-bot: This pull request references Jira Issue OCPBUGS-87218, which is invalid:
Comment DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
@openshift-bot: This pull request references Jira Issue OCPBUGS-87218, which is invalid:
Comment Retaining the jira/valid-bug label as it was manually added. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
Scheduling required tests: |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: sanchezl The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
@openshift-bot: all tests passed! Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
|
@openshift-bot: This pull request references Jira Issue OCPBUGS-87218, which is invalid:
Comment Retaining the jira/valid-bug label as it was manually added. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
Updating ose-cluster-bootstrap-container image to be consistent with ART for 5.0
TLDR:
Product builds by ART can be configured for different base and builder images than corresponding CI
builds. This automated PR requests a change to CI configuration to align with ART's configuration;
please take steps to merge it quickly or contact ART to coordinate changes.
The configuration in the following ART component metadata is driving this alignment request:
ose-cluster-bootstrap.yml.
Detail:
This repository is out of sync with the downstream product builds for this component. The CI
configuration for at least one image differs from ART's expected product configuration. This should
be addressed to ensure that the component's CI testing accurate reflects what customers will
experience.
Most of these PRs are opened as an ART-driven proposal to migrate base image or builder(s) to a
different version, usually prior to GA. The intent is to effect changes in both configurations
simultaneously without breaking either CI or ART builds, so usually ART builds are configured to
consider CI as canonical and attempt to match CI config until the PR merges to align both. ART may
also configure changes in GA releases with CI remaining canonical for a brief grace period to enable
CI to succeed and the alignment PR to merge. In either case, ART configuration will be made
canonical at some point (typically at branch-cut before GA or release dev-cut after GA), so it is
important to align CI configuration as soon as possible.
PRs are also triggered when CI configuration changes without ART coordination, for instance to
change the number of builder images or to use a different golang version. These changes should be
coordinated with ART; whether ART configuration is canonical or not, preferably it would be updated
first to enable the changes to occur simultaneously in both CI and ART at the same time. This also
gives ART a chance to validate the intended changes first. For instance, ART compiles most
components with the Golang version being used by the control plane for a given OpenShift release.
Exceptions to this convention (i.e. you believe your component must be compiled with a Golang
version independent from the control plane) must be granted by the OpenShift staff engineers and
communicated to the ART team.
Roles & Responsibilities:
tests OR that necessary metadata changes are reported to the ART team
in
#forum-ocp-arton Slack. If necessary, the changes required by this pull request can beintroduced with a separate PR opened by the component team. Once the repository is aligned,
this PR will be closed automatically.
verify-depsis complaining. In that case, please opena new PR with the dependency issues addressed (and base images bumped). ART-9595 for reference.
any required labels to ensure the PR merges once tests are passing. In cases where ART config is
canonical, downstream builds are already being built with these changes, and merging this PR
only improves the fidelity of our CI. In cases where ART config is not canonical, this provides
a grace period for the component team to align their CI with ART's configuration before it becomes
canonical in product builds.
ART has been configured to reconcile your CI build root image (see https://docs.ci.openshift.org/docs/architecture/ci-operator/#build-root-image).
In order for your upstream .ci-operator.yaml configuration to be honored, you must set the following in your openshift/release ci-operator configuration file:
Change behavior of future PRs:
set up automatically. This means that such a PR would merge without human intervention (and awareness!) in the future.
To do so, open a PR to set the
auto_labelattribute in the image configuration. ExampleUPSTREAM: <carry>:. An example.If you have any questions about this pull request, please reach out in the
#forum-ocp-artSlack channel.