Skip to content

Instantly share code, notes, and snippets.

@straubt1
Last active July 7, 2022 15:07
Show Gist options
  • Save straubt1/f7f5c48c85d444bccdfadce47919f916 to your computer and use it in GitHub Desktop.
Save straubt1/f7f5c48c85d444bccdfadce47919f916 to your computer and use it in GitHub Desktop.
TFE Download Airgap
#!/bin/bash
# export LICENSE_ID=""
# export PASSWORD=""
[[ -z "$LICENSE_ID" ]] && echo "Please Set LICENSE_ID Environment Variable" && exit 1
[[ -z "$PASSWORD" ]] && echo "Please Set PASSWORD Environment Variable" && exit 1
b64_password=$(echo -n ${PASSWORD} | base64)
# Get all releases so we can pull the label
all_releases=$(curl -s \
-H "Authorization: Basic ${b64_password}" \
-H "Accept: application/json" \
"https://api.replicated.com/market/v1/airgap/releases?license_id=${LICENSE_ID}")
# echo $all_releases > all_releases.json
echo "Seq Label"
echo ${all_releases} | jq -r '.releases[:10] | .[] | "\(.release_sequence) \(.label)"'
#!/bin/bash
# export LICENSE_ID=""
# export PASSWORD=""
release_sequence=$1
[[ -z "$LICENSE_ID" ]] && echo "Please Set LICENSE_ID Environment Variable" && exit 1
[[ -z "$PASSWORD" ]] && echo "Please Set PASSWORD Environment Variable" && exit 1
[[ -z "$release_sequence" ]] && echo "Please Pass a release sequence number" && exit 1
b64_password=$(echo -n ${PASSWORD} | base64)
# Get all releases so we can pull the label
all_releases=$(curl -s \
-H "Authorization: Basic ${b64_password}" \
-H "Accept: application/json" \
"https://api.replicated.com/market/v1/airgap/releases?license_id=${LICENSE_ID}")
# echo $all_releases > all_releases.json
# Get the specific release airgap so we can get the generated URL
replicated_release=$(curl -s \
-H "Authorization: Basic ${b64_password}" \
-H "Accept: application/json" \
"https://api.replicated.com/market/v1/airgap/images/url?license_id=${LICENSE_ID}&sequence=${release_sequence}")
# echo $replicated_release > replicated_release.json
label=$(echo ${all_releases} | jq -r ".releases[] | select(.release_sequence == ${release_sequence}) | .label")
url=$(echo ${replicated_release} | jq -r '.url')
filename="${label}(${release_sequence}).airgap"
echo
echo "Found TFE release:"
echo " Sequence: ${release_sequence}"
echo " Label: ${label}"
echo
echo "Generated URL:"
echo " URL: ${url}"
echo " Filename: ${filename}"
echo
curl -o ${filename} ${url}
#!/bin/sh
URL="https://release-notes.replicated.com"
curl -Ss ${URL} | grep blog-post-title | awk -F '>' '{print $2}' | awk -F '<' '{print $1}'
#!/bin/bash
version=$1
[[ -z "$version" ]] && echo "Please Pass a version (example 2.42.5)" && exit 1
url="https://s3.amazonaws.com/replicated-airgap-work/stable/replicated-${version}%2B${version}%2B${version}.tar.gz"
filename="replicated-${version}.tar.gz"
echo
echo "Replicated:"
echo " Version: ${version}"
echo " URL: ${url}"
echo " Filename: ${filename}"
echo
curl -Lo ${filename} ${url}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment