-
Notifications
You must be signed in to change notification settings - Fork 103
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
Allow control server to pin version for osqueryd and launcher #1629
Allow control server to pin version for osqueryd and launcher #1629
Conversation
05ed9db
to
3c3c73a
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.
I am still ambivalent about whether we need 3 flags, or 2 flags. But I think I can live with it, and the code looks reasonable.
// versionFromTarget extracts the semantic version for an update from its filename. | ||
func versionFromTarget(binary autoupdatableBinary, targetFilename string) string { | ||
// The target is in the form `launcher-0.13.6.tar.gz` -- trim the prefix and the file extension to return the version | ||
prefixToTrim := fmt.Sprintf("%s-", binary) |
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.
Could also SplitN
LGTM! |
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!
Relates to #1577
Some users may want to pin a particular version of osqueryd or launcher. This PR enables that functionality via the TUF autoupdater.
If a pinned version is set, the autoupdater will select that version first. If it cannot find that version, then it will fall back to using the release version for the configured update channel.
While working on this PR, I noticed I had a couple related functions about parsing and comparing versions, so I've moved them into their own file and separated out their tests as well.
Also -- updated to handle control server actions during the initial delay in a clearer and more opinionated way: