Add git to image build docker step #4534
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Our cloud build image uploader started failing a week ago with an error about git not being available in the build container. It never has been, so I'm not sure how it worked before if git was required. But I can reproduce the failure locally, and adding git indeed fixes the problem.
My guess as to the cause of this is that we are not controlling the version of the Go alpine image we're building in, and it updated to use go 1.18. With Go 1.18, the build seems to default to trying to populate
[BuildInfo](https://pkg.go.dev/debug/buildinfo@master#BuildInfo)
including VCS information. The error I got locally is more informative:We aren't currently/yet using BuildInfo regardless, and if we do we'll want to make sure the VCS information it gets this way is correct.