-
Notifications
You must be signed in to change notification settings - Fork 540
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
Add syft version to version command output #420
Conversation
Signed-off-by: Christopher Angelo Phillips <christopher.phillips@anchore.com>
Signed-off-by: Christopher Angelo Phillips <christopher.phillips@anchore.com>
Signed-off-by: Christopher Angelo Phillips <christopher.phillips@anchore.com>
Signed-off-by: Christopher Angelo Phillips <christopher.phillips@anchore.com>
Signed-off-by: Christopher Angelo Phillips <christopher.phillips@anchore.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice addition! 🎉
@@ -21,6 +21,7 @@ BOOTSTRAP_CACHE="c7afb99ad" | |||
DISTDIR=./dist | |||
SNAPSHOTDIR=./snapshot | |||
GITTREESTATE=$(if $(shell git status --porcelain),dirty,clean) | |||
SYFTVERSION=$(shell go list -m all | grep github.com/anchore/syft | awk '{print $$2}') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know if this is any safer than what you've already done, but there's a "machine readable" flow using JSON, too, like this:
go list -m -json all | jq --raw-output 'select(.Path == "github.com/anchore/syft").Version'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I just saw this comment. Happy to make the change if the taskrunners have jq installed. I used awk because I was more certain that would be available in the workflow by default than something like jq.
To Test run
Locally you should see syft version populated in the build:
When you run:
./snapshot/grype-macos_darwin_amd64/grype version
You should see syft version populated in the output: