Skip to content

Retry core.getIDToken for JWT Auth Method#574

Merged
fairclothjm merged 2 commits intohashicorp:mainfrom
veslab:retry-core-getIDToken
Mar 3, 2025
Merged

Retry core.getIDToken for JWT Auth Method#574
fairclothjm merged 2 commits intohashicorp:mainfrom
veslab:retry-core-getIDToken

Conversation

@aefuente
Copy link
Copy Markdown
Contributor

Description

core.getIDToken intermittently fails for both cloud hosted and on prem runners. This causes entire workflows to fail.

Adds a generic async retry function. Adds 5 retries with 3 seconds of delay between core.getIDToken calls.

Closes #525

Copy link
Copy Markdown
Collaborator

@fairclothjm fairclothjm left a comment

Choose a reason for hiding this comment

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

Thanks @aefuente !

@fairclothjm fairclothjm merged commit 5d06ce8 into hashicorp:main Mar 3, 2025
2 checks passed
if (!privateKey) {
jwt = await core.getIDToken(githubAudience)
jwt = await retryAsyncFunction(retries, retries_delay, core.getIDToken, githubAudience)
.then((result) => {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@aefuente Should we catch any errors here?

Copy link
Copy Markdown
Contributor Author

@aefuente aefuente Mar 3, 2025

Choose a reason for hiding this comment

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

@fairclothjm The error that gets thrown would be core.getIDToken Error. Its possible we could return a more explicit/generic message "failed to get ID Token from Github" or something like that, but the error should still be thrown at this step. This error isn't caught by action.js and should terminate the run in error status.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks, that was my assumption as well but wanted to confirm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Intermittant: "Error message: Failed to get ID Token."

2 participants