diff --git a/images/linux/scripts/installers/aws-sam-cli.sh b/images/linux/scripts/installers/aws-sam-cli.sh index f86a68715..004a7f3a7 100644 --- a/images/linux/scripts/installers/aws-sam-cli.sh +++ b/images/linux/scripts/installers/aws-sam-cli.sh @@ -16,7 +16,7 @@ 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) +Python3Dir=$(echo /opt/hostedtoolcache/Python/3.7*/x64) Python3BinDir="${Python3Dir}/bin" export PATH="$Python3Dir:$Python3BinDir:$PATH" python3 -m pip install setuptools diff --git a/images/linux/scripts/installers/homebrew-validate.sh b/images/linux/scripts/installers/homebrew-validate.sh index a8eef2580..88d61f946 100644 --- a/images/linux/scripts/installers/homebrew-validate.sh +++ b/images/linux/scripts/installers/homebrew-validate.sh @@ -8,7 +8,7 @@ echo "Validate the Homebrew can run after reboot" if ! command -v brew; then - echo "brew cat not run after reboot" + echo "brew executable not found after reboot" exit 1 fi diff --git a/images/linux/scripts/installers/homebrew.sh b/images/linux/scripts/installers/homebrew.sh index ee94ea602..0a739e274 100644 --- a/images/linux/scripts/installers/homebrew.sh +++ b/images/linux/scripts/installers/homebrew.sh @@ -2,6 +2,7 @@ ################################################################################ ## File: homebrew.sh ## Desc: Installs the Homebrew on Linux +## Caveat: Brew MUST NOT be used to install any tool during the image build to avoid dependencies, which may come along with the tool ################################################################################ # Source the helpers @@ -20,7 +21,7 @@ sudo chmod -R o+w $HOMEBREW_PREFIX brew shellenv|grep 'export HOMEBREW'|sed -E 's/^export (.*);$/\1/' | sudo tee -a /etc/environment # add brew executables locations to PATH brew_path=$(brew shellenv|grep '^export PATH' |sed -E 's/^export PATH="([^$]+)\$.*/\1/') -appendEtcEnvironmentPath "$brew_path" +prependEtcEnvironmentPath "$brew_path" # Validate the installation ad hoc echo "Validate the installation reloading /etc/environment" diff --git a/images/linux/ubuntu1604.json b/images/linux/ubuntu1604.json index 33c29cc43..eb92096bb 100644 --- a/images/linux/ubuntu1604.json +++ b/images/linux/ubuntu1604.json @@ -135,36 +135,6 @@ ], "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" }, - { - "type": "shell", - "scripts": [ - "{{template_dir}}/scripts/installers/homebrew.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": "shell", - "expect_disconnect": true, - "scripts": [ - "{{template_dir}}/scripts/base/reboot.sh" - ], - "execute_command": "/bin/sh -c '{{ .Vars }} {{ .Path }}'" - }, - { - "type": "shell", - "pause_before": "30s", - "timeout": "10m", - "start_retry_timeout": "10s", - "scripts": [ - "{{template_dir}}/scripts/installers/homebrew-validate.sh" - ], - "execute_command": "/bin/sh -c '{{ .Vars }} {{ .Path }}'" - }, { "type": "shell", "scripts": [ @@ -287,6 +257,36 @@ ], "execute_command": "/bin/sh -c '{{ .Vars }} {{ .Path }}'" }, + { + "type": "shell", + "scripts": [ + "{{template_dir}}/scripts/installers/homebrew.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": "shell", + "expect_disconnect": true, + "scripts": [ + "{{template_dir}}/scripts/base/reboot.sh" + ], + "execute_command": "/bin/sh -c '{{ .Vars }} {{ .Path }}'" + }, + { + "type": "shell", + "pause_before": "30s", + "timeout": "10m", + "start_retry_timeout": "10s", + "scripts": [ + "{{template_dir}}/scripts/installers/homebrew-validate.sh" + ], + "execute_command": "/bin/sh -c '{{ .Vars }} {{ .Path }}'" + }, { "type": "shell", "scripts":[ diff --git a/images/linux/ubuntu1804.json b/images/linux/ubuntu1804.json index f40fe02c0..25c21d9f7 100644 --- a/images/linux/ubuntu1804.json +++ b/images/linux/ubuntu1804.json @@ -138,36 +138,6 @@ ], "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" }, - { - "type": "shell", - "scripts": [ - "{{template_dir}}/scripts/installers/homebrew.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": "shell", - "expect_disconnect": true, - "scripts": [ - "{{template_dir}}/scripts/base/reboot.sh" - ], - "execute_command": "/bin/sh -c '{{ .Vars }} {{ .Path }}'" - }, - { - "type": "shell", - "pause_before": "30s", - "timeout": "10m", - "start_retry_timeout": "10s", - "scripts": [ - "{{template_dir}}/scripts/installers/homebrew-validate.sh" - ], - "execute_command": "/bin/sh -c '{{ .Vars }} {{ .Path }}'" - }, { "type": "shell", "scripts": [ @@ -291,6 +261,36 @@ ], "execute_command": "/bin/sh -c '{{ .Vars }} {{ .Path }}'" }, + { + "type": "shell", + "scripts": [ + "{{template_dir}}/scripts/installers/homebrew.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": "shell", + "expect_disconnect": true, + "scripts": [ + "{{template_dir}}/scripts/base/reboot.sh" + ], + "execute_command": "/bin/sh -c '{{ .Vars }} {{ .Path }}'" + }, + { + "type": "shell", + "pause_before": "30s", + "timeout": "10m", + "start_retry_timeout": "10s", + "scripts": [ + "{{template_dir}}/scripts/installers/homebrew-validate.sh" + ], + "execute_command": "/bin/sh -c '{{ .Vars }} {{ .Path }}'" + }, { "type": "shell", "scripts":[ diff --git a/images/linux/ubuntu2004.json b/images/linux/ubuntu2004.json index 64fcd69ce..4601317af 100644 --- a/images/linux/ubuntu2004.json +++ b/images/linux/ubuntu2004.json @@ -140,36 +140,6 @@ ], "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" }, - { - "type": "shell", - "scripts": [ - "{{template_dir}}/scripts/installers/homebrew.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": "shell", - "expect_disconnect": true, - "scripts": [ - "{{template_dir}}/scripts/base/reboot.sh" - ], - "execute_command": "/bin/sh -c '{{ .Vars }} {{ .Path }}'" - }, - { - "type": "shell", - "pause_before": "30s", - "timeout": "10m", - "start_retry_timeout": "10s", - "scripts": [ - "{{template_dir}}/scripts/installers/homebrew-validate.sh" - ], - "execute_command": "/bin/sh -c '{{ .Vars }} {{ .Path }}'" - }, { "type": "shell", "scripts": [ @@ -292,6 +262,36 @@ ], "execute_command": "/bin/sh -c '{{ .Vars }} {{ .Path }}'" }, + { + "type": "shell", + "scripts": [ + "{{template_dir}}/scripts/installers/homebrew.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": "shell", + "expect_disconnect": true, + "scripts": [ + "{{template_dir}}/scripts/base/reboot.sh" + ], + "execute_command": "/bin/sh -c '{{ .Vars }} {{ .Path }}'" + }, + { + "type": "shell", + "pause_before": "30s", + "timeout": "10m", + "start_retry_timeout": "10s", + "scripts": [ + "{{template_dir}}/scripts/installers/homebrew-validate.sh" + ], + "execute_command": "/bin/sh -c '{{ .Vars }} {{ .Path }}'" + }, { "type": "shell", "scripts":[