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

Add syft version to version command output #420

Merged
merged 5 commits into from
Sep 16, 2021
Merged

Conversation

spiffcs
Copy link
Contributor

@spiffcs spiffcs commented Sep 16, 2021

To Test run

make bootstrap
make build

Locally you should see syft version populated in the build:
Screen Shot 2021-09-16 at 10 13 07 AM

When you run:
./snapshot/grype-macos_darwin_amd64/grype version

You should see syft version populated in the output:
Screen Shot 2021-09-16 at 10 18 06 AM

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>
@spiffcs spiffcs marked this pull request as ready for review September 16, 2021 14:19
@spiffcs spiffcs requested a review from a team September 16, 2021 14:19
Copy link
Contributor

@luhring luhring left a 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}')
Copy link
Contributor

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'

Copy link
Contributor Author

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.

@spiffcs spiffcs merged commit fe00b3c into main Sep 16, 2021
@spiffcs spiffcs deleted the enhance_version_cmd branch September 16, 2021 20:08
@wagoodman wagoodman changed the title Enhance version cmd Add syft version to version command output Sep 23, 2021
@wagoodman wagoodman added the enhancement New feature or request label Sep 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants