From 1a9637391893d136ed84d1607a9a24d2094a81b1 Mon Sep 17 00:00:00 2001 From: Marcus Felling Date: Wed, 23 Jun 2021 09:52:45 -0500 Subject: [PATCH] [Windows] Adding Bicep CLI (#3600) * Add Bicep CLI * Correct regex for bicep version Co-authored-by: Marcus Felling --- images/win/scripts/Installers/Install-Bicep.ps1 | 8 ++++++++ .../scripts/SoftwareReport/SoftwareReport.Generator.ps1 | 1 + .../win/scripts/SoftwareReport/SoftwareReport.Tools.psm1 | 6 ++++++ images/win/scripts/Tests/Tools.Tests.ps1 | 6 ++++++ images/win/windows2016.json | 3 ++- images/win/windows2019.json | 3 ++- 6 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 images/win/scripts/Installers/Install-Bicep.ps1 diff --git a/images/win/scripts/Installers/Install-Bicep.ps1 b/images/win/scripts/Installers/Install-Bicep.ps1 new file mode 100644 index 000000000000..21a66ce23b58 --- /dev/null +++ b/images/win/scripts/Installers/Install-Bicep.ps1 @@ -0,0 +1,8 @@ +################################################################################ +## File: Install-Bicep.ps1 +## Desc: Install Bicep +################################################################################ + +Choco-Install -PackageName Bicep + +Invoke-PesterTests -TestFile "Tools" -TestName "Bicep" \ No newline at end of file diff --git a/images/win/scripts/SoftwareReport/SoftwareReport.Generator.ps1 b/images/win/scripts/SoftwareReport/SoftwareReport.Generator.ps1 index 2c14ee9bc91f..a8e6d947288f 100644 --- a/images/win/scripts/SoftwareReport/SoftwareReport.Generator.ps1 +++ b/images/win/scripts/SoftwareReport/SoftwareReport.Generator.ps1 @@ -77,6 +77,7 @@ $markdown += New-MDList -Style Unordered -Lines (@( (Get-AzCopyVersion), (Get-BazelVersion), (Get-BazeliskVersion), + (Get-BicepVersion), (Get-CabalVersion), (Get-CMakeVersion), (Get-CodeQLBundleVersion), diff --git a/images/win/scripts/SoftwareReport/SoftwareReport.Tools.psm1 b/images/win/scripts/SoftwareReport/SoftwareReport.Tools.psm1 index eddd3de97374..ad5eb2255ad4 100644 --- a/images/win/scripts/SoftwareReport/SoftwareReport.Tools.psm1 +++ b/images/win/scripts/SoftwareReport/SoftwareReport.Tools.psm1 @@ -18,6 +18,12 @@ function Get-BazeliskVersion { return "Bazelisk $bazeliskVersion" } +function Get-BicepVersion { + (bicep --version | Out-String) -match "bicep cli version (?\d+\.\d+\.\d+)" | Out-Null + $bicepVersion = $Matches.Version + return "Bicep $bicepVersion" +} + function Get-RVersion { ($(cmd /c "Rscript --version 2>&1") | Out-String) -match "R scripting front-end version (?\d+\.\d+\.\d+)" | Out-Null $rVersion = $Matches.Version diff --git a/images/win/scripts/Tests/Tools.Tests.ps1 b/images/win/scripts/Tests/Tools.Tests.ps1 index db110f5f25d3..62f5846fa468 100644 --- a/images/win/scripts/Tests/Tools.Tests.ps1 +++ b/images/win/scripts/Tests/Tools.Tests.ps1 @@ -35,6 +35,12 @@ Describe "Bazel" { } } +Describe "Bicep" { + It "Bicep" { + "bicep --version" | Should -ReturnZeroExitCode + } +} + Describe "CMake" { It "cmake" { "cmake --version" | Should -ReturnZeroExitCode diff --git a/images/win/windows2016.json b/images/win/windows2016.json index 4259124d9d29..b492cd7360e2 100644 --- a/images/win/windows2016.json +++ b/images/win/windows2016.json @@ -254,7 +254,8 @@ "{{ template_dir }}/scripts/Installers/Install-IEWebDriver.ps1", "{{ template_dir }}/scripts/Installers/Install-Apache.ps1", "{{ template_dir }}/scripts/Installers/Install-Nginx.ps1", - "{{ template_dir }}/scripts/Installers/Install-Swig.ps1" + "{{ template_dir }}/scripts/Installers/Install-Swig.ps1", + "{{ template_dir }}/scripts/Installers/Install-Bicep.ps1" ] }, { diff --git a/images/win/windows2019.json b/images/win/windows2019.json index 5c4a775871ac..6b1de8d1129a 100644 --- a/images/win/windows2019.json +++ b/images/win/windows2019.json @@ -258,7 +258,8 @@ "{{ template_dir }}/scripts/Installers/Install-IEWebDriver.ps1", "{{ template_dir }}/scripts/Installers/Install-Apache.ps1", "{{ template_dir }}/scripts/Installers/Install-Nginx.ps1", - "{{ template_dir }}/scripts/Installers/Install-Swig.ps1" + "{{ template_dir }}/scripts/Installers/Install-Swig.ps1", + "{{ template_dir }}/scripts/Installers/Install-Bicep.ps1" ] }, {