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

Scan Directory: Add (git) version #1866

Open
lclc opened this issue May 16, 2024 · 2 comments
Open

Scan Directory: Add (git) version #1866

lclc opened this issue May 16, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@lclc
Copy link

lclc commented May 16, 2024

What would you like to be added:
When I scan code in a directory, I'd like to use the template to also return which version it scanned (I suggest using git describe --tag). This way, it can generate a meaningful report.

Why is this needed:

When scanning images, there is {{.Distro.Version}} for the template. Nothing like this exists for scanning code.

@lclc lclc added the enhancement New feature or request label May 16, 2024
@tgerla
Copy link
Contributor

tgerla commented May 23, 2024

Hi @lclc, thanks for the issue. We think this idea makes sense. There is a workaround that you could use to inject some arbitrary information into your Grype result right now, using the --name option. For instance, using a subshell to call git:

grype --name `git describe --tags --abbrev=0` . -o json

The value passed in using --name will be accessible in the template using {{ .Descriptor.Configuration.Name }}

Two notes: currently the --name value ends up in Descriptor.Configuration.Name which is not the right place -- it will move to a different path soon, when we fix that bug. We will also be changing --name to --source-name and adding --source-version to match Syft. Once those changes are made, --source-version will probably be the right place to inject this info.

We've got a couple of other issues that we will link to this one--stay tuned!

@tgerla
Copy link
Contributor

tgerla commented May 23, 2024

Here is a feature request for Syft related to this request: anchore/syft#2898

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
Status: Backlog
Development

No branches or pull requests

2 participants