From be310626e05d1aa248fd8cb8aa4ef237f6c3f6a5 Mon Sep 17 00:00:00 2001 From: Vladimir Safonkin Date: Thu, 1 Oct 2020 17:52:16 +0300 Subject: [PATCH 01/24] Add pipx, yamllint and aws sam cli --- .../linux/scripts/installers/pipx-packages.sh | 25 +++++++++++++++++++ images/linux/scripts/installers/python.sh | 21 +++++++++++++--- images/linux/toolsets/toolset-1604.json | 1 - images/linux/toolsets/toolset-1804.json | 1 - images/linux/toolsets/toolset-2004.json | 1 - images/linux/ubuntu1804.json | 13 ++-------- 6 files changed, 45 insertions(+), 17 deletions(-) create mode 100644 images/linux/scripts/installers/pipx-packages.sh diff --git a/images/linux/scripts/installers/pipx-packages.sh b/images/linux/scripts/installers/pipx-packages.sh new file mode 100644 index 00000000..c6a4a6bb --- /dev/null +++ b/images/linux/scripts/installers/pipx-packages.sh @@ -0,0 +1,25 @@ +#!/bin/bash +################################################################################ +## File: pipx-packages.sh +## Desc: Install tools via pipx +################################################################################ + +# Install yamlint +pipx install yamllint + +if ! command -v yamllint; then + echo "yamllint 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.9/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 diff --git a/images/linux/scripts/installers/python.sh b/images/linux/scripts/installers/python.sh index 47041778..3c7886ae 100644 --- a/images/linux/scripts/installers/python.sh +++ b/images/linux/scripts/installers/python.sh @@ -10,17 +10,32 @@ source $HELPER_SCRIPTS/os.sh # Install Python, Python 3, pip, pip3 if isUbuntu16 || isUbuntu18; then - apt-get install -y --no-install-recommends python python-dev python-pip python3 python3-dev python3-pip + apt-get install -y --no-install-recommends python python-dev python-pip python3 python3-dev python3-pip python3-venv fi if isUbuntu20; then - apt-get install -y --no-install-recommends python3 python3-dev python3-pip + apt-get install -y --no-install-recommends python3 python3-dev python3-pip python3-venv ln -s /usr/bin/pip3 /usr/bin/pip fi +# Install pipx +# Set pipx custom directory +export PIPX_BIN_DIR=/opt/pipx_bin +export PIPX_HOME=/opt/pipx + +python3 -m pip install pipx +python3 -m pipx ensurepath + +echo "PIPX_BIN_DIR=$PIPX_BIN_DIR" | tee -a /etc/environment +echo "PIPX_HOME=$PIPX_HOME" | tee -a /etc/environment + +# Add pipx bin directory to path +export PATH="$PATH:$PIPX_BIN_DIR" +echo 'export PATH="$PATH:/opt/pipx_bin"' >> /etc/skel/.bashrc + # 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 python pip python3 pip3; do +for cmd in python pip python3 pip3 pipx; do if ! command -v $cmd; then echo "$cmd was not installed or not found on PATH" exit 1 diff --git a/images/linux/toolsets/toolset-1604.json b/images/linux/toolsets/toolset-1604.json index 46aad66a..fcb5fde1 100644 --- a/images/linux/toolsets/toolset-1604.json +++ b/images/linux/toolsets/toolset-1604.json @@ -172,7 +172,6 @@ "time", "unzip", "wget", - "yamllint", "zip" ] }, diff --git a/images/linux/toolsets/toolset-1804.json b/images/linux/toolsets/toolset-1804.json index 2670b4cf..b14a6077 100644 --- a/images/linux/toolsets/toolset-1804.json +++ b/images/linux/toolsets/toolset-1804.json @@ -167,7 +167,6 @@ "time", "unzip", "wget", - "yamllint", "zip" ] }, diff --git a/images/linux/toolsets/toolset-2004.json b/images/linux/toolsets/toolset-2004.json index 7c704263..62aad447 100644 --- a/images/linux/toolsets/toolset-2004.json +++ b/images/linux/toolsets/toolset-2004.json @@ -130,7 +130,6 @@ "time", "unzip", "wget", - "yamllint", "zip" ] }, diff --git a/images/linux/ubuntu1804.json b/images/linux/ubuntu1804.json index 12ef6d0c..c35d99eb 100644 --- a/images/linux/ubuntu1804.json +++ b/images/linux/ubuntu1804.json @@ -212,7 +212,8 @@ "{{template_dir}}/scripts/installers/hosted-tool-cache.sh", "{{template_dir}}/scripts/installers/pypy.sh", "{{template_dir}}/scripts/installers/python.sh", - "{{template_dir}}/scripts/installers/test-toolcache.sh" + "{{template_dir}}/scripts/installers/test-toolcache.sh", + "{{template_dir}}/scripts/installers/pipx-packages.sh" ], "environment_vars": [ "HELPER_SCRIPTS={{user `helper_script_folder`}}", @@ -235,16 +236,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": [ From 790ccbb8e572539dbfb09c08a38e3c797e1575b6 Mon Sep 17 00:00:00 2001 From: Vladimir Safonkin Date: Thu, 1 Oct 2020 22:55:54 +0300 Subject: [PATCH 02/24] Add pipx_bin to path for pipx packages --- images/linux/scripts/installers/pipx-packages.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/images/linux/scripts/installers/pipx-packages.sh b/images/linux/scripts/installers/pipx-packages.sh index c6a4a6bb..d1083735 100644 --- a/images/linux/scripts/installers/pipx-packages.sh +++ b/images/linux/scripts/installers/pipx-packages.sh @@ -4,6 +4,9 @@ ## Desc: Install tools via pipx ################################################################################ +# Add pipx_bin to path +export PATH="$PATH:/opt/pipx_bin" + # Install yamlint pipx install yamllint From 89040937914f35cfcaceb6cadd8d08a205c49cce Mon Sep 17 00:00:00 2001 From: Vladimir Safonkin Date: Thu, 1 Oct 2020 23:49:11 +0300 Subject: [PATCH 03/24] Disable env vars --- images/linux/scripts/installers/pipx-packages.sh | 2 +- images/linux/scripts/installers/python.sh | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/images/linux/scripts/installers/pipx-packages.sh b/images/linux/scripts/installers/pipx-packages.sh index d1083735..beec3ffa 100644 --- a/images/linux/scripts/installers/pipx-packages.sh +++ b/images/linux/scripts/installers/pipx-packages.sh @@ -5,7 +5,7 @@ ################################################################################ # Add pipx_bin to path -export PATH="$PATH:/opt/pipx_bin" +python3 -m pipx ensurepath # Install yamlint pipx install yamllint diff --git a/images/linux/scripts/installers/python.sh b/images/linux/scripts/installers/python.sh index 3c7886ae..85b2775d 100644 --- a/images/linux/scripts/installers/python.sh +++ b/images/linux/scripts/installers/python.sh @@ -26,11 +26,11 @@ export PIPX_HOME=/opt/pipx python3 -m pip install pipx python3 -m pipx ensurepath -echo "PIPX_BIN_DIR=$PIPX_BIN_DIR" | tee -a /etc/environment -echo "PIPX_HOME=$PIPX_HOME" | tee -a /etc/environment +# echo "PIPX_BIN_DIR=$PIPX_BIN_DIR" | tee -a /etc/environment +# echo "PIPX_HOME=$PIPX_HOME" | tee -a /etc/environment # Add pipx bin directory to path -export PATH="$PATH:$PIPX_BIN_DIR" +# export PATH="$PATH:$PIPX_BIN_DIR" echo 'export PATH="$PATH:/opt/pipx_bin"' >> /etc/skel/.bashrc # Run tests to determine that the software installed as expected From 88f35e5ba499a42b6819196e436fc1d43b041f25 Mon Sep 17 00:00:00 2001 From: Vladimir Safonkin Date: Fri, 2 Oct 2020 09:15:26 +0300 Subject: [PATCH 04/24] Fix --- images/linux/scripts/installers/python.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/images/linux/scripts/installers/python.sh b/images/linux/scripts/installers/python.sh index 85b2775d..6472de40 100644 --- a/images/linux/scripts/installers/python.sh +++ b/images/linux/scripts/installers/python.sh @@ -26,8 +26,8 @@ export PIPX_HOME=/opt/pipx python3 -m pip install pipx python3 -m pipx ensurepath -# echo "PIPX_BIN_DIR=$PIPX_BIN_DIR" | tee -a /etc/environment -# echo "PIPX_HOME=$PIPX_HOME" | tee -a /etc/environment +echo "PIPX_BIN_DIR=$PIPX_BIN_DIR" | tee -a /etc/environment +echo "PIPX_HOME=$PIPX_HOME" | tee -a /etc/environment # Add pipx bin directory to path # export PATH="$PATH:$PIPX_BIN_DIR" From a1f44e0d46e60eada8b0eba2772fbdea5010894c Mon Sep 17 00:00:00 2001 From: Vladimir Safonkin Date: Fri, 2 Oct 2020 09:20:33 +0300 Subject: [PATCH 05/24] Fix --- images/linux/scripts/installers/pipx-packages.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/images/linux/scripts/installers/pipx-packages.sh b/images/linux/scripts/installers/pipx-packages.sh index beec3ffa..28041048 100644 --- a/images/linux/scripts/installers/pipx-packages.sh +++ b/images/linux/scripts/installers/pipx-packages.sh @@ -4,8 +4,8 @@ ## Desc: Install tools via pipx ################################################################################ -# Add pipx_bin to path -python3 -m pipx ensurepath + +export PATH="$PATH:/opt/pipx_bin" # Install yamlint pipx install yamllint From 6d325ba3988da0d8cb5a642248fba3fa1495cb98 Mon Sep 17 00:00:00 2001 From: Vladimir Safonkin Date: Fri, 2 Oct 2020 11:23:02 +0300 Subject: [PATCH 06/24] Add pipx and yamllint to report --- .../SoftwareReport/SoftwareReport.Common.psm1 | 4 ++++ .../SoftwareReport/SoftwareReport.Generator.ps1 | 2 ++ .../SoftwareReport/SoftwareReport.Tools.psm1 | 4 ++++ images/linux/ubuntu1604.json | 13 ++----------- images/linux/ubuntu2004.json | 13 ++----------- 5 files changed, 14 insertions(+), 22 deletions(-) diff --git a/images/linux/scripts/SoftwareReport/SoftwareReport.Common.psm1 b/images/linux/scripts/SoftwareReport/SoftwareReport.Common.psm1 index c9257407..49dd5bda 100644 --- a/images/linux/scripts/SoftwareReport/SoftwareReport.Common.psm1 +++ b/images/linux/scripts/SoftwareReport/SoftwareReport.Common.psm1 @@ -243,4 +243,8 @@ function Get-AptPackages { $apt = $toolsetJson.apt $pkgs = ($apt.common_packages + $apt.cmd_packages | Sort-Object) -join ", " return $pkgs +} + +function Get-PipxVersion { + return "Pipx $(pipx --version 2> $null)" } \ No newline at end of file diff --git a/images/linux/scripts/SoftwareReport/SoftwareReport.Generator.ps1 b/images/linux/scripts/SoftwareReport/SoftwareReport.Generator.ps1 index ff03ba84..1bb44d54 100644 --- a/images/linux/scripts/SoftwareReport/SoftwareReport.Generator.ps1 +++ b/images/linux/scripts/SoftwareReport/SoftwareReport.Generator.ps1 @@ -58,6 +58,7 @@ $markdown += New-MDList -Style Unordered -Lines @( (Get-YarnVersion), (Get-PipVersion), (Get-Pip3Version), + (Get-PipxVersion), (Get-VcpkgVersion) ) @@ -110,6 +111,7 @@ $toolsList = @( (Get-TerraformVersion), (Get-UnZipVersion), (Get-WgetVersion), + (Get-YamllintVersion), (Get-ZipVersion), (Get-ZstdVersion) ) diff --git a/images/linux/scripts/SoftwareReport/SoftwareReport.Tools.psm1 b/images/linux/scripts/SoftwareReport/SoftwareReport.Tools.psm1 index d1984b2a..831279e7 100644 --- a/images/linux/scripts/SoftwareReport/SoftwareReport.Tools.psm1 +++ b/images/linux/scripts/SoftwareReport/SoftwareReport.Tools.psm1 @@ -269,4 +269,8 @@ function Get-RVersion { function Get-SphinxVersion { $sphinxVersion = searchd -h | Select-Object -First 1 | Take-OutputPart -Part 1 | Take-OutputPart -Part 0 -Delimiter "-" return "Sphinx Open Source Search Server $sphinxVersion" +} + +function Get-YamllintVersion { + return (yamllint --version | Out-String) } \ No newline at end of file diff --git a/images/linux/ubuntu1604.json b/images/linux/ubuntu1604.json index 8a4255ec..c4133976 100644 --- a/images/linux/ubuntu1604.json +++ b/images/linux/ubuntu1604.json @@ -208,7 +208,8 @@ "{{template_dir}}/scripts/installers/hosted-tool-cache.sh", "{{template_dir}}/scripts/installers/pypy.sh", "{{template_dir}}/scripts/installers/python.sh", - "{{template_dir}}/scripts/installers/test-toolcache.sh" + "{{template_dir}}/scripts/installers/test-toolcache.sh", + "{{template_dir}}/scripts/installers/pipx-packages.sh" ], "environment_vars": [ "HELPER_SCRIPTS={{user `helper_script_folder`}}", @@ -231,16 +232,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": [ diff --git a/images/linux/ubuntu2004.json b/images/linux/ubuntu2004.json index 24c1f17e..3deb5a1b 100644 --- a/images/linux/ubuntu2004.json +++ b/images/linux/ubuntu2004.json @@ -214,7 +214,8 @@ "{{template_dir}}/scripts/installers/hosted-tool-cache.sh", "{{template_dir}}/scripts/installers/pypy.sh", "{{template_dir}}/scripts/installers/python.sh", - "{{template_dir}}/scripts/installers/test-toolcache.sh" + "{{template_dir}}/scripts/installers/test-toolcache.sh", + "{{template_dir}}/scripts/installers/pipx-packages.sh" ], "environment_vars": [ "HELPER_SCRIPTS={{user `helper_script_folder`}}", @@ -237,16 +238,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": [ From 3203e151219d495f7ed464212216fca9f8b737c5 Mon Sep 17 00:00:00 2001 From: Vladimir Safonkin Date: Fri, 2 Oct 2020 12:58:12 +0300 Subject: [PATCH 07/24] Minor fix --- images/linux/scripts/installers/pipx-packages.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/images/linux/scripts/installers/pipx-packages.sh b/images/linux/scripts/installers/pipx-packages.sh index 28041048..67931b59 100644 --- a/images/linux/scripts/installers/pipx-packages.sh +++ b/images/linux/scripts/installers/pipx-packages.sh @@ -18,7 +18,7 @@ fi echo "yamllint is successfully installed" # Install aws sam cli -pipx install aws-sam-cli --python /opt/hostedtoolcache/Python/3.7.9/x64/bin/python3.7 +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" From 7df63a370d4cf6e05bb19ad993382be0b733ebfd Mon Sep 17 00:00:00 2001 From: Vladimir Safonkin Date: Fri, 2 Oct 2020 16:51:03 +0300 Subject: [PATCH 08/24] Fix ubuntu 18.04 template --- images/linux/ubuntu1804.json | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/images/linux/ubuntu1804.json b/images/linux/ubuntu1804.json index c35d99eb..49e1aa1c 100644 --- a/images/linux/ubuntu1804.json +++ b/images/linux/ubuntu1804.json @@ -212,8 +212,7 @@ "{{template_dir}}/scripts/installers/hosted-tool-cache.sh", "{{template_dir}}/scripts/installers/pypy.sh", "{{template_dir}}/scripts/installers/python.sh", - "{{template_dir}}/scripts/installers/test-toolcache.sh", - "{{template_dir}}/scripts/installers/pipx-packages.sh" + "{{template_dir}}/scripts/installers/test-toolcache.sh" ], "environment_vars": [ "HELPER_SCRIPTS={{user `helper_script_folder`}}", @@ -236,6 +235,13 @@ ], "execute_command": "sudo sh -c '{{ .Vars }} pwsh -f {{ .Path }}'" }, + { + "type": "shell", + "scripts": [ + "{{template_dir}}/scripts/installers/pipx-packages.sh" + ], + "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" + }, { "type": "shell", "scripts": [ From fd2efe9c53aea311cce0863e78af9315074179a0 Mon Sep 17 00:00:00 2001 From: Vladimir Safonkin Date: Sat, 3 Oct 2020 11:54:36 +0300 Subject: [PATCH 09/24] Fix --- images/linux/scripts/installers/pipx-packages.sh | 2 +- images/linux/scripts/installers/python.sh | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/images/linux/scripts/installers/pipx-packages.sh b/images/linux/scripts/installers/pipx-packages.sh index 67931b59..77308fa3 100644 --- a/images/linux/scripts/installers/pipx-packages.sh +++ b/images/linux/scripts/installers/pipx-packages.sh @@ -5,7 +5,7 @@ ################################################################################ -export PATH="$PATH:/opt/pipx_bin" +# export PATH="$PATH:/opt/pipx_bin" # Install yamlint pipx install yamllint diff --git a/images/linux/scripts/installers/python.sh b/images/linux/scripts/installers/python.sh index 6472de40..72651567 100644 --- a/images/linux/scripts/installers/python.sh +++ b/images/linux/scripts/installers/python.sh @@ -6,6 +6,7 @@ set -e # Source the helpers for use with the script +source $HELPER_SCRIPTS/etc-environment.sh source $HELPER_SCRIPTS/os.sh # Install Python, Python 3, pip, pip3 @@ -26,8 +27,12 @@ export PIPX_HOME=/opt/pipx python3 -m pip install pipx python3 -m pipx ensurepath -echo "PIPX_BIN_DIR=$PIPX_BIN_DIR" | tee -a /etc/environment -echo "PIPX_HOME=$PIPX_HOME" | tee -a /etc/environment +# Update /etc/environment +setEtcEnvironmentVariable "PIPX_BIN_DIR" $PIPX_BIN_DIR +setEtcEnvironmentVariable "PIPX_HOME" $PIPX_HOME +prependEtcEnvironmentPath /opt/pipx_bin +# echo "PIPX_BIN_DIR=$PIPX_BIN_DIR" | tee -a /etc/environment +# echo "PIPX_HOME=$PIPX_HOME" | tee -a /etc/environment # Add pipx bin directory to path # export PATH="$PATH:$PIPX_BIN_DIR" From 7601fe7b507bed11cb661079edbb6af08e8b97f1 Mon Sep 17 00:00:00 2001 From: Vladimir Safonkin Date: Sat, 3 Oct 2020 19:51:07 +0300 Subject: [PATCH 10/24] Fix --- images/linux/scripts/installers/pipx-packages.sh | 1 + images/linux/scripts/installers/python.sh | 3 --- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/images/linux/scripts/installers/pipx-packages.sh b/images/linux/scripts/installers/pipx-packages.sh index 77308fa3..48a16c4e 100644 --- a/images/linux/scripts/installers/pipx-packages.sh +++ b/images/linux/scripts/installers/pipx-packages.sh @@ -6,6 +6,7 @@ # export PATH="$PATH:/opt/pipx_bin" +python3 -m pipx ensurepath # Install yamlint pipx install yamllint diff --git a/images/linux/scripts/installers/python.sh b/images/linux/scripts/installers/python.sh index 72651567..8535074b 100644 --- a/images/linux/scripts/installers/python.sh +++ b/images/linux/scripts/installers/python.sh @@ -31,11 +31,8 @@ python3 -m pipx ensurepath setEtcEnvironmentVariable "PIPX_BIN_DIR" $PIPX_BIN_DIR setEtcEnvironmentVariable "PIPX_HOME" $PIPX_HOME prependEtcEnvironmentPath /opt/pipx_bin -# echo "PIPX_BIN_DIR=$PIPX_BIN_DIR" | tee -a /etc/environment -# echo "PIPX_HOME=$PIPX_HOME" | tee -a /etc/environment # Add pipx bin directory to path -# export PATH="$PATH:$PIPX_BIN_DIR" echo 'export PATH="$PATH:/opt/pipx_bin"' >> /etc/skel/.bashrc # Run tests to determine that the software installed as expected From f6b3cf674cba6f7b7373ab5ce847d2dc97d44682 Mon Sep 17 00:00:00 2001 From: Vladimir Safonkin Date: Sat, 3 Oct 2020 23:03:28 +0300 Subject: [PATCH 11/24] Fix --- images/linux/scripts/installers/pipx-packages.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/images/linux/scripts/installers/pipx-packages.sh b/images/linux/scripts/installers/pipx-packages.sh index 48a16c4e..67931b59 100644 --- a/images/linux/scripts/installers/pipx-packages.sh +++ b/images/linux/scripts/installers/pipx-packages.sh @@ -5,8 +5,7 @@ ################################################################################ -# export PATH="$PATH:/opt/pipx_bin" -python3 -m pipx ensurepath +export PATH="$PATH:/opt/pipx_bin" # Install yamlint pipx install yamllint From a11c9fff0858b03764a9e0db1a58e0cd4ccfc3ab Mon Sep 17 00:00:00 2001 From: Vladimir Safonkin Date: Sun, 4 Oct 2020 14:51:46 +0300 Subject: [PATCH 12/24] Fix templates --- .../SoftwareReport/SoftwareReport.Tools.psm1 | 2 +- .../linux/scripts/installers/aws-sam-cli.sh | 31 ------------------- images/linux/ubuntu1604.json | 10 ++++-- images/linux/ubuntu2004.json | 10 ++++-- 4 files changed, 17 insertions(+), 36 deletions(-) delete mode 100644 images/linux/scripts/installers/aws-sam-cli.sh diff --git a/images/linux/scripts/SoftwareReport/SoftwareReport.Tools.psm1 b/images/linux/scripts/SoftwareReport/SoftwareReport.Tools.psm1 index 831279e7..60c1a699 100644 --- a/images/linux/scripts/SoftwareReport/SoftwareReport.Tools.psm1 +++ b/images/linux/scripts/SoftwareReport/SoftwareReport.Tools.psm1 @@ -272,5 +272,5 @@ function Get-SphinxVersion { } function Get-YamllintVersion { - return (yamllint --version | Out-String) + return "$(yamllint --version)" } \ No newline at end of file diff --git a/images/linux/scripts/installers/aws-sam-cli.sh b/images/linux/scripts/installers/aws-sam-cli.sh deleted file mode 100644 index ac56144b..00000000 --- a/images/linux/scripts/installers/aws-sam-cli.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash -################################################################################ -## File: aws-sam-cli.sh -## Desc: Installs AWS SAM CLI -## Requires Python >=3.6, must be run as non-root user after toolset installation -################################################################################ - - -# 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" -wget $TarballUrl -O $TarballPath -tar -xzvf $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 - -# 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 diff --git a/images/linux/ubuntu1604.json b/images/linux/ubuntu1604.json index c4133976..2fc97542 100644 --- a/images/linux/ubuntu1604.json +++ b/images/linux/ubuntu1604.json @@ -208,8 +208,7 @@ "{{template_dir}}/scripts/installers/hosted-tool-cache.sh", "{{template_dir}}/scripts/installers/pypy.sh", "{{template_dir}}/scripts/installers/python.sh", - "{{template_dir}}/scripts/installers/test-toolcache.sh", - "{{template_dir}}/scripts/installers/pipx-packages.sh" + "{{template_dir}}/scripts/installers/test-toolcache.sh" ], "environment_vars": [ "HELPER_SCRIPTS={{user `helper_script_folder`}}", @@ -232,6 +231,13 @@ ], "execute_command": "sudo sh -c '{{ .Vars }} pwsh -f {{ .Path }}'" }, + { + "type": "shell", + "scripts": [ + "{{template_dir}}/scripts/installers/pipx-packages.sh" + ], + "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" + }, { "type": "shell", "scripts": [ diff --git a/images/linux/ubuntu2004.json b/images/linux/ubuntu2004.json index 3deb5a1b..0b1fdc8d 100644 --- a/images/linux/ubuntu2004.json +++ b/images/linux/ubuntu2004.json @@ -214,8 +214,7 @@ "{{template_dir}}/scripts/installers/hosted-tool-cache.sh", "{{template_dir}}/scripts/installers/pypy.sh", "{{template_dir}}/scripts/installers/python.sh", - "{{template_dir}}/scripts/installers/test-toolcache.sh", - "{{template_dir}}/scripts/installers/pipx-packages.sh" + "{{template_dir}}/scripts/installers/test-toolcache.sh" ], "environment_vars": [ "HELPER_SCRIPTS={{user `helper_script_folder`}}", @@ -238,6 +237,13 @@ ], "execute_command": "sudo sh -c '{{ .Vars }} pwsh -f {{ .Path }}'" }, + { + "type": "shell", + "scripts": [ + "{{template_dir}}/scripts/installers/pipx-packages.sh" + ], + "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" + }, { "type": "shell", "scripts": [ From f4b8b26237977256312ce82b6ce972ceac6f7bdb Mon Sep 17 00:00:00 2001 From: Vladimir Safonkin Date: Mon, 5 Oct 2020 09:20:26 +0300 Subject: [PATCH 13/24] Revert for ubuntu 1604 --- .../linux/scripts/installers/aws-sam-cli.sh | 31 +++++++++++++++++ images/linux/scripts/installers/python.sh | 34 ++++++++++++------- images/linux/ubuntu1604.json | 5 ++- 3 files changed, 56 insertions(+), 14 deletions(-) create mode 100644 images/linux/scripts/installers/aws-sam-cli.sh diff --git a/images/linux/scripts/installers/aws-sam-cli.sh b/images/linux/scripts/installers/aws-sam-cli.sh new file mode 100644 index 00000000..ac56144b --- /dev/null +++ b/images/linux/scripts/installers/aws-sam-cli.sh @@ -0,0 +1,31 @@ +#!/bin/bash +################################################################################ +## File: aws-sam-cli.sh +## Desc: Installs AWS SAM CLI +## Requires Python >=3.6, must be run as non-root user after toolset installation +################################################################################ + + +# 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" +wget $TarballUrl -O $TarballPath +tar -xzvf $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 + +# 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 diff --git a/images/linux/scripts/installers/python.sh b/images/linux/scripts/installers/python.sh index 8535074b..b939b62b 100644 --- a/images/linux/scripts/installers/python.sh +++ b/images/linux/scripts/installers/python.sh @@ -19,25 +19,33 @@ if isUbuntu20; then ln -s /usr/bin/pip3 /usr/bin/pip fi -# Install pipx -# Set pipx custom directory -export PIPX_BIN_DIR=/opt/pipx_bin -export PIPX_HOME=/opt/pipx +if isUbuntu18 || isUbuntu20 ; then + # Install pipx + # Set pipx custom directory + export PIPX_BIN_DIR=/opt/pipx_bin + export PIPX_HOME=/opt/pipx -python3 -m pip install pipx -python3 -m pipx ensurepath + python3 -m pip install pipx + python3 -m pipx ensurepath -# Update /etc/environment -setEtcEnvironmentVariable "PIPX_BIN_DIR" $PIPX_BIN_DIR -setEtcEnvironmentVariable "PIPX_HOME" $PIPX_HOME -prependEtcEnvironmentPath /opt/pipx_bin + # Update /etc/environment + setEtcEnvironmentVariable "PIPX_BIN_DIR" $PIPX_BIN_DIR + setEtcEnvironmentVariable "PIPX_HOME" $PIPX_HOME + prependEtcEnvironmentPath /opt/pipx_bin -# Add pipx bin directory to path -echo 'export PATH="$PATH:/opt/pipx_bin"' >> /etc/skel/.bashrc + # Add pipx bin directory to path + echo 'export PATH="$PATH:/opt/pipx_bin"' >> /etc/skel/.bashrc + + # Test pipx + if ! command -v pipx; then + echo "pipx was not installed or not found on PATH" + exit 1 + fi +fi # 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 python pip python3 pip3 pipx; do +for cmd in python pip python3 pip3; do if ! command -v $cmd; then echo "$cmd was not installed or not found on PATH" exit 1 diff --git a/images/linux/ubuntu1604.json b/images/linux/ubuntu1604.json index 2fc97542..8a4255ec 100644 --- a/images/linux/ubuntu1604.json +++ b/images/linux/ubuntu1604.json @@ -234,7 +234,10 @@ { "type": "shell", "scripts": [ - "{{template_dir}}/scripts/installers/pipx-packages.sh" + "{{template_dir}}/scripts/installers/aws-sam-cli.sh" + ], + "environment_vars": [ + "HELPER_SCRIPTS={{user `helper_script_folder`}}" ], "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" }, From 63925c8d9f58194ee7e811ce2a02bcc55acb6f6d Mon Sep 17 00:00:00 2001 From: Vladimir Safonkin Date: Mon, 5 Oct 2020 09:22:23 +0300 Subject: [PATCH 14/24] Revert yamllint for ubuntu 1604 --- images/linux/toolsets/toolset-1604.json | 1 + 1 file changed, 1 insertion(+) diff --git a/images/linux/toolsets/toolset-1604.json b/images/linux/toolsets/toolset-1604.json index fcb5fde1..46aad66a 100644 --- a/images/linux/toolsets/toolset-1604.json +++ b/images/linux/toolsets/toolset-1604.json @@ -172,6 +172,7 @@ "time", "unzip", "wget", + "yamllint", "zip" ] }, From 687f58106d1735b22339d1eee0f7f8a5b9b36639 Mon Sep 17 00:00:00 2001 From: Vladimir Safonkin Date: Mon, 5 Oct 2020 09:56:42 +0300 Subject: [PATCH 15/24] Minor fix --- images/linux/scripts/installers/python.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/images/linux/scripts/installers/python.sh b/images/linux/scripts/installers/python.sh index b939b62b..7ce5f449 100644 --- a/images/linux/scripts/installers/python.sh +++ b/images/linux/scripts/installers/python.sh @@ -33,9 +33,6 @@ if isUbuntu18 || isUbuntu20 ; then setEtcEnvironmentVariable "PIPX_HOME" $PIPX_HOME prependEtcEnvironmentPath /opt/pipx_bin - # Add pipx bin directory to path - echo 'export PATH="$PATH:/opt/pipx_bin"' >> /etc/skel/.bashrc - # Test pipx if ! command -v pipx; then echo "pipx was not installed or not found on PATH" From 4b0de6f6f4e56d8e67de09c03644b12d84252a78 Mon Sep 17 00:00:00 2001 From: Vladimir Safonkin Date: Mon, 5 Oct 2020 11:08:22 +0300 Subject: [PATCH 16/24] Minor fix --- images/linux/scripts/installers/python.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/images/linux/scripts/installers/python.sh b/images/linux/scripts/installers/python.sh index 7ce5f449..62dc8d35 100644 --- a/images/linux/scripts/installers/python.sh +++ b/images/linux/scripts/installers/python.sh @@ -31,7 +31,7 @@ if isUbuntu18 || isUbuntu20 ; then # Update /etc/environment setEtcEnvironmentVariable "PIPX_BIN_DIR" $PIPX_BIN_DIR setEtcEnvironmentVariable "PIPX_HOME" $PIPX_HOME - prependEtcEnvironmentPath /opt/pipx_bin + prependEtcEnvironmentPath $PIPX_BIN_DIR # Test pipx if ! command -v pipx; then From 08f157956fcecdb4618959b4f52cb4d7ff7bdfca Mon Sep 17 00:00:00 2001 From: Vladimir Safonkin Date: Mon, 5 Oct 2020 12:04:29 +0300 Subject: [PATCH 17/24] Move list of pipx packages into toolset --- .../linux/scripts/installers/pipx-packages.sh | 31 +++++++++---------- images/linux/toolsets/toolset-1804.json | 6 +++- images/linux/toolsets/toolset-2004.json | 6 +++- images/linux/ubuntu1804.json | 3 ++ images/linux/ubuntu2004.json | 3 ++ 5 files changed, 30 insertions(+), 19 deletions(-) diff --git a/images/linux/scripts/installers/pipx-packages.sh b/images/linux/scripts/installers/pipx-packages.sh index 67931b59..825d1edc 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 b14a6077..cd327dec 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 62aad447..add68395 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 49e1aa1c..daf40ce8 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 0b1fdc8d..740fe097 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 }}'" }, { From 958f252984ea7f3fb1c332f50c5b84e248b1a365 Mon Sep 17 00:00:00 2001 From: Vladimir Safonkin Date: Mon, 5 Oct 2020 13:31:53 +0300 Subject: [PATCH 18/24] Add check for python path --- images/linux/scripts/installers/pipx-packages.sh | 12 +++++++++--- images/linux/toolsets/toolset-1804.json | 10 ++++++++-- images/linux/toolsets/toolset-2004.json | 10 ++++++++-- 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/images/linux/scripts/installers/pipx-packages.sh b/images/linux/scripts/installers/pipx-packages.sh index 825d1edc..6a5fe4df 100644 --- a/images/linux/scripts/installers/pipx-packages.sh +++ b/images/linux/scripts/installers/pipx-packages.sh @@ -8,11 +8,17 @@ export PATH="$PATH:/opt/pipx_bin" toolset="$INSTALLER_SCRIPT_FOLDER/toolset.json" -pipx_packages=$(jq -r ".pipx[]" $toolset) +pipx_packages=$(jq ".pipx[] .package" $toolset) for package in $pipx_packages; do - echo "Install $package" - pipx install $package + python_path=$(jq ".pipx[] | select(.package == $package) .python" $toolset) + if [ "$python_path" = "default" ]; then + echo "Install $package into default python" + pipx install $package + else + echo "Install $package into python $python_path" + pipx install $package --python $python_path + fi done # Run tests to determine that the software installed as expected diff --git a/images/linux/toolsets/toolset-1804.json b/images/linux/toolsets/toolset-1804.json index cd327dec..f466f9f0 100644 --- a/images/linux/toolsets/toolset-1804.json +++ b/images/linux/toolsets/toolset-1804.json @@ -190,7 +190,13 @@ ] }, "pipx": [ - "yamllint", - "aws-sam-cli" + { + "package": "yamllint", + "python": "default" + }, + { + "package": "aws-sam-cli", + "python": "/opt/hostedtoolcache/Python/3.7*/x64/bin/python3.7" + } ] } diff --git a/images/linux/toolsets/toolset-2004.json b/images/linux/toolsets/toolset-2004.json index add68395..6bf5ece7 100644 --- a/images/linux/toolsets/toolset-2004.json +++ b/images/linux/toolsets/toolset-2004.json @@ -153,7 +153,13 @@ ] }, "pipx": [ - "yamllint", - "aws-sam-cli" + { + "package": "yamllint", + "python": "default" + }, + { + "package": "aws-sam-cli", + "python": "/opt/hostedtoolcache/Python/3.7*/x64/bin/python3.7" + } ] } From d26db64941d48a51d7d740443dc2f24c3f33d148 Mon Sep 17 00:00:00 2001 From: Vladimir Safonkin Date: Mon, 5 Oct 2020 13:41:50 +0300 Subject: [PATCH 19/24] Fix --- images/linux/scripts/installers/pipx-packages.sh | 8 +++----- images/linux/toolsets/toolset-1804.json | 6 ++++-- images/linux/toolsets/toolset-2004.json | 6 ++++-- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/images/linux/scripts/installers/pipx-packages.sh b/images/linux/scripts/installers/pipx-packages.sh index 6a5fe4df..5f908b9f 100644 --- a/images/linux/scripts/installers/pipx-packages.sh +++ b/images/linux/scripts/installers/pipx-packages.sh @@ -19,13 +19,11 @@ for package in $pipx_packages; do echo "Install $package into python $python_path" pipx install $package --python $python_path fi -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 + # Run tests to determine that the software installed as expected + cmd=$(jq ".pipx[] | select(.package == $package) .cmd" $toolset) if ! command -v $cmd; then - echo "$cmd was not installed" + echo "$package was not installed" exit 1 fi done diff --git a/images/linux/toolsets/toolset-1804.json b/images/linux/toolsets/toolset-1804.json index f466f9f0..10b5fb75 100644 --- a/images/linux/toolsets/toolset-1804.json +++ b/images/linux/toolsets/toolset-1804.json @@ -192,11 +192,13 @@ "pipx": [ { "package": "yamllint", - "python": "default" + "python": "default", + "cmd": "yamllint" }, { "package": "aws-sam-cli", - "python": "/opt/hostedtoolcache/Python/3.7*/x64/bin/python3.7" + "python": "/opt/hostedtoolcache/Python/3.7*/x64/bin/python3.7", + "cmd": "sam" } ] } diff --git a/images/linux/toolsets/toolset-2004.json b/images/linux/toolsets/toolset-2004.json index 6bf5ece7..00f888c6 100644 --- a/images/linux/toolsets/toolset-2004.json +++ b/images/linux/toolsets/toolset-2004.json @@ -155,11 +155,13 @@ "pipx": [ { "package": "yamllint", - "python": "default" + "python": "default", + "cmd": "yamllint" }, { "package": "aws-sam-cli", - "python": "/opt/hostedtoolcache/Python/3.7*/x64/bin/python3.7" + "python": "/opt/hostedtoolcache/Python/3.7*/x64/bin/python3.7", + "cmd": "sam" } ] } From 8750bf40117e29e0f717cf6439f0f7bb3d6255e4 Mon Sep 17 00:00:00 2001 From: Vladimir Safonkin Date: Mon, 5 Oct 2020 15:01:46 +0300 Subject: [PATCH 20/24] Rework pipx toolset --- images/linux/scripts/installers/pipx-packages.sh | 13 +++++++------ images/linux/toolsets/toolset-1804.json | 3 +-- images/linux/toolsets/toolset-2004.json | 3 +-- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/images/linux/scripts/installers/pipx-packages.sh b/images/linux/scripts/installers/pipx-packages.sh index 5f908b9f..0743b89b 100644 --- a/images/linux/scripts/installers/pipx-packages.sh +++ b/images/linux/scripts/installers/pipx-packages.sh @@ -11,17 +11,18 @@ toolset="$INSTALLER_SCRIPT_FOLDER/toolset.json" pipx_packages=$(jq ".pipx[] .package" $toolset) for package in $pipx_packages; do - python_path=$(jq ".pipx[] | select(.package == $package) .python" $toolset) - if [ "$python_path" = "default" ]; then - echo "Install $package into default python" - pipx install $package - else + python_version=$(jq -r ".pipx[] | select(.package == $package) .python" $toolset) + if [ "$python_version" != "null" ]; then + python_path="/opt/hostedtoolcache/Python/$python_version*/x64/bin/python$python_version" echo "Install $package into python $python_path" pipx install $package --python $python_path + else + echo "Install $package into default python" + pipx install $package fi # Run tests to determine that the software installed as expected - cmd=$(jq ".pipx[] | select(.package == $package) .cmd" $toolset) + cmd=$(jq -r ".pipx[] | select(.package == $package) .cmd" $toolset) if ! command -v $cmd; then echo "$package was not installed" exit 1 diff --git a/images/linux/toolsets/toolset-1804.json b/images/linux/toolsets/toolset-1804.json index 10b5fb75..94abdafb 100644 --- a/images/linux/toolsets/toolset-1804.json +++ b/images/linux/toolsets/toolset-1804.json @@ -192,12 +192,11 @@ "pipx": [ { "package": "yamllint", - "python": "default", "cmd": "yamllint" }, { "package": "aws-sam-cli", - "python": "/opt/hostedtoolcache/Python/3.7*/x64/bin/python3.7", + "python": "3.7", "cmd": "sam" } ] diff --git a/images/linux/toolsets/toolset-2004.json b/images/linux/toolsets/toolset-2004.json index 00f888c6..73f76c64 100644 --- a/images/linux/toolsets/toolset-2004.json +++ b/images/linux/toolsets/toolset-2004.json @@ -155,12 +155,11 @@ "pipx": [ { "package": "yamllint", - "python": "default", "cmd": "yamllint" }, { "package": "aws-sam-cli", - "python": "/opt/hostedtoolcache/Python/3.7*/x64/bin/python3.7", + "python": "3.7", "cmd": "sam" } ] From 84b3837f88117dfb563a90a0c55ff5663c4f6f9c Mon Sep 17 00:00:00 2001 From: Vladimir Safonkin Date: Mon, 5 Oct 2020 17:21:27 +0300 Subject: [PATCH 21/24] Install aws sam cli to default python --- images/linux/toolsets/toolset-1804.json | 1 - images/linux/toolsets/toolset-2004.json | 1 - 2 files changed, 2 deletions(-) diff --git a/images/linux/toolsets/toolset-1804.json b/images/linux/toolsets/toolset-1804.json index 94abdafb..e0441944 100644 --- a/images/linux/toolsets/toolset-1804.json +++ b/images/linux/toolsets/toolset-1804.json @@ -196,7 +196,6 @@ }, { "package": "aws-sam-cli", - "python": "3.7", "cmd": "sam" } ] diff --git a/images/linux/toolsets/toolset-2004.json b/images/linux/toolsets/toolset-2004.json index 73f76c64..f0cde0ec 100644 --- a/images/linux/toolsets/toolset-2004.json +++ b/images/linux/toolsets/toolset-2004.json @@ -159,7 +159,6 @@ }, { "package": "aws-sam-cli", - "python": "3.7", "cmd": "sam" } ] From 3024e8ebe2db9bb0963964b7d635b4cf34a17234 Mon Sep 17 00:00:00 2001 From: Vladimir Safonkin Date: Tue, 6 Oct 2020 09:21:36 +0300 Subject: [PATCH 22/24] Fix jq parsing --- images/linux/scripts/installers/pipx-packages.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/images/linux/scripts/installers/pipx-packages.sh b/images/linux/scripts/installers/pipx-packages.sh index 0743b89b..697d01ee 100644 --- a/images/linux/scripts/installers/pipx-packages.sh +++ b/images/linux/scripts/installers/pipx-packages.sh @@ -8,7 +8,7 @@ export PATH="$PATH:/opt/pipx_bin" toolset="$INSTALLER_SCRIPT_FOLDER/toolset.json" -pipx_packages=$(jq ".pipx[] .package" $toolset) +pipx_packages=$(jq -r ".pipx[] .package" $toolset) for package in $pipx_packages; do python_version=$(jq -r ".pipx[] | select(.package == $package) .python" $toolset) From 6b1e7f5cdb7b392cca46f53a7d2d2deaeeff999b Mon Sep 17 00:00:00 2001 From: Vladimir Safonkin Date: Tue, 6 Oct 2020 09:30:49 +0300 Subject: [PATCH 23/24] Fix Ubuntu 16 doc --- .../SoftwareReport/SoftwareReport.Generator.ps1 | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/images/linux/scripts/SoftwareReport/SoftwareReport.Generator.ps1 b/images/linux/scripts/SoftwareReport/SoftwareReport.Generator.ps1 index 1bb44d54..f0e79735 100644 --- a/images/linux/scripts/SoftwareReport/SoftwareReport.Generator.ps1 +++ b/images/linux/scripts/SoftwareReport/SoftwareReport.Generator.ps1 @@ -49,7 +49,8 @@ $markdown += New-MDList -Style Unordered -Lines @( ) $markdown += New-MDHeader "Package Management" -Level 3 -$markdown += New-MDList -Style Unordered -Lines @( + +$packageManagementList = @( (Get-HomebrewVersion), (Get-GemVersion), (Get-MinicondaVersion), @@ -62,6 +63,14 @@ $markdown += New-MDList -Style Unordered -Lines @( (Get-VcpkgVersion) ) +if (-not (Test-IsUbuntu16)) { + $packageManagementList += @( + (Get-PipxVersion) + ) +} + +$markdown += New-MDList -Style Unordered -Lines ($packageManagementList | Sort-Object) + $markdown += New-MDHeader "Project Management" -Level 3 $markdown += New-MDList -Style Unordered -Lines @( (Get-AntVersion), From 58cf3bb6a4d6942a7e1166cc3e3e448b8253306f Mon Sep 17 00:00:00 2001 From: Vladimir Safonkin Date: Tue, 6 Oct 2020 13:11:47 +0300 Subject: [PATCH 24/24] Minor fix --- .../linux/scripts/SoftwareReport/SoftwareReport.Generator.ps1 | 1 - images/linux/scripts/installers/pipx-packages.sh | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/images/linux/scripts/SoftwareReport/SoftwareReport.Generator.ps1 b/images/linux/scripts/SoftwareReport/SoftwareReport.Generator.ps1 index f0e79735..70e11101 100644 --- a/images/linux/scripts/SoftwareReport/SoftwareReport.Generator.ps1 +++ b/images/linux/scripts/SoftwareReport/SoftwareReport.Generator.ps1 @@ -59,7 +59,6 @@ $packageManagementList = @( (Get-YarnVersion), (Get-PipVersion), (Get-Pip3Version), - (Get-PipxVersion), (Get-VcpkgVersion) ) diff --git a/images/linux/scripts/installers/pipx-packages.sh b/images/linux/scripts/installers/pipx-packages.sh index 697d01ee..07e1427e 100644 --- a/images/linux/scripts/installers/pipx-packages.sh +++ b/images/linux/scripts/installers/pipx-packages.sh @@ -11,7 +11,7 @@ toolset="$INSTALLER_SCRIPT_FOLDER/toolset.json" pipx_packages=$(jq -r ".pipx[] .package" $toolset) for package in $pipx_packages; do - python_version=$(jq -r ".pipx[] | select(.package == $package) .python" $toolset) + python_version=$(jq -r ".pipx[] | select(.package == \"$package\") .python" $toolset) if [ "$python_version" != "null" ]; then python_path="/opt/hostedtoolcache/Python/$python_version*/x64/bin/python$python_version" echo "Install $package into python $python_path" @@ -22,7 +22,7 @@ for package in $pipx_packages; do fi # Run tests to determine that the software installed as expected - cmd=$(jq -r ".pipx[] | select(.package == $package) .cmd" $toolset) + cmd=$(jq -r ".pipx[] | select(.package == \"$package\") .cmd" $toolset) if ! command -v $cmd; then echo "$package was not installed" exit 1