-
Notifications
You must be signed in to change notification settings - Fork 174
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
refactor: action retry to use go-retry #2868
Conversation
Signed-off-by: Philip Laine <[email protected]>
aee71be
to
8bd06ce
Compare
Signed-off-by: Philip Laine <[email protected]>
8bd06ce
to
4c03b75
Compare
spinner.Updatef("Waiting for \"%s\" %s", cmdEscaped, timeoutStr) | ||
}), | ||
) | ||
if actionCtx.Err() != nil { |
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 will also happen on context cancel so need another way of checking for timeout. An option is to use with cause.
// Try running the command and continue the retry loop if it fails. | ||
if out, err = actionRun(ctx, actionDefaults, cmd, actionDefaults.Shell, spinner); err != nil { | ||
// If an output variable is defined, set it. | ||
for _, v := range action.SetVariables { |
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.
Should this be retried? It it seems like this was done because implementing it would have been difficult in the old code. It seems a lot smarter to only retry the action on errors and not the setting on variables as I assume the output variables will be the same every time the actions run.
Before merging we should add tests to the Run function to validate the error output for the different failure modes. |
Description
This change replaces the custom retry logic with using go-retry. It simplifies legibility a lot by removing use of labels to break out of the outer loop.
Related Issue
Depends on #2856
Checklist before merging