Skip to content

MGMT-24453: upgrade to golang 1.26#2171

Open
shay23bra wants to merge 1 commit into
openshift:masterfrom
shay23bra:MGMT-24453-upgrade-golang-1.26
Open

MGMT-24453: upgrade to golang 1.26#2171
shay23bra wants to merge 1 commit into
openshift:masterfrom
shay23bra:MGMT-24453-upgrade-golang-1.26

Conversation

@shay23bra

@shay23bra shay23bra commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Upgrade Go version from 1.25 to 1.26 in go.mod and Dockerfiles
  • Update toolchain to go1.26.2
  • Bump golangci-lint from v2.8.0 to v2.11.4

https://redhat.atlassian.net/browse/MGMT-24453

Summary by CodeRabbit

  • Chores
    • Upgraded Go toolchain from version 1.25 to 1.26 across all build systems and CI pipelines.
    • Updated build container images and associated linting tools to support the new Go version.
    • Refined code quality checks with updated linter configurations.

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Jun 3, 2026
@openshift-ci-robot

openshift-ci-robot commented Jun 3, 2026

Copy link
Copy Markdown

@shay23bra: This pull request references MGMT-24453 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the task to target the "5.0.0" version, but no target version was set.

Details

In response to this:

Summary

  • Upgrade Go version from 1.25 to 1.26 in go.mod and Dockerfiles
  • Update toolchain to go1.26.2

https://redhat.atlassian.net/browse/MGMT-24453

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.

@coderabbitai

coderabbitai Bot commented Jun 3, 2026

Copy link
Copy Markdown

Walkthrough

This pull request upgrades the Go toolchain from 1.25 to 1.26 across the repository: go.mod toolchain directives, the CI operator build image, and builder-stage images in nine Dockerfiles (one Dockerfile also updates the golangci-lint installer version to v2.11.4).

Changes

Go 1.26 toolchain upgrade

Layer / File(s) Summary
Go module version declaration
go.mod
go directive updated to 1.26.0 and toolchain directive updated to go1.26.2.
CI operator build image tag
.ci-operator.yaml
build_root_image tag bumped from rhel-9-release-golang-1.25-openshift-4.21rhel-9-release-golang-1.26-openshift-5.0.
Dockerfile builder images and linter installer
Dockerfile.assisted-installer-build, Dockerfile.assisted-installer, Dockerfile.assisted-installer-controller, Dockerfile.assisted-installer-controller-downstream, Dockerfile.assisted-installer-controller-mce, Dockerfile.assisted-installer-controller.ocp, Dockerfile.assisted-installer-downstream, Dockerfile.assisted-installer-mce, Dockerfile.assisted-installer.ocp
All builder-stage base images bumped from Go toolset 1.251.26 (OCP variants updated to the corresponding OpenShift 5.0 golang builder). Dockerfile.assisted-installer-build additionally updates golangci-lint installer to v2.11.4.
GolangCI GoSec excludes
.golangci.yml
Added G118 to the GoSec excludes list.

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 5 | ❌ 10

❌ Failed checks (10 inconclusive)

Check name Status Explanation Resolution
Stable And Deterministic Test Names ❓ Inconclusive Repository clone failed, so this custom check could not run with code access. Retry the review run. If this persists, inspect pre-merge custom-check logs for infrastructure or agent runtime failures.
Test Structure And Quality ❓ Inconclusive Repository clone failed, so this custom check could not run with code access. Retry the review run. If this persists, inspect pre-merge custom-check logs for infrastructure or agent runtime failures.
Microshift Test Compatibility ❓ Inconclusive Repository clone failed, so this custom check could not run with code access. Retry the review run. If this persists, inspect pre-merge custom-check logs for infrastructure or agent runtime failures.
Single Node Openshift (Sno) Test Compatibility ❓ Inconclusive Repository clone failed, so this custom check could not run with code access. Retry the review run. If this persists, inspect pre-merge custom-check logs for infrastructure or agent runtime failures.
Topology-Aware Scheduling Compatibility ❓ Inconclusive Repository clone failed, so this custom check could not run with code access. Retry the review run. If this persists, inspect pre-merge custom-check logs for infrastructure or agent runtime failures.
Ote Binary Stdout Contract ❓ Inconclusive Repository clone failed, so this custom check could not run with code access. Retry the review run. If this persists, inspect pre-merge custom-check logs for infrastructure or agent runtime failures.
Ipv6 And Disconnected Network Test Compatibility ❓ Inconclusive Repository clone failed, so this custom check could not run with code access. Retry the review run. If this persists, inspect pre-merge custom-check logs for infrastructure or agent runtime failures.
No-Weak-Crypto ❓ Inconclusive Repository clone failed, so this custom check could not run with code access. Retry the review run. If this persists, inspect pre-merge custom-check logs for infrastructure or agent runtime failures.
Container-Privileges ❓ Inconclusive Repository clone failed, so this custom check could not run with code access. Retry the review run. If this persists, inspect pre-merge custom-check logs for infrastructure or agent runtime failures.
No-Sensitive-Data-In-Logs ❓ Inconclusive Repository clone failed, so this custom check could not run with code access. Retry the review run. If this persists, inspect pre-merge custom-check logs for infrastructure or agent runtime failures.
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and accurately summarizes the main change: upgrading Go from version 1.25 to 1.26 across the codebase, which is the primary objective reflected in all file modifications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

