Created
December 15, 2025 15:59
-
-
Save timosalm/61682404e7301ca6a9352c4d124f286f to your computer and use it in GitHub Desktop.
Download Spring Application Advisor recipes and package as tar file
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
| #!/bin/bash | |
| # Configuration | |
| REPO_URL="https://packages.broadcom.com/artifactory/spring-enterprise/com/vmware/tanzu/spring/recipes/" | |
| OUTPUT_TAR="spring-recipes-offline.tar" | |
| DOWNLOAD_DIR="spring-repo-mirror" | |
| # Credentials - Set these or export them in your shell | |
| USERNAME="${ARTIFACTORY_USER:-your_username}" | |
| PASSWORD="${ARTIFACTORY_PASS:-your_password}" | |
| if [[ "$USERNAME" == "your_username" ]]; then | |
| echo "Error: Please set ARTIFACTORY_USER and ARTIFACTORY_PASS." | |
| exit 1 | |
| fi | |
| echo "Cleaning up previous runs..." | |
| rm -rf "$DOWNLOAD_DIR" "$OUTPUT_TAR" | |
| mkdir -p "$DOWNLOAD_DIR" | |
| echo "Mirroring artifacts from $REPO_URL..." | |
| # wget flags explained: | |
| # -m: mirror (recursive download) | |
| # -np: no parent (prevents going up to parent directories) | |
| # -nH: no host directories (prevents creating 'packages.broadcom.com' folder) | |
| # --cut-dirs: removes the path prefix so we start cleanly at 'com/...' | |
| # -R "index.html*": rejects the HTML index files generated by Artifactory | |
| wget -m -np -nH --cut-dirs=2 \ | |
| -R "index.html*" \ | |
| --user="$USERNAME" \ | |
| --password="$PASSWORD" \ | |
| -P "$DOWNLOAD_DIR" \ | |
| "$REPO_URL" | |
| if [ $? -ne 0 ]; then | |
| echo "Download failed. Please check credentials and URL." | |
| exit 1 | |
| fi | |
| echo "Creating zip archive..." | |
| # Zip the contents (preserving the com/vmware... structure inside) | |
| cd "$DOWNLOAD_DIR" | |
| tar -cvf "../$OUTPUT_TAR" . | |
| cd .. | |
| echo "Success! Artifacts are packaged in $OUTPUT_TAR" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment