diff --git a/images/linux/scripts/installers/bazel.sh b/images/linux/scripts/installers/bazel.sh new file mode 100644 index 00000000..fcc8f03d --- /dev/null +++ b/images/linux/scripts/installers/bazel.sh @@ -0,0 +1,25 @@ +#!/bin/bash +################################################################################ +## File: bazel.sh +## Desc: Installs bazel +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh + +# Install bazel +curl https://bazel.build/bazel-release.pub.gpg | sudo apt-key add - +echo "deb [arch=amd64] https://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list +apt-get update -y +apt-get install -y bazel + +# 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 ! command -v bazel; then + echo "Bazel was not installed" + exit 1 +fi + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" +DocumentInstalledItem "Bazel ($(bazel version))" diff --git a/images/linux/ubuntu1604.json b/images/linux/ubuntu1604.json index e303746b..0bbd3149 100644 --- a/images/linux/ubuntu1604.json +++ b/images/linux/ubuntu1604.json @@ -123,6 +123,7 @@ "{{template_dir}}/scripts/installers/azcopy.sh", "{{template_dir}}/scripts/installers/azure-cli.sh", "{{template_dir}}/scripts/installers/azure-devops-cli.sh", + "{{template_dir}}/scripts/installers/bazel.sh", "{{template_dir}}/scripts/installers/1604/basic.sh", "{{template_dir}}/scripts/installers/aws.sh", "{{template_dir}}/scripts/installers/build-essential.sh", diff --git a/images/linux/ubuntu1804.json b/images/linux/ubuntu1804.json index 1492d4b5..61d31e11 100644 --- a/images/linux/ubuntu1804.json +++ b/images/linux/ubuntu1804.json @@ -126,6 +126,7 @@ "{{template_dir}}/scripts/installers/azcopy.sh", "{{template_dir}}/scripts/installers/azure-cli.sh", "{{template_dir}}/scripts/installers/azure-devops-cli.sh", + "{{template_dir}}/scripts/installers/bazel.sh", "{{template_dir}}/scripts/installers/1804/basic.sh", "{{template_dir}}/scripts/installers/aws.sh", "{{template_dir}}/scripts/installers/build-essential.sh", diff --git a/images/win/Windows2016-Azure.json b/images/win/Windows2016-Azure.json index 60d72a9d..fd0ff610 100644 --- a/images/win/Windows2016-Azure.json +++ b/images/win/Windows2016-Azure.json @@ -564,6 +564,12 @@ "{{ template_dir }}/scripts/Installers/Install-Kind.ps1" ] }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-Bazel.ps1" + ] + }, { "type": "windows-restart", "restart_timeout": "30m" @@ -831,6 +837,12 @@ "{{ template_dir }}/scripts/Installers/Validate-Kind.ps1" ] }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-Bazel.ps1" + ] + }, { "type": "file", "source": "C:\\InstalledSoftware.md", diff --git a/images/win/Windows2019-Azure.json b/images/win/Windows2019-Azure.json index 15ed7cb8..5ded226e 100644 --- a/images/win/Windows2019-Azure.json +++ b/images/win/Windows2019-Azure.json @@ -533,6 +533,12 @@ "{{ template_dir }}/scripts/Installers/Install-Kind.ps1" ] }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-Bazel.ps1" + ] + }, { "type": "windows-restart", "restart_timeout": "10m" @@ -800,6 +806,12 @@ "{{ template_dir }}/scripts/Installers/Validate-Kind.ps1" ] }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-Bazel.ps1" + ] + }, { "type": "file", "source": "C:\\InstalledSoftware.md", diff --git a/images/win/scripts/Installers/Install-Bazel.ps1 b/images/win/scripts/Installers/Install-Bazel.ps1 new file mode 100644 index 00000000..1973c06f --- /dev/null +++ b/images/win/scripts/Installers/Install-Bazel.ps1 @@ -0,0 +1,6 @@ +################################################################################ +## File: Install-Bazel.ps1 +## Desc: Install Bazel +################################################################################ + +choco install bazel -y \ No newline at end of file diff --git a/images/win/scripts/Installers/Validate-Bazel.ps1 b/images/win/scripts/Installers/Validate-Bazel.ps1 new file mode 100644 index 00000000..71af7df7 --- /dev/null +++ b/images/win/scripts/Installers/Validate-Bazel.ps1 @@ -0,0 +1,23 @@ +################################################################################ +## File: Validate-Bazel.ps1 +## Desc: Validate Bazel +################################################################################ + +if (Get-Command -Name 'bazel') +{ + Write-Host "bazel on path" +} +else +{ + Write-Host 'bazel is not on path' + exit 1 +} + +# Adding description of the software to Markdown +$SoftwareName = "bazel" + +$Description = @" +_Version:_ $(bazel --version)
+"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description \ No newline at end of file