Review ran into problems

🔥 Problems

Git: Failed to clone repository. Please run the @coderabbitai full review command to re-trigger a full review. If the issue persists, set path_filters to include or exclude specific files.


Comment @coderabbitai help to get the list of available commands and usage tips.

@openshift-ci openshift-ci Bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Jun 3, 2026
@openshift-ci openshift-ci Bot requested review from CrystalChun and omertuc June 3, 2026 08:44
@openshift-ci openshift-ci Bot added the downstream-change-needed Requires updating downstream image label Jun 3, 2026
@openshift-ci

openshift-ci Bot commented Jun 3, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: shay23bra
Once this PR has been reviewed and has the lgtm label, please assign yoavsc0302 for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@codecov

codecov Bot commented Jun 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 48.82%. Comparing base (7c400e8) to head (09abbe1).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2171   +/-   ##
=======================================
  Coverage   48.82%   48.82%           
=======================================
  Files          20       20           
  Lines        4397     4397           
=======================================
  Hits         2147     2147           
  Misses       2026     2026           
  Partials      224      224           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

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 (8)
Dockerfile.assisted-installer-mce (3)

1-51: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Define a healthcheck for the final image.

This Dockerfile lacks HEALTHCHECK.

As per coding guidelines: "HEALTHCHECK defined."

🤖 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.assisted-installer-mce` around lines 1 - 51, Add a HEALTHCHECK to
the final image: in the final stage (after ENTRYPOINT and COPY of /installer)
add a HEALTHCHECK instruction that runs a lightweight command against the
running binary (e.g., invoking /installer's health probe or checking a local
HTTP endpoint or PID) with sensible interval, timeout and retries; ensure the
instruction references the installed binary (/installer) or its health endpoint
so container platforms can detect service health.

15-15: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Scope COPY to required files only.

This copies the full repository context into the image build context.

As per coding guidelines: "COPY specific files, not entire context."

🤖 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.assisted-installer-mce` at line 15, The Dockerfile currently uses
a broad COPY --chown=${USER_UID} . /app which pulls the entire repo into the
image; change this to copy only the required artifacts (e.g., specific files and
directories like package.json, package-lock.json, src/, bin/, build outputs, or
other runtime assets) by replacing the single-dot COPY with explicit COPY lines
(still using --chown=${USER_UID}) for each needed file/dir and add/verify a
.dockerignore to exclude everything else; update the COPY statement in
Dockerfile.assisted-installer-mce (the COPY --chown=${USER_UID} . /app line)
accordingly and ensure the build context contains the listed files.

20-30: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Set a non-root runtime user and add a HEALTHCHECK to the final image.

  • The final (ubi-minimal) stage has no USER, so the container runs as root by default.
  • There is no HEALTHCHECK directive in the Dockerfile.
  • The only COPY ... . /app happens in the builder stage (COPY --chown=${USER_UID} . /app); if the guideline is meant to apply to runtime only, this part is not in the final stage.
🤖 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.assisted-installer-mce` around lines 20 - 30, Add a non-root
runtime user in the final image and a HEALTHCHECK: create a dedicated user/group
(e.g., installer user) in the final stage, ensure ownership of runtime assets
copied into the image (chown /installer and /assisted-installer-controller or
recreate files with correct ownership), switch to that user with USER before the
ENTRYPOINT, and add a HEALTHCHECK directive that probes the running service
(return non-zero on failure) to allow container health monitoring; reference the
final-stage artifacts (/installer, /assisted-installer-controller) and the
existing ENTRYPOINT when making these changes.
Dockerfile.assisted-installer-downstream (3)

13-13: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Avoid copying the entire build context.

COPY --chown=${USER_UID} . /app pulls everything from context; scope this to required files/directories.

As per coding guidelines: "COPY specific files, not entire context."

🤖 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.assisted-installer-downstream` at line 13, The Dockerfile
currently uses a broad COPY instruction ("COPY --chown=${USER_UID} . /app") that
copies the entire build context; change it to copy only the required files and
directories (e.g., specific source dirs, package files, build artifacts) using
explicit COPY lines with the same --chown=${USER_UID} and target /app (or
subpaths) so unintended files aren’t included; update any related build steps
that expect those files and remove the blanket "COPY --chown=${USER_UID} . /app"
entry.

1-48: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Add a container healthcheck.

No HEALTHCHECK is defined for this image.

As per coding guidelines: "HEALTHCHECK defined."

