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

replace go_container.sh with gimme #1769

Merged
merged 12 commits into from
Aug 7, 2020

Conversation

BenTheElder
Copy link
Member

speeds up builds. streamlines a lot of the tools (they can just invoke go without containerization hoops).
still should be reproducible with go1.13+

also the .go-version file should be goenv compatible

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Aug 6, 2020
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: BenTheElder

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Aug 6, 2020
PATH:=$(shell . hack/build/setup-go.sh && echo "$${PATH}")
export PATH
# work around broken PATH export
SHELL:=env PATH=$(PATH) $(SHELL)
Copy link
Member Author

Choose a reason for hiding this comment

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

this is the trickiest bit, at least on macOS default make, without this you fail to actually set path in trivial commands.

https://stackoverflow.com/questions/8941110/how-i-could-add-dir-to-path-in-makefile put me on the right track

all: build
# build flags for the kind binary
# - reproducible builds: -trimpath and -ldlflags=-buildid=
# - smaller binaries: -w (trim debugger data, but not panics)
Copy link
Member Author

Choose a reason for hiding this comment

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

forgot to mention in the PR body, 9.1M => 7M on macOS

# ========================= Setup Go With Gimme ================================
# go version to use for build etc.
# setup correct go version with gimme
PATH:=$(shell . hack/build/setup-go.sh && echo "$${PATH}")
Copy link
Member Author

Choose a reason for hiding this comment

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

  • GOROOT is not required since go.19, go will look next to the go binary on it's own
  • I don't think GOOS / GOARCH are relevant here
  • PATH is how we inject the go version we want

This part is also not striclty necessary after a later commit, where scripts try to ensure this themselves

Copy link
Member Author

Choose a reason for hiding this comment

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

@amwat pointed out that gvm sets this (and probably other tools, including gimme when used natively), and when set to a different value in the host environment that causes us to potentially use the gimme go binary against some other goroot. we mitigate that below now by clearing GOROOT so it will be auto-detected instead.

@aledbf
Copy link
Member

aledbf commented Aug 6, 2020

@BenTheElder why are you adding the gimme script?

@BenTheElder
Copy link
Member Author

@BenTheElder why are you adding the gimme script?

to version it and avoid having to download it from the internet each time

@BenTheElder
Copy link
Member Author

not really related to this PR I think, but amwat discovered some issues with go1.15 and trying to use vendor if vendor is present.

@aojea
Copy link
Contributor

aojea commented Aug 6, 2020

I prefer this to the docker build honestly, defer to @amwat the final lgtm
LGTM

@BenTheElder
Copy link
Member Author

/retest
pod pending timeout (prow)

@BenTheElder
Copy link
Member Author

verify now has an inexplicable go.sum issue after da5b190
https://prow.k8s.io/pr-history/?org=kubernetes-sigs&repo=kind&pr=1769

Copy link
Contributor

@amwat amwat left a comment

Choose a reason for hiding this comment

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

/lgtm
/hold

Nice, this is a much faster and cleaner solution than go_container.sh.

Makefile Outdated
clean: clean-output clean-cache
clean:
rm -rf $(OUT_DIR)/
# TODO: remove this in the future. We no longer populat vendor
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: dedent
this currently prints out as a shell command

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed


# only setup go if we haven't set FORCE_HOST_GO, or `go version` doesn't match
# go version output looks like:
# go version go1.14.5 darwin/amd64
Copy link
Contributor

Choose a reason for hiding this comment

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

something somewhere is outputting the go version, can't seem to pinpoint where :/

Copy link
Member Author

Choose a reason for hiding this comment

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

it's related to gimme, I've failed to silence it properly
gimme has an env to disable this, but it only works if used during the first time setting up that version, they don't regenerate the .evn file. not sure what the best fix is yet.

Copy link
Member Author

Choose a reason for hiding this comment

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

it is mostly cosmetic though

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed in 83d19a4

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 6, 2020
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 6, 2020
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 6, 2020
@BenTheElder
Copy link
Member Author

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 6, 2020
@BenTheElder
Copy link
Member Author

/retest

@amwat
Copy link
Contributor

amwat commented Aug 6, 2020

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 6, 2020
@BenTheElder
Copy link
Member Author

/retest

@BenTheElder
Copy link
Member Author

what's one more flake
/retest

@justaugustus
Copy link
Member

(I speedread this, but I just wanted to drop by and say I'm excited to see it!)

@k8s-ci-robot k8s-ci-robot merged commit 6d53060 into kubernetes-sigs:master Aug 7, 2020
@BenTheElder BenTheElder deleted the reprodigo branch August 7, 2020 01:21
@BenTheElder
Copy link
Member Author

this is allowing us to upgrade go versions immediately, instead of waiting a fairly long time for the golang docker images to be live at a given version.

@BenTheElder
Copy link
Member Author

#1771 is within 30m of the release announcement (just when I got around to it) instead of checking back repeatedly for the image to be live

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants