Files
runner-images/images/linux/scripts/installers/oras-cli.sh
T

30 lines
1.2 KiB
Bash
Raw Normal View History

2020-07-07 16:40:02 +03:00
#!/bin/bash
################################################################################
## File: oras-cli.sh
2020-07-07 17:25:41 +03:00
## Desc: Installs ORAS CLI
2020-07-07 16:40:02 +03:00
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
2020-07-07 19:23:45 +03:00
source $HELPER_SCRIPTS/install.sh
2020-07-07 16:40:02 +03:00
# Determine latest ORAS CLI version
ORAS_CLI_LATEST_VERSION_URL=https://api.github.com/repos/deislabs/oras/releases/latest
2020-07-07 19:14:31 +03:00
ORAS_CLI_DOWNLOAD_URL=$(curl -s $ORAS_CLI_LATEST_VERSION_URL | jq -r '.assets[].browser_download_url | select(contains("linux_amd64.tar.gz"))')
ORAS_CLI_ARCHIVE=$(basename $ORAS_CLI_DOWNLOAD_URL)
2020-07-07 16:40:02 +03:00
# Install ORAS CLI
2020-07-07 19:14:31 +03:00
cd /tmp
2020-07-07 19:23:45 +03:00
download_with_retries $ORAS_CLI_DOWNLOAD_URL
2020-07-08 11:13:21 +03:00
tar -zxvf $ORAS_CLI_ARCHIVE -C /usr/local/bin oras
2020-07-07 16:40:02 +03:00
# Run tests to determine that the software installed as expected
echo "Testing to make sure that script performed as expected, and basic scenarios work"
if ! oras version; then
echo "ORAS CLI was not installed"
exit 1
fi
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
2020-07-08 11:13:21 +03:00
DocumentInstalledItem "ORAS CLI $(oras version | awk 'NR==1{print $2}')"