🤖 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.assisted-installer-downstream` around lines 1 - 48, Add a Docker
HEALTHCHECK after the existing ENTRYPOINT to satisfy the "HEALTHCHECK defined"
guideline: for this image (ENTRYPOINT ["/installer"]) add a HEALTHCHECK stanza
(e.g., HEALTHCHECK --interval=30s --timeout=5s --start-period=30s CMD pgrep -f
/installer >/dev/null || exit 1) so the container runtime can detect unhealthy
/installer processes; update the Dockerfile.assisted-installer-downstream by
inserting that HEALTHCHECK instruction after the ENTRYPOINT line.

17-28: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Run the final stage as non-root
Dockerfile.assisted-installer-downstream’s runtime stage (the ubi-minimal FROM ...) has no USER instruction, so it will run as root by default.

🤖 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.assisted-installer-downstream` around lines 17 - 28, The final
image stage runs as root because there is no USER set; create a non-root user
and switch to it in this runtime stage: add creation of a dedicated unprivileged
user (e.g., installer or appuser) and group, chown the copied runtime artifacts
(/installer and /assisted-installer-controller/deploy) to that user, and then
add a USER instruction before the ENTRYPOINT so ENTRYPOINT ["/installer"] runs
non-root; ensure file permissions allow execution by that user.
Dockerfile.assisted-installer.ocp (2)

10-18: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Add a HEALTHCHECK to the runtime image.

The final stage does not define a healthcheck.

As per coding guidelines: "HEALTHCHECK defined."

