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

cmd/operator-sdk/internal: explicitly set GOROOT #2754

Merged
merged 2 commits into from
Apr 1, 2020

Conversation

aharbis
Copy link
Contributor

@aharbis aharbis commented Mar 31, 2020

Description of the change:

If the user's GOROOT does not match the GOROOT used to build the binary, they would be required to explicitly set the GOROOT env variable:

export GOROOT=$(go env GOROOT)

To avoid this step for end-users we can explicitly pull the GOROOT from go env and explicitly set the GOROOT env variable prior to generation code executing.

Motivation for the change:

Closes #2744

If the user's GOROOT does not match the GOROOT used to build the
binary, they would be required to explicitly set the GOROOT env
variable to their go env GOROOT. To avoid this step for end-users
we can explicitly pull the GOROOT from go env and explicitly set
the GOROOT env variable.

Fixes: operator-framework#2744
Copy link
Member

@joelanford joelanford left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution! This will hopefully close the book on this troublesome issue.

Just a few suggestions and we can merge it.

cmd/operator-sdk/internal/genutil/k8s.go Outdated Show resolved Hide resolved
cmd/operator-sdk/internal/genutil/k8s.go Outdated Show resolved Hide resolved
@@ -34,6 +35,16 @@ import (
func K8sCodegen() error {
Copy link
Contributor

Choose a reason for hiding this comment

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

Also, just one question, is the issue just faced with the operator-sdk generate k8s command?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good question. I tested in a failing environment (where I have release v0.16.0 and unset GOROOT), and both the crds and csv generate commands work without throwing any errors.

This seems to be isolated to the k8s generation.

@aharbis
Copy link
Contributor Author

aharbis commented Apr 1, 2020

Thanks for the quick turnaround on feedback on the PR! Pushed a patch commit, I was not sure if y'all prefer me to squash and update my branch, or if you handle the squash on the merge. Let me know if anything is out of place, and I'll keep note for future contributions.

@joelanford
Copy link
Member

We squash on merge, so no worries. As soon as CI passes, I'll merge it in. Thanks again!

@joelanford joelanford merged commit 9aed734 into operator-framework:master Apr 1, 2020
joelanford added a commit to joelanford/operator-sdk that referenced this pull request Apr 1, 2020
joelanford added a commit to joelanford/operator-sdk that referenced this pull request Apr 1, 2020
joelanford added a commit to joelanford/operator-sdk that referenced this pull request Apr 1, 2020
@aharbis aharbis deleted the issue-2744 branch April 1, 2020 04:13
joelanford added a commit that referenced this pull request Apr 1, 2020
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.

Upgrading from v0.15.2 to v0.16.0 breaks types generation
3 participants