-
Notifications
You must be signed in to change notification settings - Fork 1
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 plugins support #4
base: main
Are you sure you want to change the base?
Conversation
log.Print("requesting reboot") | ||
// TODO: change call from target.Reboot to something like target.ScheduleReboot | ||
// which can asyncronouly perform the task instead of waiting | ||
// for all the services to shutdown and then ack the reboot, | ||
// othewise this causes a deadlock as the selfupdate service won't SIGTERM cleanly | ||
// until the reboot ack is received, but won't receive the ack until all services shut down, | ||
// causing a delayed reboot until SIGKILL kicks in. | ||
if err := target.Reboot(); err != nil { | ||
return fmt.Errorf("reboot: %v", 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.
This one will need some thought
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.
Hmm, why will selfupdate not SIGTERM cleanly in this state? I would have expected it to. SIGINT and SIGTERM are hooked up to context cancellation in selfupdate’s main function.
ticker := time.NewTicker(frequency) | ||
|
||
for { | ||
for c := time.Tick(frequency); ; { |
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.
Changing this so then we get an immediate first check without waiting an extra frequency
interval.
Also changing the skipWaiting to only skip the Jitter once, the first time.
These two changes combined still achieve the same initially defined behaviour for skipWaiting, but improve the first check also in cases where skipWaiting is set to false
As part of the update system efforts, we are introducing the ability to specify plugins that allow to push and pull updates from many different sources (e.g. OCI, S3, ...) in addition to the natively supported HTTP file server source.
As such in gokrazy/gokrazy#173 we want to give
selfupdate
the ability to understand payload links that differ from HTTP and may be coming from a GUS update response.To be able to do this, selfupdate must give the user the ability to specify a plugin name (which will be used by
selfupdate
to reference the plugin binary) and some credentials that the plugin will use to fetch the update from the source registries (think for example at the credentials necessary to fetch an OCI update payload from an OCI registry or at the AWS credentials necessary to pull a file from AWS S3).This PR aims at implementing this ability for
selfupdate
.Note:
With this approach
selfupdate
will be able to load only one plugin at a time in addition to the already natively supported HTTP fetching mechanism.