🤖 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.assisted-installer.ocp` around lines 10 - 18, The final image
stage is missing a HEALTHCHECK; add a Docker HEALTHCHECK instruction to the
runtime stage (the stage that sets ENTRYPOINT [/usr/bin/installer] and copies
/usr/bin/installer and /assisted-installer-controller/deploy) that performs a
lightweight readiness probe (for example, an HTTP GET against the service
readiness endpoint or invoking a built-in health command on /usr/bin/installer),
and configure sensible parameters (interval, timeout, start-period, retries) so
container orchestration can detect unhealthy containers.

10-18: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Runtime stage still runs as root by default.

No USER instruction is set in the final stage.

As per coding guidelines: "USER non-root; never run as root."

🤖 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.assisted-installer.ocp` around lines 10 - 18, The final stage of
the Dockerfile runs as root because there is no USER instruction; modify the
final stage (after the COPY lines and before ENTRYPOINT) to switch to a non-root
user: create or use a dedicated non-root user (or UID/GID), ensure the copied
binaries (/usr/bin/installer and /assisted-installer-controller/deploy) are
owned/accessible by that user (use chown in the COPY or run chown/chmod
earlier), and then add USER <non-root-user-or-uid> so ENTRYPOINT
["/usr/bin/installer"] runs without root privileges.
🤖 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.assisted-installer.ocp`:
- Line 1: Update the Dockerfile base image and runtime security directives:
replace the tag-only FROM registry.ci.openshift.org image with a
catalog.redhat.com UBI or approved distroless base (update the FROM instruction
identified by the current builder stage), pin to a digest, avoid using tag-only
image sources; do not rely on root—add a non-root USER instruction and ensure
any build-only user changes happen in the builder stage; add a HEALTHCHECK
instruction to provide runtime liveness information; and stop using COPY . . —
change the COPY that currently copies the entire build context to copy only the
specific source/artifacts needed for the build.

---

Outside diff comments:
In `@Dockerfile.assisted-installer-downstream`:
- Line 13: The Dockerfile currently uses a broad COPY instruction ("COPY
--chown=${USER_UID} . /app") that copies the entire build context; change it to
copy only the required files and directories (e.g., specific source dirs,
package files, build artifacts) using explicit COPY lines with the same
--chown=${USER_UID} and target /app (or subpaths) so unintended files aren’t
included; update any related build steps that expect those files and remove the
blanket "COPY --chown=${USER_UID} . /app" entry.
- Around line 1-48: Add a Docker HEALTHCHECK after the existing ENTRYPOINT to
satisfy the "HEALTHCHECK defined" guideline: for this image (ENTRYPOINT
["/installer"]) add a HEALTHCHECK stanza (e.g., HEALTHCHECK --interval=30s
--timeout=5s --start-period=30s CMD pgrep -f /installer >/dev/null || exit 1) so
the container runtime can detect unhealthy /installer processes; update the
Dockerfile.assisted-installer-downstream by inserting that HEALTHCHECK
instruction after the ENTRYPOINT line.
- Around line 17-28: The final image stage runs as root because there is no USER
set; create a non-root user and switch to it in this runtime stage: add creation
of a dedicated unprivileged user (e.g., installer or appuser) and group, chown
the copied runtime artifacts (/installer and
/assisted-installer-controller/deploy) to that user, and then add a USER
instruction before the ENTRYPOINT so ENTRYPOINT ["/installer"] runs non-root;
ensure file permissions allow execution by that user.

In `@Dockerfile.assisted-installer-mce`:
- Around line 1-51: Add a HEALTHCHECK to the final image: in the final stage
(after ENTRYPOINT and COPY of /installer) add a HEALTHCHECK instruction that
runs a lightweight command against the running binary (e.g., invoking
/installer's health probe or checking a local HTTP endpoint or PID) with
sensible interval, timeout and retries; ensure the instruction references the
installed binary (/installer) or its health endpoint so container platforms can
detect service health.
- Line 15: The Dockerfile currently uses a broad COPY --chown=${USER_UID} . /app
which pulls the entire repo into the image; change this to copy only the
required artifacts (e.g., specific files and directories like package.json,
package-lock.json, src/, bin/, build outputs, or other runtime assets) by
replacing the single-dot COPY with explicit COPY lines (still using
--chown=${USER_UID}) for each needed file/dir and add/verify a .dockerignore to
exclude everything else; update the COPY statement in
Dockerfile.assisted-installer-mce (the COPY --chown=${USER_UID} . /app line)
accordingly and ensure the build context contains the listed files.
- Around line 20-30: Add a non-root runtime user in the final image and a
HEALTHCHECK: create a dedicated user/group (e.g., installer user) in the final
stage, ensure ownership of runtime assets copied into the image (chown
/installer and /assisted-installer-controller or recreate files with correct
ownership), switch to that user with USER before the ENTRYPOINT, and add a
HEALTHCHECK directive that probes the running service (return non-zero on
failure) to allow container health monitoring; reference the final-stage
artifacts (/installer, /assisted-installer-controller) and the existing
ENTRYPOINT when making these changes.

In `@Dockerfile.assisted-installer.ocp`:
- Around line 10-18: The final image stage is missing a HEALTHCHECK; add a
Docker HEALTHCHECK instruction to the runtime stage (the stage that sets
ENTRYPOINT [/usr/bin/installer] and copies /usr/bin/installer and
/assisted-installer-controller/deploy) that performs a lightweight readiness
probe (for example, an HTTP GET against the service readiness endpoint or
invoking a built-in health command on /usr/bin/installer), and configure
sensible parameters (interval, timeout, start-period, retries) so container
orchestration can detect unhealthy containers.
- Around line 10-18: The final stage of the Dockerfile runs as root because
there is no USER instruction; modify the final stage (after the COPY lines and
before ENTRYPOINT) to switch to a non-root user: create or use a dedicated
non-root user (or UID/GID), ensure the copied binaries (/usr/bin/installer and
/assisted-installer-controller/deploy) are owned/accessible by that user (use
chown in the COPY or run chown/chmod earlier), and then add USER
<non-root-user-or-uid> so ENTRYPOINT ["/usr/bin/installer"] runs without root
privileges.
🪄 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: 172fffc3-0a28-4a42-9258-4291981b206d

📥 Commits

Reviewing files that changed from the base of the PR and between 7c400e8 and 42d8a2f.

📒 Files selected for processing (11)
  • .ci-operator.yaml
  • Dockerfile.assisted-installer
  • Dockerfile.assisted-installer-build
  • Dockerfile.assisted-installer-controller
  • Dockerfile.assisted-installer-controller-downstream
  • Dockerfile.assisted-installer-controller-mce
  • Dockerfile.assisted-installer-controller.ocp
  • Dockerfile.assisted-installer-downstream
  • Dockerfile.assisted-installer-mce
  • Dockerfile.assisted-installer.ocp
  • go.mod

@@ -1,4 +1,4 @@
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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | 🏗️ Heavy lift

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Inspect base images and whether they are digest pinned
nl -ba Dockerfile.assisted-installer.ocp | sed -n '1,12p'

Repository: openshift/assisted-installer

Length of output: 113


🏁 Script executed:

#!/bin/bash
set -euo pipefail

FILE="Dockerfile.assisted-installer.ocp"
echo "== File =="
ls -la "$FILE" || true
echo "== Line count =="
wc -l "$FILE" || true
echo "== First 80 lines =="
sed -n '1,80p' "$FILE" || true
echo "== Lines containing key directives =="
rg -n "^(FROM|USER|HEALTHCHECK|COPY|RUN|ARG|ENV)" "$FILE" || true
echo "== FROM lines (all stages) =="
rg -n "^FROM " "$FILE" || true

Repository: openshift/assisted-installer

Length of output: 1482


Fix container base image policy and missing runtime security directives in Dockerfile.assisted-installer.ocp.

FROM registry.ci.openshift.org/ocp/builder:rhel-9-golang-1.26-openshift-5.0 AS builder
  • Base images are from registry.ci.openshift.org and are tag-only (no digest pinning), not catalog.redhat.com UBI/distroless.
  • No USER is set (runtime defaults to root).
  • No HEALTHCHECK is defined.
  • COPY . . copies the entire build context instead of specific files.
🤖 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.assisted-installer.ocp` at line 1, Update the Dockerfile base
image and runtime security directives: replace the tag-only FROM
registry.ci.openshift.org image with a catalog.redhat.com UBI or approved
distroless base (update the FROM instruction identified by the current builder
stage), pin to a digest, avoid using tag-only image sources; do not rely on
root—add a non-root USER instruction and ensure any build-only user changes
happen in the builder stage; add a HEALTHCHECK instruction to provide runtime
liveness information; and stop using COPY . . — change the COPY that currently
copies the entire build context to copy only the specific source/artifacts
needed for the build.

