Skip to content

FKAS go.mod is importing an actual CAPM3 release #2157

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
mquhuy opened this issue Dec 12, 2024 · 3 comments
Open

FKAS go.mod is importing an actual CAPM3 release #2157

mquhuy opened this issue Dec 12, 2024 · 3 comments
Labels
kind/bug Categorizes issue or PR as related to a bug. triage/accepted Indicates an issue is ready to be actively worked on.

Comments

@mquhuy
Copy link
Member

mquhuy commented Dec 12, 2024

What steps did you take and what happened:
https://github.com/metal3-io/cluster-api-provider-metal3/blob/main/hack/fake-apiserver/go.mod#L7

What did you expect to happen:
Should have used v0.0.0, and added a replace line to refer to ./../../api

Anything else you would like to add:
This happens because our image build workflow uses the absolute context, hence we cannot build with anything outside of the hack/fake-apiserver directory.

This could be solved by mounting the api/ to the build container, but that requires enabling buildkit. We might want to do that anyway, as docker build will go away soon.

/kind bug

@metal3-io-bot metal3-io-bot added kind/bug Categorizes issue or PR as related to a bug. needs-triage Indicates an issue lacks a `triage/foo` label and requires one. labels Dec 12, 2024
@tuminoid
Copy link
Member

/triage accepted

@tuminoid
Copy link
Member

tuminoid commented Mar 6, 2025

Just providing further context on this.

This directive in the action mounts just the specified directory in the container via the reusable action, so ../../.. does not point to /api as it does not exist in build context.

Building the PR #2379 would result in (simulated with "gh act" and relaxed workflow files):

| Building Docker image quay.io/metal3-io/metal3-fkas with tags kashif_fix-fakeapi-gomod,kashif_fix-fakeapi-gomod_2025-03-06_7f1a1622c979e7f757a1276f6cf54c1dd9af663b...
| BuildCommand docker build -f hack/fake-apiserver/Dockerfile -t quay.io/metal3-io/metal3-fkas:kashif_fix-fakeapi-gomod -t quay.io/metal3-io/metal3-fkas:kashif_fix-fakeapi-gomod_2025-03-06_7f1a1622c979e7f757a1276f6cf54c1dd9af663b hack/fake-apiserver
[+] Building 1.9s (10/16)                                        docker:default
|  => [internal] load build definition from Dockerfile                       0.1s
|  => => transferring dockerfile: 2.15kB                                     0.0s
|  => [internal] load metadata for gcr.io/distroless/static:nonroot@sha256:  0.5s
|  => [internal] load metadata for docker.io/library/golang:1.23.7@sha256:1  0.0s
|  => [internal] load .dockerignore                                          0.1s
|  => => transferring context: 2B                                            0.0s
|  => [base 1/4] FROM docker.io/library/golang:1.23.7@sha256:1acb493b9f9dfd  0.0s
|  => [stage-3 1/4] FROM gcr.io/distroless/static:nonroot@sha256:9ecc53c269  0.0s
|  => [internal] load build context                                          0.1s
|  => => transferring context: 66.01kB                                       0.0s
|  => CACHED [base 2/4] WORKDIR /workspace                                   0.0s
|  => [base 3/4] COPY go.mod go.sum ./                                       0.1s
|  => ERROR [base 4/4] RUN go mod download                                   1.0s
| ------
|  > [base 4/4] RUN go mod download:
| 0.908 go: github.com/metal3-io/cluster-api-provider-metal3/[email protected] (replaced by ./../../api): reading /api/go.mod: open /api/go.mod: no such file or directory
| ------
| Dockerfile:32
| --------------------
|   30 |     # Cache deps before building and copying source so that we don't need to re-download as much
|   31 |     # and so that source changes don't invalidate our downloaded layer
|   32 | >>> RUN go mod download
|   33 |     
|   34 |     # Build Fkas
| --------------------
| ERROR: failed to solve: process "/bin/sh -c go mod download" did not complete successfully: exit code: 1

@tuminoid
Copy link
Member

tuminoid commented Mar 6, 2025

Local docker build breaks exactly the same, no need to even use the container build workflow. Build context matters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. triage/accepted Indicates an issue is ready to be actively worked on.
Projects
None yet
Development

No branches or pull requests

3 participants