-
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
[TUF autoupdater] Check out latest #1185
[TUF autoupdater] Check out latest #1185
Conversation
c4e5f88
to
a4b6235
Compare
I was slacking about this. It feels confusing and complex. |
90c3db6
to
0ae45a1
Compare
@directionless I think this is simpler and more lightweight now -- let me know what you think. |
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 lack the understanding to review the code on a macro level. I'll try to look again later. Left some "micro" comments =)
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 this is mostly okay. (See questions)
this feels much more readable than the prior. I suspect some of this should land in the library manager, and we should call it. Having this iterate files on disk feels wrong. (What happens if we move the library into ram?) But we can iterate there if we want to.
pkg/autoupdate/tuf/library_lookup.go
Outdated
targets, err := metadataClient.Targets() | ||
if err != nil { | ||
return "", "", fmt.Errorf("could not get target: %w", err) | ||
} | ||
|
||
targetName, _, err := findRelease(binary, targets, channel) | ||
if err != nil { | ||
return "", "", fmt.Errorf("could not find release: %w", err) | ||
} |
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 this is okay, but it feels weird. These are functions that are hard to follow, and work a lot with github.com/theupdateframework/go-tuf/data
. It feels like we should bake them into something like metadataClient
. Not sure it's worth it though
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 there are a couple places in autoupdate.go
that feel similar, where it's a lot of work with go-tuf/data. Maybe could be wrapped in a tufReleaseClient
(or something) that performs the repeated tasks (update from remote TUF repo to download updated targets, find release target among those targets, find what target it's pointing at, return that target). I could do that here, or add it to the TODOs for a subsequent PR if we want to think about it more.
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.
Your call. I think this is okay, but it's still murky feeling.
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'll leave as-is for now, I guess, and think on it
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 know this had a lot of iteration. It seems like it's getting pretty clean
Relates to #954.
This is the next step toward using our new TUF infrastructure: a new implementation of
findNew
that looks at our new update library.Includes some drive-by changes:
kolide_tuf_autoupdater_errors
table that I'm hoping this will resolve.GetChannelVersionFromTufServer
to be used bylauncher doctor
and by packaging changes for Make launcher available per-architecture #1149How we pick which version of launcher/osqueryd to run
This flowchart is also committed to the docs in this PR.
Future work + linked PRs
Subsequent PRs will tackle the following (order is not set in stone):
<binary>/<os>/<arch>/<channel>/release.json
, once available (in progress but on hold here: [TUF autoupdater] Include arch in release file path and download file path #1195)findNew
); launcher performs library tidying after version selectionPrevious work: