diff --git a/images/linux/scripts/installers/pipx-packages.sh b/images/linux/scripts/installers/pipx-packages.sh index 67931b591..825d1edcb 100644 --- a/images/linux/scripts/installers/pipx-packages.sh +++ b/images/linux/scripts/installers/pipx-packages.sh @@ -7,22 +7,19 @@ export PATH="$PATH:/opt/pipx_bin" -# Install yamlint -pipx install yamllint +toolset="$INSTALLER_SCRIPT_FOLDER/toolset.json" +pipx_packages=$(jq -r ".pipx[]" $toolset) -if ! command -v yamllint; then - echo "yamllint was not installed" +for package in $pipx_packages; do + echo "Install $package" + pipx install $package +done + +# Run tests to determine that the software installed as expected +echo "Testing to make sure that script performed as expected, and basic scenarios work" +for cmd in $pipx_packages; do + if ! command -v $cmd; then + echo "$cmd was not installed" exit 1 -fi - -echo "yamllint is successfully installed" - -# Install aws sam cli -pipx install aws-sam-cli --python /opt/hostedtoolcache/Python/3.7*/x64/bin/python3.7 - -if ! command -v sam; then - echo "aws sam cli was not installed" - exit 1 -fi - -echo "aws sam cli is successfully installed" \ No newline at end of file + fi +done diff --git a/images/linux/toolsets/toolset-1804.json b/images/linux/toolsets/toolset-1804.json index b14a60771..cd327dec7 100644 --- a/images/linux/toolsets/toolset-1804.json +++ b/images/linux/toolsets/toolset-1804.json @@ -188,5 +188,9 @@ "node:12-alpine", "ubuntu:14.04" ] - } + }, + "pipx": [ + "yamllint", + "aws-sam-cli" + ] } diff --git a/images/linux/toolsets/toolset-2004.json b/images/linux/toolsets/toolset-2004.json index 62aad4477..add68395d 100644 --- a/images/linux/toolsets/toolset-2004.json +++ b/images/linux/toolsets/toolset-2004.json @@ -151,5 +151,9 @@ "node:12-alpine", "ubuntu:14.04" ] - } + }, + "pipx": [ + "yamllint", + "aws-sam-cli" + ] } diff --git a/images/linux/ubuntu1804.json b/images/linux/ubuntu1804.json index 49e1aa1cd..daf40ce81 100644 --- a/images/linux/ubuntu1804.json +++ b/images/linux/ubuntu1804.json @@ -240,6 +240,9 @@ "scripts": [ "{{template_dir}}/scripts/installers/pipx-packages.sh" ], + "environment_vars": [ + "INSTALLER_SCRIPT_FOLDER={{user `installer_script_folder`}}" + ], "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" }, { diff --git a/images/linux/ubuntu2004.json b/images/linux/ubuntu2004.json index 0b1fdc8d9..740fe097f 100644 --- a/images/linux/ubuntu2004.json +++ b/images/linux/ubuntu2004.json @@ -242,6 +242,9 @@ "scripts": [ "{{template_dir}}/scripts/installers/pipx-packages.sh" ], + "environment_vars": [ + "INSTALLER_SCRIPT_FOLDER={{user `installer_script_folder`}}" + ], "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" }, {