Skip to content
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 retry on 401 and 403 for runner-registration #3377

Merged
merged 6 commits into from
Mar 27, 2024

Conversation

nikola-jokic
Copy link
Contributor

No description provided.

@nikola-jokic nikola-jokic changed the title Modify retry client in actions pkg to retry on >= 400 Add retry on 401 and 403 for runner-registration Mar 25, 2024
@nikola-jokic nikola-jokic added the gha-runner-scale-set Related to the gha-runner-scale-set mode label Mar 26, 2024
if retry > 3 {
return nil, fmt.Errorf("unable to register runner after 3 retries: %v", err)
}
time.Sleep(1 * time.Second)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we use a growing interval here? e.g. 250 * time.Millisecond * (retries + 1) or something like that?

Comment on lines 987 to 992
var actionsServiceAdminConnection *ActionsServiceAdminConnection
if err := json.NewDecoder(resp.Body).Decode(&actionsServiceAdminConnection); err != nil {
return nil, err
}

return actionsServiceAdminConnection, nil
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we move handling the happy path out of the loop? I think the goal of the loop should be to handle retryable errors?

github/actions/client.go Outdated Show resolved Hide resolved
}
defer resp.Body.Close()
retry := 0
for {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be painful because this is unexported, but can we add a test for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added, good call!

@nikola-jokic nikola-jokic merged commit 1d17906 into master Mar 27, 2024
15 checks passed
@nikola-jokic nikola-jokic deleted the nikola-jokic/retry-on-4xx branch March 27, 2024 09:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gha-runner-scale-set Related to the gha-runner-scale-set mode
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants