Skip to content

Conversation

@imlogang
Copy link
Contributor

Checklist

  • All new jobs, commands, executors, parameters have descriptions
  • Examples have been added for any significant new features
  • README has been updated, if necessary

Motivation, issues

Sometimes, the CIRCLE_OIDC_TOKEN/V2 is missing from a job.
With the CircleCI CLI in jobs, you can configure a new token based on any audience.
This utilizes the built-in CIRCLE_ORGANIZATION_ID environment variable as the audience, similar to the current token that's injected into your job.

Description

Currently, the AWS CLI Orb errors out, which requires you to rerun the workflow.
This provides a retry mechanism to try 3 times to retrieve a new token based on the

@imlogang imlogang requested a review from a team as a code owner April 16, 2025 16:44
@anthony-j-castro anthony-j-castro requested a review from a team April 16, 2025 16:59
@marboledacci marboledacci merged commit c4143ac into CircleCI-Public:master Apr 16, 2025
2 checks passed
echo "Successfully set CIRCLE_OIDC_TOKEN"
echo 'export CIRCLE_OIDC_TOKEN="'"$CIRCLE_OIDC_TOKEN"'"' >> "$BASH_ENV"
echo 'export CIRCLE_OIDC_TOKEN_V2="'"$CIRCLE_OIDC_TOKEN"'"' >> "$BASH_ENV"
exit 0
Copy link
Contributor

Choose a reason for hiding this comment

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

Hi I was reviewing the script and was wondering why we would want to exit out of here? Wouldn't we want to exit the for loop and continue the script?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @ohjinsoo!

In this version of this script, if the exit 0 was not there, even if it were able to get a new token, it would trigger the last echo "failed to set ..." message.
The exit 0 in this case exits the scripts entirely once we confirm that we have a token set.

Copy link
Contributor

@ohjinsoo ohjinsoo Apr 18, 2025

Choose a reason for hiding this comment

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

Right, but the command aws-cli/setup is used to setup AWS creds. By exiting here, you won't be setting AWS creds, and you'd have to run the same command again which doesn't seem ideal.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch. I've created a new PR for this #224

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.

3 participants