-
Notifications
You must be signed in to change notification settings - Fork 1
PREQ-9016 Add public shared action for JFrog Edge token federation #353
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
Closed
+62
−0
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| name: Wait for Artifactory token federation | ||
| description: Wait until a Vault-issued Artifactory token is accepted by the JFrog Edge node | ||
|
|
||
| inputs: | ||
| artifactory-url: | ||
| description: JFrog Artifactory base URL | ||
| default: https://repox-internal.dev.sonar.build/artifactory | ||
| probe-path: | ||
| description: Authenticated Edge endpoint path and optional query used to verify the token | ||
| required: true | ||
|
|
||
| runs: | ||
| using: composite | ||
| steps: | ||
| - shell: bash | ||
| env: | ||
| ARTIFACTORY_URL: ${{ inputs.artifactory-url }} | ||
| PROBE_PATH: ${{ inputs.probe-path }} | ||
| run: | | ||
| : "${ARTIFACTORY_ACCESS_TOKEN:?ARTIFACTORY_ACCESS_TOKEN must be configured before waiting for token federation}" | ||
|
|
||
| for attempt in {1..12}; do | ||
| status=$(curl --silent --show-error --connect-timeout 5 --max-time 10 --output /dev/null --write-out "%{http_code}" \ | ||
| --header "Authorization: Bearer ${ARTIFACTORY_ACCESS_TOKEN}" \ | ||
| "${ARTIFACTORY_URL}/${PROBE_PATH}" || true) | ||
| if [[ "${status}" == "200" ]]; then | ||
| echo "Artifactory token accepted by Edge" | ||
| exit 0 | ||
| fi | ||
| if [[ ! "${status}" =~ ^(000|401|408|429|500|502|503|504)$ ]]; then | ||
| echo "Unexpected response from Edge: HTTP ${status}" | ||
| exit 1 | ||
| fi | ||
| echo "Waiting for Artifactory token federation (attempt ${attempt}/12, HTTP ${status})" | ||
| if (( attempt < 12 )); then | ||
| sleep 10 | ||
| fi | ||
| done | ||
|
|
||
| echo "Artifactory token was not accepted by Edge after 12 attempts" | ||
| exit 1 |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
💡 Quality: README section order doesn't match the table of contents
The new entry is added at the end of the "Actions provided in this repository" list, after
report-ci-metrics. The## wait-for-artifactory-token-federationsection, however, sits right after that list and before## get-build-number(line 89). Every other README section follows the list order, so a reader expecting this action last will find it first. To fix this, move the section (and its---separator) to just after thereport-ci-metricssection and before## Deployment Strategy, or move the list entry to the top of the list.Was this helpful? React with 👍 / 👎