mirror of
https://github.com/actions/runner-images.git
synced 2025-12-14 22:05:17 +00:00
31 lines
1.2 KiB
Bash
31 lines
1.2 KiB
Bash
#!/bin/bash
|
|
################################################################################
|
|
## File: oras-cli.sh
|
|
## Desc: Installs ORAS CLI
|
|
################################################################################
|
|
|
|
# Source the helpers for use with the script
|
|
source $HELPER_SCRIPTS/document.sh
|
|
|
|
# Determine latest ORAS CLI version
|
|
ORAS_CLI_LATEST_VERSION_URL=https://api.github.com/repos/deislabs/oras/releases/latest
|
|
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)
|
|
|
|
# Install ORAS CLI
|
|
cd /tmp
|
|
curl -LO $ORAS_CLI_DOWNLOAD_URL -o $ORAS_CLI_ARCHIVE
|
|
mkdir -p oras-install
|
|
tar -xzvf $ORAS_CLI_ARCHIVE -C oras-install/
|
|
mv oras-install/oras /usr/local/bin/
|
|
|
|
# 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"
|
|
DocumentInstalledItem "ORAS $(oras version | awk 'NR==1{print $2})" |