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

tools: move tools.go to its own directory tools/ #382

Merged
merged 1 commit into from
Jun 26, 2023

Conversation

Rakshith-R
Copy link
Member

tools.go is moved to another module tools to
separate all dependencies used for build from
main go.mod.

@Rakshith-R
Copy link
Member Author

locally it seems to be working fine,
and all other go build are running fine.

We'll be able to upgrade a lot csiaddons dependencies if we separate operator-sdk out.

@nixpanic any idea why this maybe failing in workflow?

cd ./tools && go build -o /home/runner/work/kubernetes-csi-addons/kubernetes-csi-addons/bin/operator-sdk ./vendor/github.com/operator-framework/operator-sdk/cmd/operator-sdk
go: finding module for package github.com/operator-framework/operator-sdk/internal/cmd/operator-sdk/bundle
go: finding module for package github.com/operator-framework/operator-sdk/internal/cmd/operator-sdk/generate/bundle
go: finding module for package github.com/operator-framework/operator-sdk/internal/cmd/operator-sdk/run/bundle
go: finding module for package github.com/operator-framework/operator-registry/pkg/lib/bundle
Error: vendor/github.com/operator-framework/operator-sdk/internal/registry/labels.go:24:2: cannot query module due to -mod=vendor
	(Go version in go.mod is at least 1.14 and vendor directory exists.)
Error: vendor/github.com/operator-framework/operator-sdk/internal/cmd/operator-sdk/cli/cli.go:39:2: cannot query module due to -mod=vendor
	(Go version in go.mod is at least 1.14 and vendor directory exists.)
