Skip to content
Merged
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 Containerfile.bpfman-agent
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Build the manager binary
ARG BUILDPLATFORM

FROM --platform=$BUILDPLATFORM registry.access.redhat.com/ubi9/go-toolset:9.8-1782717933 AS bpfman-agent-build
FROM --platform=$BUILDPLATFORM registry.access.redhat.com/ubi9/go-toolset:9.8-1782852234 AS bpfman-agent-build

# The following ARGs are set internally by docker/build-push-action in github actions
ARG TARGETOS
Expand Down
2 changes: 1 addition & 1 deletion Containerfile.bpfman-agent.openshift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ ARG BUILDVERSION
# Build the manager binary
ARG BUILDPLATFORM

FROM --platform=$BUILDPLATFORM registry.access.redhat.com/ubi9/go-toolset:9.8-1782717933 AS bpfman-agent-build
FROM --platform=$BUILDPLATFORM registry.access.redhat.com/ubi9/go-toolset:9.8-1782852234 AS bpfman-agent-build
ARG BUILDVERSION

# The following ARGs are set internally by docker/build-push-action in github actions
Expand Down
2 changes: 1 addition & 1 deletion Containerfile.bpfman-operator
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Build the manager binary
ARG BUILDPLATFORM

FROM --platform=$BUILDPLATFORM registry.access.redhat.com/ubi9/go-toolset:9.8-1782717933 AS bpfman-operator-build
FROM --platform=$BUILDPLATFORM registry.access.redhat.com/ubi9/go-toolset:9.8-1782852234 AS bpfman-operator-build

ARG BUILDPLATFORM

Expand Down
4 changes: 2 additions & 2 deletions Containerfile.bpfman-operator.openshift
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ ARG BUILDPLATFORM

# Verify that all code, including integration tests, compiles successfully.
# This stage catches build failures early before the main build proceeds.
FROM --platform=$BUILDPLATFORM registry.access.redhat.com/ubi9/go-toolset:9.8-1782717933 AS verify-test
FROM --platform=$BUILDPLATFORM registry.access.redhat.com/ubi9/go-toolset:9.8-1782852234 AS verify-test
WORKDIR /usr/src/bpfman-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

Avoid copying the full repository into the verification stage.

Line 10 adds COPY . . to a new stage, which violates the container policy and unnecessarily broadens what lands in build layers/cache. Copy only the files and directories needed for ./test/integration/.... As per path instructions, 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 `@Containerfile.bpfman-operator.openshift` at line 10, The verification stage
is copying the entire repository, which breaks the container policy and bloats
the layer cache. Update the new stage to copy only the minimal inputs needed for
running ./test/integration/... instead of using COPY . ., and keep the change
localized to the verification stage setup in the
Containerfile.bpfman-operator.openshift.

Source: Path instructions

RUN go test -mod vendor -tags=integration_tests -c -o /dev/null ./test/integration/... && touch /tmp/verify-test.done

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟑 Minor | ⚑ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Go package directories under test/integration:"
fd -t f -e go . test/integration | xargs -r -n1 dirname | sort -u

echo
count="$(fd -t f -e go . test/integration | xargs -r -n1 dirname | sort -u | wc -l | tr -d ' ')"
echo "Unique package dirs: ${count}"
if [ "${count}" -gt 1 ]; then
  echo "WARNING: multiple package directories detected; 'go test -c -o /dev/null ./test/integration/...' is likely fragile."
fi

Repository: openshift/bpfman-operator

Length of output: 401


Narrow the go test -c invocation ./test/integration/... expands to both test/integration and test/integration/loadimagearchive, so -c -o /dev/null is brittle here. Restrict it to a single package or write each binary to its own temp directory.

πŸ€– 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 `@Containerfile.bpfman-operator.openshift` at line 11, The `go test -c` step is
too broad because `./test/integration/...` expands to multiple packages, making
the single `-o /dev/null` output brittle. Narrow the invocation in the `RUN`
step to one package under the integration test path, or adjust the `go test`
command so each package produced by `test/integration` and
`test/integration/loadimagearchive` writes its binary to a separate temporary
location.


FROM --platform=$BUILDPLATFORM registry.access.redhat.com/ubi9/go-toolset:9.8-1782717933 AS bpfman-operator-build
FROM --platform=$BUILDPLATFORM registry.access.redhat.com/ubi9/go-toolset:9.8-1782852234 AS bpfman-operator-build

ARG BUILDVERSION
ARG BUILDPLATFORM
Expand Down