-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Optimize go build caching in release-binary make target #13408
Copy link
Copy link
Open
Labels
help wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.kind/featureCategorizes issue or PR as related to a new feature.Categorizes issue or PR as related to a new feature.priority/backlogHigher priority than priority/awaiting-more-evidence.Higher priority than priority/awaiting-more-evidence.triage/acceptedIndicates an issue or PR is ready to be actively worked on.Indicates an issue or PR is ready to be actively worked on.
Metadata
Metadata
Assignees
Labels
help wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.kind/featureCategorizes issue or PR as related to a new feature.Categorizes issue or PR as related to a new feature.priority/backlogHigher priority than priority/awaiting-more-evidence.Higher priority than priority/awaiting-more-evidence.triage/acceptedIndicates an issue or PR is ready to be actively worked on.Indicates an issue or PR is ready to be actively worked on.
The
release-binaryMakefile target currently uses /tmp/ as the GOCACHE directory inside the Docker container, which means the build cache is discarded after every run. This results in slower builds since Go has to recompile everything from scratch each time.The make target
release-binariesbuild the clusterctl binary for each architecture by calling therelease-binarytarget. Therefore, the same go packages are installed each and every time and recompilation from scratch occurs every time which is bit inefficient.Changes proposed:
GOCACHEto/go/build-cache/instead of/tmp/GOMODCACHEinto the container at/go/pkg/modto reuse downloaded modules.GOCACHEinto the container at/go/build-cacheto persist the build cache across runs.These volume mounts allow the Docker build to leverage caches from the host machine, significantly speeding up incremental builds.