@shay23bra shay23bra force-pushed the MGMT-24453-upgrade-golang-1.26 branch 2 times, most recently from 7eb73c7 to 1107df4 Compare June 3, 2026 11:04

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
Dockerfile.assisted-installer-controller.ocp (1)

9-17: 🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win

Add runtime security directives to the final stage.

The runtime stage is missing:

  • USER directive (defaults to root)
  • HEALTHCHECK instruction

Additionally, line 6 uses COPY . . which copies the entire build context instead of specific files.

As per coding guidelines, containers should run as non-root, include health checks, and copy only necessary files.

🛡️ Recommended security improvements
 FROM registry.ci.openshift.org/ocp/4.21:base-rhel9
 
 LABEL io.openshift.release.operator=true
 
 COPY --from=builder /go/src/github.com/openshift/assisted-installer/build/assisted-installer-controller /usr/bin/assisted-installer-controller
 RUN dnf install -y --nodocs --setopt=install_weak_deps=False openshift-clients \
   && dnf clean all && rm -rf /var/cache/*
 
+# Create non-root user
+RUN useradd -u 1001 -r -g 0 -s /sbin/nologin controller
+
+USER 1001
+
+HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
+  CMD ["/usr/bin/assisted-installer-controller", "--health-check"] || exit 1
+
 ENTRYPOINT ["/usr/bin/assisted-installer-controller"]

For the builder stage at line 6:

-COPY . .
+COPY go.mod go.sum ./
+COPY cmd/ cmd/
+COPY pkg/ pkg/
+COPY vendor/ vendor/

Note: Adjust the HEALTHCHECK and COPY paths to match your actual application structure.

As per coding guidelines for container security.

🤖 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.assisted-installer-controller.ocp` around lines 9 - 17, The final
image should run non-root and include a healthcheck and narrow COPYs: replace
any broad COPY . . usage in the builder/final stage with explicit file copies
(e.g., copying only the built binary and required assets instead of the whole
context), add a USER directive (e.g., create or switch to a non-root account and
add USER <username|uid>) before ENTRYPOINT, and add a HEALTHCHECK instruction
that exercises the service (for example an HTTP GET or exec that checks /health)
referencing the existing ENTRYPOINT (/usr/bin/assisted-installer-controller) so
the container reports liveness; ensure file ownership/permissions allow the
non-root user to execute the binary.
Dockerfile.assisted-installer-build (1)

13-34: ⚠️ Potential issue | 🟠 Major | 🏗️ Heavy lift

Address container security violations in the final stage.

The final stage has multiple security issues:

  • Line 13: Base image is quay.io/centos/centos:stream9, not UBI minimal or distroless from catalog.redhat.com
  • No USER directive (defaults to root)
  • No HEALTHCHECK defined
  • Lines 31-32: COPY --from=golang $GOPATH $GOPATH and COPY --from=golang $GOROOT $GOROOT copy entire directories instead of specific files

As per coding guidelines, production container images should use UBI minimal or distroless base images, run as non-root, include health checks, and copy only necessary files.

🛡️ Recommended security improvements

Consider these changes to align with container security guidelines:

  1. Replace the base image with UBI minimal:
-FROM quay.io/centos/centos:stream9
+FROM registry.access.redhat.com/ubi9/ubi-minimal:latest
  1. Add a non-root user:
+RUN microdnf install -y shadow-utils && \
+    useradd -u 1001 -r -g 0 -s /sbin/nologin builder && \
+    microdnf remove shadow-utils && \
+    microdnf clean all
  1. Set USER before COPY commands:
+USER 1001
  1. Add a HEALTHCHECK if applicable to your build environment.

As per coding guidelines for container security.

🤖 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.assisted-installer-build` around lines 13 - 34, The final build
stage uses an insecure base and copies entire Go directories as root; update the
Dockerfile to use a UBI minimal or distroless base instead of
quay.io/centos/centos:stream9, create and switch to a non-root user via a USER
directive (add user/group and set ownership) before any COPY operations, replace
the broad COPY --from=golang $GOPATH $GOPATH and COPY --from=golang $GOROOT
$GOROOT with copying only the required binaries/artifacts (referencing the COPY
--from=golang entries), and add an appropriate HEALTHCHECK line; ensure ENV
GOROOT/GOPATH remain correct and adjust file ownership/permissions for the
non-root user.
Dockerfile.assisted-installer-controller (1)

22-37: 🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win

Add runtime security directives to the final stage.

The runtime stage is missing:

  • USER directive (defaults to root)
  • HEALTHCHECK instruction

As per coding guidelines, containers should run as non-root and include health checks.

🛡️ Recommended security improvements
 FROM registry.access.redhat.com/ubi9/ubi-minimal:latest@sha256:6fc28bcb6776e387d7a35a2056d9d2b985dc4e26031e98a2bd35a7137cd6fd71
 ARG TARGETPLATFORM
 
 RUN microdnf install -y tar gzip rsync which procps-ng findutils && microdnf clean all
+
+# Create non-root user
+RUN microdnf install -y shadow-utils && \
+    useradd -u 1001 -r -g 0 -s /sbin/nologin controller && \
+    microdnf remove shadow-utils && \
+    microdnf clean all
 
 # openshift clients
 RUN case $TARGETPLATFORM in "") platform=amd64;; *) platform=`echo $TARGETPLATFORM | sed 's#linux/##'` ;; esac ; \
     curl -k -L -s "https://mirror.openshift.com/pub/openshift-v4/multi/clients/ocp/latest/amd64/openshift-client-linux-${platform}-rhel9.tar.gz" | tar xvz -C /usr/bin; \
     chmod +x /usr/bin/oc /usr/bin/kubectl
 
 COPY --from=builder /go/src/github.com/openshift/assisted-installer/build/assisted-installer-controller /usr/bin/assisted-installer-controller
 
 # Copy the commit reference from the builder
 COPY --from=builder /commit-reference.txt /commit-reference.txt
 
+USER 1001
+
+HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
+  CMD ["/usr/bin/assisted-installer-controller", "--health-check"] || exit 1
+
 ENTRYPOINT ["/usr/bin/assisted-installer-controller"]

Note: Adjust the HEALTHCHECK command to match the actual health check endpoint/flag supported by your controller.

As per coding guidelines for container security.

🤖 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.assisted-installer-controller` around lines 22 - 37, The final
runtime stage in the Dockerfile for assisted-installer-controller is missing
required security directives. Update the last stage after the COPY steps to add
a non-root USER and a HEALTHCHECK using a command supported by
assisted-installer-controller so the container does not default to root and
exposes a liveness check. Keep the changes in the final stage only, and make
sure the USER and HEALTHCHECK are placed before ENTRYPOINT.
♻️ Duplicate comments (1)
Dockerfile.assisted-installer.ocp (1)

1-17: 🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win

Add runtime security directives; note that CI registry images are acceptable.

Similar to previous review comments, this Dockerfile is missing:

  • USER directive (defaults to root)
  • HEALTHCHECK instruction

Additionally, line 6 uses COPY . . which copies the entire build context.

Note: The use of registry.ci.openshift.org images with floating tags is acceptable per coding guidelines ("Red Hat images: use floating tags"). The previous comment's concern about using catalog.redhat.com does not apply to OpenShift CI internal builds.

🛡️ Recommended security improvements
 FROM registry.ci.openshift.org/ocp/4.21:base-rhel9
 
 LABEL io.openshift.release.operator=true
 
 COPY --from=builder /go/src/github.com/openshift/assisted-installer/build/installer /usr/bin/installer
 COPY --from=builder /go/src/github.com/openshift/assisted-installer/deploy/assisted-installer-controller /assisted-installer-controller/deploy
 
+# Create non-root user
+RUN useradd -u 1001 -r -g 0 -s /sbin/nologin installer
+
+USER 1001
+
+HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
+  CMD ["/usr/bin/installer", "--health-check"] || exit 1
+
 ENTRYPOINT ["/usr/bin/installer"]

For the builder stage at line 6:

-COPY . .
+COPY go.mod go.sum ./
+COPY cmd/ cmd/
+COPY pkg/ pkg/
+COPY vendor/ vendor/
+COPY deploy/ deploy/

Note: Adjust the HEALTHCHECK and COPY paths to match your actual application structure.

As per coding guidelines for container security.

🤖 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.assisted-installer.ocp` around lines 1 - 17, The Dockerfile is
missing runtime security directives and copies the entire build context; update
the builder stage (WORKDIR and COPY . .) to use explicit COPYs for only required
sources (e.g., go.mod, go.sum, cmd/ and pkg/ paths) instead of COPY . ., keep
the multi-stage COPYs (COPY --from=builder ...) intact, and add a non-root USER
directive (e.g., create or switch to a dedicated uid/gid before ENTRYPOINT) plus
a HEALTHCHECK instruction that probes the installer’s readiness (use a
lightweight curl/wget or similar against the appropriate local port/path) so the
final image includes USER and HEALTHCHECK alongside the existing ENTRYPOINT and
COPY --from=builder lines.
🤖 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.

Outside diff comments:
In `@Dockerfile.assisted-installer-build`:
- Around line 13-34: The final build stage uses an insecure base and copies
entire Go directories as root; update the Dockerfile to use a UBI minimal or
distroless base instead of quay.io/centos/centos:stream9, create and switch to a
non-root user via a USER directive (add user/group and set ownership) before any
COPY operations, replace the broad COPY --from=golang $GOPATH $GOPATH and COPY
--from=golang $GOROOT $GOROOT with copying only the required binaries/artifacts
(referencing the COPY --from=golang entries), and add an appropriate HEALTHCHECK
line; ensure ENV GOROOT/GOPATH remain correct and adjust file
ownership/permissions for the non-root user.

In `@Dockerfile.assisted-installer-controller`:
- Around line 22-37: The final runtime stage in the Dockerfile for
assisted-installer-controller is missing required security directives. Update
the last stage after the COPY steps to add a non-root USER and a HEALTHCHECK
using a command supported by assisted-installer-controller so the container does
not default to root and exposes a liveness check. Keep the changes in the final
stage only, and make sure the USER and HEALTHCHECK are placed before ENTRYPOINT.

In `@Dockerfile.assisted-installer-controller.ocp`:
- Around line 9-17: The final image should run non-root and include a
healthcheck and narrow COPYs: replace any broad COPY . . usage in the
builder/final stage with explicit file copies (e.g., copying only the built
binary and required assets instead of the whole context), add a USER directive
(e.g., create or switch to a non-root account and add USER <username|uid>)
before ENTRYPOINT, and add a HEALTHCHECK instruction that exercises the service
(for example an HTTP GET or exec that checks /health) referencing the existing
ENTRYPOINT (/usr/bin/assisted-installer-controller) so the container reports
liveness; ensure file ownership/permissions allow the non-root user to execute
the binary.

---

Duplicate comments:
In `@Dockerfile.assisted-installer.ocp`:
- Around line 1-17: The Dockerfile is missing runtime security directives and
copies the entire build context; update the builder stage (WORKDIR and COPY . .)
to use explicit COPYs for only required sources (e.g., go.mod, go.sum, cmd/ and
pkg/ paths) instead of COPY . ., keep the multi-stage COPYs (COPY --from=builder
...) intact, and add a non-root USER directive (e.g., create or switch to a
dedicated uid/gid before ENTRYPOINT) plus a HEALTHCHECK instruction that probes
the installer’s readiness (use a lightweight curl/wget or similar against the
appropriate local port/path) so the final image includes USER and HEALTHCHECK
alongside the existing ENTRYPOINT and COPY --from=builder lines.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: eccfb601-8e73-4843-a2b2-acd3789829d6

📥 Commits

Reviewing files that changed from the base of the PR and between 7eb73c7 and 1107df4.

📒 Files selected for processing (11)
  • .ci-operator.yaml
  • Dockerfile.assisted-installer
  • Dockerfile.assisted-installer-build
  • Dockerfile.assisted-installer-controller
  • Dockerfile.assisted-installer-controller-downstream
  • Dockerfile.assisted-installer-controller-mce
  • Dockerfile.assisted-installer-controller.ocp
  • Dockerfile.assisted-installer-downstream
  • Dockerfile.assisted-installer-mce
  • Dockerfile.assisted-installer.ocp
  • go.mod
✅ Files skipped from review due to trivial changes (5)
  • Dockerfile.assisted-installer
  • Dockerfile.assisted-installer-controller-mce
  • Dockerfile.assisted-installer-downstream
  • Dockerfile.assisted-installer-controller-downstream
  • Dockerfile.assisted-installer-mce

@shay23bra shay23bra force-pushed the MGMT-24453-upgrade-golang-1.26 branch from 1107df4 to 09abbe1 Compare June 3, 2026 11:19

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 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.assisted-installer-controller`:
- Line 1: The Dockerfile uses registry.access.redhat.com base images; update
both the builder FROM (currently
"registry.access.redhat.com/ubi9/go-toolset:1.26" in the builder stage) and the
runtime FROM (the UBI minimal image pinned by digest) to use catalog.redhat.com
equivalents instead (replace registry.access.redhat.com/... with
catalog.redhat.com/... and remove unnecessary digest pinning for the runtime
image if project policy requires tag usage), ensuring you keep the same
major/minor Go toolset and UBI minimal semantics when selecting the
catalog-hosted tags.

In `@Dockerfile.assisted-installer-mce`:
- Line 1: Update the Dockerfile's builder base image to use Red Hat's catalog
registry: replace the FROM line that references the image
registry.access.redhat.com/ubi9/go-toolset:1.26 (the builder stage aliased
"builder") so it pulls from catalog.redhat.com instead (keep the same image name
and tag and the AS builder alias); ensure the --platform and tag remain
unchanged.
🪄 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: 014ab7db-74b6-4c60-9b4d-a9d3abdf516f

📥 Commits

Reviewing files that changed from the base of the PR and between 1107df4 and 09abbe1.

📒 Files selected for processing (12)
  • .ci-operator.yaml
  • .golangci.yml
  • Dockerfile.assisted-installer
  • Dockerfile.assisted-installer-build
  • Dockerfile.assisted-installer-controller
  • Dockerfile.assisted-installer-controller-downstream
  • Dockerfile.assisted-installer-controller-mce
  • Dockerfile.assisted-installer-controller.ocp
  • Dockerfile.assisted-installer-downstream
  • Dockerfile.assisted-installer-mce
  • Dockerfile.assisted-installer.ocp
  • go.mod
✅ Files skipped from review due to trivial changes (4)
  • Dockerfile.assisted-installer-build
  • .golangci.yml
  • Dockerfile.assisted-installer-controller-mce
  • Dockerfile.assisted-installer-controller.ocp

@@ -1,4 +1,4 @@
FROM registry.access.redhat.com/ubi9/go-toolset:1.25 AS builder
FROM registry.access.redhat.com/ubi9/go-toolset:1.26 AS builder

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

repo_root="."
file="Dockerfile.assisted-installer-controller"

# Confirm file exists and show FROM lines
if [ ! -f "$repo_root/$file" ]; then
  echo "MISSING_FILE: $file"
  exit 0
fi

echo "FILE_PATH: $file"
echo "---- First 80 lines (to capture all FROM stages) ----"
sed -n '1,80p' "$repo_root/$file" | nl -ba

echo "---- All FROM lines ----"
rg -n --fixed-string "FROM " "$repo_root/$file" || true

Repository: openshift/assisted-installer

Length of output: 1952


🌐 Web query:

Find the contents of Dockerfile.assisted-installer-controller in openshift/assisted-installer and locate the FROM line(s), especially the builder stage base image.

💡 Result:

The openshift/assisted-installer repository contains multiple Dockerfiles related to the controller, notably Dockerfile.assisted-installer-controller [1] and Dockerfile.assisted-installer-controller.ocp [2]. In the standard Dockerfile.assisted-installer-controller, the FROM lines are as follows [1]: 1. Builder stage base image: FROM registry.access.redhat.com/ubi9/go-toolset:1.25 AS builder 2. Runtime stage base image: FROM registry.access.redhat.com/ubi9/ubi-minimal:latest@sha256:6fc28bcb6776e387d7a35a2056d9d2b985dc4e26031e98a2bd35a7137cd6fd71 In the Dockerfile.assisted-installer-controller.ocp variant, the FROM lines are [2]: 1. Builder stage base image: FROM registry.ci.openshift.org/ocp/builder:rhel-9-golang-1.25-openshift-4.21 AS builder 2. Runtime stage base image: FROM registry.ci.openshift.org/ocp/4.21:base-rhel9

Citations:


Switch base images to catalog.redhat.com (builder + runtime).

  • Dockerfile.assisted-installer-controller builder stage uses registry.access.redhat.com/ubi9/go-toolset:1.25 instead of a catalog-hosted image.
  • Dockerfile.assisted-installer-controller runtime stage uses registry.access.redhat.com/ubi9/ubi-minimal:latest@sha256:6fc28bcb6776e387d7a35a2056d9d2b985dc4e26031e98a2bd35a7137cd6fd71 (also not catalog.redhat.com, and pinned by digest even though it’s a Red Hat image).
🤖 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.assisted-installer-controller` at line 1, The Dockerfile uses
registry.access.redhat.com base images; update both the builder FROM (currently
"registry.access.redhat.com/ubi9/go-toolset:1.26" in the builder stage) and the
runtime FROM (the UBI minimal image pinned by digest) to use catalog.redhat.com
equivalents instead (replace registry.access.redhat.com/... with
catalog.redhat.com/... and remove unnecessary digest pinning for the runtime
image if project policy requires tag usage), ensuring you keep the same
major/minor Go toolset and UBI minimal semantics when selecting the
catalog-hosted tags.

@@ -1,4 +1,4 @@
FROM --platform=$BUILDPLATFORM registry.access.redhat.com/ubi9/go-toolset:1.25 AS builder
FROM --platform=$BUILDPLATFORM registry.access.redhat.com/ubi9/go-toolset:1.26 AS builder

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Update builder image source to comply with container security policy

Dockerfile.assisted-installer-mce uses a Red Hat base image from registry.access.redhat.com:

FROM --platform=$BUILDPLATFORM registry.access.redhat.com/ubi9/go-toolset:1.26 AS builder

The policy requires Red Hat base images to be sourced from catalog.redhat.com.

🤖 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.assisted-installer-mce` at line 1, Update the Dockerfile's builder
base image to use Red Hat's catalog registry: replace the FROM line that
references the image registry.access.redhat.com/ubi9/go-toolset:1.26 (the
builder stage aliased "builder") so it pulls from catalog.redhat.com instead
(keep the same image name and tag and the AS builder alias); ensure the
--platform and tag remain unchanged.

@shay23bra

Copy link
Copy Markdown
Contributor Author

/retest

@openshift-ci

openshift-ci Bot commented Jun 11, 2026

Copy link
Copy Markdown

@shay23bra: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/edge-e2e-metal-assisted-5-0 09abbe1 link true /test edge-e2e-metal-assisted-5-0

Full PR test history. Your PR dashboard.

Details

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 kubernetes-sigs/prow repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

downstream-change-needed Requires updating downstream image jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants