Skip to content

Commit 5161c25

Browse files
authored
[ubuntu] Install yq (actions#3646)
1 parent ad358c8 commit 5161c25

File tree

7 files changed

+31
-1
lines changed

7 files changed

+31
-1
lines changed

images/linux/scripts/SoftwareReport/SoftwareReport.Generator.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ $toolsList = @(
123123
(Get-HHVMVersion),
124124
(Get-SVNVersion),
125125
(Get-JqVersion),
126+
(Get-YqVersion),
126127
(Get-KindVersion),
127128
(Get-KubectlVersion),
128129
(Get-KustomizeVersion),

images/linux/scripts/SoftwareReport/SoftwareReport.Tools.psm1

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,3 +278,8 @@ function Get-ZstdVersion {
278278
$zstdVersion = zstd --version | Take-OutputPart -Part 1 -Delimiter "v" | Take-OutputPart -Part 0 -Delimiter ","
279279
return "zstd $zstdVersion (homebrew)"
280280
}
281+
282+
function Get-YqVersion {
283+
$yqVersion = ($(yq -V) -Split " ")[-1]
284+
return "yq $yqVersion"
285+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash -e
2+
3+
# Source the helpers for use with the script
4+
source $HELPER_SCRIPTS/install.sh
5+
6+
YQ_BINARY=yq_linux_amd64
7+
8+
# As per https://github.com/mikefarah/yq#wget
9+
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\"))")
10+
echo "Downloading latest yq from $YQ_URL"
11+
12+
download_with_retries "$YQ_URL" "/tmp" "${YQ_BINARY}.tar.gz"
13+
tar xzf "/tmp/${YQ_BINARY}.tar.gz" -C "/tmp"
14+
mv /tmp/${YQ_BINARY} /usr/local/bin/yq
15+
16+
invoke_tests "Tools" "yq"

images/linux/scripts/tests/Tools.Tests.ps1

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,3 +377,9 @@ Describe "Ruby" {
377377
}
378378
}
379379
}
380+
381+
Describe "yq" {
382+
It "yq" {
383+
"yq -V" | Should -ReturnZeroExitCode
384+
}
385+
}

images/linux/ubuntu1804.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,7 @@
248248
"{{template_dir}}/scripts/installers/dpkg-config.sh",
249249
"{{template_dir}}/scripts/installers/mongodb.sh",
250250
"{{template_dir}}/scripts/installers/android.sh",
251+
"{{template_dir}}/scripts/installers/yq.sh",
251252
"{{template_dir}}/scripts/installers/pypy.sh",
252253
"{{template_dir}}/scripts/installers/python.sh"
253254
],

images/linux/ubuntu2004.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,7 @@
248248
"{{template_dir}}/scripts/installers/dpkg-config.sh",
249249
"{{template_dir}}/scripts/installers/mongodb.sh",
250250
"{{template_dir}}/scripts/installers/android.sh",
251+
"{{template_dir}}/scripts/installers/yq.sh",
251252
"{{template_dir}}/scripts/installers/pypy.sh",
252253
"{{template_dir}}/scripts/installers/python.sh",
253254
"{{template_dir}}/scripts/installers/graalvm.sh"

images/win/scripts/SoftwareReport/SoftwareReport.Tools.psm1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,4 +269,4 @@ function Get-SwigVersion {
269269
(swig -version | Out-String) -match "version (?<version>\d+\.\d+\.\d+)" | Out-Null
270270
$swigVersion = $Matches.Version
271271
return "Swig $swigVersion"
272-
}
272+
}

0 commit comments

Comments
 (0)