Skip to content
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

Running make reviewable in a fresh clone shouldn't fail #4401

Closed
mergenci opened this issue Jul 28, 2023 · 2 comments
Closed

Running make reviewable in a fresh clone shouldn't fail #4401

mergenci opened this issue Jul 28, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@mergenci
Copy link
Member

What happened?

I cloned the repo, ran make. Then, running make reviewable failed:

$ git clone https://github.com/crossplane/crossplane.git
$ cd crossplane
$ make
$ make reviewable
[Output redacted for brevity]
Failure: plugin go: could not find protoc plugin for name go - please make sure protoc-gen-go is installed and present on your $PATH
exit status 1
apis/generate.go:81: running "go": exit status 1
11:32:55 [FAIL]
make[2]: *** [build/makelib/golang.mk:240: go.generate] Error 1
make[1]: *** [build/makelib/common.mk:434: generate] Error 2
make: *** [build/makelib/common.mk:439: reviewable] Error 2

I would have expected all dependencies have been installed as part of the build procedure. I manually installed protoc-gen-go and protoc-gen-go-grpc, as instructed in gRPC Quickstart. I tried to build again, but it failed with an error that I don't know how to solve:

$ go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.28
$ go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.2
$ make reviewable
11:46:08 [ .. ] verify go modules dependencies have expected content
all modules verified
11:46:12 [ OK ] go modules dependencies verified
11:46:12 [ .. ] go generate linux_amd64
Duplicated apiextensions/v1/composition_revision_types.go (package v1) to apiextensions/v1beta1/zz_generated.composition_revision_types.go (package v1beta1).
Duplicated apiextensions/v1/composition_common.go (package v1) to apiextensions/v1beta1/zz_generated.composition_common.go (package v1beta1).
Duplicated apiextensions/v1/composition_patches.go (package v1) to apiextensions/v1beta1/zz_generated.composition_patches.go (package v1beta1).
Duplicated apiextensions/v1/composition_transforms.go (package v1) to apiextensions/v1beta1/zz_generated.composition_transforms.go (package v1beta1).
Duplicated apiextensions/v1/composition_environment.go (package v1) to apiextensions/v1beta1/zz_generated.composition_environment.go (package v1beta1).
Duplicated pkg/meta/v1/configuration_types.go (package v1) to pkg/meta/v1alpha1/zz_generated.configuration_types.go (package v1alpha1).
Duplicated pkg/meta/v1/provider_types.go (package v1) to pkg/meta/v1alpha1/zz_generated.provider_types.go (package v1alpha1).
Duplicated pkg/meta/v1/meta.go (package v1) to pkg/meta/v1alpha1/zz_generated.meta.go (package v1alpha1).
11:46:51 [ OK ] go generate linux_amd64
11:46:51 [ .. ] go mod tidy
11:46:51 [ OK ] go mod tidy
11:46:51 [ .. ] installing helm-docs
go: cannot install cross-compiled binaries when GOBIN is set
11:46:51 [FAIL]
make[2]: *** [build/makelib/helm.mk:221: /Users/mergenci/Documents/upbound/dev/crossplane-2/.cache/tools/darwin_x86_64/helm-docs] Error 1
make[1]: *** [build/makelib/common.mk:434: generate] Error 2
make: *** [build/makelib/common.mk:439: reviewable] Error 2

GOBIN environment variable is already not set. To make sure, I unset it and tried again, which failed with the same error as above.

How can we reproduce it?

Perhaps by following the procedure above in an environment that doesn't have any go packages installed.

What environment did it happen in?

Crossplane version: Latest (be72cc00e4df771773edc80315d616fb06bf654a)
OS: macOS Ventura 13.4.1 (c)
Hardware: Apple M1 Pro
make --version: GNU Make 4.4 Built for x86_64-apple-darwin21.6.0
go version: go version go1.20.4 darwin/arm64

@mergenci mergenci added the bug Something isn't working label Jul 28, 2023
@turkenh
Copy link
Member

turkenh commented Jul 28, 2023

Thanks for the report @mergenci!

This is the line that is failing for you, which contains setting GOBIN: https://github.com/upbound/build/blob/292f958d2d97f26b450723998f82f7fc1767920c/makelib/helm.mk#L221

If I comment out the @ in the file and run make helm.generate after a rm -rf .cache, I see the command is as below:

GOBIN=/private/tmp/crossplane/.cache/tools/darwin_arm64 GOOS=darwin GOARCH=arm64 go install github.com/norwoodj/helm-docs/cmd/helm-docs@v1.11.0 || (echo `date +%H:%M:%S` [FAIL] && false)

This works on my side on an M1 MacBook similar to yours, but obviously not working on your side.
I hope this helps you to narrow the problem down and find the root cause.

It would be great if you could keep the issue updated, so that we can consider fixing it for others as well.

@mergenci
Copy link
Member Author

mergenci commented Aug 4, 2023

@turkenh thanks for the pointer. It occurred to me that the problem might be related to GNU Make version. I'm using version 4.4, whereas macOS has built-in version 3.81. Upon switching to GNU Make 3.81, I was able to make reviewable. I'm not sure if the problems I've encountered are because of breaking changes introduced by version 4 or if there's another problem with my setup. Thanks again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants