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

fix: add terraform failure if reset api key fails to create api key #540

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Aashiq-J
Copy link
Member

@Aashiq-J Aashiq-J commented Oct 9, 2024

Description

Issue: https://github.ibm.com/GoldenEye/issues/issues/11046

Release required?

  • No release
  • Patch release (x.x.X)
  • Minor release (x.X.x)
  • Major release (X.x.x)
Release notes content

Run the pipeline

If the CI pipeline doesn't run when you create the PR, the PR requires a user with GitHub collaborators access to run the pipeline.

Run the CI pipeline when the PR is ready for review and you expect tests to pass. Add a comment to the PR with the following text:

/run pipeline

Checklist for reviewers

  • If relevant, a test for the change is included or updated with this PR.
  • If relevant, documentation for the change is included or updated with this PR.

For mergers

  • Use a conventional commit message to set the release level. Follow the guidelines.
  • Include information that users need to know about the PR in the commit message. The commit message becomes part of the GitHub release notes.
  • Use the Squash and merge option.

@Aashiq-J
Copy link
Member Author

Aashiq-J commented Oct 9, 2024

/run pipeline

@@ -54,14 +54,25 @@ if [ "${reset}" == true ]; then
if [ "$PRIVATE_ENV" = true ]; then
if [ "$CLUSTER_ENDPOINT" == "private" ] || [ "$CLUSTER_ENDPOINT" == "default" ]; then
RESET_URL="https://private.$REGION.containers.cloud.ibm.com/v1/keys"
curl -H "accept: application/json" -H "Authorization: $IAM_TOKEN" -H "X-Auth-Resource-Group: $RESOURCE_GROUP_ID" -X POST "$RESET_URL"
result=$(curl -i -H "accept: application/json" -H "Authorization: $IAM_TOKEN" -H "X-Auth-Resource-Group: $RESOURCE_GROUP_ID" -X POST "$RESET_URL" 2>/dev/null)
status_code=$(echo "$result" | head -n 1 | cut -d$' ' -f2)
Copy link
Member

Choose a reason for hiding this comment

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

This doesn't seem very clean. curl has a built in way to fail if the response code is a failure response using the --fail flag. Take a look at https://curl.se/docs/manpage.html

Copy link
Member Author

Choose a reason for hiding this comment

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

This is the current output after the change if the reset fails:
Screenshot 2024-10-09 at 3 12 45 PM

This is the error when we use --fail and --show-error
Screenshot 2024-10-09 at 3 32 11 PM

@Aashiq-J
Copy link
Member Author

/run pipeline

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.

2 participants