Skip to content

Commit

Permalink
Merge pull request actions#1160 from miketimofeev/v-mitim/install_aws…
Browse files Browse the repository at this point in the history
…_sam_w-o_brew

[Ubuntu] Install aws-sam-cli without brew
  • Loading branch information
AlenaSviridenko authored Jul 2, 2020
2 parents 195a1de + abf21e6 commit beec47e
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 40 deletions.
19 changes: 15 additions & 4 deletions images/linux/scripts/installers/aws-sam-cli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,26 @@
################################################################################
## File: aws-sam-cli.sh
## Desc: Installs AWS SAM CLI
## Must be run as non-root user after homebrew and clang
## 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/document.sh

# Install aws sam cli
brew tap aws/tap
brew install aws-sam-cli
# Download latest aws sam cli sources
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 package required for the installation
Python3Dir=$(echo ${AGENT_TOOLSDIRECTORY}/Python/3.7*/x64)
Python3BinDir="${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

# Run tests to determine that the software installed as expected
echo "Testing to make sure that script performed as expected, and basic scenarios work"
Expand Down
23 changes: 11 additions & 12 deletions images/linux/ubuntu1604.json
Original file line number Diff line number Diff line change
Expand Up @@ -233,18 +233,6 @@
],
"execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'"
},
{
"type": "shell",
"scripts": [
"{{template_dir}}/scripts/installers/aws-sam-cli.sh"
],
"environment_vars": [
"METADATA_FILE={{user `metadata_file`}}",
"HELPER_SCRIPTS={{user `helper_script_folder`}}",
"DEBIAN_FRONTEND=noninteractive"
],
"execute_command": "/bin/sh -c '{{ .Vars }} {{ .Path }}'"
},
{
"type": "file",
"source": "{{template_dir}}/toolsets/toolcache-1604.json",
Expand Down Expand Up @@ -288,6 +276,17 @@
],
"execute_command": "sudo sh -c '{{ .Vars }} pwsh -f {{ .Path }}'"
},
{
"type": "shell",
"scripts": [
"{{template_dir}}/scripts/installers/aws-sam-cli.sh"
],
"environment_vars": [
"METADATA_FILE={{user `metadata_file`}}",
"HELPER_SCRIPTS={{user `helper_script_folder`}}"
],
"execute_command": "/bin/sh -c '{{ .Vars }} {{ .Path }}'"
},
{
"type": "shell",
"scripts":[
Expand Down
23 changes: 11 additions & 12 deletions images/linux/ubuntu1804.json
Original file line number Diff line number Diff line change
Expand Up @@ -237,18 +237,6 @@
],
"execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'"
},
{
"type": "shell",
"scripts": [
"{{template_dir}}/scripts/installers/aws-sam-cli.sh"
],
"environment_vars": [
"METADATA_FILE={{user `metadata_file`}}",
"HELPER_SCRIPTS={{user `helper_script_folder`}}",
"DEBIAN_FRONTEND=noninteractive"
],
"execute_command": "/bin/sh -c '{{ .Vars }} {{ .Path }}'"
},
{
"type": "file",
"source": "{{template_dir}}/toolsets/toolcache-1804.json",
Expand Down Expand Up @@ -292,6 +280,17 @@
],
"execute_command": "sudo sh -c '{{ .Vars }} pwsh -f {{ .Path }}'"
},
{
"type": "shell",
"scripts": [
"{{template_dir}}/scripts/installers/aws-sam-cli.sh"
],
"environment_vars": [
"METADATA_FILE={{user `metadata_file`}}",
"HELPER_SCRIPTS={{user `helper_script_folder`}}"
],
"execute_command": "/bin/sh -c '{{ .Vars }} {{ .Path }}'"
},
{
"type": "shell",
"scripts":[
Expand Down
23 changes: 11 additions & 12 deletions images/linux/ubuntu2004.json
Original file line number Diff line number Diff line change
Expand Up @@ -238,18 +238,6 @@
],
"execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'"
},
{
"type": "shell",
"scripts": [
"{{template_dir}}/scripts/installers/aws-sam-cli.sh"
],
"environment_vars": [
"METADATA_FILE={{user `metadata_file`}}",
"HELPER_SCRIPTS={{user `helper_script_folder`}}",
"DEBIAN_FRONTEND=noninteractive"
],
"execute_command": "/bin/sh -c '{{ .Vars }} {{ .Path }}'"
},
{
"type": "file",
"source": "{{template_dir}}/toolsets/toolcache-2004.json",
Expand Down Expand Up @@ -293,6 +281,17 @@
],
"execute_command": "sudo sh -c '{{ .Vars }} pwsh -f {{ .Path }}'"
},
{
"type": "shell",
"scripts": [
"{{template_dir}}/scripts/installers/aws-sam-cli.sh"
],
"environment_vars": [
"METADATA_FILE={{user `metadata_file`}}",
"HELPER_SCRIPTS={{user `helper_script_folder`}}"
],
"execute_command": "/bin/sh -c '{{ .Vars }} {{ .Path }}'"
},
{
"type": "shell",
"scripts":[
Expand Down

0 comments on commit beec47e

Please sign in to comment.