Skip to content

Instantly share code, notes, and snippets.

@haydonryan
Created September 17, 2024 16:39
Show Gist options
  • Save haydonryan/fbfcab5301885b44d3ff4760ff90a7f8 to your computer and use it in GitHub Desktop.
Save haydonryan/fbfcab5301885b44d3ff4760ff90a7f8 to your computer and use it in GitHub Desktop.
Parse concourse deployment and download release blobs
#!/bin/bash
mkdir -p ../images/concourse
for i in {0..15} # Cap at 15 releases adjust as necessary
do
URL="$(bosh int \
-e bosh-1 \
-d concourse \
./concourse-bosh-deployment/cluster/concourse.yml \
-l ./concourse-bosh-deployment/versions.yml \
-l ./variables.yml \
-o ./concourse-bosh-deployment/cluster/operations/backup-atc.yml \
-o ./concourse-bosh-deployment/cluster/operations/basic-auth.yml \
-o ./concourse-bosh-deployment/cluster/operations/static-web.yml \
-o ./concourse-bosh-deployment/cluster/operations/privileged-https.yml \
-o ./concourse-bosh-deployment/cluster/operations/tls-vars.yml \
-o ./concourse-bosh-deployment/cluster/operations/tls.yml \
-o ./concourse-bosh-deployment/cluster/operations/uaa.yml \
-o ./concourse-bosh-deployment/cluster/operations/credhub-colocated.yml \
-o ./concourse-bosh-deployment/cluster/operations/encryption.yml \
--vars-store cluster-creds.yml \
--path /releases/$i/url 2>/dev/null)"
if [[ $? -ne 0 ]]; then
exit 1
fi
VERSION="${URL#*=}" # From a given URL eg: https://bosh.io/d/github.com/cloudfoundry-incubator/backup-and-restore-sdk-release?v=1.18.119
# Grab and save the version
RELEASE="${URL%\?*}" # Remove ? and everything after it
RELEASE="${RELEASE##*/}" # Remove largest match (##) up to / eg only keep file
echo "Filename: $RELEASE-$VERSION.tgz"
echo "Downloading: $URL"
wget -vvvv --no-clobber -O "../images/concourse/$RELEASE-$VERSION.tgz" $URL # No clobber so not over write existing file
echo ""
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment