Last active
February 17, 2025 13:54
-
-
Save jdmichaud/2c710d006d8545de9d6b204cfa4a1bc4 to your computer and use it in GitHub Desktop.
artifactory
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
ARTIFACTORY_DOMAIN=$(grep '^registry=' ~/.npmrc | awk -F'=' '{print $2}' | awk -F/ '{print $3}') | |
ARTIFACTORY_TOKEN=$(grep '^//${ARTIFACTORY_DOMAIN}' ~/.npmrc | \ | |
awk -F':' '{ print $2 }' | \ | |
awk -F'_auth=' '{ print $2 }' | \ | |
tr -d '"\r' | \ | |
base64 -d | \ | |
awk -F':' '{ print $2 }') | |
curl -H "Authorization: Bearer ${ARTIFACTORY_TOKEN}" \ | |
"https://${ARTIFACTORY_DOMAIN}/artifactory/api/storage/${PATH_TO_RESOURCE}?list&deep=1&listFolders=1&mdTimestamps=1" \ | |
| jq '.files |= sort_by(.lastModified)' \ | |
| jq '.files[-1].uri' \ | |
| tr -d '"\r' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment