mirror of
https://github.com/actions/runner-images.git
synced 2025-12-15 06:08:07 +00:00
38 lines
1.4 KiB
Bash
38 lines
1.4 KiB
Bash
#!/bin/bash
|
|
################################################################################
|
|
## File: aws-sam-cli.sh
|
|
## Desc: Installs AWS SAM CLI
|
|
## Must be run after toolset installation
|
|
################################################################################
|
|
|
|
# Source the helpers for use with the script
|
|
source $HELPER_SCRIPTS/document.sh
|
|
|
|
# Install aws sam cli
|
|
TarballUrl=$(curl -s https://api.github.com/repos/awslabs/aws-sam-cli/releases/latest | jq -r '.tarball_url')
|
|
TarballPath="/tmp/aws-sam-cli.tar.gz"
|
|
wget $TarballUrl -O $TarballPath
|
|
tar -xzvf $TarballPath -C /tmp
|
|
cd /tmp/awslabs-aws-sam-cli*
|
|
# Use python 3.7 from toolcache to install aws sam, setuptools module required for the installation
|
|
Python3Dir=$(echo ${AGENT_TOOLSDIRECTORY}/Python/3.7*/x64)
|
|
Python3BinDir=$(echo ${Python3Dir}/bin)
|
|
export PATH="$Python3Dir:$Python3BinDir:$PATH"
|
|
python3 -m pip install setuptools
|
|
python3 setup.py install
|
|
sudo ln -sf ${Python3BinDir}/sam /usr/local/bin/sam
|
|
|
|
# Cleanup downloaded files
|
|
rm -rf $TarballPath
|
|
rm -rf /tmp/awslabs-aws-sam-cli*
|
|
|
|
# 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 ! sam --version; then
|
|
echo "AWS SAM 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 "AWS $(sam --version)" |