-
Notifications
You must be signed in to change notification settings - Fork 571
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
feat(cmd/update): add UA header with current ver when check for update #2100
feat(cmd/update): add UA header with current ver when check for update #2100
Conversation
Signed-off-by: hainenber <[email protected]>
966e004
to
2d1f75a
Compare
cmd/syft/cli/commands/update.go
Outdated
req, err := http.NewRequest(http.MethodGet, latestAppVersionURL.host+latestAppVersionURL.path, nil) | ||
if err != nil { | ||
return nil, fmt.Errorf("failed to create request for latest version: %w", err) | ||
} | ||
req.Header.Add("User-Agent", fmt.Sprintf("%v %v", "Syft", currentVersion)) |
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 think we should instead modify this function to take the id clio.Identification
as a parameter (and, by association the isUpdateAvailable
function), then this line would be something like:
req.Header.Add("User-Agent", fmt.Sprintf("%v %v", id.Name, id.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.
Thanks for the prompt review! Sounds reasonable to me, I'll try pushing new commits to amend this
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.
Done pushing. PTAL again. Thanks!
Signed-off-by: hainenber <[email protected]>
74a7ffd
to
535a8e7
Compare
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.
Thanks for the contribution @hainenber!
* main: chore(deps): update bootstrap tools to latest versions (anchore#2086) chore(deps): update CPE dictionary index (anchore#2089) chore(deps): bump github.com/saferwall/pe from 1.4.4 to 1.4.5 (anchore#2096) chore(deps): bump github.com/docker/docker (anchore#2098) chore(deps): bump golang.org/x/net from 0.14.0 to 0.15.0 (anchore#2099) feat(cmd/update): add UA header with current ver when check for update (anchore#2100) fix(cdx): validate external refs before encoding (anchore#2091) expose cobra command in cli package (anchore#2097) Signed-off-by: Christopher Phillips <[email protected]>
anchore#2100) Signed-off-by: hainenber <[email protected]>
Implements #2072
PR description
When check for version update during
syft
commands, specify UA header with current version of the binary.Notes