The main reason for this is to support cases where the `go build`
happens on a non git folder but we want to pass a revision anyway.
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
* Bump min go version to 1.18 & read build SHA from binary
* GitHub Commit ID is really a Git Revision
* update go.sum
* fix spelling
* Address PR feedback
- Use a sync.Once to prevent double parsing
- Support SHA256
- Allow non-SHA revision strings
* Don't include 'unknown' revision value in logs
Go 1.17 introduced a new handy API for setting env vars scoped for
a single test so we can avoid the hard to read set and reset env
loops.
Signed-off-by: Pierangelo Di Pilato <pierdipi@redhat.com>
If you have a lot of refs in a repo, git will eventually start
condensing them into a single file instead of letting them sprawl out in
separate directories on the filesystem. This change lets the changeset
package use the packed-refs file as a fall back in the event that the
ref file is not found.
See https://git-scm.com/docs/git-pack-refs for more details on packed
refs.
With https://github.com/google/ko/pull/73 we can link the Git ref information
into images with:
```
ln -r -s .git/refs ./cmd/foo/kodata
```
If the changeset package gets a `ref: <ref>` entry, it attempts to read that
file from `KO_DATA_PATH` next, which lets the changeset work much more effectively.
* Some fixes to the spoof.go and exporter.go
While reviewing some other CL, I saw some avenues for improving
spoof.go, to log the URL that's being fetched, which would help in test
debugging and to use switch construct, rather than nested if's.
While testing the change, I noticed some shifty loggin from the
exporter, so I fixed that as well while I was there.
* Continuation of the previous cleanups.
* Fix the issues with formatting by executing a grep
* and fix compilation error
* lowercase error
* fix the newly changed unit test