diff --git a/images/linux/scripts/SoftwareReport/SoftwareReport.Generator.ps1 b/images/linux/scripts/SoftwareReport/SoftwareReport.Generator.ps1 index 26b380a76..34dd7d111 100644 --- a/images/linux/scripts/SoftwareReport/SoftwareReport.Generator.ps1 +++ b/images/linux/scripts/SoftwareReport/SoftwareReport.Generator.ps1 @@ -123,6 +123,7 @@ $toolsList = @( (Get-HHVMVersion), (Get-SVNVersion), (Get-JqVersion), + (Get-YqVersion), (Get-KindVersion), (Get-KubectlVersion), (Get-KustomizeVersion), diff --git a/images/linux/scripts/SoftwareReport/SoftwareReport.Tools.psm1 b/images/linux/scripts/SoftwareReport/SoftwareReport.Tools.psm1 index ae7ddfa6d..4c641c23b 100644 --- a/images/linux/scripts/SoftwareReport/SoftwareReport.Tools.psm1 +++ b/images/linux/scripts/SoftwareReport/SoftwareReport.Tools.psm1 @@ -278,3 +278,8 @@ function Get-ZstdVersion { $zstdVersion = zstd --version | Take-OutputPart -Part 1 -Delimiter "v" | Take-OutputPart -Part 0 -Delimiter "," return "zstd $zstdVersion (homebrew)" } + +function Get-YqVersion { + $yqVersion = ($(yq -V) -Split " ")[-1] + return "yq $yqVersion" +} diff --git a/images/linux/scripts/installers/yq.sh b/images/linux/scripts/installers/yq.sh new file mode 100644 index 000000000..7f3e3b447 --- /dev/null +++ b/images/linux/scripts/installers/yq.sh @@ -0,0 +1,16 @@ +#!/bin/bash -e + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/install.sh + +YQ_BINARY=yq_linux_amd64 + +# As per https://github.com/mikefarah/yq#wget +YQ_URL=$(curl -s https://api.github.com/repos/mikefarah/yq/releases/latest | jq -r ".assets[].browser_download_url | select(endswith(\"$YQ_BINARY.tar.gz\"))") +echo "Downloading latest yq from $YQ_URL" + +download_with_retries "$YQ_URL" "/tmp" "${YQ_BINARY}.tar.gz" +tar xzf "/tmp/${YQ_BINARY}.tar.gz" -C "/tmp" +mv /tmp/${YQ_BINARY} /usr/local/bin/yq + +invoke_tests "Tools" "yq" diff --git a/images/linux/scripts/tests/Tools.Tests.ps1 b/images/linux/scripts/tests/Tools.Tests.ps1 index 1caa559e4..d3b0cfbf5 100644 --- a/images/linux/scripts/tests/Tools.Tests.ps1 +++ b/images/linux/scripts/tests/Tools.Tests.ps1 @@ -377,3 +377,9 @@ Describe "Ruby" { } } } + +Describe "yq" { + It "yq" { + "yq -V" | Should -ReturnZeroExitCode + } +} diff --git a/images/linux/ubuntu1804.json b/images/linux/ubuntu1804.json index 8c300c593..a91430fd9 100644 --- a/images/linux/ubuntu1804.json +++ b/images/linux/ubuntu1804.json @@ -248,6 +248,7 @@ "{{template_dir}}/scripts/installers/dpkg-config.sh", "{{template_dir}}/scripts/installers/mongodb.sh", "{{template_dir}}/scripts/installers/android.sh", + "{{template_dir}}/scripts/installers/yq.sh", "{{template_dir}}/scripts/installers/pypy.sh", "{{template_dir}}/scripts/installers/python.sh" ], diff --git a/images/linux/ubuntu2004.json b/images/linux/ubuntu2004.json index 6d333e3c0..5cc79cce4 100644 --- a/images/linux/ubuntu2004.json +++ b/images/linux/ubuntu2004.json @@ -248,6 +248,7 @@ "{{template_dir}}/scripts/installers/dpkg-config.sh", "{{template_dir}}/scripts/installers/mongodb.sh", "{{template_dir}}/scripts/installers/android.sh", + "{{template_dir}}/scripts/installers/yq.sh", "{{template_dir}}/scripts/installers/pypy.sh", "{{template_dir}}/scripts/installers/python.sh", "{{template_dir}}/scripts/installers/graalvm.sh" diff --git a/images/win/scripts/SoftwareReport/SoftwareReport.Tools.psm1 b/images/win/scripts/SoftwareReport/SoftwareReport.Tools.psm1 index ad5eb2255..c769c6260 100644 --- a/images/win/scripts/SoftwareReport/SoftwareReport.Tools.psm1 +++ b/images/win/scripts/SoftwareReport/SoftwareReport.Tools.psm1 @@ -269,4 +269,4 @@ function Get-SwigVersion { (swig -version | Out-String) -match "version (?\d+\.\d+\.\d+)" | Out-Null $swigVersion = $Matches.Version return "Swig $swigVersion" -} +} \ No newline at end of file