Error: vendor/github.com/operator-framework/operator-sdk/internal/cmd/operator-sdk/generate/cmd.go:[20](https://github.com/csi-addons/kubernetes-csi-addons/actions/runs/5355497139/jobs/9713846588?pr=382#step:4:21):2: cannot query module due to -mod=vendor
	(Go version in go.mod is at least 1.14 and vendor directory exists.)
Error: vendor/github.com/operator-framework/operator-sdk/internal/cmd/operator-sdk/run/cmd.go:20:2: cannot query module due to -mod=vendor
	(Go version in go.mod is at least 1.14 and vendor directory exists.)
make: *** [Makefile:[24](https://github.com/csi-addons/kubernetes-csi-addons/actions/runs/5355497139/jobs/9713846588?pr=382#step:4:25)3: operator-sdk] Error 1

@nixpanic
Copy link
Collaborator

locally it seems to be working fine, and all other go build are running fine.

We'll be able to upgrade a lot csiaddons dependencies if we separate operator-sdk out.

@nixpanic any idea why this maybe failing in workflow?

cd ./tools && go build -o /home/runner/work/kubernetes-csi-addons/kubernetes-csi-addons/bin/operator-sdk ./vendor/github.com/operator-framework/operator-sdk/cmd/operator-sdk
go: finding module for package github.com/operator-framework/operator-sdk/internal/cmd/operator-sdk/bundle
go: finding module for package github.com/operator-framework/operator-sdk/internal/cmd/operator-sdk/generate/bundle
go: finding module for package github.com/operator-framework/operator-sdk/internal/cmd/operator-sdk/run/bundle
go: finding module for package github.com/operator-framework/operator-registry/pkg/lib/bundle
Error: vendor/github.com/operator-framework/operator-sdk/internal/registry/labels.go:24:2: cannot query module due to -mod=vendor
	(Go version in go.mod is at least 1.14 and vendor directory exists.)
Error: vendor/github.com/operator-framework/operator-sdk/internal/cmd/operator-sdk/cli/cli.go:39:2: cannot query module due to -mod=vendor
	(Go version in go.mod is at least 1.14 and vendor directory exists.)
Error: vendor/github.com/operator-framework/operator-sdk/internal/cmd/operator-sdk/generate/cmd.go:[20](https://github.com/csi-addons/kubernetes-csi-addons/actions/runs/5355497139/jobs/9713846588?pr=382#step:4:21):2: cannot query module due to -mod=vendor
	(Go version in go.mod is at least 1.14 and vendor directory exists.)
Error: vendor/github.com/operator-framework/operator-sdk/internal/cmd/operator-sdk/run/cmd.go:20:2: cannot query module due to -mod=vendor
	(Go version in go.mod is at least 1.14 and vendor directory exists.)
make: *** [Makefile:[24](https://github.com/csi-addons/kubernetes-csi-addons/actions/runs/5355497139/jobs/9713846588?pr=382#step:4:25)3: operator-sdk] Error 1

When checking, I noticed this:

$ go mod vendor
go: downloading sigs.k8s.io/controller-runtime/tools/setup-envtest v0.0.0-20230620070423-a784ee78d04b
verifying github.com/operator-framework/[email protected]: checksum mismatch
	downloaded: h1:ZUwkRxMTngafaBtIi8WYEOv2WiI4FsG2UMzKSEgEPPg=
	go.sum:     h1:fHHJd6JkIUWMtQCGfokLZBWYBV7xqFv3JHNSRZzNnjQ=

SECURITY ERROR
This download does NOT match an earlier download recorded in go.sum.
The bits may have been replaced on the origin server, or an attacker may
have intercepted the download attempt.

For more information, see 'go help module-auth'.

After deleting tools/go.sum and running go mod tidy and go mod vendor in the tools/ directory, building operator-sdk works for me (drop the -mod=mod from the Makefile).

Makefile Outdated

# operator-sdk gets installed from the vendor/ directory.
OPERATOR_SDK = $(shell pwd)/bin/operator-sdk
.PHONY: operator-sdk
operator-sdk:
go build -o $(OPERATOR_SDK) ./vendor/$(shell grep operator-sdk tools.go | sed 's/.*_ "//;s/"//')
cd ./tools && go build -o $(OPERATOR_SDK) ./vendor/$(shell grep operator-sdk tools/tools.go | sed 's/.*_ "//;s/"//') -mod=mod
Copy link
Collaborator

Choose a reason for hiding this comment

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

remove the -mod=mod

@Rakshith-R
Copy link
Member Author

locally it seems to be working fine, and all other go build are running fine.
We'll be able to upgrade a lot csiaddons dependencies if we separate operator-sdk out.
@nixpanic any idea why this maybe failing in workflow?

cd ./tools && go build -o /home/runner/work/kubernetes-csi-addons/kubernetes-csi-addons/bin/operator-sdk ./vendor/github.com/operator-framework/operator-sdk/cmd/operator-sdk
go: finding module for package github.com/operator-framework/operator-sdk/internal/cmd/operator-sdk/bundle
go: finding module for package github.com/operator-framework/operator-sdk/internal/cmd/operator-sdk/generate/bundle
go: finding module for package github.com/operator-framework/operator-sdk/internal/cmd/operator-sdk/run/bundle
go: finding module for package github.com/operator-framework/operator-registry/pkg/lib/bundle
Error: vendor/github.com/operator-framework/operator-sdk/internal/registry/labels.go:24:2: cannot query module due to -mod=vendor
	(Go version in go.mod is at least 1.14 and vendor directory exists.)
Error: vendor/github.com/operator-framework/operator-sdk/internal/cmd/operator-sdk/cli/cli.go:39:2: cannot query module due to -mod=vendor
	(Go version in go.mod is at least 1.14 and vendor directory exists.)
Error: vendor/github.com/operator-framework/operator-sdk/internal/cmd/operator-sdk/generate/cmd.go:[20](https://github.com/csi-addons/kubernetes-csi-addons/actions/runs/5355497139/jobs/9713846588?pr=382#step:4:21):2: cannot query module due to -mod=vendor
	(Go version in go.mod is at least 1.14 and vendor directory exists.)
Error: vendor/github.com/operator-framework/operator-sdk/internal/cmd/operator-sdk/run/cmd.go:20:2: cannot query module due to -mod=vendor
	(Go version in go.mod is at least 1.14 and vendor directory exists.)
make: *** [Makefile:[24](https://github.com/csi-addons/kubernetes-csi-addons/actions/runs/5355497139/jobs/9713846588?pr=382#step:4:25)3: operator-sdk] Error 1

When checking, I noticed this:

$ go mod vendor
go: downloading sigs.k8s.io/controller-runtime/tools/setup-envtest v0.0.0-20230620070423-a784ee78d04b
verifying github.com/operator-framework/[email protected]: checksum mismatch
	downloaded: h1:ZUwkRxMTngafaBtIi8WYEOv2WiI4FsG2UMzKSEgEPPg=
	go.sum:     h1:fHHJd6JkIUWMtQCGfokLZBWYBV7xqFv3JHNSRZzNnjQ=

SECURITY ERROR
This download does NOT match an earlier download recorded in go.sum.
The bits may have been replaced on the origin server, or an attacker may
have intercepted the download attempt.

For more information, see 'go help module-auth'.

After deleting tools/go.sum and running go mod tidy and go mod vendor in the tools/ directory, building operator-sdk works for me (drop the -mod=mod from the Makefile).

Tried the same thing,
Did go clean -modcache too.
switched to mobile hotstop then observed the current compare.

But there's still same failure. https://github.com/csi-addons/kubernetes-csi-addons/actions/runs/5356030502/jobs/9715035090?pr=382
I think there's some problem with my go locally or some network cache problem somewhere
with my ISP.

@nixpanic Can you please run pull this pr, run those changes and force push ?

@nixpanic
Copy link
Collaborator

Maybe one file under tools/vendor/... was missing, that has been added now.

@Rakshith-R
Copy link
Member Author

Thanks !

But it still fails with same error 😩
Bad luck has hit Csiaddons ci 🙁

Comment on lines +243 to +244
# FIXME: Remove `go mod tidy && go mod vendor` once we find the reason why ci workflow fails.
cd ./tools && go mod tidy && go mod vendor && go build -o $(OPERATOR_SDK) ./vendor/$(shell grep operator-sdk tools/tools.go | sed 's/.*_ "//;s/"//')
Copy link
Member Author

Choose a reason for hiding this comment

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

Added this to make ci happy .
opened new issue for this #384

@Rakshith-R
Copy link
Member Author

@nixpanic @Madhu-1 Can you please take a look?
mergifyio is failing with The pull request reports more than 7900 files, reaching the limit of 1000 files.
We can ignore it.
We need to merge this pr manually.

@nixpanic
Copy link
Collaborator

@Mergifyio queue

@mergify
Copy link

mergify bot commented Jun 26, 2023

queue

✅ The pull request has been merged automatically

The pull request has been merged automatically at 342d457

tools.go is moved to another module tools to
separate all dependencies used for build from
main go.mod.

Signed-off-by: Rakshith R <[email protected]>
@mergify mergify bot merged commit 342d457 into csi-addons:main Jun 26, 2023
12 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants