Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .ci-operator.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
build_root_image:
name: release
namespace: openshift
tag: rhel-9-release-golang-1.25-openshift-4.22
tag: rhel-9-release-golang-1.26-openshift-5.0
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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
WORKDIR /go/src/github.com/openshift/cluster-openshift-controller-manager-operator
COPY . .

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟠 Major | 🏗️ Heavy lift

Copy only the files required for the build.

COPY . . sends the entire repository into the builder, including any accidental secrets, credentials, or unrelated artifacts. Replace it with explicit source/configuration copies and keep only required build inputs in the context.

As per path instructions, “COPY specific files, not entire context” and “No secrets in ENV, ARG, or COPY.”

🤖 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 . . instruction in the
Dockerfile with explicit COPY directives for only the source files,
configuration, and other inputs required by the build. Exclude secrets,
credentials, generated artifacts, and unrelated repository files from the build
context.

Source: Path instructions

RUN GO_COMPLIANCE_INFO=0 make build \
&& gzip cluster-openshift-controller-manager-operator-tests-ext

FROM registry.ci.openshift.org/ocp/4.22:base-rhel9
FROM registry.ci.openshift.org/ocp/5.0:base-rhel9

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Run the runtime image as a non-root user.

The final stage has no USER declaration, and Trivy reports DS-0002. Add a project-supported non-root UID before release.

As per path instructions, “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` at line 7, Add a USER declaration in the final Docker image stage
using the project-supported non-root identity, such as non-root, before the
image is released. Ensure the runtime image does not run as root while
preserving the existing base image configuration.

Sources: Path instructions, Linters/SAST tools


🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Define a container healthcheck.

The runtime stage does not declare HEALTHCHECK, so orchestration cannot reliably detect an unhealthy operator container through the image metadata. Add the appropriate healthcheck for this operator image.

As per path instructions, “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` at line 7, Add a Dockerfile HEALTHCHECK instruction for the
runtime image based on the operator’s existing health endpoint or health probe
command, ensuring it reliably reports container health through image metadata.
Keep the current base image and runtime configuration unchanged.

Source: Path instructions

COPY --from=builder /go/src/github.com/openshift/cluster-openshift-controller-manager-operator/cluster-openshift-controller-manager-operator /usr/bin/
COPY --from=builder /go/src/github.com/openshift/cluster-openshift-controller-manager-operator/cluster-openshift-controller-manager-operator-tests-ext.gz /usr/bin/
COPY manifests /manifests
Expand Down