-
Notifications
You must be signed in to change notification settings - Fork 0
fix: testing improvements #102
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
Changes from 3 commits
73471fb
ab77d3d
60da231
6ee1757
dc36ce5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,4 +1,6 @@ | ||||||||||||||||||
| #!/bin/bash | ||||||||||||||||||
| #!/usr/bin/env bash | ||||||||||||||||||
|
|
||||||||||||||||||
| set -euo pipefail | ||||||||||||||||||
|
|
||||||||||||||||||
| # Derive additional environment variables | ||||||||||||||||||
| TOKEN_URL="${OIDC_OP_TOKEN_ENDPOINT}" | ||||||||||||||||||
|
|
@@ -24,6 +26,11 @@ get_token() { | |||||||||||||||||
|
|
||||||||||||||||||
| echo "🔐 Getting access token..." | ||||||||||||||||||
| BEARER=$( get_token | jq -r '.access_token' ) | ||||||||||||||||||
| if [ -z "$BEARER" ]; then | ||||||||||||||||||
| echo "❌ Failed to get access token." | ||||||||||||||||||
| exit 1 | ||||||||||||||||||
| fi | ||||||||||||||||||
|
Comment on lines
+29
to
+32
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The check for an empty To make this check more robust, you should also test if
Suggested change
|
||||||||||||||||||
|
|
||||||||||||||||||
| # NOTE: It's always okay to print this token, because it will | ||||||||||||||||||
| # only be valid / available in dummy / dev scenarios | ||||||||||||||||||
| [[ "${DEBUG:-}" == "1" ]] && echo "Got Access Token: ${BEARER}" | ||||||||||||||||||
|
|
||||||||||||||||||
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 check is great for robustness! To make it more concise and idiomatic to shell scripting, you can use a short-circuit
||operator. This also provides an opportunity to redirect the error message to stderr (>&2), which is a best practice for error reporting.