You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The failure occurs in test/e2e/e2e_suite_test.go while running:
cmd:=exec.Command("make", "docker-build", fmt.Sprintf("IMG=%s", managerImage))
_, err:=utils.Run(cmd)
ExpectWithOffset(1, err).NotTo(HaveOccurred(), "Failed to build the manager image")
The command ultimately invokes the Makefile target:
docker-build: ## Build docker image with the manager.$(CONTAINER_TOOL) build -t ${IMG}.
The job log shows:
[BeforeSuite] building the manager image
running: "make docker-build IMG=example.com/kubevirt-datamover-controller:v0.0.1"
[FAILED] Failed to build the manager image
make: *** [Makefile:98: test-e2e] Error 1
Process completed with exit code 2.
Likely root cause
The Docker build only copies a subset of local Go source directories into the builder stage:
If cmd/main.go or packages under internal/ import local packages outside those directories, such as the Kubebuilder-style api/ package, the image build will fail because those files are missing inside the build context in the container.
Suggested fix
Update the Dockerfile to copy all local source directories required by the manager build before running go build.
At minimum, add api/:
# Copy the go source
COPY cmd/main.go cmd/main.go
+COPY api/ api/
COPY internal/ internal/
COPY pkg/ pkg/
If other local packages are imported by the manager, copy those as well.
Recommended section:
# Copy the go sourceCOPY cmd/main.go cmd/main.go
COPY api/ api/
COPY internal/ internal/
COPY pkg/ pkg/
# BuildRUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -a -o manager cmd/main.go
Acceptance criteria
make docker-build IMG=example.com/kubevirt-datamover-controller:v0.0.1 succeeds locally or in CI.
make test-e2e proceeds past the Ginkgo BeforeSuite manager image build step.
Summary
The E2E workflow fails during the Ginkgo
BeforeSuitebefore any specs run because the suite cannot build the manager image.Failing job: https://github.com/migtools/kubevirt-datamover-controller/actions/runs/30126138631/job/89589981078?pr=139
Related PR: #139
Commit:
50a76b5b76d810ee2103c7dc96350e20ccee6095Failure details
The failure occurs in
test/e2e/e2e_suite_test.gowhile running:The command ultimately invokes the Makefile target:
The job log shows:
Likely root cause
The Docker build only copies a subset of local Go source directories into the builder stage:
If
cmd/main.goor packages underinternal/import local packages outside those directories, such as the Kubebuilder-styleapi/package, the image build will fail because those files are missing inside the build context in the container.Suggested fix
Update the
Dockerfileto copy all local source directories required by the manager build before runninggo build.At minimum, add
api/:# Copy the go source COPY cmd/main.go cmd/main.go +COPY api/ api/ COPY internal/ internal/ COPY pkg/ pkg/If other local packages are imported by the manager, copy those as well.
Recommended section:
Acceptance criteria
make docker-build IMG=example.com/kubevirt-datamover-controller:v0.0.1succeeds locally or in CI.make test-e2eproceeds past the GinkgoBeforeSuitemanager image build step.