OCPBUGS-87404: Updating ose-agent-installer-node-agent-container image to be consistent with ART for 5.0#1491
Conversation
57befd4 to
9ac8035
Compare
|
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 |
WalkthroughThis PR upgrades the build infrastructure to OpenShift 5.0 and Go 1.26. The CI operator configuration and Dockerfile base images are updated from the OpenShift 4.21 builder and runtime images to their OpenShift 5.0 equivalents with Go 1.26 support. ChangesInfrastructure Upgrade
🎯 1 (Trivial) | ⏱️ ~2 minutes Important Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional. ❌ Failed checks (1 error)
✅ Passed checks (14 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
@openshift-bot: This pull request references Jira Issue OCPBUGS-87404, 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. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: openshift-bot The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
@openshift-bot: This pull request references Jira Issue OCPBUGS-87404, 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: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
Dockerfile.ocp (1)
8-21:⚠️ Potential issue | 🔴 Critical | ⚡ Quick winAdd USER directive to run container as non-root.
The Dockerfile does not specify a USER directive, which means the container runs as root. The coding guidelines explicitly require "USER non-root; never run as root" for container security compliance.
🔒 Proposed fix to add non-root user
FROM registry.ci.openshift.org/ocp/5.0:base-rhel9 LABEL io.openshift.release.operator=true +RUN useradd -r -u 1001 -g 0 agent-user + COPY --from=builder /go/src/github.com/openshift/assisted-installer-agent/build/agent /usr/bin/agent RUN ln -s /usr/bin/agent /usr/bin/free_addresses && \ ln -s /usr/bin/agent /usr/bin/inventory && \ ln -s /usr/bin/agent /usr/bin/logs_sender && \ ln -s /usr/bin/agent /usr/bin/next_step_runner && \ ln -s /usr/bin/agent /usr/bin/disk_speed_check RUN if [ "$(arch)" = "x86_64" ]; then dnf install -y biosdevname dmidecode; fi RUN if [ "$(arch)" = "aarch64" ]; then dnf install -y dmidecode; fi RUN dnf install -y dhclient file findutils fio ipmitool iputils nmap openssh-clients podman chrony sg3_utils && dnf clean all + +USER 1001🤖 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.ocp` around lines 8 - 21, The Dockerfile currently leaves the container running as root (see COPY --from=builder /go/src/.../agent and the RUN ln -s ... symlink and package install RUNs); create a dedicated non-root user and group (e.g., uid 1000) and home, chown the installed binary and any required dirs to that user, perform all dnf install and other root-only steps before switching, then add a USER directive (USER <non-root-user> or USER 1000) at the end so the container runs non-root; ensure the symlinks and /usr/bin/agent ownership are set to the new user prior to the USER switch.Source: Coding guidelines
🤖 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.ocp`:
- Line 2: The Dockerfile.ocp uses internal OpenShift ART images in its FROM
lines (e.g., "FROM
registry.ci.openshift.org/ocp/builder:rhel-9-golang-1.26-openshift-5.0" and the
runtime base "ocp/5.0:base-rhel9"); update these base images to the approved UBI
minimal or distroless images hosted on catalog.redhat.com (replace the builder
and base FROM references with equivalent catalog.redhat.com UBI-minimal or
distroless tags) or, if ART/CI images are intentionally exempt, add an explicit
documented exception for those specific registry/image names in the repo
policy/config so reviewers know the exemption applies.
---
Outside diff comments:
In `@Dockerfile.ocp`:
- Around line 8-21: The Dockerfile currently leaves the container running as
root (see COPY --from=builder /go/src/.../agent and the RUN ln -s ... symlink
and package install RUNs); create a dedicated non-root user and group (e.g., uid
1000) and home, chown the installed binary and any required dirs to that user,
perform all dnf install and other root-only steps before switching, then add a
USER directive (USER <non-root-user> or USER 1000) at the end so the container
runs non-root; ensure the symlinks and /usr/bin/agent ownership are set to the
new user prior to the USER switch.
🪄 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: c2809735-73cd-424b-a154-23eb748dc2ab
📒 Files selected for processing (2)
.ci-operator.yamlDockerfile.ocp
| @@ -1,11 +1,11 @@ | |||
|
|
|||
| FROM registry.ci.openshift.org/ocp/builder:rhel-9-golang-1.25-openshift-4.21 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
# Check if the base images are UBI-based and verify their registry source
echo "=== Checking builder image ==="
skopeo inspect docker://registry.ci.openshift.org/ocp/builder:rhel-9-golang-1.26-openshift-5.0 | jq '{name: .Name, labels: .Labels}' || echo "Image not accessible without auth"
echo -e "\n=== Checking runtime base image ==="
skopeo inspect docker://registry.ci.openshift.org/ocp/5.0:base-rhel9 | jq '{name: .Name, labels: .Labels}' || echo "Image not accessible without auth"
echo -e "\n=== Checking if UBI images are available from catalog.redhat.com ==="
echo "UBI9 minimal: https://catalog.redhat.com/software/containers/ubi9/ubi-minimal"
echo "Verify if ART CI builds have exception to use registry.ci.openshift.org"Repository: openshift/assisted-installer-agent
Length of output: 474
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "=== Files matching Dockerfile.ocp ==="
fd -t f -g 'Dockerfile.ocp' . || true
echo "=== Relevant excerpt: Dockerfile.ocp ==="
if [ -f Dockerfile.ocp ]; then
nl -ba Dockerfile.ocp | sed -n '1,120p'
else
# try common locations
for f in $(fd -t f 'Dockerfile.ocp' .); do
echo "--- $f ---"
nl -ba "$f" | sed -n '1,160p'
done
fi
echo "=== Grep for USER / HEALTHCHECK / COPY . . ==="
if [ -f Dockerfile.ocp ]; then
rg -n '^\s*(USER|HEALTHCHECK)\b|^\s*COPY\s+\.\s+\.' Dockerfile.ocp || true
else
for f in $(fd -t f 'Dockerfile.ocp' .); do
echo "--- $f ---"
rg -n '^\s*(USER|HEALTHCHECK)\b|^\s*COPY\s+\.\s+\.' "$f" || true
done
fiRepository: openshift/assisted-installer-agent
Length of output: 235
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "=== Dockerfile.ocp excerpt (first 120 lines, with line numbers) ==="
if [ -f Dockerfile.ocp ]; then
cat -n Dockerfile.ocp | sed -n '1,120p'
else
echo "Dockerfile.ocp not found"
exit 1
fi
echo -e "\n=== Grep for USER / HEALTHCHECK / COPY . . ==="
rg -n '^\s*USER\b|^\s*HEALTHCHECK\b|^\s*COPY\s+\.\s+\.' Dockerfile.ocp || trueRepository: openshift/assisted-installer-agent
Length of output: 1259
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "=== USER occurrences ==="
rg -n '^\s*USER\b' Dockerfile.ocp || true
echo -e "\n=== HEALTHCHECK occurrences ==="
rg -n '^\s*HEALTHCHECK\b' Dockerfile.ocp || true
echo -e "\n=== COPY . . occurrences ==="
rg -n '^\s*COPY\s+\.\s+\.' Dockerfile.ocp || trueRepository: openshift/assisted-installer-agent
Length of output: 178
🌐 Web query:
What is registry.ci.openshift.org/ocp/5.0:base-rhel9 (OpenShift CI image) UBI minimal distroless?
💡 Result:
The image registry.ci.openshift.org/ocp/5.0:base-rhel9 is an internal base image used by the OpenShift CI system for building and testing OpenShift components [1][2]. It is not a public UBI minimal or distroless image in the general-purpose sense [3]. Instead, it serves as a specialized, internal RHEL 9-based container image maintained by the OpenShift Automated Release Team (ART) [4][5]. These images are designed to provide a consistent environment for OpenShift product builds and CI pipelines, ensuring that the components tested in CI match the downstream product environment [4][2][5]. Key characteristics include: - Internal Availability: These images reside in the internal OpenShift CI registry (registry.ci.openshift.org) and are generally intended for use by Red Hat's internal build systems and CI pipelines [3]. - RHEL 9 Foundation: It is based on Red Hat Enterprise Linux 9, providing the necessary operating system foundation for OpenShift components [2][3][5]. - Alignment with Product Builds: The configuration and content of these images are tightly managed to stay synchronized with official product build configurations, often addressed through automated PRs when drifts are detected [4][5]. - Purpose: It acts as a base layer for various OpenShift component builds (such as controllers, operators, and agents) that require a stable, enterprise-aligned environment [2]. While the industry often uses "distroless" or "minimal" images to reduce attack surfaces, this specific image is a managed, enterprise-supported base image specifically configured for OpenShift's complex build requirements [4][5]. Users looking for public RHEL-based minimal images for their own projects should use the official UBI (Universal Base Image) Minimal images available on the Red Hat Container Registry (registry.access.redhat.com) [3][6].
Citations:
- 1: https://docs.ci.openshift.org/docs/architecture/ci-operator/
- 2: https://docs.ci.openshift.org/architecture/images/
- 3: OCPBUILD-174: Clean Up Containerfiles builder#414
- 4: OCPBUGS-72552: Updating openshift-enterprise-base-rhel9-minimal-container image to be consistent with ART for 4.22 images#220
- 5: OCPBUGS-45342: Updating openshift-enterprise-base-rhel9-container image to be consistent with ART for 4.19 images#200
- 6: KFLUXSPRT-5246: update base images from RHEL9 ELS to UBI9 minimal 9.4 hypershift#6916
🌐 Web query:
What is registry.ci.openshift.org/ocp/builder:rhel-9-golang-1.26-openshift-5.0 image based on?
💡 Result:
The container image registry.ci.openshift.org/ocp/builder:rhel-9-golang-1.26-openshift-5.0 is an OpenShift builder image [1]. As indicated by its tag, it is based on Red Hat Enterprise Linux 9 (RHEL 9) [1] and includes the Go 1.26 programming language environment [1]. These builder images are maintained by the OpenShift team for use within the OpenShift CI/CD pipeline [1][2]. They are specifically configured to provide the necessary tooling and environment to build OpenShift components [1][3]. While they are RHEL 9-based, they are distinct from standard RHEL Go Toolset images [4], as they are tailored for the OpenShift release process and infrastructure requirements [1][5]. They are frequently referenced in component Dockerfiles and CI operator configurations to ensure consistent build environments across the OpenShift project [2][3][6][7].
Citations:
- 1: https://docs.ci.openshift.org/architecture/images/
- 2: https://docs.ci.openshift.org/docs/architecture/ci-operator/
- 3: https://github.com/openshift/builder/blob/main/Dockerfile.rhel8
- 4: https://docs.redhat.com/en/documentation/red_hat_developer_tools/1/html/using_go_1.26.2_toolset/container-images-with-go-toolset
- 5: openshift/builder@ff595e4...9ed70da
- 6: https://github.com/openshift/oc/blob/main/images/cli/Dockerfile.rhel
- 7: NO-JIRA: ci: update build root image to Go 1.25 hypershift#7584
Update Dockerfile.ocp base images to meet prodsec-skills (UBI minimal/distroless from catalog.redhat.com)
Dockerfile.ocplines 2 and 8 useregistry.ci.openshift.orgOpenShift ART/internal images (ocp/builder:rhel-9-golang-1.26-openshift-5.0andocp/5.0:base-rhel9), which are internal RHEL 9-based CI base images—not UBI minimal or distroless images fromcatalog.redhat.com.- If ART/CI builds are exempt from the UBI-minimal/distroless requirement, the exception should explicitly cover these images/registries; otherwise, switch to the required UBI minimal/distroless bases.
🤖 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.ocp` at line 2, The Dockerfile.ocp uses internal OpenShift ART
images in its FROM lines (e.g., "FROM
registry.ci.openshift.org/ocp/builder:rhel-9-golang-1.26-openshift-5.0" and the
runtime base "ocp/5.0:base-rhel9"); update these base images to the approved UBI
minimal or distroless images hosted on catalog.redhat.com (replace the builder
and base FROM references with equivalent catalog.redhat.com UBI-minimal or
distroless tags) or, if ART/CI images are intentionally exempt, add an explicit
documented exception for those specific registry/image names in the repo
policy/config so reviewers know the exemption applies.
Source: Coding guidelines
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1491 +/- ##
==========================================
+ Coverage 55.78% 55.83% +0.04%
==========================================
Files 89 89
Lines 4508 4508
==========================================
+ Hits 2515 2517 +2
+ Misses 1802 1801 -1
+ Partials 191 190 -1 🚀 New features to boost your workflow:
|
|
@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. |
|
ART wants to connect issue OCPBUGS-87690 to this PR, but found it is currently hooked up to ['OCPBUGS-87404']. Please consult with #forum-ocp-art if it is not clear what there is to do. |
Updating ose-agent-installer-node-agent-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-agent-installer-node-agent.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.