[ubuntu] Move aws-sam-cli installation to the aws.sh script (#3401)

This commit is contained in:
Mikhail Timofeev
2021-05-17 21:55:32 +03:00
committed by GitHub
parent c4b6ffb1dc
commit 952ee3e740
6 changed files with 8 additions and 49 deletions

View File

@@ -1,28 +0,0 @@
#!/bin/bash -e
################################################################################
## File: aws-sam-cli.sh
## Desc: Installs AWS SAM CLI
## Requires Python >=3.6, must be run as non-root user after toolset installation
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/install.sh
# Download latest aws sam cli sources
TarballUrl=$(curl -s https://api.github.com/repos/aws/aws-sam-cli/releases/latest | jq -r '.tarball_url')
TarballPath="/tmp/aws-sam-cli.tar.gz"
download_with_retries $TarballUrl "/tmp" "aws-sam-cli.tar.gz"
tar -xzf $TarballPath -C /tmp
cd /tmp/aws-aws-sam-cli*
mkdir /opt/python-aws-sam-cli
cp -r /opt/hostedtoolcache/Python/3.7* /opt/python-aws-sam-cli
# Use copy of python 3.7 from toolcache to install aws sam, setuptools package required for the installation
Python3Dir=$(echo /opt/python-aws-sam-cli/3.7*/x64)
Python3BinDir="${Python3Dir}/bin"
$Python3BinDir/python3 -m pip install setuptools
$Python3BinDir/python3 setup.py install
ln -sf ${Python3BinDir}/sam /usr/local/bin/sam
invoke_tests "CLI.Tools" "AWS SAM CLI"

View File

@@ -1,7 +1,7 @@
#!/bin/bash -e
################################################################################
## File: aws.sh
## Desc: Installs the AWS CLI
## Desc: Installs the AWS CLI, Session Manager plugin for the AWS CLI, and AWS SAM CLI
################################################################################
# Source the helpers for use with the script
@@ -24,4 +24,11 @@ fi
download_with_retries "https://s3.amazonaws.com/session-manager-downloads/plugin/latest/ubuntu_64bit/session-manager-plugin.deb" "/tmp" "session-manager-plugin.deb"
apt install /tmp/session-manager-plugin.deb
# Download & install the latest aws sam cli release
zipName="aws-sam-cli-linux-x86_64.zip"
zipUrl="https://github.com/aws/aws-sam-cli/releases/latest/download/${zipName}"
download_with_retries $zipUrl "/tmp" $zipName
unzip /tmp/${zipName} -d /tmp
/tmp/install
invoke_tests "CLI.Tools" "AWS"

View File

@@ -25,9 +25,7 @@ Describe "AWS" {
It "Session Manager Plugin for the AWS CLI" {
session-manager-plugin | Out-String | Should -Match "plugin was installed successfully"
}
}
Describe "AWS SAM CLI" {
It "AWS SAM CLI" {
"sam --version" | Should -ReturnZeroExitCode
}

View File

@@ -223,10 +223,6 @@
"package": "yamllint",
"cmd": "yamllint"
},
{
"package": "aws-sam-cli",
"cmd": "sam"
},
{
"package": "ansible-base",
"cmd": "ansible"

View File

@@ -223,10 +223,6 @@
"package": "yamllint",
"cmd": "yamllint"
},
{
"package": "aws-sam-cli",
"cmd": "sam"
},
{
"package": "ansible-base",
"cmd": "ansible"

View File

@@ -265,16 +265,6 @@
],
"execute_command": "sudo sh -c '{{ .Vars }} pwsh -f {{ .Path }}'"
},
{
"type": "shell",
"scripts": [
"{{template_dir}}/scripts/installers/aws-sam-cli.sh"
],
"environment_vars": [
"HELPER_SCRIPTS={{user `helper_script_folder`}}"
],
"execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'"
},
{
"type": "shell",
"scripts": [