From cf9a92d64ebb7b289782fc9ce0598ebec8267434 Mon Sep 17 00:00:00 2001 From: Leonid Lapshin Date: Tue, 1 Sep 2020 15:53:26 +0300 Subject: [PATCH 01/50] add VS build tools installation, tests, reports, made minor changes to current VS install helper functions --- .../scripts/ImageHelpers/ImageHelpers.psm1 | 3 +- .../scripts/ImageHelpers/InstallHelpers.ps1 | 10 +---- .../ImageHelpers/VisualStudioHelpers.ps1 | 38 ++++++++++++++----- images/win/scripts/Installers/Install-VS.ps1 | 25 ++++++------ .../SoftwareReport.Generator.ps1 | 7 +++- .../SoftwareReport.VisualStudio.psm1 | 2 +- .../win/scripts/Tests/VisualStudio.Tests.ps1 | 16 +++++++- images/win/toolsets/toolset-2016.json | 3 ++ images/win/toolsets/toolset-2019.json | 3 ++ 9 files changed, 70 insertions(+), 37 deletions(-) diff --git a/images/win/scripts/ImageHelpers/ImageHelpers.psm1 b/images/win/scripts/ImageHelpers/ImageHelpers.psm1 index e150e1a12..9441ac7a2 100644 --- a/images/win/scripts/ImageHelpers/ImageHelpers.psm1 +++ b/images/win/scripts/ImageHelpers/ImageHelpers.psm1 @@ -35,8 +35,7 @@ Export-ModuleMember -Function @( 'Get-EnvironmentVariable' 'Invoke-PesterTests' 'Get-VsCatalogJsonPath' - 'Get-VisualStudioPath' 'Install-AndroidSDKPackages' - 'Get-VisualStudioPackages' + 'Get-VisualStudioInstallation' 'Get-VisualStudioComponents' ) diff --git a/images/win/scripts/ImageHelpers/InstallHelpers.ps1 b/images/win/scripts/ImageHelpers/InstallHelpers.ps1 index 282c03762..dc815eea7 100644 --- a/images/win/scripts/ImageHelpers/InstallHelpers.ps1 +++ b/images/win/scripts/ImageHelpers/InstallHelpers.ps1 @@ -266,14 +266,8 @@ function Get-VSExtensionVersion [string] $packageName ) - $instanceFolders = Get-ChildItem -Path "C:\ProgramData\Microsoft\VisualStudio\Packages\_Instances" - if ($instanceFolders -is [array]) - { - Write-Host "More than one instance installed" - exit 1 - } - - $stateContent = Get-Content -Path (Join-Path $instanceFolders.FullName '\state.packages.json') + $instanceFolders = "C:\ProgramData\Microsoft\VisualStudio\Packages\_Instances\" + (Get-VisualStudioInstallation -VSInstallType "VS").InstanceId + $stateContent = Get-Content -Path (Join-Path $instanceFolders '\state.packages.json') $state = $stateContent | ConvertFrom-Json $packageVersion = ($state.packages | Where-Object { $_.id -eq $packageName }).version diff --git a/images/win/scripts/ImageHelpers/VisualStudioHelpers.ps1 b/images/win/scripts/ImageHelpers/VisualStudioHelpers.ps1 index 0fd6bc8b6..bf87912de 100644 --- a/images/win/scripts/ImageHelpers/VisualStudioHelpers.ps1 +++ b/images/win/scripts/ImageHelpers/VisualStudioHelpers.ps1 @@ -61,20 +61,40 @@ Function Install-VisualStudio } function Get-VsCatalogJsonPath { - $instanceFolder = Get-Item "C:\ProgramData\Microsoft\VisualStudio\Packages\_Instances\*" | Select-Object -First 1 - return Join-Path $instanceFolder.FullName "catalog.json" + $instanceFolder = "C:\ProgramData\Microsoft\VisualStudio\Packages\_Instances\" + (Get-VisualStudioInstallation -VSInstallType "VS").InstanceId + return Join-Path $instanceFolder "catalog.json" } -function Get-VisualStudioPath { - return (Get-VSSetupInstance | Select-VSSetupInstance -Product *).InstallationPath -} +function Get-VisualStudioInstallation { + Param + ( + [Parameter(Mandatory)] + [String] $VSInstallType + ) -function Get-VisualStudioPackages { - return (Get-VSSetupInstance | Select-VSSetupInstance -Product *).Packages + if ($VSInstallType -eq "VS") + { + $VSSelectionType = "*Enterprise*" + } + elseif ($VSInstallType -eq "BuildTools") + { + $VSSelectionType = "*Build*" + } + else + { + Write-Output "Visual Studio Installation type have to be 'VS' or 'BuildTools'" + exit 1 + } + return Get-VSSetupInstance | Select-VSSetupInstance -Product * | Where-Object -Property DisplayName -like $VSSelectionType } function Get-VisualStudioComponents { - Get-VisualStudioPackages | Where-Object type -in 'Component', 'Workload' | + Param + ( + [Parameter(Mandatory)] + [String] $VSInstallType + ) + (Get-VisualStudioInstallation -VSInstallType $VSInstallType).Packages | Where-Object type -in 'Component', 'Workload' | Sort-Object Id, Version | Select-Object @{n = 'Package'; e = {$_.Id}}, Version | Where-Object { $_.Package -notmatch "[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}" } -} \ No newline at end of file +} diff --git a/images/win/scripts/Installers/Install-VS.ps1 b/images/win/scripts/Installers/Install-VS.ps1 index ed4fca73f..9d075ce4a 100644 --- a/images/win/scripts/Installers/Install-VS.ps1 +++ b/images/win/scripts/Installers/Install-VS.ps1 @@ -1,38 +1,35 @@ ################################################################################ ## File: Install-VS.ps1 -## Desc: Install Visual Studio +## Desc: Install Visual Studio and build tools ################################################################################ $ErrorActionPreference = "Stop" $toolset = Get-ToolsetContent $requiredComponents = $toolset.visualStudio.workloads | ForEach-Object { "--add $_" } +$buildRequiredComponents = $toolset.visualStudio.build_workloads | ForEach-Object { "--add $_" } $workLoads = @( "--allWorkloads --includeRecommended" $requiredComponents "--remove Component.CPython3.x64" ) $workLoadsArgument = [String]::Join(" ", $workLoads) +$buildWorkLoads = @( + "--includeRecommended" + $buildRequiredComponents +) +$buildWorkLoadsArgument = [String]::Join(" ", $buildWorkLoads) $releaseInPath = $toolset.visualStudio.edition $subVersion = $toolset.visualStudio.subversion $bootstrapperUrl = "https://aka.ms/vs/${subVersion}/release/vs_${releaseInPath}.exe" +$buildbootstrapperUrl = "https://aka.ms/vs/${subVersion}/release/vs_buildtools.exe" -# Install VS +# Install VS and VS Build tools Install-VisualStudio -BootstrapperUrl $bootstrapperUrl -WorkLoads $workLoadsArgument +Install-VisualStudio -BootstrapperUrl $buildbootstrapperUrl -WorkLoads $buildWorkLoadsArgument -# Find the version of VS installed for this instance -# Only supports a single instance -$vsProgramData = Get-Item -Path "C:\ProgramData\Microsoft\VisualStudio\Packages\_Instances" -$instanceFolders = Get-ChildItem -Path $vsProgramData.FullName - -if ($instanceFolders -is [array]) -{ - Write-Host "More than one instance installed" - exit 1 -} - -$vsInstallRoot = Get-VisualStudioPath +$vsInstallRoot = (Get-VisualStudioInstallation -VStype "VS").InstallationPath # Initialize Visual Studio Experimental Instance & "$vsInstallRoot\Common7\IDE\devenv.exe" /RootSuffix Exp /ResetSettings General.vssettings /Command File.Exit diff --git a/images/win/scripts/SoftwareReport/SoftwareReport.Generator.ps1 b/images/win/scripts/SoftwareReport/SoftwareReport.Generator.ps1 index eb8b35f0d..e818a25d8 100644 --- a/images/win/scripts/SoftwareReport/SoftwareReport.Generator.ps1 +++ b/images/win/scripts/SoftwareReport/SoftwareReport.Generator.ps1 @@ -171,7 +171,12 @@ $markdown += New-MDNewLine $markdown += New-MDHeader "Workloads, components and extensions:" -Level 4 $markdown += New-MDNewLine -$markdown += ((Get-VisualStudioComponents) + (Get-VisualStudioExtensions)) | New-MDTable +$markdown += ((Get-VisualStudioComponents -VSInstallType "VS") + (Get-VisualStudioExtensions)) | New-MDTable +$markdown += New-MDNewLine + +$markdown += New-MDHeader "Build Workloads and components:" -Level 4 +$markdown += New-MDNewLine +$markdown += (Get-VisualStudioComponents -VSInstallType "BuildTools") | New-MDTable $markdown += New-MDNewLine $markdown += New-MDHeader "Microsoft Visual C++:" -Level 4 diff --git a/images/win/scripts/SoftwareReport/SoftwareReport.VisualStudio.psm1 b/images/win/scripts/SoftwareReport/SoftwareReport.VisualStudio.psm1 index 0004c168b..ba6907b35 100644 --- a/images/win/scripts/SoftwareReport/SoftwareReport.VisualStudio.psm1 +++ b/images/win/scripts/SoftwareReport/SoftwareReport.VisualStudio.psm1 @@ -23,7 +23,7 @@ function Get-VisualStudioExtensions { # Wix $vs = (Get-VisualStudioVersion).Name.Split()[-1] $wixPackageVersion = Get-WixVersion - $wixExtensionVersion = (Get-VisualStudioPackages | Where-Object {$_.Id -match 'WixToolset.VisualStudioExtension.Dev' -and $_.type -eq 'vsix'}).Version + $wixExtensionVersion = ((Get-VisualStudioInstallation -VSInstallType "VS").Packages | Where-Object {$_.Id -match 'WixToolset.VisualStudioExtension.Dev' -and $_.type -eq 'vsix'}).Version # WDK $wdkPackageVersion = Get-VSExtensionVersion -packageName 'Microsoft.Windows.DriverKit' diff --git a/images/win/scripts/Tests/VisualStudio.Tests.ps1 b/images/win/scripts/Tests/VisualStudio.Tests.ps1 index 142a9917e..14806a5a5 100644 --- a/images/win/scripts/Tests/VisualStudio.Tests.ps1 +++ b/images/win/scripts/Tests/VisualStudio.Tests.ps1 @@ -5,7 +5,7 @@ Describe "Visual Studio" { } It "Devenv.exe" { - $vsInstallRoot = Get-VisualStudioPath + $vsInstallRoot = (Get-VisualStudioInstallation -VStype "VS").InstallationPath $devenvexePath = "${vsInstallRoot}\Common7\IDE\devenv.exe" $devenvexePath | Should -Exist } @@ -15,7 +15,19 @@ Describe "Visual Studio" { $expectedComponents = Get-ToolsetContent | Select-Object -ExpandProperty visualStudio | Select-Object -ExpandProperty workloads $testCases = $expectedComponents | ForEach-Object { @{ComponentName = $_} } BeforeAll { - $installedComponents = Get-VisualStudioComponents | Select-Object -ExpandProperty Package + $installedComponents = Get-VisualStudioComponents -VSInstallType "VS" | Select-Object -ExpandProperty Package + } + + It "" -TestCases $testCases { + $installedComponents | Should -Contain $ComponentName + } + } + + Context "Visual Studio build components" { + $expectedComponents = Get-ToolsetContent | Select-Object -ExpandProperty visualStudio | Select-Object -ExpandProperty build_workloads + $testCases = $expectedComponents | ForEach-Object { @{ComponentName = $_} } + BeforeAll { + $installedComponents = Get-VisualStudioComponents -VSInstallType "Build" | Select-Object -ExpandProperty Package } It "" -TestCases $testCases { diff --git a/images/win/toolsets/toolset-2016.json b/images/win/toolsets/toolset-2016.json index f01e9473c..d9a5a3259 100644 --- a/images/win/toolsets/toolset-2016.json +++ b/images/win/toolsets/toolset-2016.json @@ -226,6 +226,9 @@ "Microsoft.VisualStudio.Component.VC.Runtimes.ARM64.Spectre", "Microsoft.VisualStudio.Component.Workflow", "Microsoft.VisualStudio.Workload.Office" + ], + "build_workloads": [ + "Microsoft.VisualStudio.Workload.WebBuildTools" ] } } diff --git a/images/win/toolsets/toolset-2019.json b/images/win/toolsets/toolset-2019.json index e29552df3..684579e21 100644 --- a/images/win/toolsets/toolset-2019.json +++ b/images/win/toolsets/toolset-2019.json @@ -257,6 +257,9 @@ "Microsoft.VisualStudio.Workload.VisualStudioExtension", "Component.MDD.Linux", "Component.MDD.Linux.GCC.arm" + ], + "build_workloads": [ + "Microsoft.VisualStudio.Workload.WebBuildTools" ] } } From e1d821a0733d6dced74d1bf158dd8765eb17918f Mon Sep 17 00:00:00 2001 From: Leonid Lapshin Date: Tue, 1 Sep 2020 16:05:15 +0300 Subject: [PATCH 02/50] Vstype typo --- images/win/scripts/Installers/Install-VS.ps1 | 2 +- images/win/scripts/Tests/VisualStudio.Tests.ps1 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/images/win/scripts/Installers/Install-VS.ps1 b/images/win/scripts/Installers/Install-VS.ps1 index 9d075ce4a..af834b621 100644 --- a/images/win/scripts/Installers/Install-VS.ps1 +++ b/images/win/scripts/Installers/Install-VS.ps1 @@ -29,7 +29,7 @@ $buildbootstrapperUrl = "https://aka.ms/vs/${subVersion}/release/vs_buildtools.e Install-VisualStudio -BootstrapperUrl $bootstrapperUrl -WorkLoads $workLoadsArgument Install-VisualStudio -BootstrapperUrl $buildbootstrapperUrl -WorkLoads $buildWorkLoadsArgument -$vsInstallRoot = (Get-VisualStudioInstallation -VStype "VS").InstallationPath +$vsInstallRoot = (Get-VisualStudioInstallation -VSInstallType "VS").InstallationPath # Initialize Visual Studio Experimental Instance & "$vsInstallRoot\Common7\IDE\devenv.exe" /RootSuffix Exp /ResetSettings General.vssettings /Command File.Exit diff --git a/images/win/scripts/Tests/VisualStudio.Tests.ps1 b/images/win/scripts/Tests/VisualStudio.Tests.ps1 index 14806a5a5..315e7e5c2 100644 --- a/images/win/scripts/Tests/VisualStudio.Tests.ps1 +++ b/images/win/scripts/Tests/VisualStudio.Tests.ps1 @@ -5,7 +5,7 @@ Describe "Visual Studio" { } It "Devenv.exe" { - $vsInstallRoot = (Get-VisualStudioInstallation -VStype "VS").InstallationPath + $vsInstallRoot = (Get-VisualStudioInstallation -VSInstallType "VS").InstallationPath $devenvexePath = "${vsInstallRoot}\Common7\IDE\devenv.exe" $devenvexePath | Should -Exist } From ade2f9d34a48bac7ead22af7aa8e0b506a6a6b5f Mon Sep 17 00:00:00 2001 From: Leonid Lapshin Date: Tue, 1 Sep 2020 16:17:55 +0300 Subject: [PATCH 03/50] removed unused variable --- images/win/scripts/ImageHelpers/InstallHelpers.ps1 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/images/win/scripts/ImageHelpers/InstallHelpers.ps1 b/images/win/scripts/ImageHelpers/InstallHelpers.ps1 index dc815eea7..767391780 100644 --- a/images/win/scripts/ImageHelpers/InstallHelpers.ps1 +++ b/images/win/scripts/ImageHelpers/InstallHelpers.ps1 @@ -267,8 +267,7 @@ function Get-VSExtensionVersion ) $instanceFolders = "C:\ProgramData\Microsoft\VisualStudio\Packages\_Instances\" + (Get-VisualStudioInstallation -VSInstallType "VS").InstanceId - $stateContent = Get-Content -Path (Join-Path $instanceFolders '\state.packages.json') - $state = $stateContent | ConvertFrom-Json + $state = Get-Content -Path (Join-Path $instanceFolders '\state.packages.json') | ConvertFrom-Json $packageVersion = ($state.packages | Where-Object { $_.id -eq $packageName }).version if (-not $packageVersion) From 53993a9421a96efac9694cbbef7cb698be0f47b6 Mon Sep 17 00:00:00 2001 From: Image generation service account Date: Tue, 1 Sep 2020 13:28:12 +0000 Subject: [PATCH 04/50] Updating readme file for ubuntu16 version 20200901.1 --- images/linux/Ubuntu1604-README.md | 50 ++++++++++++++++--------------- 1 file changed, 26 insertions(+), 24 deletions(-) diff --git a/images/linux/Ubuntu1604-README.md b/images/linux/Ubuntu1604-README.md index 56c643030..aaf93b3d6 100644 --- a/images/linux/Ubuntu1604-README.md +++ b/images/linux/Ubuntu1604-README.md @@ -1,12 +1,12 @@ # Ubuntu 16.04.7 LTS -The following software is installed on machines with the 20200825.1 update. +The following software is installed on machines with the 20200901.1 update. *** - 7-Zip 9.20 - Ansible (ansible 2.9.12) - AzCopy7 (available by azcopy alias) 7.3.0 - AzCopy10 (available by azcopy10 alias) 10.6.0 -- Azure CLI (azure-cli 2.10.1 *) +- Azure CLI (azure-cli 2.11.1) - Azure CLI (azure-devops 0.18.0) - Basic packages: - dnsutils @@ -66,7 +66,7 @@ The following software is installed on machines with the 20200825.1 update. - yamllint - libcurl3 - Alibaba Cloud CLI (3.0.56) -- AWS CLI (aws-cli/1.18.125 Python/2.7.12 Linux/4.15.0-1092-azure botocore/1.17.48) +- AWS CLI (aws-cli/1.18.129 Python/2.7.12 Linux/4.15.0-1092-azure botocore/1.17.52) - AWS CLI Session manager plugin (1.1.61.0) - build-essential - nvm (0.35.3) @@ -147,7 +147,7 @@ Target: x86_64-unknown-linux-gnu - 2.1.301 - 2.1.300 - Erlang (Erlang (SMP,ASYNC_THREADS,HIPE) (BEAM) emulator version 11.0.3) -- Firefox (Mozilla Firefox 79.0) +- Firefox (Mozilla Firefox 80.0) - Geckodriver (0.27.0); Gecko Driver is available via GECKOWEBDRIVER environment variable - GNU C++ 7.5.0 - GNU C++ 8.4.0 @@ -160,13 +160,13 @@ Target: x86_64-unknown-linux-gnu - Hub CLI (2.14.2) - GitHub CLI 0.11.1 - Google Chrome (Google Chrome 85.0.4183.83 ) -- ChromeDriver 85.0.4183.38 (9047dbc2c693f044042bbec5c91401c708c7c26a-refs/branch-heads/4183@{#779}); Chrome Driver is available via CHROMEWEBDRIVER environment variable +- ChromeDriver 85.0.4183.87 (cd6713ebf92fa1cacc0f1a598df280093af0c5d7-refs/branch-heads/4183@{#1689}); Chrome Driver is available via CHROMEWEBDRIVER environment variable - Google Cloud SDK (307.0.0) - Haskell Cabal (cabal-install version 3.2.0.0 compiled using version 3.2.0.0 of the Cabal library ) - GHC (The Glorious Glasgow Haskell Compilation System, version 8.10.2) - Haskell Stack (Version 2.3.3, Git revision cb44d51bed48b723a5deb08c3348c0b3ccfc437e x86_64 hpack-0.33.0) -- Heroku (heroku/7.42.10 linux-x64 node-v12.16.2) +- Heroku (heroku/7.42.13 linux-x64 node-v12.16.2) - HHVM (HipHop VM 4.56.1 (rel)) - ImageMagick - Azul Zulu OpenJDK: @@ -179,15 +179,16 @@ compiled using version 3.2.0.0 of the Cabal library ) - Gradle 6.6.1 - Maven (Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)) - Kind (kind v0.8.1 go1.14.2 linux/amd64) -- kubectl (Client Version: v1.18.8) -- helm (v3.3.0+g8a4aeec) +- kubectl (Client Version: v1.19.0) +- helm (v3.3.1+g249e521) - minikube version: v1.12.3 -- kustomize ({kustomize/v3.8.1 2020-07-16T00:58:46Z }) +- kustomize ({kustomize/v3.8.2 2020-08-29T17:44:01Z }) - oc CLI Client Version: 4.5.0-202005291417-9933eb9 - Leiningen (Leiningen 2.9.4 on Java 1.8.0_265 OpenJDK 64-Bit Server VM) - Mercurial (Mercurial Distributed SCM (version 4.4.1)) - Miniconda (conda 4.8.3) - Mono (Mono JIT compiler version 6.10.0.104 (tarball Fri Jun 26 19:43:02 UTC 2020)) +- NuGet (NuGet Version: 5.5.0.6382) - MySQL (mysql Ver 14.14 Distrib 5.7.31, for Linux (x86_64) using EditLine wrapper) - MySQL Server (user:root password:root) - MS SQL Server Client Tools @@ -201,7 +202,7 @@ Local version: Unknown) - TypeScript (Version 4.0.2) - Webpack (4.44.1) - Webpack CLI (3.3.12) -- Yarn (1.22.4) +- Yarn (1.22.5) - Newman (5.1.2) - Bazel (bazel 3.4.1) - Bazelisk (1.6.1) @@ -218,34 +219,35 @@ Local version: Unknown) - Pollinate - psql (PostgreSQL) 12.4 - Powershell (PowerShell 7.0.3) +- Pulumi v2.9.2 - ruby (2.3.1p112) - gem (3.1.4) - OpenSSL 1.1.0h 27 Mar 2018 (Library: OpenSSL 1.1.1g 21 Apr 2020) - Libssl 1.1.1g-1+ubuntu16.04.1+deb.sury.org+1 - R 4.0.2 - rustup (1.22.1) -- rust (1.45.2) -- cargo (1.45.1) -- rustfmt (1.4.17-stable) +- rust (1.46.0) +- cargo (1.46.0) +- rustfmt (1.4.18-stable) - clippy (0.0.212) -- rustdoc (1.45.2) +- rustdoc (1.46.0) - bindgen (0.55.1) - cbindgen (0.14.4) - cargo audit (0.12.0) - cargo outdated (v0.9.11) -- Julia (julia version 1.5.0) +- Julia (julia version 1.5.1) - sbt (1.3.13) - Selenium server standalone (available via SELENIUM_JAR_PATH environment variable) - Sphinx Open Source Search Server - Subversion (svn, version 1.9.3 (r1718519)) -- Terraform (Terraform v0.13.0) -- Packer (1.6.1) +- Terraform (Terraform v0.13.1) +- Packer (1.6.2) - Vcpkg 2020.06.15-unknownhash -- Vercel CLI (20.0.0) +- Vercel CLI (20.1.0) - MongoDB on Linux v4.4.0 - Haveged 1.9.1-3 - Swig 3.0.8 -- Netlify CLI (netlify-cli/2.59.1 linux-x64 node-v12.18.3) +- Netlify CLI (netlify-cli/2.59.3 linux-x64 node-v12.18.3) - Google Repository 58 - Google Play services 49 - Google APIs 24 @@ -320,10 +322,10 @@ Local version: Unknown) - Az Module (4.3.0) - Az Module (4.4.0) - Cached container images + - buildpack-deps:stretch (Digest: sha256:82a686ba95fdf2bf4a5f5264e8e55b8aa272ffcedaed7826777f08de0d9e1146) + - buildpack-deps:buster (Digest: sha256:0f7be4c25fadb2b8aee537cdac00a684b09057e66368683bbf22adf477e05faa) - node:10 (Digest: sha256:cf3ee6a5a1b1916c7a2e4fb51eb7ecba1afe186739677d62e9c1bb2cb1c7d6b0) - node:12 (Digest: sha256:d0738468dfc7cedb7d260369e0546fd7ee8731cfd67136f6023d070ad9679090) - - buildpack-deps:stretch (Digest: sha256:34a18637ed801407f7a17a29575e82264fb0818f9b6a0c890f8a6530afea43dc) - - buildpack-deps:buster (Digest: sha256:b9343e9ba16795186ab1f34825803f1d7e9b0943dba5d644d3c1de5473f0602e) - debian:9 (Digest: sha256:335ecf9e8d9b2206c2e9e7f8b09547faa9f868e694f7c5be14c38be15ea8a7cf) - debian:8 (Digest: sha256:8a0f2603166345b4d7bbf4842137b2ffcb492ece20d15f963f08aa26670f82c7) - node:12-alpine (Digest: sha256:9623cd396644f9b2e595d833dc0188a880333674488d939338ab5fde10ef7c43) @@ -357,7 +359,7 @@ Local version: Unknown) - node 8.17.0 - node 10.22.0 - node 12.18.3 - - node 14.8.0 + - node 14.9.0 - go: - go 1.11.13 - go 1.12.17 @@ -368,5 +370,5 @@ Local version: Unknown) - boost 1.69.0 - boost 1.72.0 - AWS SAM CLI, version 1.1.0 -- Homebrew on Linux (Homebrew 2.4.13 -Homebrew/linuxbrew-core (git revision 7d5ec; last commit 2020-08-24)) +- Homebrew on Linux (Homebrew 2.4.16 +Homebrew/linuxbrew-core (git revision d0486f; last commit 2020-09-01)) From 956c4284e4bd744b1f591432df08ce99f8d81d6e Mon Sep 17 00:00:00 2001 From: Image generation service account Date: Tue, 1 Sep 2020 13:29:14 +0000 Subject: [PATCH 05/50] Updating readme file for ubuntu18 version 20200901.1 --- images/linux/Ubuntu1804-README.md | 54 ++++++++++++++++--------------- 1 file changed, 28 insertions(+), 26 deletions(-) diff --git a/images/linux/Ubuntu1804-README.md b/images/linux/Ubuntu1804-README.md index 03ef00720..11cc81e81 100644 --- a/images/linux/Ubuntu1804-README.md +++ b/images/linux/Ubuntu1804-README.md @@ -1,12 +1,12 @@ # Ubuntu 18.04.5 LTS -The following software is installed on machines with the 20200825.1 update. +The following software is installed on machines with the 20200901.1 update. *** - 7-Zip 16.02 - Ansible (ansible 2.9.12) - AzCopy7 (available by azcopy alias) 7.3.0 - AzCopy10 (available by azcopy10 alias) 10.6.0 -- Azure CLI (azure-cli 2.10.1 *) +- Azure CLI (azure-cli 2.11.1) - Azure CLI (azure-devops 0.18.0) - Basic packages: - dnsutils @@ -65,7 +65,7 @@ The following software is installed on machines with the 20200825.1 update. - yamllint - libcurl3 - Alibaba Cloud CLI (3.0.56) -- AWS CLI (aws-cli/1.18.125 Python/2.7.17 Linux/5.3.0-1035-azure botocore/1.17.48) +- AWS CLI (aws-cli/1.18.129 Python/2.7.17 Linux/5.3.0-1035-azure botocore/1.17.52) - AWS CLI Session manager plugin (1.1.61.0) - build-essential - Clang 6.0 (6.0.0) @@ -74,7 +74,7 @@ The following software is installed on machines with the 20200825.1 update. - Swift version 5.2.5 (swift-5.2.5-RELEASE) Target: x86_64-unknown-linux-gnu - CMake (cmake version 3.17.0) -- Podman (2.0.4) +- Podman (2.0.5) - Buildah (1.15.1) - Skopeo (1.1.1) - Docker Compose (docker-compose version 1.26.2, build eefe0d31) @@ -148,7 +148,7 @@ Target: x86_64-unknown-linux-gnu - 2.1.301 - 2.1.300 - Erlang (Erlang (SMP,ASYNC_THREADS,HIPE) (BEAM) emulator version 11.0.3) -- Firefox (Mozilla Firefox 79.0) +- Firefox (Mozilla Firefox 80.0) - Geckodriver (0.27.0); Gecko Driver is available via GECKOWEBDRIVER environment variable - GNU C++ 7.5.0 - GNU C++ 8.4.0 @@ -161,14 +161,14 @@ Target: x86_64-unknown-linux-gnu - Hub CLI (2.14.2) - GitHub CLI 0.11.1 - Google Chrome (Google Chrome 85.0.4183.83 ) -- ChromeDriver 85.0.4183.38 (9047dbc2c693f044042bbec5c91401c708c7c26a-refs/branch-heads/4183@{#779}); Chrome Driver is available via CHROMEWEBDRIVER environment variable +- ChromeDriver 85.0.4183.87 (cd6713ebf92fa1cacc0f1a598df280093af0c5d7-refs/branch-heads/4183@{#1689}); Chrome Driver is available via CHROMEWEBDRIVER environment variable - Google Cloud SDK (307.0.0) - Haskell Cabal (cabal-install version 3.2.0.0 compiled using version 3.2.0.0 of the Cabal library ) - GHC (The Glorious Glasgow Haskell Compilation System, version 8.10.2) - Haskell Stack (Version 2.3.3, Git revision cb44d51bed48b723a5deb08c3348c0b3ccfc437e x86_64 hpack-0.33.0) -- Heroku (heroku/7.42.10 linux-x64 node-v12.16.2) -- HHVM (HipHop VM 4.71.0 (rel)) +- Heroku (heroku/7.42.13 linux-x64 node-v12.16.2) +- HHVM (HipHop VM 4.72.0 (rel)) - ImageMagick - Azul Zulu OpenJDK: - 7 (openjdk version "1.7.0_272") @@ -180,15 +180,16 @@ compiled using version 3.2.0.0 of the Cabal library ) - Gradle 6.6.1 - Maven (Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)) - Kind (kind v0.8.1 go1.14.2 linux/amd64) -- kubectl (Client Version: v1.18.8) -- helm (v3.3.0+g8a4aeec) +- kubectl (Client Version: v1.19.0) +- helm (v3.3.1+g249e521) - minikube version: v1.12.3 -- kustomize ({kustomize/v3.8.1 2020-07-16T00:58:46Z }) +- kustomize ({kustomize/v3.8.2 2020-08-29T17:44:01Z }) - oc CLI Client Version: 4.5.0-202005291417-9933eb9 - Leiningen (Leiningen 2.9.4 on Java 1.8.0_265 OpenJDK 64-Bit Server VM) - Mercurial (Mercurial Distributed SCM (version 4.5.3)) - Miniconda (conda 4.8.3) - Mono (Mono JIT compiler version 6.10.0.104 (tarball Fri Jun 26 19:38:24 UTC 2020)) +- NuGet (NuGet Version: 5.5.0.6382) - MySQL (mysql Ver 14.14 Distrib 5.7.31, for Linux (x86_64) using EditLine wrapper) - MySQL Server (user:root password:root) - MS SQL Server Client Tools @@ -203,7 +204,7 @@ Local version: Unknown) - TypeScript (Version 4.0.2) - Webpack (4.44.1) - Webpack CLI (3.3.12) -- Yarn (1.22.4) +- Yarn (1.22.5) - Newman (5.1.2) - Bazel (bazel 3.4.1) - Bazelisk (1.6.1) @@ -218,34 +219,35 @@ Local version: Unknown) - Pollinate - psql (PostgreSQL) 12.4 - Powershell (PowerShell 7.0.3) +- Pulumi v2.9.2 - ruby (2.5.1p57) - gem (3.1.4) - OpenSSL 1.1.1g 21 Apr 2020 - Libssl 1.1.1g-1+ubuntu18.04.1+deb.sury.org+1 - R 4.0.2 - rustup (1.22.1) -- rust (1.45.2) -- cargo (1.45.1) -- rustfmt (1.4.17-stable) +- rust (1.46.0) +- cargo (1.46.0) +- rustfmt (1.4.18-stable) - clippy (0.0.212) -- rustdoc (1.45.2) +- rustdoc (1.46.0) - bindgen (0.55.1) - cbindgen (0.14.4) - cargo audit (0.12.0) - cargo outdated (v0.9.11) -- Julia (julia version 1.5.0) +- Julia (julia version 1.5.1) - sbt (1.3.13) - Selenium server standalone (available via SELENIUM_JAR_PATH environment variable) - Sphinx Open Source Search Server - Subversion (svn, version 1.9.7 (r1800392)) -- Terraform (Terraform v0.13.0) -- Packer (1.6.1) +- Terraform (Terraform v0.13.1) +- Packer (1.6.2) - Vcpkg 2020.06.15-unknownhash -- Vercel CLI (20.0.0) +- Vercel CLI (20.1.0) - MongoDB on Linux v4.4.0 - Haveged 1.9.1-6 - Swig 3.0.12 -- Netlify CLI (netlify-cli/2.59.1 linux-x64 node-v12.18.3) +- Netlify CLI (netlify-cli/2.59.3 linux-x64 node-v12.18.3) - Google Repository 58 - Google Play services 49 - Google APIs 24 @@ -314,10 +316,10 @@ Local version: Unknown) - Az Module (4.3.0) - Az Module (4.4.0) - Cached container images + - buildpack-deps:stretch (Digest: sha256:82a686ba95fdf2bf4a5f5264e8e55b8aa272ffcedaed7826777f08de0d9e1146) + - buildpack-deps:buster (Digest: sha256:0f7be4c25fadb2b8aee537cdac00a684b09057e66368683bbf22adf477e05faa) - node:10 (Digest: sha256:cf3ee6a5a1b1916c7a2e4fb51eb7ecba1afe186739677d62e9c1bb2cb1c7d6b0) - node:12 (Digest: sha256:d0738468dfc7cedb7d260369e0546fd7ee8731cfd67136f6023d070ad9679090) - - buildpack-deps:stretch (Digest: sha256:34a18637ed801407f7a17a29575e82264fb0818f9b6a0c890f8a6530afea43dc) - - buildpack-deps:buster (Digest: sha256:b9343e9ba16795186ab1f34825803f1d7e9b0943dba5d644d3c1de5473f0602e) - debian:9 (Digest: sha256:335ecf9e8d9b2206c2e9e7f8b09547faa9f868e694f7c5be14c38be15ea8a7cf) - debian:8 (Digest: sha256:8a0f2603166345b4d7bbf4842137b2ffcb492ece20d15f963f08aa26670f82c7) - node:12-alpine (Digest: sha256:9623cd396644f9b2e595d833dc0188a880333674488d939338ab5fde10ef7c43) @@ -351,7 +353,7 @@ Local version: Unknown) - node 8.17.0 - node 10.22.0 - node 12.18.3 - - node 14.8.0 + - node 14.9.0 - go: - go 1.11.13 - go 1.12.17 @@ -362,5 +364,5 @@ Local version: Unknown) - boost 1.69.0 - boost 1.72.0 - AWS SAM CLI, version 1.1.0 -- Homebrew on Linux (Homebrew 2.4.13 -Homebrew/linuxbrew-core (git revision 7d5ec; last commit 2020-08-24)) +- Homebrew on Linux (Homebrew 2.4.16 +Homebrew/linuxbrew-core (git revision d0486f; last commit 2020-09-01)) From 425d62e593503b0b9df9bbcdd9173b0a6414f4bb Mon Sep 17 00:00:00 2001 From: Leonid Lapshin Date: Tue, 1 Sep 2020 17:22:57 +0300 Subject: [PATCH 06/50] validate set for new functions --- images/win/scripts/ImageHelpers/VisualStudioHelpers.ps1 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/images/win/scripts/ImageHelpers/VisualStudioHelpers.ps1 b/images/win/scripts/ImageHelpers/VisualStudioHelpers.ps1 index bf87912de..10e8d0cd8 100644 --- a/images/win/scripts/ImageHelpers/VisualStudioHelpers.ps1 +++ b/images/win/scripts/ImageHelpers/VisualStudioHelpers.ps1 @@ -69,6 +69,7 @@ function Get-VisualStudioInstallation { Param ( [Parameter(Mandatory)] + [ValidateSet('VS','BuildTools')] [String] $VSInstallType ) @@ -92,6 +93,7 @@ function Get-VisualStudioComponents { Param ( [Parameter(Mandatory)] + [ValidateSet('VS','BuildTools')] [String] $VSInstallType ) (Get-VisualStudioInstallation -VSInstallType $VSInstallType).Packages | Where-Object type -in 'Component', 'Workload' | From 210cb9cdbb790563d91fe5ae817ec55ccf07ec70 Mon Sep 17 00:00:00 2001 From: Image generation service account Date: Tue, 1 Sep 2020 15:12:32 +0000 Subject: [PATCH 07/50] Updating readme file for ubuntu20 version 20200901.1 --- images/linux/Ubuntu2004-README.md | 56 ++++++++++++++++--------------- 1 file changed, 29 insertions(+), 27 deletions(-) diff --git a/images/linux/Ubuntu2004-README.md b/images/linux/Ubuntu2004-README.md index fb074ef38..7a78efab2 100644 --- a/images/linux/Ubuntu2004-README.md +++ b/images/linux/Ubuntu2004-README.md @@ -1,12 +1,12 @@ # Ubuntu 20.04.1 LTS -The following software is installed on machines with the 20200825.1 update. +The following software is installed on machines with the 20200901.1 update. *** - 7-Zip 16.02 - Ansible (ansible 2.9.6) - AzCopy7 (available by azcopy alias) 7.3.0 - AzCopy10 (available by azcopy10 alias) 10.6.0 -- Azure CLI (azure-cli 2.10.1 *) +- Azure CLI (azure-cli 2.11.1) - Azure CLI (azure-devops 0.18.0) - Basic packages: - dnsutils @@ -65,7 +65,7 @@ The following software is installed on machines with the 20200825.1 update. - yamllint - libcurl4 - Alibaba Cloud CLI (3.0.56) -- AWS CLI (aws-cli/2.0.42 Python/3.7.3 Linux/5.4.0-1022-azure exe/x86_64.ubuntu.20) +- AWS CLI (aws-cli/2.0.44 Python/3.7.3 Linux/5.4.0-1022-azure exe/x86_64.ubuntu.20) - AWS CLI Session manager plugin (1.1.61.0) - build-essential - Clang 6.0 (6.0.1) @@ -74,7 +74,7 @@ The following software is installed on machines with the 20200825.1 update. - Swift version 5.2.5 (swift-5.2.5-RELEASE) Target: x86_64-unknown-linux-gnu - CMake (cmake version 3.17.0) -- Podman (2.0.4) +- Podman (2.0.5) - Buildah (1.15.1) - Skopeo (1.1.1) - Docker Compose (docker-compose version 1.26.2, build eefe0d31) @@ -144,7 +144,7 @@ Target: x86_64-unknown-linux-gnu - 2.1.301 - 2.1.300 - Erlang (Erlang (SMP,ASYNC_THREADS,HIPE) (BEAM) emulator version 11.0.3) -- Firefox (Mozilla Firefox 79.0) +- Firefox (Mozilla Firefox 80.0) - Geckodriver (0.27.0); Gecko Driver is available via GECKOWEBDRIVER environment variable - GNU C++ 7.5.0 - GNU C++ 8.4.0 @@ -157,14 +157,14 @@ Target: x86_64-unknown-linux-gnu - Hub CLI (2.14.2) - GitHub CLI 0.11.1 - Google Chrome (Google Chrome 85.0.4183.83 ) -- ChromeDriver 85.0.4183.38 (9047dbc2c693f044042bbec5c91401c708c7c26a-refs/branch-heads/4183@{#779}); Chrome Driver is available via CHROMEWEBDRIVER environment variable +- ChromeDriver 85.0.4183.87 (cd6713ebf92fa1cacc0f1a598df280093af0c5d7-refs/branch-heads/4183@{#1689}); Chrome Driver is available via CHROMEWEBDRIVER environment variable - Google Cloud SDK (307.0.0) - Haskell Cabal (cabal-install version 3.2.0.0 compiled using version 3.2.0.0 of the Cabal library ) - GHC (The Glorious Glasgow Haskell Compilation System, version 8.10.2) - Haskell Stack (Version 2.3.3, Git revision cb44d51bed48b723a5deb08c3348c0b3ccfc437e x86_64 hpack-0.33.0) -- Heroku (heroku/7.42.10 linux-x64 node-v12.16.2) -- HHVM (HipHop VM 4.71.0 (rel)) +- Heroku (heroku/7.42.13 linux-x64 node-v12.16.2) +- HHVM (HipHop VM 4.72.0 (rel)) - ImageMagick - Adopt OpenJDK: - 8 (openjdk version "1.8.0_265") @@ -173,15 +173,16 @@ compiled using version 3.2.0.0 of the Cabal library ) - Gradle 6.6.1 - Maven (Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)) - Kind (kind v0.8.1 go1.14.2 linux/amd64) -- kubectl (Client Version: v1.18.8) -- helm (v3.3.0+g8a4aeec) +- kubectl (Client Version: v1.19.0) +- helm (v3.3.1+g249e521) - minikube version: v1.12.3 -- kustomize ({kustomize/v3.8.1 2020-07-16T00:58:46Z }) +- kustomize ({kustomize/v3.8.2 2020-08-29T17:44:01Z }) - oc CLI Client Version: 4.5.0-202005291417-9933eb9 - Leiningen (Leiningen 2.9.4 on Java 11.0.8 OpenJDK 64-Bit Server VM) - Mercurial (Mercurial Distributed SCM (version 5.3.1)) - Miniconda (conda 4.8.3) - Mono (Mono JIT compiler version 6.10.0.104 (tarball Fri Jun 26 19:38:44 UTC 2020)) +- NuGet (NuGet Version: 5.5.0.6382) - MySQL (mysql Ver 8.0.21-0ubuntu0.20.04.4 for Linux on x86_64 ((Ubuntu))) - MySQL Server (user:root password:root) - MS SQL Server Client Tools @@ -196,7 +197,7 @@ Local version: Unknown) - TypeScript (Version 4.0.2) - Webpack (4.44.1) - Webpack CLI (3.3.12) -- Yarn (1.22.4) +- Yarn (1.22.5) - Newman (5.1.2) - Bazel (bazel 3.4.1) - Bazelisk (1.6.1) @@ -213,35 +214,36 @@ apt-get update - Pollinate - psql (PostgreSQL) 12.4 - Powershell (PowerShell 7.0.3) +- Pulumi v2.9.2 - ruby (2.7.0p0) - gem (3.1.2) - OpenSSL 1.1.1f 31 Mar 2020 - Libssl 1.1.1f-1ubuntu2 - R 4.0.2 - rustup (1.22.1) -- rust (1.45.2) -- cargo (1.45.1) -- rustfmt (1.4.17-stable) +- rust (1.46.0) +- cargo (1.46.0) +- rustfmt (1.4.18-stable) - clippy (0.0.212) -- rustdoc (1.45.2) +- rustdoc (1.46.0) - bindgen (0.55.1) - cbindgen (0.14.4) - cargo audit (0.12.0) - cargo outdated (v0.9.11) -- Julia (julia version 1.5.0) +- Julia (julia version 1.5.1) - sbt (copying runtime jar... 1.3.13) - Selenium server standalone (available via SELENIUM_JAR_PATH environment variable) - Sphinx Open Source Search Server - Subversion (svn, version 1.13.0 (r1867053)) -- Terraform (Terraform v0.13.0) -- Packer (1.6.1) +- Terraform (Terraform v0.13.1) +- Packer (1.6.2) - Vcpkg 2020.06.15-unknownhash -- Vercel CLI (20.0.0) +- Vercel CLI (20.1.0) - MongoDB on Linux v4.4.0 - Haveged 1.9.1-6ubuntu1 - Swig 4.0.1 -- Netlify CLI (netlify-cli/2.59.1 linux-x64 node-v12.18.3) +- Netlify CLI (netlify-cli/2.59.3 linux-x64 node-v12.18.3) - Google Repository 58 - Google Play services 49 - CMake 3.10.2.4988404 @@ -266,12 +268,12 @@ apt-get update - Android SDK Build-Tools 27.0.1 - Android SDK Build-Tools 27.0.0 - Android NDK 21.3.6528147 -- Az Module (4.6.0) +- Az Module (4.6.1) - Cached container images + - buildpack-deps:stretch (Digest: sha256:82a686ba95fdf2bf4a5f5264e8e55b8aa272ffcedaed7826777f08de0d9e1146) + - buildpack-deps:buster (Digest: sha256:0f7be4c25fadb2b8aee537cdac00a684b09057e66368683bbf22adf477e05faa) - node:10 (Digest: sha256:cf3ee6a5a1b1916c7a2e4fb51eb7ecba1afe186739677d62e9c1bb2cb1c7d6b0) - node:12 (Digest: sha256:d0738468dfc7cedb7d260369e0546fd7ee8731cfd67136f6023d070ad9679090) - - buildpack-deps:stretch (Digest: sha256:34a18637ed801407f7a17a29575e82264fb0818f9b6a0c890f8a6530afea43dc) - - buildpack-deps:buster (Digest: sha256:b9343e9ba16795186ab1f34825803f1d7e9b0943dba5d644d3c1de5473f0602e) - debian:9 (Digest: sha256:335ecf9e8d9b2206c2e9e7f8b09547faa9f868e694f7c5be14c38be15ea8a7cf) - debian:8 (Digest: sha256:8a0f2603166345b4d7bbf4842137b2ffcb492ece20d15f963f08aa26670f82c7) - node:12-alpine (Digest: sha256:9623cd396644f9b2e595d833dc0188a880333674488d939338ab5fde10ef7c43) @@ -304,10 +306,10 @@ apt-get update - node 8.17.0 - node 10.22.0 - node 12.18.3 - - node 14.8.0 + - node 14.9.0 - go: - go 1.14.7 - go 1.15.0 - AWS SAM CLI, version 1.1.0 -- Homebrew on Linux (Homebrew 2.4.13 -Homebrew/linuxbrew-core (git revision 7d5ec; last commit 2020-08-24)) +- Homebrew on Linux (Homebrew 2.4.16 +Homebrew/linuxbrew-core (git revision d0486f; last commit 2020-09-01)) From fdf40a931b7c67d27cc7710959b0f146b77ea88f Mon Sep 17 00:00:00 2001 From: Leonid Lapshin Date: Tue, 1 Sep 2020 22:05:26 +0300 Subject: [PATCH 08/50] some variable names clarifications --- .../scripts/ImageHelpers/ImageHelpers.psm1 | 2 +- .../scripts/ImageHelpers/InstallHelpers.ps1 | 21 --------- .../ImageHelpers/VisualStudioHelpers.ps1 | 43 +++++++++++++------ images/win/scripts/Installers/Install-VS.ps1 | 10 ++--- .../SoftwareReport.Generator.ps1 | 6 +-- .../SoftwareReport.VisualStudio.psm1 | 2 +- .../win/scripts/Tests/VisualStudio.Tests.ps1 | 10 ++--- images/win/toolsets/toolset-2016.json | 2 +- images/win/toolsets/toolset-2019.json | 2 +- 9 files changed, 46 insertions(+), 52 deletions(-) diff --git a/images/win/scripts/ImageHelpers/ImageHelpers.psm1 b/images/win/scripts/ImageHelpers/ImageHelpers.psm1 index 9441ac7a2..07b406621 100644 --- a/images/win/scripts/ImageHelpers/ImageHelpers.psm1 +++ b/images/win/scripts/ImageHelpers/ImageHelpers.psm1 @@ -36,6 +36,6 @@ Export-ModuleMember -Function @( 'Invoke-PesterTests' 'Get-VsCatalogJsonPath' 'Install-AndroidSDKPackages' - 'Get-VisualStudioInstallation' + 'Get-VisualStudioProduct' 'Get-VisualStudioComponents' ) diff --git a/images/win/scripts/ImageHelpers/InstallHelpers.ps1 b/images/win/scripts/ImageHelpers/InstallHelpers.ps1 index 767391780..9f1a32f6a 100644 --- a/images/win/scripts/ImageHelpers/InstallHelpers.ps1 +++ b/images/win/scripts/ImageHelpers/InstallHelpers.ps1 @@ -258,27 +258,6 @@ function Install-VsixExtension } } -function Get-VSExtensionVersion -{ - Param - ( - [Parameter(Mandatory=$true)] - [string] $packageName - ) - - $instanceFolders = "C:\ProgramData\Microsoft\VisualStudio\Packages\_Instances\" + (Get-VisualStudioInstallation -VSInstallType "VS").InstanceId - $state = Get-Content -Path (Join-Path $instanceFolders '\state.packages.json') | ConvertFrom-Json - $packageVersion = ($state.packages | Where-Object { $_.id -eq $packageName }).version - - if (-not $packageVersion) - { - Write-Host "installed package $packageName for Visual Studio 2019 was not found" - exit 1 - } - - return $packageVersion -} - function Get-ToolcachePackages { $toolcachePath = Join-Path $env:ROOT_FOLDER "toolcache.json" diff --git a/images/win/scripts/ImageHelpers/VisualStudioHelpers.ps1 b/images/win/scripts/ImageHelpers/VisualStudioHelpers.ps1 index 10e8d0cd8..8be653f42 100644 --- a/images/win/scripts/ImageHelpers/VisualStudioHelpers.ps1 +++ b/images/win/scripts/ImageHelpers/VisualStudioHelpers.ps1 @@ -61,31 +61,26 @@ Function Install-VisualStudio } function Get-VsCatalogJsonPath { - $instanceFolder = "C:\ProgramData\Microsoft\VisualStudio\Packages\_Instances\" + (Get-VisualStudioInstallation -VSInstallType "VS").InstanceId + $instanceFolder = "C:\ProgramData\Microsoft\VisualStudio\Packages\_Instances\" + (Get-VisualStudioProduct -ProductType "VisualStudio").InstanceId return Join-Path $instanceFolder "catalog.json" } -function Get-VisualStudioInstallation { +function Get-VisualStudioProduct { Param ( [Parameter(Mandatory)] - [ValidateSet('VS','BuildTools')] - [String] $VSInstallType + [ValidateSet('VisualStudio','BuildTools')] + [String] $ProductType ) - if ($VSInstallType -eq "VS") + if ($ProductType -eq "VisualStudio") { $VSSelectionType = "*Enterprise*" } - elseif ($VSInstallType -eq "BuildTools") + elseif ($ProductType -eq "BuildTools") { $VSSelectionType = "*Build*" } - else - { - Write-Output "Visual Studio Installation type have to be 'VS' or 'BuildTools'" - exit 1 - } return Get-VSSetupInstance | Select-VSSetupInstance -Product * | Where-Object -Property DisplayName -like $VSSelectionType } @@ -93,10 +88,30 @@ function Get-VisualStudioComponents { Param ( [Parameter(Mandatory)] - [ValidateSet('VS','BuildTools')] - [String] $VSInstallType + [String] $ProductType ) - (Get-VisualStudioInstallation -VSInstallType $VSInstallType).Packages | Where-Object type -in 'Component', 'Workload' | + (Get-VisualStudioProduct -ProductType $ProductType).Packages | Where-Object type -in 'Component', 'Workload' | Sort-Object Id, Version | Select-Object @{n = 'Package'; e = {$_.Id}}, Version | Where-Object { $_.Package -notmatch "[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}" } } + +function Get-VSExtensionVersion +{ + Param + ( + [Parameter(Mandatory=$true)] + [string] $packageName + ) + + $instanceFolders = "C:\ProgramData\Microsoft\VisualStudio\Packages\_Instances\" + (Get-VisualStudioProduct -ProductType "VisualStudio").InstanceId + $state = Get-Content -Path (Join-Path $instanceFolders '\state.packages.json') | ConvertFrom-Json + $packageVersion = ($state.packages | Where-Object { $_.id -eq $packageName }).version + + if (-not $packageVersion) + { + Write-Host "installed package $packageName for Visual Studio 2019 was not found" + exit 1 + } + + return $packageVersion +} diff --git a/images/win/scripts/Installers/Install-VS.ps1 b/images/win/scripts/Installers/Install-VS.ps1 index af834b621..be776dded 100644 --- a/images/win/scripts/Installers/Install-VS.ps1 +++ b/images/win/scripts/Installers/Install-VS.ps1 @@ -7,18 +7,18 @@ $ErrorActionPreference = "Stop" $toolset = Get-ToolsetContent $requiredComponents = $toolset.visualStudio.workloads | ForEach-Object { "--add $_" } -$buildRequiredComponents = $toolset.visualStudio.build_workloads | ForEach-Object { "--add $_" } +$buildToolsRequiredComponents = $toolset.visualStudio.buildtools_workloads | ForEach-Object { "--add $_" } $workLoads = @( "--allWorkloads --includeRecommended" $requiredComponents "--remove Component.CPython3.x64" ) $workLoadsArgument = [String]::Join(" ", $workLoads) -$buildWorkLoads = @( +$buildToolsWorkloads= @( "--includeRecommended" - $buildRequiredComponents + $buildToolsRequiredComponents ) -$buildWorkLoadsArgument = [String]::Join(" ", $buildWorkLoads) +$buildWorkLoadsArgument = [String]::Join(" ", $buildToolsWorkloads) $releaseInPath = $toolset.visualStudio.edition $subVersion = $toolset.visualStudio.subversion @@ -29,7 +29,7 @@ $buildbootstrapperUrl = "https://aka.ms/vs/${subVersion}/release/vs_buildtools.e Install-VisualStudio -BootstrapperUrl $bootstrapperUrl -WorkLoads $workLoadsArgument Install-VisualStudio -BootstrapperUrl $buildbootstrapperUrl -WorkLoads $buildWorkLoadsArgument -$vsInstallRoot = (Get-VisualStudioInstallation -VSInstallType "VS").InstallationPath +$vsInstallRoot = (Get-VisualStudioProduct -ProductType "VisualStudio").InstallationPath # Initialize Visual Studio Experimental Instance & "$vsInstallRoot\Common7\IDE\devenv.exe" /RootSuffix Exp /ResetSettings General.vssettings /Command File.Exit diff --git a/images/win/scripts/SoftwareReport/SoftwareReport.Generator.ps1 b/images/win/scripts/SoftwareReport/SoftwareReport.Generator.ps1 index e818a25d8..5ff886c77 100644 --- a/images/win/scripts/SoftwareReport/SoftwareReport.Generator.ps1 +++ b/images/win/scripts/SoftwareReport/SoftwareReport.Generator.ps1 @@ -171,12 +171,12 @@ $markdown += New-MDNewLine $markdown += New-MDHeader "Workloads, components and extensions:" -Level 4 $markdown += New-MDNewLine -$markdown += ((Get-VisualStudioComponents -VSInstallType "VS") + (Get-VisualStudioExtensions)) | New-MDTable +$markdown += ((Get-VisualStudioComponents -ProductType "VisualStudio") + (Get-VisualStudioExtensions)) | New-MDTable $markdown += New-MDNewLine -$markdown += New-MDHeader "Build Workloads and components:" -Level 4 +$markdown += New-MDHeader "Build Tools Workloads:" -Level 4 $markdown += New-MDNewLine -$markdown += (Get-VisualStudioComponents -VSInstallType "BuildTools") | New-MDTable +$markdown += (Get-VisualStudioComponents -ProductType "BuildTools") | New-MDTable $markdown += New-MDNewLine $markdown += New-MDHeader "Microsoft Visual C++:" -Level 4 diff --git a/images/win/scripts/SoftwareReport/SoftwareReport.VisualStudio.psm1 b/images/win/scripts/SoftwareReport/SoftwareReport.VisualStudio.psm1 index ba6907b35..9d1e3941a 100644 --- a/images/win/scripts/SoftwareReport/SoftwareReport.VisualStudio.psm1 +++ b/images/win/scripts/SoftwareReport/SoftwareReport.VisualStudio.psm1 @@ -23,7 +23,7 @@ function Get-VisualStudioExtensions { # Wix $vs = (Get-VisualStudioVersion).Name.Split()[-1] $wixPackageVersion = Get-WixVersion - $wixExtensionVersion = ((Get-VisualStudioInstallation -VSInstallType "VS").Packages | Where-Object {$_.Id -match 'WixToolset.VisualStudioExtension.Dev' -and $_.type -eq 'vsix'}).Version + $wixExtensionVersion = ((Get-VisualStudioProduct -ProductType "VisualStudio").Packages | Where-Object {$_.Id -match 'WixToolset.VisualStudioExtension.Dev' -and $_.type -eq 'vsix'}).Version # WDK $wdkPackageVersion = Get-VSExtensionVersion -packageName 'Microsoft.Windows.DriverKit' diff --git a/images/win/scripts/Tests/VisualStudio.Tests.ps1 b/images/win/scripts/Tests/VisualStudio.Tests.ps1 index 315e7e5c2..0b56165a1 100644 --- a/images/win/scripts/Tests/VisualStudio.Tests.ps1 +++ b/images/win/scripts/Tests/VisualStudio.Tests.ps1 @@ -5,7 +5,7 @@ Describe "Visual Studio" { } It "Devenv.exe" { - $vsInstallRoot = (Get-VisualStudioInstallation -VSInstallType "VS").InstallationPath + $vsInstallRoot = (Get-VisualStudioProduct -ProductType "VisualStudio").InstallationPath $devenvexePath = "${vsInstallRoot}\Common7\IDE\devenv.exe" $devenvexePath | Should -Exist } @@ -15,7 +15,7 @@ Describe "Visual Studio" { $expectedComponents = Get-ToolsetContent | Select-Object -ExpandProperty visualStudio | Select-Object -ExpandProperty workloads $testCases = $expectedComponents | ForEach-Object { @{ComponentName = $_} } BeforeAll { - $installedComponents = Get-VisualStudioComponents -VSInstallType "VS" | Select-Object -ExpandProperty Package + $installedComponents = Get-VisualStudioComponents -ProductType "VisualStudio" | Select-Object -ExpandProperty Package } It "" -TestCases $testCases { @@ -23,11 +23,11 @@ Describe "Visual Studio" { } } - Context "Visual Studio build components" { - $expectedComponents = Get-ToolsetContent | Select-Object -ExpandProperty visualStudio | Select-Object -ExpandProperty build_workloads + Context "Visual Studio Build Tools components" { + $expectedComponents = Get-ToolsetContent | Select-Object -ExpandProperty visualStudio | Select-Object -ExpandProperty buildtools_workloads $testCases = $expectedComponents | ForEach-Object { @{ComponentName = $_} } BeforeAll { - $installedComponents = Get-VisualStudioComponents -VSInstallType "Build" | Select-Object -ExpandProperty Package + $installedComponents = Get-VisualStudioComponents -ProductType "Build" | Select-Object -ExpandProperty Package } It "" -TestCases $testCases { diff --git a/images/win/toolsets/toolset-2016.json b/images/win/toolsets/toolset-2016.json index d9a5a3259..feaa8e758 100644 --- a/images/win/toolsets/toolset-2016.json +++ b/images/win/toolsets/toolset-2016.json @@ -227,7 +227,7 @@ "Microsoft.VisualStudio.Component.Workflow", "Microsoft.VisualStudio.Workload.Office" ], - "build_workloads": [ + "buildtools_workloads": [ "Microsoft.VisualStudio.Workload.WebBuildTools" ] } diff --git a/images/win/toolsets/toolset-2019.json b/images/win/toolsets/toolset-2019.json index 684579e21..4a5c0fecf 100644 --- a/images/win/toolsets/toolset-2019.json +++ b/images/win/toolsets/toolset-2019.json @@ -258,7 +258,7 @@ "Component.MDD.Linux", "Component.MDD.Linux.GCC.arm" ], - "build_workloads": [ + "buildtools_workloads": [ "Microsoft.VisualStudio.Workload.WebBuildTools" ] } From 26183d0fa773fdf6a62b834b398f2b9dda34faae Mon Sep 17 00:00:00 2001 From: Leonid Lapshin Date: Wed, 2 Sep 2020 16:43:01 +0300 Subject: [PATCH 09/50] test parameter error --- images/win/scripts/Tests/VisualStudio.Tests.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/images/win/scripts/Tests/VisualStudio.Tests.ps1 b/images/win/scripts/Tests/VisualStudio.Tests.ps1 index 0b56165a1..34c59e2d9 100644 --- a/images/win/scripts/Tests/VisualStudio.Tests.ps1 +++ b/images/win/scripts/Tests/VisualStudio.Tests.ps1 @@ -27,7 +27,7 @@ Describe "Visual Studio" { $expectedComponents = Get-ToolsetContent | Select-Object -ExpandProperty visualStudio | Select-Object -ExpandProperty buildtools_workloads $testCases = $expectedComponents | ForEach-Object { @{ComponentName = $_} } BeforeAll { - $installedComponents = Get-VisualStudioComponents -ProductType "Build" | Select-Object -ExpandProperty Package + $installedComponents = Get-VisualStudioComponents -ProductType "BuildTools" | Select-Object -ExpandProperty Package } It "" -TestCases $testCases { From e438bd43025d12230714255eb77f22fed78b770b Mon Sep 17 00:00:00 2001 From: Leonid Lapshin Date: Thu, 3 Sep 2020 10:34:05 +0300 Subject: [PATCH 10/50] style and syntax improvments --- .../win/scripts/ImageHelpers/VisualStudioHelpers.ps1 | 12 +++++++----- images/win/scripts/Tests/VisualStudio.Tests.ps1 | 6 ++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/images/win/scripts/ImageHelpers/VisualStudioHelpers.ps1 b/images/win/scripts/ImageHelpers/VisualStudioHelpers.ps1 index 8be653f42..7c1b7a1cb 100644 --- a/images/win/scripts/ImageHelpers/VisualStudioHelpers.ps1 +++ b/images/win/scripts/ImageHelpers/VisualStudioHelpers.ps1 @@ -60,9 +60,12 @@ Function Install-VisualStudio } } +function Get-VisualStudioInstancePath { + return "C:\ProgramData\Microsoft\VisualStudio\Packages\_Instances\" + (Get-VisualStudioProduct -ProductType "VisualStudio").InstanceId +} + function Get-VsCatalogJsonPath { - $instanceFolder = "C:\ProgramData\Microsoft\VisualStudio\Packages\_Instances\" + (Get-VisualStudioProduct -ProductType "VisualStudio").InstanceId - return Join-Path $instanceFolder "catalog.json" + return Join-Path (Get-VisualStudioInstancePath) "catalog.json" } function Get-VisualStudioProduct { @@ -81,7 +84,7 @@ function Get-VisualStudioProduct { { $VSSelectionType = "*Build*" } - return Get-VSSetupInstance | Select-VSSetupInstance -Product * | Where-Object -Property DisplayName -like $VSSelectionType + return Get-VSSetupInstance | Where-Object -Property DisplayName -like $VSSelectionType } function Get-VisualStudioComponents { @@ -103,8 +106,7 @@ function Get-VSExtensionVersion [string] $packageName ) - $instanceFolders = "C:\ProgramData\Microsoft\VisualStudio\Packages\_Instances\" + (Get-VisualStudioProduct -ProductType "VisualStudio").InstanceId - $state = Get-Content -Path (Join-Path $instanceFolders '\state.packages.json') | ConvertFrom-Json + $state = Get-Content -Path (Join-Path (Get-VisualStudioInstancePath) '\state.packages.json') | ConvertFrom-Json $packageVersion = ($state.packages | Where-Object { $_.id -eq $packageName }).version if (-not $packageVersion) diff --git a/images/win/scripts/Tests/VisualStudio.Tests.ps1 b/images/win/scripts/Tests/VisualStudio.Tests.ps1 index 34c59e2d9..56869cc91 100644 --- a/images/win/scripts/Tests/VisualStudio.Tests.ps1 +++ b/images/win/scripts/Tests/VisualStudio.Tests.ps1 @@ -12,8 +12,7 @@ Describe "Visual Studio" { } Context "Visual Studio components" { - $expectedComponents = Get-ToolsetContent | Select-Object -ExpandProperty visualStudio | Select-Object -ExpandProperty workloads - $testCases = $expectedComponents | ForEach-Object { @{ComponentName = $_} } + $testCases = (Get-ToolsetContent).visualStudio.workloads | ForEach-Object { @{ComponentName = $_} } BeforeAll { $installedComponents = Get-VisualStudioComponents -ProductType "VisualStudio" | Select-Object -ExpandProperty Package } @@ -24,8 +23,7 @@ Describe "Visual Studio" { } Context "Visual Studio Build Tools components" { - $expectedComponents = Get-ToolsetContent | Select-Object -ExpandProperty visualStudio | Select-Object -ExpandProperty buildtools_workloads - $testCases = $expectedComponents | ForEach-Object { @{ComponentName = $_} } + $testCases = (Get-ToolsetContent).visualStudio.buildtools_workloads | ForEach-Object { @{ComponentName = $_} } BeforeAll { $installedComponents = Get-VisualStudioComponents -ProductType "BuildTools" | Select-Object -ExpandProperty Package } From af06b80d9863def7314f6cfa2ae54633b97fc056 Mon Sep 17 00:00:00 2001 From: Aleksandr Chebotov Date: Thu, 3 Sep 2020 18:23:08 +0300 Subject: [PATCH 11/50] fix output announcements --- images/linux/scripts/installers/preparemetadata.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/images/linux/scripts/installers/preparemetadata.sh b/images/linux/scripts/installers/preparemetadata.sh index 8342cfe11..9e8aef1e1 100644 --- a/images/linux/scripts/installers/preparemetadata.sh +++ b/images/linux/scripts/installers/preparemetadata.sh @@ -9,8 +9,8 @@ source $HELPER_SCRIPTS/document.sh WriteItem "" -if [ $ANNOUNCEMENTS ]; then - WriteItem $ANNOUNCEMENTS +if [ -n "$ANNOUNCEMENTS" ]; then + WriteItem "$ANNOUNCEMENTS" WriteItem "***" fi From 9129c68e36225aa5a60a51fc231a5781f6dd3038 Mon Sep 17 00:00:00 2001 From: "Andrey Mishechkin (GITHUB INC)" Date: Fri, 4 Sep 2020 12:09:39 +0400 Subject: [PATCH 12/50] Microsoft.VisualStudio.ComponentGroup.UWP.VC has been added to toolset 2019 --- images/win/toolsets/toolset-2019.json | 1 + 1 file changed, 1 insertion(+) diff --git a/images/win/toolsets/toolset-2019.json b/images/win/toolsets/toolset-2019.json index 48af87df7..a2a7ec4a5 100644 --- a/images/win/toolsets/toolset-2019.json +++ b/images/win/toolsets/toolset-2019.json @@ -239,6 +239,7 @@ "Microsoft.VisualStudio.ComponentGroup.Azure.ResourceManager.Tools", "Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Llvm.Clang", "Microsoft.VisualStudio.ComponentGroup.Web.CloudTools", + "Microsoft.VisualStudio.ComponentGroup.UWP.VC", "Microsoft.VisualStudio.Workload.Azure", "Microsoft.VisualStudio.Workload.Data", "Microsoft.VisualStudio.Workload.DataScience", From 2e6ca0ca5607ca389569e49ebdded79fed2b8a19 Mon Sep 17 00:00:00 2001 From: Leonid Lapshin Date: Mon, 7 Sep 2020 10:27:55 +0300 Subject: [PATCH 13/50] syntax notation --- images/win/scripts/ImageHelpers/VisualStudioHelpers.ps1 | 6 +++--- .../SoftwareReport/SoftwareReport.VisualStudio.psm1 | 8 ++++---- images/win/scripts/Tests/SSDTExtensions.Tests.ps1 | 4 ++-- images/win/scripts/Tests/WDK.Tests.ps1 | 2 +- images/win/scripts/Tests/Wix.Tests.ps1 | 4 ++-- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/images/win/scripts/ImageHelpers/VisualStudioHelpers.ps1 b/images/win/scripts/ImageHelpers/VisualStudioHelpers.ps1 index 7c1b7a1cb..d9478390f 100644 --- a/images/win/scripts/ImageHelpers/VisualStudioHelpers.ps1 +++ b/images/win/scripts/ImageHelpers/VisualStudioHelpers.ps1 @@ -103,15 +103,15 @@ function Get-VSExtensionVersion Param ( [Parameter(Mandatory=$true)] - [string] $packageName + [string] $PackageName ) $state = Get-Content -Path (Join-Path (Get-VisualStudioInstancePath) '\state.packages.json') | ConvertFrom-Json - $packageVersion = ($state.packages | Where-Object { $_.id -eq $packageName }).version + $packageVersion = ($state.packages | Where-Object { $_.id -eq $PackageName }).version if (-not $packageVersion) { - Write-Host "installed package $packageName for Visual Studio 2019 was not found" + Write-Host "installed package $PackageName for Visual Studio 2019 was not found" exit 1 } diff --git a/images/win/scripts/SoftwareReport/SoftwareReport.VisualStudio.psm1 b/images/win/scripts/SoftwareReport/SoftwareReport.VisualStudio.psm1 index 9d1e3941a..9427ccc3b 100644 --- a/images/win/scripts/SoftwareReport/SoftwareReport.VisualStudio.psm1 +++ b/images/win/scripts/SoftwareReport/SoftwareReport.VisualStudio.psm1 @@ -26,15 +26,15 @@ function Get-VisualStudioExtensions { $wixExtensionVersion = ((Get-VisualStudioProduct -ProductType "VisualStudio").Packages | Where-Object {$_.Id -match 'WixToolset.VisualStudioExtension.Dev' -and $_.type -eq 'vsix'}).Version # WDK - $wdkPackageVersion = Get-VSExtensionVersion -packageName 'Microsoft.Windows.DriverKit' + $wdkPackageVersion = Get-VSExtensionVersion -PackageName 'Microsoft.Windows.DriverKit' $wdkExtensionVersion = Get-WDKVersion # SSDT - $analysisPackageVersion = Get-VSExtensionVersion -packageName '04a86fc2-dbd5-4222-848e-911638e487fe' - $reportingPackageVersion = Get-VSExtensionVersion -packageName '717ad572-c4b7-435c-c166-c2969777f718' + $analysisPackageVersion = Get-VSExtensionVersion -PackageName '04a86fc2-dbd5-4222-848e-911638e487fe' + $reportingPackageVersion = Get-VSExtensionVersion -PackageName '717ad572-c4b7-435c-c166-c2969777f718' $integrationPackageName = ($vs -match "2019") ? '851E7A09-7B2B-4F06-A15D-BABFCB26B970' : 'D1B09713-C12E-43CC-9EF4-6562298285AB' - $integrationPackageVersion = Get-VSExtensionVersion -packageName $integrationPackageName + $integrationPackageVersion = Get-VSExtensionVersion -PackageName $integrationPackageName $extensions = @( @{Package = 'SSDT Microsoft Analysis Services Projects'; Version = $analysisPackageVersion} diff --git a/images/win/scripts/Tests/SSDTExtensions.Tests.ps1 b/images/win/scripts/Tests/SSDTExtensions.Tests.ps1 index 7d1c6ee0b..5b6031de5 100644 --- a/images/win/scripts/Tests/SSDTExtensions.Tests.ps1 +++ b/images/win/scripts/Tests/SSDTExtensions.Tests.ps1 @@ -9,12 +9,12 @@ Describe "SSDTExtensions" { ) It "Extensions id=" -TestCases $testExtenions { - $version = Get-VSExtensionVersion -packageName "${id}" + $version = Get-VSExtensionVersion -PackageName "${id}" $version | Should -Not -BeNullOrEmpty } } else { It "Extension SSDT" { - $version = Get-VSExtensionVersion -packageName "SSDT" + $version = Get-VSExtensionVersion -PackageName "SSDT" $version | Should -Not -BeNullOrEmpty } } diff --git a/images/win/scripts/Tests/WDK.Tests.ps1 b/images/win/scripts/Tests/WDK.Tests.ps1 index c67586e79..0f8e76770 100644 --- a/images/win/scripts/Tests/WDK.Tests.ps1 +++ b/images/win/scripts/Tests/WDK.Tests.ps1 @@ -5,7 +5,7 @@ Describe "WDK" { } It "WDK version from system" { - $version = Get-VSExtensionVersion -packageName "Microsoft.Windows.DriverKit" + $version = Get-VSExtensionVersion -PackageName "Microsoft.Windows.DriverKit" $version | Should -Not -BeNullOrEmpty } } diff --git a/images/win/scripts/Tests/Wix.Tests.ps1 b/images/win/scripts/Tests/Wix.Tests.ps1 index 2a12261e2..bd22bef36 100644 --- a/images/win/scripts/Tests/Wix.Tests.ps1 +++ b/images/win/scripts/Tests/Wix.Tests.ps1 @@ -12,11 +12,11 @@ Describe "Wix" { It "Wix Toolset version from system" { if (Test-IsWin19) { - $exVersion = Get-VSExtensionVersion -packageName "WixToolset.VisualStudioExtension.Dev16" + $exVersion = Get-VSExtensionVersion -PackageName "WixToolset.VisualStudioExtension.Dev16" } else { - $exVersion = Get-VSExtensionVersion -packageName "WixToolset.VisualStudioExtension.Dev15" + $exVersion = Get-VSExtensionVersion -PackageName "WixToolset.VisualStudioExtension.Dev15" } $exVersion | Should -Not -BeNullOrEmpty } From 865b3bf4cd0c6d0b24dbab6afbc693a2263d2627 Mon Sep 17 00:00:00 2001 From: "no-reply@microsoft.com" Date: Tue, 8 Sep 2020 06:56:18 +0000 Subject: [PATCH 14/50] Updating readme file for macos-10.15 version 20200903.1 --- images/macos/macos-10.15-Readme.md | 64 ++++++++++++++++-------------- 1 file changed, 34 insertions(+), 30 deletions(-) diff --git a/images/macos/macos-10.15-Readme.md b/images/macos/macos-10.15-Readme.md index 2e0227806..325d4c7e7 100644 --- a/images/macos/macos-10.15-Readme.md +++ b/images/macos/macos-10.15-Readme.md @@ -1,7 +1,11 @@ -# macOS info +| Announcements | +|-| +| [Xcode 11.7 will be set as a default one on September, 9](https://github.com/actions/virtual-environments/issues/1537) | +*** +# macOS 10.15 info - System Version: macOS 10.15.6 (19G2021) - Kernel Version: Darwin 19.6.0 -- Image Version: 20200829.1 +- Image Version: 20200903.1 ## Installed Software ### Language and Runtime @@ -19,7 +23,7 @@ - .NET SDK 2.1.300 2.1.301 2.1.302 2.1.401 2.1.402 2.1.403 2.1.500 2.1.502 2.1.503 2.1.504 2.1.505 2.1.506 2.1.507 2.1.602 2.1.603 2.1.604 2.1.607 2.1.700 2.1.701 2.1.801 2.1.802 2.1.803 2.1.804 2.1.805 2.1.806 2.1.807 2.1.808 2.1.809 3.0.100 3.0.101 3.0.102 3.0.103 3.1.100 3.1.101 3.1.200 3.1.201 3.1.300 3.1.301 3.1.302 3.1.401 - R 4.0.2 - Go 1.15 -- PHP 7.4.9 +- PHP 7.4.10 - julia 1.5.1 ### Package Management @@ -27,7 +31,7 @@ - Bundler version 2.1.4 - Carthage 0.35.0 - CocoaPods 1.9.3 -- Homebrew 2.4.14 +- Homebrew 2.4.16 - NPM 6.14.6 - Yarn 1.22.5 - NuGet 5.6.0.6489 @@ -45,7 +49,7 @@ ### Utilities - Curl 7.72.0 - Git: 2.28.0 -- Git LFS: 2.11.0 +- Git LFS: 2.12.0 - GitHub CLI: 0.11.1 - Hub CLI: 2.14.2 - GNU Wget 1.20.3 @@ -54,30 +58,30 @@ - GNU parallel 20200722 - OpenSSL 1.0.2t 10 Sep 2019 `(/usr/local/opt/openssl -> /usr/local/Cellar/openssl/1.0.2t)` - jq 1.6 -- gpg (GnuPG) 2.2.21 +- gpg (GnuPG) 2.2.22 - psql (PostgreSQL) 12.4 - PostgreSQL 12.4 - aria2 1.35.0 - azcopy 10.6.0 - zstd 1.4.5 -- bazel 3.4.1 +- bazel 3.5.0 - bazelisk 1.6.1 -- helm v3.3.0+g8a4aeec +- helm v3.3.1+g249e521 - virtualbox 6.1.12r139181 - mongo v4.4.0 - mongod v4.4.0 - Vagrant 2.2.10 - 7-Zip 16.02 -- Newman 5.1.2 +- Newman 5.2.0 ### Tools -- Fastlane 2.157.2 +- Fastlane fastlane - Cmake 3.18.2 - App Center CLI 2.6.7 - Azure CLI 2.11.1 - AWS CLI 2.0.44 -- AWS SAM CLI 1.1.0 +- AWS SAM CLI 1.2.0 - AWS Session Manager CLI 1.1.61.0 - Aliyun CLI 3.0.56 - GHCup v0.1.10 @@ -94,9 +98,9 @@ - SafariDriver 13.1.2 (15609.3.5.1.3) - Google Chrome 85.0.4183.83 - ChromeDriver 85.0.4183.87 -- Microsoft Edge 85.0.564.41 -- MSEdgeDriver 85.0.564.41 -- Mozilla Firefox 80.0 +- Microsoft Edge 85.0.564.44 +- MSEdgeDriver 85.0.564.44 +- Mozilla Firefox 80.0.1 - geckodriver 0.27.0 ### Java @@ -136,8 +140,8 @@ - 1.11.13 - 1.12.17 - 1.13.15 -- 1.14.7 -- 1.15.0 +- 1.14.8 +- 1.15.1 ### Rust Tools - Rust 1.46.0 @@ -157,7 +161,7 @@ | ---------- | ------- | | Az | 4.6.1 | | MarkdownPS | 1.9 | -| Pester | 5.0.3 | +| Pester | 5.0.4 | ### Xamarin #### Visual Studio for Mac @@ -203,19 +207,19 @@ - NUnit 3.6.1 ### Xcode -| Version | Build | Path | -| -------------- | -------- | --------------------------------- | -| 12.0 (beta) | 12A8189n | /Applications/Xcode_12_beta.app | -| 11.7 (beta) | 11E801a | /Applications/Xcode_11.7_beta.app | -| 11.6 (default) | 11E708 | /Applications/Xcode_11.6.app | -| 11.5 | 11E608c | /Applications/Xcode_11.5.app | -| 11.4.1 | 11E503a | /Applications/Xcode_11.4.1.app | -| 11.4 | 11E146 | /Applications/Xcode_11.4.app | -| 11.3.1 | 11C505 | /Applications/Xcode_11.3.1.app | -| 11.2.1 | 11B500 | /Applications/Xcode_11.2.1.app | -| 11.1 | 11A1027 | /Applications/Xcode_11.1.app | -| 11.0 | 11A420a | /Applications/Xcode_11.app | -| 10.3 | 10G8 | /Applications/Xcode_10.3.app | +| Version | Build | Path | +| -------------- | -------- | ------------------------------- | +| 12.0 (beta) | 12A8189n | /Applications/Xcode_12_beta.app | +| 11.7 (default) | 11E801a | /Applications/Xcode_11.7.app | +| 11.6 | 11E708 | /Applications/Xcode_11.6.app | +| 11.5 | 11E608c | /Applications/Xcode_11.5.app | +| 11.4.1 | 11E503a | /Applications/Xcode_11.4.1.app | +| 11.4 | 11E146 | /Applications/Xcode_11.4.app | +| 11.3.1 | 11C505 | /Applications/Xcode_11.3.1.app | +| 11.2.1 | 11B500 | /Applications/Xcode_11.2.1.app | +| 11.1 | 11A1027 | /Applications/Xcode_11.1.app | +| 11.0 | 11A420a | /Applications/Xcode_11.app | +| 10.3 | 10G8 | /Applications/Xcode_10.3.app | #### Xcode Support Tools - Nomad CLI 3.1.4 From 5b40c3de56addd8f65e38244c5a950c0762fc227 Mon Sep 17 00:00:00 2001 From: Maxim Lobanov Date: Tue, 8 Sep 2020 10:21:52 +0300 Subject: [PATCH 15/50] Update macos-10.15-Readme.md --- images/macos/macos-10.15-Readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/images/macos/macos-10.15-Readme.md b/images/macos/macos-10.15-Readme.md index 325d4c7e7..3c57b80b5 100644 --- a/images/macos/macos-10.15-Readme.md +++ b/images/macos/macos-10.15-Readme.md @@ -76,7 +76,7 @@ ### Tools -- Fastlane fastlane +- Fastlane 2.157.2 - Cmake 3.18.2 - App Center CLI 2.6.7 - Azure CLI 2.11.1 From 54978f0e06d7339440d749015c2656404d53fd21 Mon Sep 17 00:00:00 2001 From: Leonid Lapshin Date: Tue, 8 Sep 2020 10:48:31 +0300 Subject: [PATCH 16/50] Add VS build tools installation for Windows (#1533) * add VS build tools installation, tests, reports, made minor changes to current VS install helper functions * Vstype typo * removed unused variable * validate set for new functions * some variable names clarifications * test parameter error * style and syntax improvments * syntax notation Co-authored-by: Leonid Lapshin --- .../scripts/ImageHelpers/ImageHelpers.psm1 | 3 +- .../scripts/ImageHelpers/InstallHelpers.ps1 | 28 --------- .../ImageHelpers/VisualStudioHelpers.ps1 | 57 ++++++++++++++++--- images/win/scripts/Installers/Install-VS.ps1 | 25 ++++---- .../SoftwareReport.Generator.ps1 | 7 ++- .../SoftwareReport.VisualStudio.psm1 | 10 ++-- .../scripts/Tests/SSDTExtensions.Tests.ps1 | 4 +- .../win/scripts/Tests/VisualStudio.Tests.ps1 | 18 ++++-- images/win/scripts/Tests/WDK.Tests.ps1 | 2 +- images/win/scripts/Tests/Wix.Tests.ps1 | 4 +- images/win/toolsets/toolset-2016.json | 3 + images/win/toolsets/toolset-2019.json | 3 + 12 files changed, 96 insertions(+), 68 deletions(-) diff --git a/images/win/scripts/ImageHelpers/ImageHelpers.psm1 b/images/win/scripts/ImageHelpers/ImageHelpers.psm1 index e150e1a12..07b406621 100644 --- a/images/win/scripts/ImageHelpers/ImageHelpers.psm1 +++ b/images/win/scripts/ImageHelpers/ImageHelpers.psm1 @@ -35,8 +35,7 @@ Export-ModuleMember -Function @( 'Get-EnvironmentVariable' 'Invoke-PesterTests' 'Get-VsCatalogJsonPath' - 'Get-VisualStudioPath' 'Install-AndroidSDKPackages' - 'Get-VisualStudioPackages' + 'Get-VisualStudioProduct' 'Get-VisualStudioComponents' ) diff --git a/images/win/scripts/ImageHelpers/InstallHelpers.ps1 b/images/win/scripts/ImageHelpers/InstallHelpers.ps1 index 282c03762..9f1a32f6a 100644 --- a/images/win/scripts/ImageHelpers/InstallHelpers.ps1 +++ b/images/win/scripts/ImageHelpers/InstallHelpers.ps1 @@ -258,34 +258,6 @@ function Install-VsixExtension } } -function Get-VSExtensionVersion -{ - Param - ( - [Parameter(Mandatory=$true)] - [string] $packageName - ) - - $instanceFolders = Get-ChildItem -Path "C:\ProgramData\Microsoft\VisualStudio\Packages\_Instances" - if ($instanceFolders -is [array]) - { - Write-Host "More than one instance installed" - exit 1 - } - - $stateContent = Get-Content -Path (Join-Path $instanceFolders.FullName '\state.packages.json') - $state = $stateContent | ConvertFrom-Json - $packageVersion = ($state.packages | Where-Object { $_.id -eq $packageName }).version - - if (-not $packageVersion) - { - Write-Host "installed package $packageName for Visual Studio 2019 was not found" - exit 1 - } - - return $packageVersion -} - function Get-ToolcachePackages { $toolcachePath = Join-Path $env:ROOT_FOLDER "toolcache.json" diff --git a/images/win/scripts/ImageHelpers/VisualStudioHelpers.ps1 b/images/win/scripts/ImageHelpers/VisualStudioHelpers.ps1 index 0fd6bc8b6..d9478390f 100644 --- a/images/win/scripts/ImageHelpers/VisualStudioHelpers.ps1 +++ b/images/win/scripts/ImageHelpers/VisualStudioHelpers.ps1 @@ -60,21 +60,60 @@ Function Install-VisualStudio } } +function Get-VisualStudioInstancePath { + return "C:\ProgramData\Microsoft\VisualStudio\Packages\_Instances\" + (Get-VisualStudioProduct -ProductType "VisualStudio").InstanceId +} + function Get-VsCatalogJsonPath { - $instanceFolder = Get-Item "C:\ProgramData\Microsoft\VisualStudio\Packages\_Instances\*" | Select-Object -First 1 - return Join-Path $instanceFolder.FullName "catalog.json" + return Join-Path (Get-VisualStudioInstancePath) "catalog.json" } -function Get-VisualStudioPath { - return (Get-VSSetupInstance | Select-VSSetupInstance -Product *).InstallationPath -} +function Get-VisualStudioProduct { + Param + ( + [Parameter(Mandatory)] + [ValidateSet('VisualStudio','BuildTools')] + [String] $ProductType + ) -function Get-VisualStudioPackages { - return (Get-VSSetupInstance | Select-VSSetupInstance -Product *).Packages + if ($ProductType -eq "VisualStudio") + { + $VSSelectionType = "*Enterprise*" + } + elseif ($ProductType -eq "BuildTools") + { + $VSSelectionType = "*Build*" + } + return Get-VSSetupInstance | Where-Object -Property DisplayName -like $VSSelectionType } function Get-VisualStudioComponents { - Get-VisualStudioPackages | Where-Object type -in 'Component', 'Workload' | + Param + ( + [Parameter(Mandatory)] + [String] $ProductType + ) + (Get-VisualStudioProduct -ProductType $ProductType).Packages | Where-Object type -in 'Component', 'Workload' | Sort-Object Id, Version | Select-Object @{n = 'Package'; e = {$_.Id}}, Version | Where-Object { $_.Package -notmatch "[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}" } -} \ No newline at end of file +} + +function Get-VSExtensionVersion +{ + Param + ( + [Parameter(Mandatory=$true)] + [string] $PackageName + ) + + $state = Get-Content -Path (Join-Path (Get-VisualStudioInstancePath) '\state.packages.json') | ConvertFrom-Json + $packageVersion = ($state.packages | Where-Object { $_.id -eq $PackageName }).version + + if (-not $packageVersion) + { + Write-Host "installed package $PackageName for Visual Studio 2019 was not found" + exit 1 + } + + return $packageVersion +} diff --git a/images/win/scripts/Installers/Install-VS.ps1 b/images/win/scripts/Installers/Install-VS.ps1 index ed4fca73f..be776dded 100644 --- a/images/win/scripts/Installers/Install-VS.ps1 +++ b/images/win/scripts/Installers/Install-VS.ps1 @@ -1,38 +1,35 @@ ################################################################################ ## File: Install-VS.ps1 -## Desc: Install Visual Studio +## Desc: Install Visual Studio and build tools ################################################################################ $ErrorActionPreference = "Stop" $toolset = Get-ToolsetContent $requiredComponents = $toolset.visualStudio.workloads | ForEach-Object { "--add $_" } +$buildToolsRequiredComponents = $toolset.visualStudio.buildtools_workloads | ForEach-Object { "--add $_" } $workLoads = @( "--allWorkloads --includeRecommended" $requiredComponents "--remove Component.CPython3.x64" ) $workLoadsArgument = [String]::Join(" ", $workLoads) +$buildToolsWorkloads= @( + "--includeRecommended" + $buildToolsRequiredComponents +) +$buildWorkLoadsArgument = [String]::Join(" ", $buildToolsWorkloads) $releaseInPath = $toolset.visualStudio.edition $subVersion = $toolset.visualStudio.subversion $bootstrapperUrl = "https://aka.ms/vs/${subVersion}/release/vs_${releaseInPath}.exe" +$buildbootstrapperUrl = "https://aka.ms/vs/${subVersion}/release/vs_buildtools.exe" -# Install VS +# Install VS and VS Build tools Install-VisualStudio -BootstrapperUrl $bootstrapperUrl -WorkLoads $workLoadsArgument +Install-VisualStudio -BootstrapperUrl $buildbootstrapperUrl -WorkLoads $buildWorkLoadsArgument -# Find the version of VS installed for this instance -# Only supports a single instance -$vsProgramData = Get-Item -Path "C:\ProgramData\Microsoft\VisualStudio\Packages\_Instances" -$instanceFolders = Get-ChildItem -Path $vsProgramData.FullName - -if ($instanceFolders -is [array]) -{ - Write-Host "More than one instance installed" - exit 1 -} - -$vsInstallRoot = Get-VisualStudioPath +$vsInstallRoot = (Get-VisualStudioProduct -ProductType "VisualStudio").InstallationPath # Initialize Visual Studio Experimental Instance & "$vsInstallRoot\Common7\IDE\devenv.exe" /RootSuffix Exp /ResetSettings General.vssettings /Command File.Exit diff --git a/images/win/scripts/SoftwareReport/SoftwareReport.Generator.ps1 b/images/win/scripts/SoftwareReport/SoftwareReport.Generator.ps1 index eb8b35f0d..5ff886c77 100644 --- a/images/win/scripts/SoftwareReport/SoftwareReport.Generator.ps1 +++ b/images/win/scripts/SoftwareReport/SoftwareReport.Generator.ps1 @@ -171,7 +171,12 @@ $markdown += New-MDNewLine $markdown += New-MDHeader "Workloads, components and extensions:" -Level 4 $markdown += New-MDNewLine -$markdown += ((Get-VisualStudioComponents) + (Get-VisualStudioExtensions)) | New-MDTable +$markdown += ((Get-VisualStudioComponents -ProductType "VisualStudio") + (Get-VisualStudioExtensions)) | New-MDTable +$markdown += New-MDNewLine + +$markdown += New-MDHeader "Build Tools Workloads:" -Level 4 +$markdown += New-MDNewLine +$markdown += (Get-VisualStudioComponents -ProductType "BuildTools") | New-MDTable $markdown += New-MDNewLine $markdown += New-MDHeader "Microsoft Visual C++:" -Level 4 diff --git a/images/win/scripts/SoftwareReport/SoftwareReport.VisualStudio.psm1 b/images/win/scripts/SoftwareReport/SoftwareReport.VisualStudio.psm1 index 0004c168b..9427ccc3b 100644 --- a/images/win/scripts/SoftwareReport/SoftwareReport.VisualStudio.psm1 +++ b/images/win/scripts/SoftwareReport/SoftwareReport.VisualStudio.psm1 @@ -23,18 +23,18 @@ function Get-VisualStudioExtensions { # Wix $vs = (Get-VisualStudioVersion).Name.Split()[-1] $wixPackageVersion = Get-WixVersion - $wixExtensionVersion = (Get-VisualStudioPackages | Where-Object {$_.Id -match 'WixToolset.VisualStudioExtension.Dev' -and $_.type -eq 'vsix'}).Version + $wixExtensionVersion = ((Get-VisualStudioProduct -ProductType "VisualStudio").Packages | Where-Object {$_.Id -match 'WixToolset.VisualStudioExtension.Dev' -and $_.type -eq 'vsix'}).Version # WDK - $wdkPackageVersion = Get-VSExtensionVersion -packageName 'Microsoft.Windows.DriverKit' + $wdkPackageVersion = Get-VSExtensionVersion -PackageName 'Microsoft.Windows.DriverKit' $wdkExtensionVersion = Get-WDKVersion # SSDT - $analysisPackageVersion = Get-VSExtensionVersion -packageName '04a86fc2-dbd5-4222-848e-911638e487fe' - $reportingPackageVersion = Get-VSExtensionVersion -packageName '717ad572-c4b7-435c-c166-c2969777f718' + $analysisPackageVersion = Get-VSExtensionVersion -PackageName '04a86fc2-dbd5-4222-848e-911638e487fe' + $reportingPackageVersion = Get-VSExtensionVersion -PackageName '717ad572-c4b7-435c-c166-c2969777f718' $integrationPackageName = ($vs -match "2019") ? '851E7A09-7B2B-4F06-A15D-BABFCB26B970' : 'D1B09713-C12E-43CC-9EF4-6562298285AB' - $integrationPackageVersion = Get-VSExtensionVersion -packageName $integrationPackageName + $integrationPackageVersion = Get-VSExtensionVersion -PackageName $integrationPackageName $extensions = @( @{Package = 'SSDT Microsoft Analysis Services Projects'; Version = $analysisPackageVersion} diff --git a/images/win/scripts/Tests/SSDTExtensions.Tests.ps1 b/images/win/scripts/Tests/SSDTExtensions.Tests.ps1 index 7d1c6ee0b..5b6031de5 100644 --- a/images/win/scripts/Tests/SSDTExtensions.Tests.ps1 +++ b/images/win/scripts/Tests/SSDTExtensions.Tests.ps1 @@ -9,12 +9,12 @@ Describe "SSDTExtensions" { ) It "Extensions id=" -TestCases $testExtenions { - $version = Get-VSExtensionVersion -packageName "${id}" + $version = Get-VSExtensionVersion -PackageName "${id}" $version | Should -Not -BeNullOrEmpty } } else { It "Extension SSDT" { - $version = Get-VSExtensionVersion -packageName "SSDT" + $version = Get-VSExtensionVersion -PackageName "SSDT" $version | Should -Not -BeNullOrEmpty } } diff --git a/images/win/scripts/Tests/VisualStudio.Tests.ps1 b/images/win/scripts/Tests/VisualStudio.Tests.ps1 index 142a9917e..56869cc91 100644 --- a/images/win/scripts/Tests/VisualStudio.Tests.ps1 +++ b/images/win/scripts/Tests/VisualStudio.Tests.ps1 @@ -5,17 +5,27 @@ Describe "Visual Studio" { } It "Devenv.exe" { - $vsInstallRoot = Get-VisualStudioPath + $vsInstallRoot = (Get-VisualStudioProduct -ProductType "VisualStudio").InstallationPath $devenvexePath = "${vsInstallRoot}\Common7\IDE\devenv.exe" $devenvexePath | Should -Exist } } Context "Visual Studio components" { - $expectedComponents = Get-ToolsetContent | Select-Object -ExpandProperty visualStudio | Select-Object -ExpandProperty workloads - $testCases = $expectedComponents | ForEach-Object { @{ComponentName = $_} } + $testCases = (Get-ToolsetContent).visualStudio.workloads | ForEach-Object { @{ComponentName = $_} } BeforeAll { - $installedComponents = Get-VisualStudioComponents | Select-Object -ExpandProperty Package + $installedComponents = Get-VisualStudioComponents -ProductType "VisualStudio" | Select-Object -ExpandProperty Package + } + + It "" -TestCases $testCases { + $installedComponents | Should -Contain $ComponentName + } + } + + Context "Visual Studio Build Tools components" { + $testCases = (Get-ToolsetContent).visualStudio.buildtools_workloads | ForEach-Object { @{ComponentName = $_} } + BeforeAll { + $installedComponents = Get-VisualStudioComponents -ProductType "BuildTools" | Select-Object -ExpandProperty Package } It "" -TestCases $testCases { diff --git a/images/win/scripts/Tests/WDK.Tests.ps1 b/images/win/scripts/Tests/WDK.Tests.ps1 index c67586e79..0f8e76770 100644 --- a/images/win/scripts/Tests/WDK.Tests.ps1 +++ b/images/win/scripts/Tests/WDK.Tests.ps1 @@ -5,7 +5,7 @@ Describe "WDK" { } It "WDK version from system" { - $version = Get-VSExtensionVersion -packageName "Microsoft.Windows.DriverKit" + $version = Get-VSExtensionVersion -PackageName "Microsoft.Windows.DriverKit" $version | Should -Not -BeNullOrEmpty } } diff --git a/images/win/scripts/Tests/Wix.Tests.ps1 b/images/win/scripts/Tests/Wix.Tests.ps1 index 2a12261e2..bd22bef36 100644 --- a/images/win/scripts/Tests/Wix.Tests.ps1 +++ b/images/win/scripts/Tests/Wix.Tests.ps1 @@ -12,11 +12,11 @@ Describe "Wix" { It "Wix Toolset version from system" { if (Test-IsWin19) { - $exVersion = Get-VSExtensionVersion -packageName "WixToolset.VisualStudioExtension.Dev16" + $exVersion = Get-VSExtensionVersion -PackageName "WixToolset.VisualStudioExtension.Dev16" } else { - $exVersion = Get-VSExtensionVersion -packageName "WixToolset.VisualStudioExtension.Dev15" + $exVersion = Get-VSExtensionVersion -PackageName "WixToolset.VisualStudioExtension.Dev15" } $exVersion | Should -Not -BeNullOrEmpty } diff --git a/images/win/toolsets/toolset-2016.json b/images/win/toolsets/toolset-2016.json index a76246e60..c292c7af9 100644 --- a/images/win/toolsets/toolset-2016.json +++ b/images/win/toolsets/toolset-2016.json @@ -227,6 +227,9 @@ "Microsoft.VisualStudio.Component.VC.Runtimes.ARM64.Spectre", "Microsoft.VisualStudio.Component.Workflow", "Microsoft.VisualStudio.Workload.Office" + ], + "buildtools_workloads": [ + "Microsoft.VisualStudio.Workload.WebBuildTools" ] } } diff --git a/images/win/toolsets/toolset-2019.json b/images/win/toolsets/toolset-2019.json index a2a7ec4a5..db7919f9a 100644 --- a/images/win/toolsets/toolset-2019.json +++ b/images/win/toolsets/toolset-2019.json @@ -259,6 +259,9 @@ "Microsoft.VisualStudio.Workload.VisualStudioExtension", "Component.MDD.Linux", "Component.MDD.Linux.GCC.arm" + ], + "buildtools_workloads": [ + "Microsoft.VisualStudio.Workload.WebBuildTools" ] } } From 2881a81b22886c8b13a8c9a982de512f82161a95 Mon Sep 17 00:00:00 2001 From: Aleksandr Chebotov Date: Tue, 8 Sep 2020 14:40:56 +0300 Subject: [PATCH 17/50] move apt pkgs to the toolset.json --- images/linux/scripts/base/apt.sh | 6 +- .../linux/scripts/helpers/containercache.sh | 34 -------- images/linux/scripts/installers/basic.sh | 87 +------------------ .../linux/scripts/installers/docker-moby.sh | 42 ++++++--- images/linux/toolsets/toolset-1604.json | 64 +++++++++++++- images/linux/toolsets/toolset-1804.json | 63 +++++++++++++- images/linux/toolsets/toolset-2004.json | 62 +++++++++++++ images/linux/ubuntu1604.json | 37 +++----- images/linux/ubuntu1804.json | 37 +++----- images/linux/ubuntu2004.json | 37 +++----- 10 files changed, 263 insertions(+), 206 deletions(-) delete mode 100644 images/linux/scripts/helpers/containercache.sh diff --git a/images/linux/scripts/base/apt.sh b/images/linux/scripts/base/apt.sh index b7ad9e7bb..8afcbe8d2 100644 --- a/images/linux/scripts/base/apt.sh +++ b/images/linux/scripts/base/apt.sh @@ -11,8 +11,10 @@ systemctl disable apt-daily-upgrade.service # Configure apt to always assume Y echo "APT::Get::Assume-Yes \"true\";" > /etc/apt/apt.conf.d/90assumeyes -# Use apt-fast for parallel downloads +# Install aria2 and jq apt-get install aria2 +apt-get install jq +# Use apt-fast for parallel downloads add-apt-repository -y ppa:apt-fast/stable apt-get update -apt-get -y install apt-fast +apt-get install apt-fast diff --git a/images/linux/scripts/helpers/containercache.sh b/images/linux/scripts/helpers/containercache.sh deleted file mode 100644 index 018bcf534..000000000 --- a/images/linux/scripts/helpers/containercache.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash -################################################################################ -## File: containercache.sh -## Desc: Prepulls Docker images used in build tasks and templates -################################################################################ - -source $HELPER_SCRIPTS/document.sh - -# Check prereqs -echo "Checking prereqs for image pulls" -if ! command -v docker; then - echo "Docker is not installed, cant pull images" - exit 1 -fi - -# Information output -systemctl status docker --no-pager - -# Pull images -images=( - docker.io/jekyll/builder - mcr.microsoft.com/azure-pipelines/node8-typescript -) - -for image in "${images[@]}"; do - docker pull "$image" -done - -## Add container information to the metadata file - DocumentInstalledItem "Cached container images" - -while read -r line; do - DocumentInstalledItemIndent "$line" -done <<< "$(docker images --digests --format '{{.Repository}}:{{.Tag}} (Digest: {{.Digest}})')" diff --git a/images/linux/scripts/installers/basic.sh b/images/linux/scripts/installers/basic.sh index 0a9e0e1b4..d216bffb3 100644 --- a/images/linux/scripts/installers/basic.sh +++ b/images/linux/scripts/installers/basic.sh @@ -4,90 +4,13 @@ ## Desc: Installs basic command line utilities and dev packages ################################################################################ +set -e # Source the helpers for use with the script source $HELPER_SCRIPTS/document.sh -source $HELPER_SCRIPTS/os.sh - -set -e - -common_packages="dnsutils - iproute2 - iputils-ping - libunwind8 - locales - openssh-client - tzdata - upx - zstd - libxkbfile-dev - pkg-config - libsecret-1-dev - libxss1 - libgconf-2-4 - dbus - xvfb - libgbm-dev - libgtk-3-0 - tk - fakeroot - dpkg - rpm - xz-utils - xorriso - zsync - gnupg2 - lib32z1 - texinfo - libsqlite3-dev - libc++-dev - libc++abi-dev" - -cmd_packages="curl - file - ftp - jq - netcat - ssh - parallel - rsync - shellcheck - sudo - telnet - time - unzip - zip - wget - m4 - bison - flex - patchelf - bzip2 - sqlite3 - brotli - yamllint" - -if isUbuntu20 ; then - echo "Install python2" - apt-get install -y --no-install-recommends python-is-python2 -fi - -echo "Install libcurl" -if isUbuntu16 || isUbuntu18; then - libcurelVer="libcurl3" -fi - -if isUbuntu20 ; then - libcurelVer="libcurl4" -fi - -apt-get install -y --no-install-recommends $libcurelVer - -# install additional packages only for Ubuntu16.04 -if isUbuntu16; then - common_packages="$common_packages - libicu55" -fi +toolsetJson="$INSTALLER_SCRIPT_FOLDER/toolset.json" +common_packages=$(jq -r ".apt.common_packages[]" $toolsetJson) +cmd_packages=$(jq -r ".apt.cmd_packages[]" $toolsetJson) for package in $common_packages $cmd_packages; do echo "Install $package" apt-get install -y --no-install-recommends $package @@ -108,5 +31,3 @@ DocumentInstalledItem "Basic packages:" for package in $common_packages $cmd_packages; do DocumentInstalledItemIndent $package done - -DocumentInstalledItemIndent "$libcurelVer" diff --git a/images/linux/scripts/installers/docker-moby.sh b/images/linux/scripts/installers/docker-moby.sh index 7ab457de8..0ce51b7ec 100644 --- a/images/linux/scripts/installers/docker-moby.sh +++ b/images/linux/scripts/installers/docker-moby.sh @@ -49,19 +49,28 @@ else set +e fi -docker pull node:10 -docker pull node:12 -docker pull buildpack-deps:stretch -docker pull buildpack-deps:buster -docker pull node:10-alpine -docker pull node:12-alpine -docker pull debian:8 -docker pull debian:9 -docker pull alpine:3.7 -docker pull alpine:3.8 -docker pull alpine:3.9 -docker pull alpine:3.10 -docker pull ubuntu:14.04 +# Pull images +images=( + node:10 + node:12 + buildpack-deps:stretch + buildpack-deps:buster + node:10-alpine + node:12-alpine + debian:8 + debian:9 + alpine:3.7 + alpine:3.8 + alpine:3.9 + alpine:3.10 + ubuntu:14.04 + docker.io/jekyll/builder + mcr.microsoft.com/azure-pipelines/node8-typescript +) + +for image in "${images[@]}"; do + docker pull "$image" +done ## Add version information to the metadata file echo "Documenting Docker version" @@ -71,3 +80,10 @@ DocumentInstalledItem "Docker-Moby ($docker_version)" echo "Documenting Docker-buildx version" DOCKER_BUILDX_VERSION=$(docker buildx version | cut -d ' ' -f2) DocumentInstalledItem "Docker-Buildx ($DOCKER_BUILDX_VERSION)" + +## Add container information to the metadata file +DocumentInstalledItem "Cached container images" + +while read -r line; do + DocumentInstalledItemIndent "$line" +done <<< "$(docker images --digests --format '{{.Repository}}:{{.Tag}} (Digest: {{.Digest}})')" \ No newline at end of file diff --git a/images/linux/toolsets/toolset-1604.json b/images/linux/toolsets/toolset-1604.json index 40ea0af4b..f03740059 100644 --- a/images/linux/toolsets/toolset-1604.json +++ b/images/linux/toolsets/toolset-1604.json @@ -108,5 +108,67 @@ "4.6.0" ] } - ] + ], + "apt": { + "common_packages": [ + "dbus", + "dnsutils", + "dpkg", + "fakeroot", + "gnupg2", + "iproute2", + "iputils-ping", + "lib32z1", + "libc++abi-dev", + "libc++-dev", + "libcurl3", + "libgbm-dev", + "libgconf-2-4", + "libgtk-3-0", + "libicu55", + "libsecret-1-dev", + "libsqlite3-dev", + "libunwind8", + "libxkbfile-dev", + "libxss1", + "locales", + "openssh-client", + "pkg-config", + "rpm", + "texinfo", + "tk", + "tzdata", + "upx", + "xorriso", + "xvfb", + "xz-utils", + "zstd", + "zsync" + ], + "cmd_packages": [ + "bison", + "brotli", + "bzip2", + "curl", + "file", + "flex", + "ftp", + "jq", + "m4", + "netcat", + "parallel", + "patchelf", + "rsync", + "shellcheck", + "sqlite3", + "ssh", + "sudo", + "telnet", + "time", + "unzip", + "wget", + "yamllint", + "zip" + ] + } } diff --git a/images/linux/toolsets/toolset-1804.json b/images/linux/toolsets/toolset-1804.json index 1bd31b15d..f1ea16b56 100644 --- a/images/linux/toolsets/toolset-1804.json +++ b/images/linux/toolsets/toolset-1804.json @@ -104,5 +104,66 @@ "4.6.0" ] } - ] + ], + "apt": { + "common_packages": [ + "dbus", + "dnsutils", + "dpkg", + "fakeroot", + "gnupg2", + "iproute2", + "iputils-ping", + "lib32z1", + "libc++abi-dev", + "libc++-dev", + "libcurl3", + "libgbm-dev", + "libgconf-2-4", + "libgtk-3-0", + "libsecret-1-dev", + "libsqlite3-dev", + "libunwind8", + "libxkbfile-dev", + "libxss1", + "locales", + "openssh-client", + "pkg-config", + "rpm", + "texinfo", + "tk", + "tzdata", + "upx", + "xorriso", + "xvfb", + "xz-utils", + "zstd", + "zsync" + ], + "cmd_packages": [ + "bison", + "brotli", + "bzip2", + "curl", + "file", + "flex", + "ftp", + "jq", + "m4", + "netcat", + "parallel", + "patchelf", + "rsync", + "shellcheck", + "sqlite3", + "ssh", + "sudo", + "telnet", + "time", + "unzip", + "wget", + "yamllint", + "zip" + ] + } } diff --git a/images/linux/toolsets/toolset-2004.json b/images/linux/toolsets/toolset-2004.json index db07186fb..b4aa7ec41 100644 --- a/images/linux/toolsets/toolset-2004.json +++ b/images/linux/toolsets/toolset-2004.json @@ -67,5 +67,67 @@ "ndk-bundle", "platform-tools" ] + }, + "apt": { + "common_packages": [ + "dbus", + "dnsutils", + "dpkg", + "fakeroot", + "gnupg2", + "iproute2", + "iputils-ping", + "lib32z1", + "libc++abi-dev", + "libc++-dev", + "libcurl4", + "libgbm-dev", + "libgconf-2-4", + "libgtk-3-0", + "libsecret-1-dev", + "libsqlite3-dev", + "libunwind8", + "libxkbfile-dev", + "libxss1", + "locales", + "openssh-client", + "pkg-config", + "python-is-python2", + "rpm", + "texinfo", + "tk", + "tzdata", + "upx", + "xorriso", + "xvfb", + "xz-utils", + "zstd", + "zsync" + ], + "cmd_packages": [ + "bison", + "brotli", + "bzip2", + "curl", + "file", + "flex", + "ftp", + "jq", + "m4", + "netcat", + "parallel", + "patchelf", + "rsync", + "shellcheck", + "sqlite3", + "ssh", + "sudo", + "telnet", + "time", + "unzip", + "wget", + "yamllint", + "zip" + ] } } diff --git a/images/linux/ubuntu1604.json b/images/linux/ubuntu1604.json index 3625b7ed2..c0d3b39d7 100644 --- a/images/linux/ubuntu1604.json +++ b/images/linux/ubuntu1604.json @@ -88,6 +88,16 @@ "source": "{{template_dir}}/scripts/installers", "destination": "{{user `installer_script_folder`}}" }, + { + "type": "file", + "source": "{{template_dir}}/toolsets/toolcache-1604.json", + "destination": "{{user `installer_script_folder`}}/toolcache.json" + }, + { + "type": "file", + "source": "{{template_dir}}/toolsets/toolset-1604.json", + "destination": "{{user `installer_script_folder`}}/toolset.json" + }, { "type": "shell", "scripts":[ @@ -198,31 +208,9 @@ "{{template_dir}}/scripts/installers/mongodb.sh", "{{template_dir}}/scripts/installers/rndgenerator.sh", "{{template_dir}}/scripts/installers/swig.sh", - "{{template_dir}}/scripts/installers/netlify.sh" - ], - "environment_vars": [ - "METADATA_FILE={{user `metadata_file`}}", - "HELPER_SCRIPTS={{user `helper_script_folder`}}", - "DEBIAN_FRONTEND=noninteractive" - ], - "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" - }, - { - "type": "file", - "source": "{{template_dir}}/toolsets/toolcache-1604.json", - "destination": "{{user `installer_script_folder`}}/toolcache.json" - }, - { - "type": "file", - "source": "{{template_dir}}/toolsets/toolset-1604.json", - "destination": "{{user `installer_script_folder`}}/toolset.json" - }, - { - "type": "shell", - "scripts":[ + "{{template_dir}}/scripts/installers/netlify.sh", "{{template_dir}}/scripts/installers/android.sh", "{{template_dir}}/scripts/installers/azpowershell.sh", - "{{template_dir}}/scripts/helpers/containercache.sh", "{{template_dir}}/scripts/installers/hosted-tool-cache.sh", "{{template_dir}}/scripts/installers/pypy.sh", "{{template_dir}}/scripts/installers/python.sh", @@ -232,7 +220,8 @@ "METADATA_FILE={{user `metadata_file`}}", "HELPER_SCRIPTS={{user `helper_script_folder`}}", "INSTALLER_SCRIPT_FOLDER={{user `installer_script_folder`}}", - "GITHUB_FEED_TOKEN={{user `github_feed_token`}}" + "GITHUB_FEED_TOKEN={{user `github_feed_token`}}", + "DEBIAN_FRONTEND=noninteractive" ], "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" }, diff --git a/images/linux/ubuntu1804.json b/images/linux/ubuntu1804.json index b5037520d..95de0713d 100644 --- a/images/linux/ubuntu1804.json +++ b/images/linux/ubuntu1804.json @@ -91,6 +91,16 @@ "source": "{{template_dir}}/scripts/installers", "destination": "{{user `installer_script_folder`}}" }, + { + "type": "file", + "source": "{{template_dir}}/toolsets/toolcache-1804.json", + "destination": "{{user `installer_script_folder`}}/toolcache.json" + }, + { + "type": "file", + "source": "{{template_dir}}/toolsets/toolset-1804.json", + "destination": "{{user `installer_script_folder`}}/toolset.json" + }, { "type": "shell", "scripts":[ @@ -202,31 +212,9 @@ "{{template_dir}}/scripts/installers/mongodb.sh", "{{template_dir}}/scripts/installers/rndgenerator.sh", "{{template_dir}}/scripts/installers/swig.sh", - "{{template_dir}}/scripts/installers/netlify.sh" - ], - "environment_vars": [ - "METADATA_FILE={{user `metadata_file`}}", - "HELPER_SCRIPTS={{user `helper_script_folder`}}", - "DEBIAN_FRONTEND=noninteractive" - ], - "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" - }, - { - "type": "file", - "source": "{{template_dir}}/toolsets/toolcache-1804.json", - "destination": "{{user `installer_script_folder`}}/toolcache.json" - }, - { - "type": "file", - "source": "{{template_dir}}/toolsets/toolset-1804.json", - "destination": "{{user `installer_script_folder`}}/toolset.json" - }, - { - "type": "shell", - "scripts":[ + "{{template_dir}}/scripts/installers/netlify.sh", "{{template_dir}}/scripts/installers/android.sh", "{{template_dir}}/scripts/installers/azpowershell.sh", - "{{template_dir}}/scripts/helpers/containercache.sh", "{{template_dir}}/scripts/installers/hosted-tool-cache.sh", "{{template_dir}}/scripts/installers/pypy.sh", "{{template_dir}}/scripts/installers/python.sh", @@ -236,7 +224,8 @@ "METADATA_FILE={{user `metadata_file`}}", "HELPER_SCRIPTS={{user `helper_script_folder`}}", "INSTALLER_SCRIPT_FOLDER={{user `installer_script_folder`}}", - "GITHUB_FEED_TOKEN={{user `github_feed_token`}}" + "GITHUB_FEED_TOKEN={{user `github_feed_token`}}", + "DEBIAN_FRONTEND=noninteractive" ], "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" }, diff --git a/images/linux/ubuntu2004.json b/images/linux/ubuntu2004.json index 48d309b1e..8e2b69e49 100644 --- a/images/linux/ubuntu2004.json +++ b/images/linux/ubuntu2004.json @@ -93,6 +93,16 @@ "source": "{{template_dir}}/scripts/installers", "destination": "{{user `installer_script_folder`}}" }, + { + "type": "file", + "source": "{{template_dir}}/toolsets/toolcache-2004.json", + "destination": "{{user `installer_script_folder`}}/toolcache.json" + }, + { + "type": "file", + "source": "{{template_dir}}/toolsets/toolset-2004.json", + "destination": "{{user `installer_script_folder`}}/toolset.json" + }, { "type": "shell", "scripts":[ @@ -204,31 +214,9 @@ "{{template_dir}}/scripts/installers/mongodb.sh", "{{template_dir}}/scripts/installers/rndgenerator.sh", "{{template_dir}}/scripts/installers/swig.sh", - "{{template_dir}}/scripts/installers/netlify.sh" - ], - "environment_vars": [ - "METADATA_FILE={{user `metadata_file`}}", - "HELPER_SCRIPTS={{user `helper_script_folder`}}", - "DEBIAN_FRONTEND=noninteractive" - ], - "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" - }, - { - "type": "file", - "source": "{{template_dir}}/toolsets/toolcache-2004.json", - "destination": "{{user `installer_script_folder`}}/toolcache.json" - }, - { - "type": "file", - "source": "{{template_dir}}/toolsets/toolset-2004.json", - "destination": "{{user `installer_script_folder`}}/toolset.json" - }, - { - "type": "shell", - "scripts":[ + "{{template_dir}}/scripts/installers/netlify.sh", "{{template_dir}}/scripts/installers/android.sh", "{{template_dir}}/scripts/installers/azpowershell.sh", - "{{template_dir}}/scripts/helpers/containercache.sh", "{{template_dir}}/scripts/installers/hosted-tool-cache.sh", "{{template_dir}}/scripts/installers/pypy.sh", "{{template_dir}}/scripts/installers/python.sh", @@ -238,7 +226,8 @@ "METADATA_FILE={{user `metadata_file`}}", "HELPER_SCRIPTS={{user `helper_script_folder`}}", "INSTALLER_SCRIPT_FOLDER={{user `installer_script_folder`}}", - "GITHUB_FEED_TOKEN={{user `github_feed_token`}}" + "GITHUB_FEED_TOKEN={{user `github_feed_token`}}", + "DEBIAN_FRONTEND=noninteractive" ], "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" }, From b8d3652352384ed633a00f8dc43611ed7aa80582 Mon Sep 17 00:00:00 2001 From: Aleksandr Chebotov Date: Tue, 8 Sep 2020 19:09:31 +0300 Subject: [PATCH 18/50] rename toolsetJson -> toolset --- images/linux/scripts/installers/android.sh | 12 ++++++------ images/linux/scripts/installers/azpowershell.sh | 4 ++-- images/linux/scripts/installers/basic.sh | 6 +++--- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/images/linux/scripts/installers/android.sh b/images/linux/scripts/installers/android.sh index 73611e665..ed06f51ac 100644 --- a/images/linux/scripts/installers/android.sh +++ b/images/linux/scripts/installers/android.sh @@ -42,12 +42,12 @@ else exit 1 fi -toolsetJson="$INSTALLER_SCRIPT_FOLDER/toolset.json" -platforms=$(cat $toolsetJson | jq -r '.android.platform_list[]|"platforms;" + .') -buildtools=$(cat $toolsetJson | jq -r '.android.build_tools[]|"build-tools;" + .') -extras=$(cat $toolsetJson | jq -r '.android.extra_list[]|"extras;" + .') -addons=$(cat $toolsetJson | jq -r '.android.addon_list[]|"add-ons;" + .') -additional=$(cat $toolsetJson | jq -r '.android.additional_tools[]') +toolset="$INSTALLER_SCRIPT_FOLDER/toolset.json" +platforms=$(jq -r '.android.platform_list[]|"platforms;" + .' $toolset) +buildtools=$(jq -r '.android.build_tools[]|"build-tools;" + .' $toolset) +extras=$(jq -r '.android.extra_list[]|"extras;" + .' $toolset) +addons=$(jq -r '.android.addon_list[]|"add-ons;" + .' $toolset) +additional=$(jq -r '.android.additional_tools[]' $toolset) # Install the following SDKs and build tools, passing in "y" to accept licenses. echo "y" | ${ANDROID_SDK_ROOT}/tools/bin/sdkmanager $platforms $buildtools $extras $google_api_list $addons $additional diff --git a/images/linux/scripts/installers/azpowershell.sh b/images/linux/scripts/installers/azpowershell.sh index 082ab185d..2b7d703df 100644 --- a/images/linux/scripts/installers/azpowershell.sh +++ b/images/linux/scripts/installers/azpowershell.sh @@ -12,8 +12,8 @@ source $HELPER_SCRIPTS/os.sh if isUbuntu20 ; then versions=$(pwsh -Command '(Find-Module -Name Az).Version') else - toolsetJson="$INSTALLER_SCRIPT_FOLDER/toolset.json" - versions=$(cat $toolsetJson | jq -r '.azureModules[] | select(.name | contains("az")) | .versions[]') + toolset="$INSTALLER_SCRIPT_FOLDER/toolset.json" + versions=$(jq -r '.azureModules[] | select(.name | contains("az")) | .versions[]' $toolset) fi # Install Azure CLI (instructions taken from https://docs.microsoft.com/en-us/cli/azure/install-azure-cli) diff --git a/images/linux/scripts/installers/basic.sh b/images/linux/scripts/installers/basic.sh index d216bffb3..0772cf4ed 100644 --- a/images/linux/scripts/installers/basic.sh +++ b/images/linux/scripts/installers/basic.sh @@ -8,9 +8,9 @@ set -e # Source the helpers for use with the script source $HELPER_SCRIPTS/document.sh -toolsetJson="$INSTALLER_SCRIPT_FOLDER/toolset.json" -common_packages=$(jq -r ".apt.common_packages[]" $toolsetJson) -cmd_packages=$(jq -r ".apt.cmd_packages[]" $toolsetJson) +toolset="$INSTALLER_SCRIPT_FOLDER/toolset.json" +common_packages=$(jq -r ".apt.common_packages[]" $toolset) +cmd_packages=$(jq -r ".apt.cmd_packages[]" $toolset) for package in $common_packages $cmd_packages; do echo "Install $package" apt-get install -y --no-install-recommends $package From 2f46bd5c7c9e4d04ba58932d20efd13e3fd3292c Mon Sep 17 00:00:00 2001 From: Aleksandr Chebotov Date: Tue, 8 Sep 2020 19:20:07 +0300 Subject: [PATCH 19/50] rename toolsetJson -> toolset --- images/linux/scripts/installers/Install-Toolset.ps1 | 4 ++-- images/linux/scripts/installers/Validate-Toolset.ps1 | 4 ++-- images/linux/scripts/installers/pypy.sh | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/images/linux/scripts/installers/Install-Toolset.ps1 b/images/linux/scripts/installers/Install-Toolset.ps1 index e95645e53..1d261ff3f 100644 --- a/images/linux/scripts/installers/Install-Toolset.ps1 +++ b/images/linux/scripts/installers/Install-Toolset.ps1 @@ -27,10 +27,10 @@ Function Install-Asset { $ErrorActionPreference = "Stop" # Get toolset content -$toolsetJson = Get-Content -Path "$env:INSTALLER_SCRIPT_FOLDER/toolset.json" -Raw +$toolset = Get-Content -Path "$env:INSTALLER_SCRIPT_FOLDER/toolset.json" -Raw $toolsToInstall = @("Python", "Node", "Boost", "Go") -$tools = ConvertFrom-Json -InputObject $toolsetJson | Select-Object -ExpandProperty toolcache | Where-Object {$ToolsToInstall -contains $_.Name} +$tools = ConvertFrom-Json -InputObject $toolset | Select-Object -ExpandProperty toolcache | Where-Object {$ToolsToInstall -contains $_.Name} foreach ($tool in $tools) { # Get versions manifest for current tool diff --git a/images/linux/scripts/installers/Validate-Toolset.ps1 b/images/linux/scripts/installers/Validate-Toolset.ps1 index 5d20dfcaf..b5eb9a0a5 100644 --- a/images/linux/scripts/installers/Validate-Toolset.ps1 +++ b/images/linux/scripts/installers/Validate-Toolset.ps1 @@ -46,8 +46,8 @@ $toolsExecutables = @{ } # Get toolset content -$toolsetJson = Get-Content -Path "$env:INSTALLER_SCRIPT_FOLDER/toolset.json" -Raw -$tools = ConvertFrom-Json -InputObject $toolsetJson | Select-Object -ExpandProperty toolcache +$toolset = Get-Content -Path "$env:INSTALLER_SCRIPT_FOLDER/toolset.json" -Raw +$tools = ConvertFrom-Json -InputObject $toolset | Select-Object -ExpandProperty toolcache foreach($tool in $tools) { Invoke-Expression "bash -c `"source $env:HELPER_SCRIPTS/document.sh; DocumentInstalledItem '$($tool.name):'`"" diff --git a/images/linux/scripts/installers/pypy.sh b/images/linux/scripts/installers/pypy.sh index e47235af7..b859eb4e1 100644 --- a/images/linux/scripts/installers/pypy.sh +++ b/images/linux/scripts/installers/pypy.sh @@ -75,8 +75,8 @@ uri="https://downloads.python.org/pypy/" download_with_retries $uri "/tmp" "pypyUrls.html" compressed pypyVersions="$(cat /tmp/pypyUrls.html | grep 'linux64' | awk -v uri="$uri" -F'>|<' '{print uri$5}')" -toolsetJson="$INSTALLER_SCRIPT_FOLDER/toolset.json" -toolsetVersions=$(cat $toolsetJson | jq -r '.toolcache[] | select(.name | contains("PyPy")) | .versions[]') +toolset="$INSTALLER_SCRIPT_FOLDER/toolset.json" +toolsetVersions=$(jq -r '.toolcache[] | select(.name | contains("PyPy")) | .versions[]' $toolset) # Fail out if any setups fail set -e From 9e6468a11c8f8a9905119902454b0a482db2c6bb Mon Sep 17 00:00:00 2001 From: Mikhail Timofeev Date: Tue, 8 Sep 2020 23:56:33 +0300 Subject: [PATCH 20/50] test --- images/linux/ubuntu2004.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/images/linux/ubuntu2004.json b/images/linux/ubuntu2004.json index 48d309b1e..131bd1f04 100644 --- a/images/linux/ubuntu2004.json +++ b/images/linux/ubuntu2004.json @@ -95,6 +95,7 @@ }, { "type": "shell", + "execute_command": "chmod +x {{ .Path }}; sudo {{ .Vars }} {{ .Path }}", "scripts":[ "{{template_dir}}/scripts/installers/preparemetadata.sh" ], @@ -103,8 +104,7 @@ "METADATA_FILE={{user `metadata_file`}}", "HELPER_SCRIPTS={{user `helper_script_folder`}}", "ANNOUNCEMENTS={{user `announcements`}}" - ], - "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" + ] }, { "type": "shell", From 2be09abc6d4970d361a1feb83e2a5e4b02e82ab3 Mon Sep 17 00:00:00 2001 From: Image generation service account Date: Wed, 9 Sep 2020 07:59:49 +0000 Subject: [PATCH 21/50] Updating readme file for ubuntu18 version 20200908.1 --- images/linux/Ubuntu1804-README.md | 66 +++++++++++++++++-------------- 1 file changed, 36 insertions(+), 30 deletions(-) diff --git a/images/linux/Ubuntu1804-README.md b/images/linux/Ubuntu1804-README.md index 11cc81e81..36e89d0b1 100644 --- a/images/linux/Ubuntu1804-README.md +++ b/images/linux/Ubuntu1804-README.md @@ -1,9 +1,9 @@ # Ubuntu 18.04.5 LTS -The following software is installed on machines with the 20200901.1 update. +The following software is installed on machines with the 20200908.1 update. *** - 7-Zip 16.02 -- Ansible (ansible 2.9.12) +- Ansible (ansible 2.9.13) - AzCopy7 (available by azcopy alias) 7.3.0 - AzCopy10 (available by azcopy10 alias) 10.6.0 - Azure CLI (azure-cli 2.11.1) @@ -65,7 +65,7 @@ The following software is installed on machines with the 20200901.1 update. - yamllint - libcurl3 - Alibaba Cloud CLI (3.0.56) -- AWS CLI (aws-cli/1.18.129 Python/2.7.17 Linux/5.3.0-1035-azure botocore/1.17.52) +- AWS CLI (aws-cli/1.18.134 Python/2.7.17 Linux/5.4.0-1025-azure botocore/1.17.57) - AWS CLI Session manager plugin (1.1.61.0) - build-essential - Clang 6.0 (6.0.0) @@ -74,13 +74,14 @@ The following software is installed on machines with the 20200901.1 update. - Swift version 5.2.5 (swift-5.2.5-RELEASE) Target: x86_64-unknown-linux-gnu - CMake (cmake version 3.17.0) -- Podman (2.0.5) -- Buildah (1.15.1) +- Podman (2.0.6) +- Buildah (1.15.2) - Skopeo (1.1.1) -- Docker Compose (docker-compose version 1.26.2, build eefe0d31) +- Docker Compose (docker-compose version 1.27.0, build 980ec85b) - Docker-Moby (Docker version 19.03.12+azure, build 0ed913b885c8919944a2e4c8d0b80a318a8dd48b) - Docker-Buildx (0.4.2+azure) - .NET Core SDK: + - 3.1.402 - 3.1.401 - 3.1.302 - 3.1.301 @@ -88,6 +89,7 @@ Target: x86_64-unknown-linux-gnu - 3.1.202 - 3.1.201 - 3.1.200 + - 3.1.108 - 3.1.107 - 3.1.106 - 3.1.105 @@ -100,6 +102,7 @@ Target: x86_64-unknown-linux-gnu - 3.0.102 - 3.0.101 - 3.0.100 + - 2.1.810 - 2.1.809 - 2.1.808 - 2.1.807 @@ -111,6 +114,7 @@ Target: x86_64-unknown-linux-gnu - 2.1.801 - 2.1.701 - 2.1.700 + - 2.1.615 - 2.1.614 - 2.1.613 - 2.1.612 @@ -124,6 +128,7 @@ Target: x86_64-unknown-linux-gnu - 2.1.604 - 2.1.603 - 2.1.602 + - 2.1.518 - 2.1.517 - 2.1.516 - 2.1.515 @@ -148,7 +153,7 @@ Target: x86_64-unknown-linux-gnu - 2.1.301 - 2.1.300 - Erlang (Erlang (SMP,ASYNC_THREADS,HIPE) (BEAM) emulator version 11.0.3) -- Firefox (Mozilla Firefox 80.0) +- Firefox (Mozilla Firefox 80.0.1) - Geckodriver (0.27.0); Gecko Driver is available via GECKOWEBDRIVER environment variable - GNU C++ 7.5.0 - GNU C++ 8.4.0 @@ -156,19 +161,19 @@ Target: x86_64-unknown-linux-gnu - GNU Fortran 8.4.0 - GNU Fortran 9.3.0 - Git (2.28.0) -- Git Large File Storage (LFS) (2.11.0) +- Git Large File Storage (LFS) (2.12.0) - Git-ftp (1.3.1) - Hub CLI (2.14.2) -- GitHub CLI 0.11.1 -- Google Chrome (Google Chrome 85.0.4183.83 ) +- GitHub CLI 0.12.0 +- Google Chrome (Google Chrome 85.0.4183.102 ) - ChromeDriver 85.0.4183.87 (cd6713ebf92fa1cacc0f1a598df280093af0c5d7-refs/branch-heads/4183@{#1689}); Chrome Driver is available via CHROMEWEBDRIVER environment variable -- Google Cloud SDK (307.0.0) -- Haskell Cabal (cabal-install version 3.2.0.0 -compiled using version 3.2.0.0 of the Cabal library ) +- Google Cloud SDK (308.0.0) +- Haskell Cabal (cabal-install version 3.4.0.0 +compiled using version 3.4.0.0 of the Cabal library ) - GHC (The Glorious Glasgow Haskell Compilation System, version 8.10.2) - Haskell Stack (Version 2.3.3, Git revision cb44d51bed48b723a5deb08c3348c0b3ccfc437e x86_64 hpack-0.33.0) - Heroku (heroku/7.42.13 linux-x64 node-v12.16.2) -- HHVM (HipHop VM 4.72.0 (rel)) +- HHVM (HipHop VM 4.74.0 (rel)) - ImageMagick - Azul Zulu OpenJDK: - 7 (openjdk version "1.7.0_272") @@ -182,13 +187,13 @@ compiled using version 3.2.0.0 of the Cabal library ) - Kind (kind v0.8.1 go1.14.2 linux/amd64) - kubectl (Client Version: v1.19.0) - helm (v3.3.1+g249e521) -- minikube version: v1.12.3 +- minikube version: v1.13.0 - kustomize ({kustomize/v3.8.2 2020-08-29T17:44:01Z }) - oc CLI Client Version: 4.5.0-202005291417-9933eb9 - Leiningen (Leiningen 2.9.4 on Java 1.8.0_265 OpenJDK 64-Bit Server VM) - Mercurial (Mercurial Distributed SCM (version 4.5.3)) - Miniconda (conda 4.8.3) -- Mono (Mono JIT compiler version 6.10.0.104 (tarball Fri Jun 26 19:38:24 UTC 2020)) +- Mono (Mono JIT compiler version 6.12.0.90 (tarball Fri Sep 4 14:01:23 UTC 2020)) - NuGet (NuGet Version: 5.5.0.6382) - MySQL (mysql Ver 14.14 Distrib 5.7.31, for Linux (x86_64) using EditLine wrapper) - MySQL Server (user:root password:root) @@ -205,8 +210,8 @@ Local version: Unknown) - Webpack (4.44.1) - Webpack CLI (3.3.12) - Yarn (1.22.5) -- Newman (5.1.2) -- Bazel (bazel 3.4.1) +- Newman (5.2.0) +- Bazel (bazel 3.5.0) - Bazelisk (1.6.1) - ORAS CLI 0.8.1 - PhantomJS (2.1.1) @@ -214,7 +219,7 @@ Local version: Unknown) - PHP 7.2 (PHP 7.2.33-1+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Aug 7 2020 14:44:29) ( NTS )) - PHP 7.3 (PHP 7.3.21-1+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Aug 7 2020 14:44:10) ( NTS )) - PHP 7.4 (PHP 7.4.9 (cli) (built: Aug 7 2020 14:29:36) ( NTS )) -- Composer (Composer version 1.10.10 2020-08-03 11:35:19) +- Composer (Composer version 1.10.12 2020-09-08 22:58:51) - PHPUnit (PHPUnit 7.5.20 by Sebastian Bergmann and contributors.) - Pollinate - psql (PostgreSQL) 12.4 @@ -240,14 +245,14 @@ Local version: Unknown) - Selenium server standalone (available via SELENIUM_JAR_PATH environment variable) - Sphinx Open Source Search Server - Subversion (svn, version 1.9.7 (r1800392)) -- Terraform (Terraform v0.13.1) +- Terraform (Terraform v0.13.2) - Packer (1.6.2) - Vcpkg 2020.06.15-unknownhash - Vercel CLI (20.1.0) - MongoDB on Linux v4.4.0 - Haveged 1.9.1-6 - Swig 3.0.12 -- Netlify CLI (netlify-cli/2.59.3 linux-x64 node-v12.18.3) +- Netlify CLI (netlify-cli/2.61.2 linux-x64 node-v12.18.3) - Google Repository 58 - Google Play services 49 - Google APIs 24 @@ -315,16 +320,17 @@ Local version: Unknown) - Az Module (3.8.0) - Az Module (4.3.0) - Az Module (4.4.0) +- Az Module (4.6.0) - Cached container images + - jekyll/builder:latest (Digest: sha256:4bc6a3b6eddebef1652ef38ceb965fc9c1b06677f65f764e1e17b88dc2aa9934) + - node:10 (Digest: sha256:304c59f827930ae1a4a9775aec5837c8f95c3d41b5e6d7c0a329b4eb8c4cc8a8) + - node:12 (Digest: sha256:099346a8e9c861b406c9bbb1f109125c7263868e5447cc57d6d564e1fec8a5cf) - buildpack-deps:stretch (Digest: sha256:82a686ba95fdf2bf4a5f5264e8e55b8aa272ffcedaed7826777f08de0d9e1146) - buildpack-deps:buster (Digest: sha256:0f7be4c25fadb2b8aee537cdac00a684b09057e66368683bbf22adf477e05faa) - - node:10 (Digest: sha256:cf3ee6a5a1b1916c7a2e4fb51eb7ecba1afe186739677d62e9c1bb2cb1c7d6b0) - - node:12 (Digest: sha256:d0738468dfc7cedb7d260369e0546fd7ee8731cfd67136f6023d070ad9679090) - debian:9 (Digest: sha256:335ecf9e8d9b2206c2e9e7f8b09547faa9f868e694f7c5be14c38be15ea8a7cf) - debian:8 (Digest: sha256:8a0f2603166345b4d7bbf4842137b2ffcb492ece20d15f963f08aa26670f82c7) - node:12-alpine (Digest: sha256:9623cd396644f9b2e595d833dc0188a880333674488d939338ab5fde10ef7c43) - node:10-alpine (Digest: sha256:2f202af4d6baba655fef9c93f41a914b33ee576b9f55a6e69ba23b49e3b62766) - - jekyll/builder:latest (Digest: sha256:98cda359955f25f18c4bcc78536cdfd30e7ded689b1f52fcd513c75cbe4e751e) - alpine:3.9 (Digest: sha256:414e0518bb9228d35e4cd5165567fb91d26c6a214e9c95899e1e056fcd349011) - alpine:3.10 (Digest: sha256:f0e9534a598e501320957059cb2a23774b4d4072e37c7b2cf7e95b241f019e35) - alpine:3.8 (Digest: sha256:2bb501e6173d9d006e56de5bce2720eb06396803300fe1687b58a7ff32bf4c14) @@ -342,7 +348,7 @@ Local version: Unknown) - pip3 (pip 9.0.1 from /usr/lib/python3/dist-packages (python 3.6)) - Python: - Python 2.7.18 - - Python 3.5.9 + - Python 3.5.10 - Python 3.6.12 - Python 3.7.9 - Python 3.8.5 @@ -358,11 +364,11 @@ Local version: Unknown) - go 1.11.13 - go 1.12.17 - go 1.13.15 - - go 1.14.7 - - go 1.15.0 + - go 1.14.8 + - go 1.15.1 - boost: - boost 1.69.0 - boost 1.72.0 -- AWS SAM CLI, version 1.1.0 -- Homebrew on Linux (Homebrew 2.4.16 -Homebrew/linuxbrew-core (git revision d0486f; last commit 2020-09-01)) +- AWS SAM CLI, version 1.2.0 +- Homebrew on Linux (Homebrew 2.5.0 +Homebrew/linuxbrew-core (git revision 3199c; last commit 2020-09-08)) From cca88753351ba1bafaeed99d91eb5e7f352837a6 Mon Sep 17 00:00:00 2001 From: Image generation service account Date: Wed, 9 Sep 2020 08:16:27 +0000 Subject: [PATCH 22/50] Updating readme file for ubuntu16 version 20200908.1 --- images/linux/Ubuntu1604-README.md | 60 +++++++++++++++++-------------- 1 file changed, 33 insertions(+), 27 deletions(-) diff --git a/images/linux/Ubuntu1604-README.md b/images/linux/Ubuntu1604-README.md index aaf93b3d6..a3bc4bd9b 100644 --- a/images/linux/Ubuntu1604-README.md +++ b/images/linux/Ubuntu1604-README.md @@ -1,9 +1,9 @@ # Ubuntu 16.04.7 LTS -The following software is installed on machines with the 20200901.1 update. +The following software is installed on machines with the 20200908.1 update. *** - 7-Zip 9.20 -- Ansible (ansible 2.9.12) +- Ansible (ansible 2.9.13) - AzCopy7 (available by azcopy alias) 7.3.0 - AzCopy10 (available by azcopy10 alias) 10.6.0 - Azure CLI (azure-cli 2.11.1) @@ -66,7 +66,7 @@ The following software is installed on machines with the 20200901.1 update. - yamllint - libcurl3 - Alibaba Cloud CLI (3.0.56) -- AWS CLI (aws-cli/1.18.129 Python/2.7.12 Linux/4.15.0-1092-azure botocore/1.17.52) +- AWS CLI (aws-cli/1.18.134 Python/2.7.12 Linux/4.15.0-1093-azure botocore/1.17.57) - AWS CLI Session manager plugin (1.1.61.0) - build-essential - nvm (0.35.3) @@ -76,10 +76,11 @@ The following software is installed on machines with the 20200901.1 update. - Swift version 5.2.5 (swift-5.2.5-RELEASE) Target: x86_64-unknown-linux-gnu - CMake (cmake version 3.17.0) -- Docker Compose (docker-compose version 1.26.2, build eefe0d31) +- Docker Compose (docker-compose version 1.27.0, build 980ec85b) - Docker-Moby (Docker version 19.03.12+azure, build 0ed913b885c8919944a2e4c8d0b80a318a8dd48b) - Docker-Buildx (0.4.2+azure) - .NET Core SDK: + - 3.1.402 - 3.1.401 - 3.1.302 - 3.1.301 @@ -87,6 +88,7 @@ Target: x86_64-unknown-linux-gnu - 3.1.202 - 3.1.201 - 3.1.200 + - 3.1.108 - 3.1.107 - 3.1.106 - 3.1.105 @@ -99,6 +101,7 @@ Target: x86_64-unknown-linux-gnu - 3.0.102 - 3.0.101 - 3.0.100 + - 2.1.810 - 2.1.809 - 2.1.808 - 2.1.807 @@ -110,6 +113,7 @@ Target: x86_64-unknown-linux-gnu - 2.1.801 - 2.1.701 - 2.1.700 + - 2.1.615 - 2.1.614 - 2.1.613 - 2.1.612 @@ -123,6 +127,7 @@ Target: x86_64-unknown-linux-gnu - 2.1.604 - 2.1.603 - 2.1.602 + - 2.1.518 - 2.1.517 - 2.1.516 - 2.1.515 @@ -147,7 +152,7 @@ Target: x86_64-unknown-linux-gnu - 2.1.301 - 2.1.300 - Erlang (Erlang (SMP,ASYNC_THREADS,HIPE) (BEAM) emulator version 11.0.3) -- Firefox (Mozilla Firefox 80.0) +- Firefox (Mozilla Firefox 80.0.1) - Geckodriver (0.27.0); Gecko Driver is available via GECKOWEBDRIVER environment variable - GNU C++ 7.5.0 - GNU C++ 8.4.0 @@ -155,15 +160,15 @@ Target: x86_64-unknown-linux-gnu - GNU Fortran 8.4.0 - GNU Fortran 9.3.0 - Git (2.28.0) -- Git Large File Storage (LFS) (2.11.0) +- Git Large File Storage (LFS) (2.12.0) - Git-ftp (1.0.2) - Hub CLI (2.14.2) -- GitHub CLI 0.11.1 -- Google Chrome (Google Chrome 85.0.4183.83 ) +- GitHub CLI 0.12.0 +- Google Chrome (Google Chrome 85.0.4183.102 ) - ChromeDriver 85.0.4183.87 (cd6713ebf92fa1cacc0f1a598df280093af0c5d7-refs/branch-heads/4183@{#1689}); Chrome Driver is available via CHROMEWEBDRIVER environment variable -- Google Cloud SDK (307.0.0) -- Haskell Cabal (cabal-install version 3.2.0.0 -compiled using version 3.2.0.0 of the Cabal library ) +- Google Cloud SDK (308.0.0) +- Haskell Cabal (cabal-install version 3.4.0.0 +compiled using version 3.4.0.0 of the Cabal library ) - GHC (The Glorious Glasgow Haskell Compilation System, version 8.10.2) - Haskell Stack (Version 2.3.3, Git revision cb44d51bed48b723a5deb08c3348c0b3ccfc437e x86_64 hpack-0.33.0) - Heroku (heroku/7.42.13 linux-x64 node-v12.16.2) @@ -181,13 +186,13 @@ compiled using version 3.2.0.0 of the Cabal library ) - Kind (kind v0.8.1 go1.14.2 linux/amd64) - kubectl (Client Version: v1.19.0) - helm (v3.3.1+g249e521) -- minikube version: v1.12.3 +- minikube version: v1.13.0 - kustomize ({kustomize/v3.8.2 2020-08-29T17:44:01Z }) - oc CLI Client Version: 4.5.0-202005291417-9933eb9 - Leiningen (Leiningen 2.9.4 on Java 1.8.0_265 OpenJDK 64-Bit Server VM) - Mercurial (Mercurial Distributed SCM (version 4.4.1)) - Miniconda (conda 4.8.3) -- Mono (Mono JIT compiler version 6.10.0.104 (tarball Fri Jun 26 19:43:02 UTC 2020)) +- Mono (Mono JIT compiler version 6.12.0.90 (tarball Fri Sep 4 13:58:50 UTC 2020)) - NuGet (NuGet Version: 5.5.0.6382) - MySQL (mysql Ver 14.14 Distrib 5.7.31, for Linux (x86_64) using EditLine wrapper) - MySQL Server (user:root password:root) @@ -203,8 +208,8 @@ Local version: Unknown) - Webpack (4.44.1) - Webpack CLI (3.3.12) - Yarn (1.22.5) -- Newman (5.1.2) -- Bazel (bazel 3.4.1) +- Newman (5.2.0) +- Bazel (bazel 3.5.0) - Bazelisk (1.6.1) - ORAS CLI 0.8.1 - PhantomJS (2.1.1) @@ -214,7 +219,7 @@ Local version: Unknown) - PHP 7.2 (PHP 7.2.33-1+ubuntu16.04.1+deb.sury.org+1 (cli) (built: Aug 7 2020 14:43:59) ( NTS )) - PHP 7.3 (PHP 7.3.21-1+ubuntu16.04.1+deb.sury.org+1 (cli) (built: Aug 7 2020 14:43:42) ( NTS )) - PHP 7.4 (PHP 7.4.9 (cli) (built: Aug 7 2020 14:29:10) ( NTS )) -- Composer (Composer version 1.10.10 2020-08-03 11:35:19) +- Composer (Composer version 1.10.12 2020-09-08 22:58:51) - PHPUnit (PHPUnit 7.5.20 by Sebastian Bergmann and contributors.) - Pollinate - psql (PostgreSQL) 12.4 @@ -240,14 +245,14 @@ Local version: Unknown) - Selenium server standalone (available via SELENIUM_JAR_PATH environment variable) - Sphinx Open Source Search Server - Subversion (svn, version 1.9.3 (r1718519)) -- Terraform (Terraform v0.13.1) +- Terraform (Terraform v0.13.2) - Packer (1.6.2) - Vcpkg 2020.06.15-unknownhash - Vercel CLI (20.1.0) - MongoDB on Linux v4.4.0 - Haveged 1.9.1-3 - Swig 3.0.8 -- Netlify CLI (netlify-cli/2.59.3 linux-x64 node-v12.18.3) +- Netlify CLI (netlify-cli/2.61.2 linux-x64 node-v12.18.3) - Google Repository 58 - Google Play services 49 - Google APIs 24 @@ -321,16 +326,17 @@ Local version: Unknown) - Az Module (3.8.0) - Az Module (4.3.0) - Az Module (4.4.0) +- Az Module (4.6.0) - Cached container images + - jekyll/builder:latest (Digest: sha256:4bc6a3b6eddebef1652ef38ceb965fc9c1b06677f65f764e1e17b88dc2aa9934) + - node:10 (Digest: sha256:304c59f827930ae1a4a9775aec5837c8f95c3d41b5e6d7c0a329b4eb8c4cc8a8) + - node:12 (Digest: sha256:099346a8e9c861b406c9bbb1f109125c7263868e5447cc57d6d564e1fec8a5cf) - buildpack-deps:stretch (Digest: sha256:82a686ba95fdf2bf4a5f5264e8e55b8aa272ffcedaed7826777f08de0d9e1146) - buildpack-deps:buster (Digest: sha256:0f7be4c25fadb2b8aee537cdac00a684b09057e66368683bbf22adf477e05faa) - - node:10 (Digest: sha256:cf3ee6a5a1b1916c7a2e4fb51eb7ecba1afe186739677d62e9c1bb2cb1c7d6b0) - - node:12 (Digest: sha256:d0738468dfc7cedb7d260369e0546fd7ee8731cfd67136f6023d070ad9679090) - debian:9 (Digest: sha256:335ecf9e8d9b2206c2e9e7f8b09547faa9f868e694f7c5be14c38be15ea8a7cf) - debian:8 (Digest: sha256:8a0f2603166345b4d7bbf4842137b2ffcb492ece20d15f963f08aa26670f82c7) - node:12-alpine (Digest: sha256:9623cd396644f9b2e595d833dc0188a880333674488d939338ab5fde10ef7c43) - node:10-alpine (Digest: sha256:2f202af4d6baba655fef9c93f41a914b33ee576b9f55a6e69ba23b49e3b62766) - - jekyll/builder:latest (Digest: sha256:98cda359955f25f18c4bcc78536cdfd30e7ded689b1f52fcd513c75cbe4e751e) - alpine:3.9 (Digest: sha256:414e0518bb9228d35e4cd5165567fb91d26c6a214e9c95899e1e056fcd349011) - alpine:3.10 (Digest: sha256:f0e9534a598e501320957059cb2a23774b4d4072e37c7b2cf7e95b241f019e35) - alpine:3.8 (Digest: sha256:2bb501e6173d9d006e56de5bce2720eb06396803300fe1687b58a7ff32bf4c14) @@ -348,7 +354,7 @@ Local version: Unknown) - pip3 (pip 8.1.1 from /usr/lib/python3/dist-packages (python 3.5)) - Python: - Python 2.7.18 - - Python 3.5.9 + - Python 3.5.10 - Python 3.6.12 - Python 3.7.9 - Python 3.8.5 @@ -364,11 +370,11 @@ Local version: Unknown) - go 1.11.13 - go 1.12.17 - go 1.13.15 - - go 1.14.7 - - go 1.15.0 + - go 1.14.8 + - go 1.15.1 - boost: - boost 1.69.0 - boost 1.72.0 -- AWS SAM CLI, version 1.1.0 -- Homebrew on Linux (Homebrew 2.4.16 -Homebrew/linuxbrew-core (git revision d0486f; last commit 2020-09-01)) +- AWS SAM CLI, version 1.2.0 +- Homebrew on Linux (Homebrew 2.5.0 +Homebrew/linuxbrew-core (git revision 3199c; last commit 2020-09-08)) From f28fb6226a2f4b23f71a5aa8555b9687b6c53f20 Mon Sep 17 00:00:00 2001 From: Image generation service account Date: Wed, 9 Sep 2020 08:19:09 +0000 Subject: [PATCH 23/50] Updating readme file for ubuntu20 version 20200908.1 --- images/linux/Ubuntu2004-README.md | 65 +++++++++++++++++-------------- 1 file changed, 35 insertions(+), 30 deletions(-) diff --git a/images/linux/Ubuntu2004-README.md b/images/linux/Ubuntu2004-README.md index 7a78efab2..82c6085ee 100644 --- a/images/linux/Ubuntu2004-README.md +++ b/images/linux/Ubuntu2004-README.md @@ -1,6 +1,6 @@ # Ubuntu 20.04.1 LTS -The following software is installed on machines with the 20200901.1 update. +The following software is installed on machines with the 20200908.1 update. *** - 7-Zip 16.02 - Ansible (ansible 2.9.6) @@ -65,7 +65,7 @@ The following software is installed on machines with the 20200901.1 update. - yamllint - libcurl4 - Alibaba Cloud CLI (3.0.56) -- AWS CLI (aws-cli/2.0.44 Python/3.7.3 Linux/5.4.0-1022-azure exe/x86_64.ubuntu.20) +- AWS CLI (aws-cli/2.0.46 Python/3.7.3 Linux/5.4.0-1023-azure exe/x86_64.ubuntu.20) - AWS CLI Session manager plugin (1.1.61.0) - build-essential - Clang 6.0 (6.0.1) @@ -74,13 +74,14 @@ The following software is installed on machines with the 20200901.1 update. - Swift version 5.2.5 (swift-5.2.5-RELEASE) Target: x86_64-unknown-linux-gnu - CMake (cmake version 3.17.0) -- Podman (2.0.5) -- Buildah (1.15.1) +- Podman (2.0.6) +- Buildah (1.15.2) - Skopeo (1.1.1) -- Docker Compose (docker-compose version 1.26.2, build eefe0d31) +- Docker Compose (docker-compose version 1.27.0, build 980ec85b) - Docker-Moby (Docker version 19.03.12+azure, build 0ed913b885c8919944a2e4c8d0b80a318a8dd48b) - Docker-Buildx (0.4.2+azure) - .NET Core SDK: + - 3.1.402 - 3.1.401 - 3.1.302 - 3.1.301 @@ -88,6 +89,7 @@ Target: x86_64-unknown-linux-gnu - 3.1.202 - 3.1.201 - 3.1.200 + - 3.1.108 - 3.1.107 - 3.1.106 - 3.1.105 @@ -96,6 +98,7 @@ Target: x86_64-unknown-linux-gnu - 3.1.102 - 3.1.101 - 3.1.100 + - 2.1.810 - 2.1.809 - 2.1.808 - 2.1.807 @@ -107,6 +110,7 @@ Target: x86_64-unknown-linux-gnu - 2.1.801 - 2.1.701 - 2.1.700 + - 2.1.615 - 2.1.614 - 2.1.613 - 2.1.612 @@ -120,6 +124,7 @@ Target: x86_64-unknown-linux-gnu - 2.1.604 - 2.1.603 - 2.1.602 + - 2.1.518 - 2.1.517 - 2.1.516 - 2.1.515 @@ -144,7 +149,7 @@ Target: x86_64-unknown-linux-gnu - 2.1.301 - 2.1.300 - Erlang (Erlang (SMP,ASYNC_THREADS,HIPE) (BEAM) emulator version 11.0.3) -- Firefox (Mozilla Firefox 80.0) +- Firefox (Mozilla Firefox 80.0.1) - Geckodriver (0.27.0); Gecko Driver is available via GECKOWEBDRIVER environment variable - GNU C++ 7.5.0 - GNU C++ 8.4.0 @@ -152,19 +157,19 @@ Target: x86_64-unknown-linux-gnu - GNU Fortran 8.4.0 - GNU Fortran 9.3.0 - Git (2.28.0) -- Git Large File Storage (LFS) (2.11.0) +- Git Large File Storage (LFS) (2.12.0) - Git-ftp (1.6.0) - Hub CLI (2.14.2) -- GitHub CLI 0.11.1 -- Google Chrome (Google Chrome 85.0.4183.83 ) +- GitHub CLI 0.12.0 +- Google Chrome (Google Chrome 85.0.4183.102 ) - ChromeDriver 85.0.4183.87 (cd6713ebf92fa1cacc0f1a598df280093af0c5d7-refs/branch-heads/4183@{#1689}); Chrome Driver is available via CHROMEWEBDRIVER environment variable -- Google Cloud SDK (307.0.0) -- Haskell Cabal (cabal-install version 3.2.0.0 -compiled using version 3.2.0.0 of the Cabal library ) +- Google Cloud SDK (308.0.0) +- Haskell Cabal (cabal-install version 3.4.0.0 +compiled using version 3.4.0.0 of the Cabal library ) - GHC (The Glorious Glasgow Haskell Compilation System, version 8.10.2) - Haskell Stack (Version 2.3.3, Git revision cb44d51bed48b723a5deb08c3348c0b3ccfc437e x86_64 hpack-0.33.0) - Heroku (heroku/7.42.13 linux-x64 node-v12.16.2) -- HHVM (HipHop VM 4.72.0 (rel)) +- HHVM (HipHop VM 4.74.0 (rel)) - ImageMagick - Adopt OpenJDK: - 8 (openjdk version "1.8.0_265") @@ -175,13 +180,13 @@ compiled using version 3.2.0.0 of the Cabal library ) - Kind (kind v0.8.1 go1.14.2 linux/amd64) - kubectl (Client Version: v1.19.0) - helm (v3.3.1+g249e521) -- minikube version: v1.12.3 +- minikube version: v1.13.0 - kustomize ({kustomize/v3.8.2 2020-08-29T17:44:01Z }) - oc CLI Client Version: 4.5.0-202005291417-9933eb9 - Leiningen (Leiningen 2.9.4 on Java 11.0.8 OpenJDK 64-Bit Server VM) - Mercurial (Mercurial Distributed SCM (version 5.3.1)) - Miniconda (conda 4.8.3) -- Mono (Mono JIT compiler version 6.10.0.104 (tarball Fri Jun 26 19:38:44 UTC 2020)) +- Mono (Mono JIT compiler version 6.12.0.90 (tarball Fri Sep 4 14:02:38 UTC 2020)) - NuGet (NuGet Version: 5.5.0.6382) - MySQL (mysql Ver 8.0.21-0ubuntu0.20.04.4 for Linux on x86_64 ((Ubuntu))) - MySQL Server (user:root password:root) @@ -198,8 +203,8 @@ Local version: Unknown) - Webpack (4.44.1) - Webpack CLI (3.3.12) - Yarn (1.22.5) -- Newman (5.1.2) -- Bazel (bazel 3.4.1) +- Newman (5.2.0) +- Bazel (bazel 3.5.0) - Bazelisk (1.6.1) - ORAS CLI 0.8.1 - PhantomJS (2.1.1) @@ -209,7 +214,7 @@ Local version: Unknown) apt-add-repository ppa:ondrej/php -y apt-get update ``` -- Composer (Composer version 1.10.10 2020-08-03 11:35:19) +- Composer (Composer version 1.10.12 2020-09-08 22:58:51) - PHPUnit (PHPUnit 7.5.20 by Sebastian Bergmann and contributors.) - Pollinate - psql (PostgreSQL) 12.4 @@ -236,14 +241,14 @@ apt-get update - Selenium server standalone (available via SELENIUM_JAR_PATH environment variable) - Sphinx Open Source Search Server - Subversion (svn, version 1.13.0 (r1867053)) -- Terraform (Terraform v0.13.1) +- Terraform (Terraform v0.13.2) - Packer (1.6.2) - Vcpkg 2020.06.15-unknownhash - Vercel CLI (20.1.0) - MongoDB on Linux v4.4.0 - Haveged 1.9.1-6ubuntu1 - Swig 4.0.1 -- Netlify CLI (netlify-cli/2.59.3 linux-x64 node-v12.18.3) +- Netlify CLI (netlify-cli/2.61.2 linux-x64 node-v12.18.3) - Google Repository 58 - Google Play services 49 - CMake 3.10.2.4988404 @@ -270,15 +275,15 @@ apt-get update - Android NDK 21.3.6528147 - Az Module (4.6.1) - Cached container images + - jekyll/builder:latest (Digest: sha256:4bc6a3b6eddebef1652ef38ceb965fc9c1b06677f65f764e1e17b88dc2aa9934) + - node:10 (Digest: sha256:304c59f827930ae1a4a9775aec5837c8f95c3d41b5e6d7c0a329b4eb8c4cc8a8) + - node:12 (Digest: sha256:099346a8e9c861b406c9bbb1f109125c7263868e5447cc57d6d564e1fec8a5cf) - buildpack-deps:stretch (Digest: sha256:82a686ba95fdf2bf4a5f5264e8e55b8aa272ffcedaed7826777f08de0d9e1146) - buildpack-deps:buster (Digest: sha256:0f7be4c25fadb2b8aee537cdac00a684b09057e66368683bbf22adf477e05faa) - - node:10 (Digest: sha256:cf3ee6a5a1b1916c7a2e4fb51eb7ecba1afe186739677d62e9c1bb2cb1c7d6b0) - - node:12 (Digest: sha256:d0738468dfc7cedb7d260369e0546fd7ee8731cfd67136f6023d070ad9679090) - debian:9 (Digest: sha256:335ecf9e8d9b2206c2e9e7f8b09547faa9f868e694f7c5be14c38be15ea8a7cf) - debian:8 (Digest: sha256:8a0f2603166345b4d7bbf4842137b2ffcb492ece20d15f963f08aa26670f82c7) - node:12-alpine (Digest: sha256:9623cd396644f9b2e595d833dc0188a880333674488d939338ab5fde10ef7c43) - node:10-alpine (Digest: sha256:2f202af4d6baba655fef9c93f41a914b33ee576b9f55a6e69ba23b49e3b62766) - - jekyll/builder:latest (Digest: sha256:98cda359955f25f18c4bcc78536cdfd30e7ded689b1f52fcd513c75cbe4e751e) - alpine:3.9 (Digest: sha256:414e0518bb9228d35e4cd5165567fb91d26c6a214e9c95899e1e056fcd349011) - alpine:3.10 (Digest: sha256:f0e9534a598e501320957059cb2a23774b4d4072e37c7b2cf7e95b241f019e35) - alpine:3.8 (Digest: sha256:2bb501e6173d9d006e56de5bce2720eb06396803300fe1687b58a7ff32bf4c14) @@ -290,12 +295,12 @@ apt-get update - Ruby 2.6.6 - Ruby 2.7.1 - Python (Python 2.7.18rc1) -- pip (pip 20.2.2 from /usr/local/lib/python2.7/dist-packages/pip (python 2.7)) +- pip (pip 20.2.3 from /usr/local/lib/python2.7/dist-packages/pip (python 2.7)) - Python3 (Python 3.8.2) - pip3 (pip 20.0.2 from /usr/lib/python3/dist-packages/pip (python 3.8)) - Python: - Python 2.7.18 - - Python 3.5.9 + - Python 3.5.10 - Python 3.6.12 - Python 3.7.9 - Python 3.8.5 @@ -308,8 +313,8 @@ apt-get update - node 12.18.3 - node 14.9.0 - go: - - go 1.14.7 - - go 1.15.0 -- AWS SAM CLI, version 1.1.0 -- Homebrew on Linux (Homebrew 2.4.16 -Homebrew/linuxbrew-core (git revision d0486f; last commit 2020-09-01)) + - go 1.14.8 + - go 1.15.1 +- AWS SAM CLI, version 1.2.0 +- Homebrew on Linux (Homebrew 2.5.0 +Homebrew/linuxbrew-core (git revision 3199c; last commit 2020-09-08)) From 6e04edd2ad4ac156a5ad903fca480a3cd40d4fcc Mon Sep 17 00:00:00 2001 From: Mikhail Timofeev Date: Wed, 9 Sep 2020 14:38:16 +0300 Subject: [PATCH 24/50] add all the other ubuntu templates --- images/linux/ubuntu1604.json | 4 ++-- images/linux/ubuntu1804.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/images/linux/ubuntu1604.json b/images/linux/ubuntu1604.json index 3625b7ed2..82cb0f06e 100644 --- a/images/linux/ubuntu1604.json +++ b/images/linux/ubuntu1604.json @@ -90,6 +90,7 @@ }, { "type": "shell", + "execute_command": "chmod +x {{ .Path }}; sudo {{ .Vars }} {{ .Path }}", "scripts":[ "{{template_dir}}/scripts/installers/preparemetadata.sh" ], @@ -98,8 +99,7 @@ "METADATA_FILE={{user `metadata_file`}}", "HELPER_SCRIPTS={{user `helper_script_folder`}}", "ANNOUNCEMENTS={{user `announcements`}}" - ], - "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" + ] }, { "type": "shell", diff --git a/images/linux/ubuntu1804.json b/images/linux/ubuntu1804.json index b5037520d..e9c756f15 100644 --- a/images/linux/ubuntu1804.json +++ b/images/linux/ubuntu1804.json @@ -93,6 +93,7 @@ }, { "type": "shell", + "execute_command": "chmod +x {{ .Path }}; sudo {{ .Vars }} {{ .Path }}", "scripts":[ "{{template_dir}}/scripts/installers/preparemetadata.sh" ], @@ -101,8 +102,7 @@ "METADATA_FILE={{user `metadata_file`}}", "HELPER_SCRIPTS={{user `helper_script_folder`}}", "ANNOUNCEMENTS={{user `announcements`}}" - ], - "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" + ] }, { "type": "shell", From 37aa3f5ade5f4a1b159038f515815ed03fb7bd52 Mon Sep 17 00:00:00 2001 From: Aleksandr Chebotov Date: Wed, 9 Sep 2020 15:42:39 +0300 Subject: [PATCH 25/50] move docker images to the toolset.json --- .../linux/scripts/installers/docker-moby.sh | 38 +++++-------------- images/linux/toolsets/toolset-1604.json | 19 ++++++++++ images/linux/toolsets/toolset-1804.json | 19 ++++++++++ images/linux/toolsets/toolset-2004.json | 19 ++++++++++ 4 files changed, 67 insertions(+), 28 deletions(-) diff --git a/images/linux/scripts/installers/docker-moby.sh b/images/linux/scripts/installers/docker-moby.sh index 0ce51b7ec..6ce336718 100644 --- a/images/linux/scripts/installers/docker-moby.sh +++ b/images/linux/scripts/installers/docker-moby.sh @@ -3,19 +3,20 @@ ## File: docker-moby.sh ## Desc: Installs docker onto the image ################################################################################ +set -e +# Source the helpers for use with the script source $HELPER_SCRIPTS/document.sh source $HELPER_SCRIPTS/install.sh source $HELPER_SCRIPTS/os.sh -docker_package=moby - # There is no stable docker-moby for Ubuntu 20 at the moment if isUbuntu20 ; then add-apt-repository "deb [arch=amd64,armhf,arm64] https://packages.microsoft.com/ubuntu/20.04/prod testing main" fi -## Check to see if docker is already installed +# Check to see if docker is already installed +docker_package=moby echo "Determing if Docker ($docker_package) is installed" if ! IsPackageInstalled $docker_package; then echo "Docker ($docker_package) was not found. Installing..." @@ -44,35 +45,17 @@ else echo "Docker-moby and Docker-buildx checking the successfull" # Docker daemon takes time to come up after installing sleep 10 - set -e docker info - set +e fi # Pull images -images=( - node:10 - node:12 - buildpack-deps:stretch - buildpack-deps:buster - node:10-alpine - node:12-alpine - debian:8 - debian:9 - alpine:3.7 - alpine:3.8 - alpine:3.9 - alpine:3.10 - ubuntu:14.04 - docker.io/jekyll/builder - mcr.microsoft.com/azure-pipelines/node8-typescript -) - -for image in "${images[@]}"; do +toolset="$INSTALLER_SCRIPT_FOLDER/toolset.json" +images=$(jq -r '.docker.images[]' $toolset) +for image in $images; do docker pull "$image" done -## Add version information to the metadata file +# Add version information to the metadata file echo "Documenting Docker version" docker_version=$(docker -v) DocumentInstalledItem "Docker-Moby ($docker_version)" @@ -81,9 +64,8 @@ echo "Documenting Docker-buildx version" DOCKER_BUILDX_VERSION=$(docker buildx version | cut -d ' ' -f2) DocumentInstalledItem "Docker-Buildx ($DOCKER_BUILDX_VERSION)" -## Add container information to the metadata file +# Add container information to the metadata file DocumentInstalledItem "Cached container images" - while read -r line; do DocumentInstalledItemIndent "$line" -done <<< "$(docker images --digests --format '{{.Repository}}:{{.Tag}} (Digest: {{.Digest}})')" \ No newline at end of file +done <<< "$(docker images --digests --format '{{.Repository}}:{{.Tag}} (Digest: {{.Digest}})')" diff --git a/images/linux/toolsets/toolset-1604.json b/images/linux/toolsets/toolset-1604.json index f03740059..1204f2a86 100644 --- a/images/linux/toolsets/toolset-1604.json +++ b/images/linux/toolsets/toolset-1604.json @@ -170,5 +170,24 @@ "yamllint", "zip" ] + }, + "docker": { + "images": [ + "alpine:3.7", + "alpine:3.8", + "alpine:3.9", + "alpine:3.10", + "buildpack-deps:stretch", + "buildpack-deps:buster", + "debian:8", + "debian:9", + "jekyll/builder", + "mcr.microsoft.com/azure-pipelines/node8-typescript", + "node:10", + "node:12", + "node:10-alpine", + "node:12-alpine", + "ubuntu:14.04" + ] } } diff --git a/images/linux/toolsets/toolset-1804.json b/images/linux/toolsets/toolset-1804.json index f1ea16b56..2c399c8fc 100644 --- a/images/linux/toolsets/toolset-1804.json +++ b/images/linux/toolsets/toolset-1804.json @@ -165,5 +165,24 @@ "yamllint", "zip" ] + }, + "docker": { + "images": [ + "alpine:3.7", + "alpine:3.8", + "alpine:3.9", + "alpine:3.10", + "buildpack-deps:stretch", + "buildpack-deps:buster", + "debian:8", + "debian:9", + "jekyll/builder", + "mcr.microsoft.com/azure-pipelines/node8-typescript", + "node:10", + "node:12", + "node:10-alpine", + "node:12-alpine", + "ubuntu:14.04" + ] } } diff --git a/images/linux/toolsets/toolset-2004.json b/images/linux/toolsets/toolset-2004.json index b4aa7ec41..1162b713f 100644 --- a/images/linux/toolsets/toolset-2004.json +++ b/images/linux/toolsets/toolset-2004.json @@ -129,5 +129,24 @@ "yamllint", "zip" ] + }, + "docker": { + "images": [ + "alpine:3.7", + "alpine:3.8", + "alpine:3.9", + "alpine:3.10", + "buildpack-deps:stretch", + "buildpack-deps:buster", + "debian:8", + "debian:9", + "jekyll/builder", + "mcr.microsoft.com/azure-pipelines/node8-typescript", + "node:10", + "node:12", + "node:10-alpine", + "node:12-alpine", + "ubuntu:14.04" + ] } } From 8c087af706c178dd2817048abf5df17a5723fc65 Mon Sep 17 00:00:00 2001 From: Alexander Sklar Date: Wed, 9 Sep 2020 10:45:40 -0700 Subject: [PATCH 26/50] Update Install-NodeLts.ps1 --- images/win/scripts/Installers/Install-NodeLts.ps1 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/images/win/scripts/Installers/Install-NodeLts.ps1 b/images/win/scripts/Installers/Install-NodeLts.ps1 index 518d8f656..8dc4559ed 100644 --- a/images/win/scripts/Installers/Install-NodeLts.ps1 +++ b/images/win/scripts/Installers/Install-NodeLts.ps1 @@ -17,11 +17,11 @@ Choco-Install -PackageName nodejs-lts -ArgumentList "--force" Add-MachinePathItem $PrefixPath $env:Path = Get-MachinePath -setx NPM_CONFIG_PREFIX $PrefixPath /M -$env:NPM_CONFIG_PREFIX = $PrefixPath +setx npm_config_prefix $PrefixPath /M +$env:npm_config_prefix = $PrefixPath -setx NPM_CONFIG_CACHE $CachePath /M -$env:NPM_CONFIG_CACHE = $CachePath +setx npm_config_cache $CachePath /M +$env:npm_config_cache = $CachePath npm config set registry http://registry.npmjs.org/ @@ -35,4 +35,4 @@ npm install -g lerna npm install -g node-sass npm install -g newman -Invoke-PesterTests -TestFile "Node" \ No newline at end of file +Invoke-PesterTests -TestFile "Node" From 511c6e636b57fab98cb28a9c9cf0e3a447121227 Mon Sep 17 00:00:00 2001 From: Maxim Lobanov Date: Thu, 10 Sep 2020 14:34:08 +0300 Subject: [PATCH 27/50] move source code to public --- images/macos/helpers/Common.Helpers.psm1 | 76 ++++ .../macos/helpers/SoftwareReport.Helpers.psm1 | 32 ++ images/macos/helpers/Tests.Helpers.psm1 | 87 ++++ images/macos/helpers/Xcode.Helpers.psm1 | 94 +++++ .../bootstrap-provisioner/change_password | 18 + .../installNewProvisioner.sh | 40 ++ .../bootstrap-provisioner/kcpassword.py | 46 +++ .../add-network-interface-detection.sh | 40 ++ .../provision/configuration/autologin.sh | 16 + .../configuration/configure-hostname.sh | 28 ++ .../configuration/configure-machine.sh | 21 + .../provision/configuration/configure-ssh.sh | 7 + .../configuration/disable-auto-updates.sh | 8 + .../configuration/environment/bashprofile | 1 + .../configuration/environment/bashrc | 32 ++ .../provision/configuration/finalize-vm.sh | 20 + .../provision/configuration/max-files.sh | 39 ++ .../macos/provision/configuration/ntpconf.sh | 15 + .../provision/configuration/preimagedata.sh | 29 ++ .../configuration/screensaver-off.sh | 25 ++ .../provision/configuration/shell-change.sh | 3 + .../macos/provision/core/android-toolsets.sh | 92 +++++ images/macos/provision/core/audiodevice.sh | 19 + images/macos/provision/core/aws.sh | 11 + images/macos/provision/core/azcopy.sh | 13 + .../provision/core/build-xcode-symlinks.sh | 20 + images/macos/provision/core/chrome.sh | 11 + images/macos/provision/core/cocoapods.sh | 9 + images/macos/provision/core/commonutils.sh | 53 +++ .../provision/core/delete-duplicate-sims.rb | 155 ++++++++ images/macos/provision/core/dotnet.sh | 68 ++++ images/macos/provision/core/edge.sh | 58 +++ images/macos/provision/core/firefox.sh | 8 + images/macos/provision/core/gcc.sh | 7 + images/macos/provision/core/git.sh | 28 ++ images/macos/provision/core/haskell.sh | 17 + images/macos/provision/core/homebrew.sh | 24 ++ images/macos/provision/core/miniconda.sh | 12 + images/macos/provision/core/mongodb.sh | 10 + images/macos/provision/core/node.sh | 45 +++ images/macos/provision/core/nvm.sh | 35 ++ images/macos/provision/core/openjdk.sh | 53 +++ images/macos/provision/core/openssl.sh | 21 + images/macos/provision/core/php.sh | 8 + images/macos/provision/core/postgresql.sh | 18 + images/macos/provision/core/powershell.sh | 34 ++ images/macos/provision/core/pypy.sh | 84 ++++ images/macos/provision/core/python.sh | 10 + images/macos/provision/core/reboot.sh | 2 + images/macos/provision/core/ruby.sh | 14 + images/macos/provision/core/rubygem.sh | 29 ++ images/macos/provision/core/rust.sh | 19 + images/macos/provision/core/stack.sh | 22 ++ .../provision/core/toolcache-high-sierra.sh | 27 ++ images/macos/provision/core/toolcache.sh | 38 ++ images/macos/provision/core/toolset.ps1 | 58 +++ images/macos/provision/core/vcpkg.sh | 15 + images/macos/provision/core/vsmac.sh | 27 ++ .../provision/core/xamarin-android-ndk.sh | 64 +++ images/macos/provision/core/xamarin.sh | 81 ++++ images/macos/provision/core/xcode-ctl.sh | 19 + .../macos/provision/core/xcode-postbuild.sh | 30 ++ images/macos/provision/core/xcode-sims.sh | 25 ++ images/macos/provision/core/xcode-tools.sh | 99 +++++ images/macos/provision/utils/utils.sh | 94 +++++ images/macos/provision/utils/xamarin-utils.sh | 233 +++++++++++ images/macos/provision/utils/xcode-utils.sh | 81 ++++ .../SoftwareReport.Android.psm1 | 166 ++++++++ .../SoftwareReport.Browsers.psm1 | 52 +++ .../SoftwareReport.Common.psm1 | 117 ++++++ .../SoftwareReport.Generator.ps1 | 361 +++++++++++++++++ .../software-report/SoftwareReport.Java.psm1 | 30 ++ .../SoftwareReport.Toolcache.psm1 | 72 ++++ .../SoftwareReport.Xamarin.psm1 | 78 ++++ .../software-report/SoftwareReport.Xcode.psm1 | 236 +++++++++++ images/macos/templates/macOS-10.13.json | 211 ++++++++++ images/macos/templates/macOS-10.14.json | 231 +++++++++++ images/macos/templates/macOS-10.15.json | 230 +++++++++++ images/macos/templates/macOS-11.0.json | 226 +++++++++++ images/macos/tests/Android.Tests.ps1 | 91 +++++ images/macos/tests/Common.Tests.ps1 | 372 ++++++++++++++++++ images/macos/tests/Java.Tests.ps1 | 61 +++ images/macos/tests/Linters.Tests.ps1 | 13 + images/macos/tests/Node.Tests.ps1 | 50 +++ images/macos/tests/Powershell.Tests.ps1 | 41 ++ images/macos/tests/Python.Tests.ps1 | 32 ++ images/macos/tests/Ruby.Tests.ps1 | 24 ++ images/macos/tests/Run-Tests.ps1 | 25 ++ images/macos/tests/Toolcache.Tests.ps1 | 240 +++++++++++ images/macos/tests/Xamarin.Tests.ps1 | 289 ++++++++++++++ images/macos/tests/Xcode.Tests.ps1 | 107 +++++ images/macos/toolsets/Readme.md | 82 ++++ images/macos/toolsets/Toolset.Tests.ps1 | 144 +++++++ images/macos/toolsets/toolcache-10.13.json | 8 + images/macos/toolsets/toolcache-10.14.json | 5 + images/macos/toolsets/toolcache-11.0.json | 5 + images/macos/toolsets/toolset-10.13.json | 202 ++++++++++ images/macos/toolsets/toolset-10.14.json | 261 ++++++++++++ images/macos/toolsets/toolset-10.15.json | 163 ++++++++ images/macos/toolsets/toolset-11.0.json | 99 +++++ 100 files changed, 6901 insertions(+) create mode 100644 images/macos/helpers/Common.Helpers.psm1 create mode 100644 images/macos/helpers/SoftwareReport.Helpers.psm1 create mode 100644 images/macos/helpers/Tests.Helpers.psm1 create mode 100644 images/macos/helpers/Xcode.Helpers.psm1 create mode 100755 images/macos/provision/bootstrap-provisioner/change_password create mode 100644 images/macos/provision/bootstrap-provisioner/installNewProvisioner.sh create mode 100755 images/macos/provision/bootstrap-provisioner/kcpassword.py create mode 100755 images/macos/provision/configuration/add-network-interface-detection.sh create mode 100755 images/macos/provision/configuration/autologin.sh create mode 100644 images/macos/provision/configuration/configure-hostname.sh create mode 100644 images/macos/provision/configuration/configure-machine.sh create mode 100755 images/macos/provision/configuration/configure-ssh.sh create mode 100755 images/macos/provision/configuration/disable-auto-updates.sh create mode 100644 images/macos/provision/configuration/environment/bashprofile create mode 100644 images/macos/provision/configuration/environment/bashrc create mode 100644 images/macos/provision/configuration/finalize-vm.sh create mode 100755 images/macos/provision/configuration/max-files.sh create mode 100755 images/macos/provision/configuration/ntpconf.sh create mode 100644 images/macos/provision/configuration/preimagedata.sh create mode 100755 images/macos/provision/configuration/screensaver-off.sh create mode 100644 images/macos/provision/configuration/shell-change.sh create mode 100755 images/macos/provision/core/android-toolsets.sh create mode 100644 images/macos/provision/core/audiodevice.sh create mode 100644 images/macos/provision/core/aws.sh create mode 100755 images/macos/provision/core/azcopy.sh create mode 100644 images/macos/provision/core/build-xcode-symlinks.sh create mode 100644 images/macos/provision/core/chrome.sh create mode 100755 images/macos/provision/core/cocoapods.sh create mode 100644 images/macos/provision/core/commonutils.sh create mode 100644 images/macos/provision/core/delete-duplicate-sims.rb create mode 100755 images/macos/provision/core/dotnet.sh create mode 100644 images/macos/provision/core/edge.sh create mode 100644 images/macos/provision/core/firefox.sh create mode 100644 images/macos/provision/core/gcc.sh create mode 100644 images/macos/provision/core/git.sh create mode 100644 images/macos/provision/core/haskell.sh create mode 100755 images/macos/provision/core/homebrew.sh create mode 100644 images/macos/provision/core/miniconda.sh create mode 100644 images/macos/provision/core/mongodb.sh create mode 100644 images/macos/provision/core/node.sh create mode 100755 images/macos/provision/core/nvm.sh create mode 100644 images/macos/provision/core/openjdk.sh create mode 100755 images/macos/provision/core/openssl.sh create mode 100644 images/macos/provision/core/php.sh create mode 100644 images/macos/provision/core/postgresql.sh create mode 100644 images/macos/provision/core/powershell.sh create mode 100644 images/macos/provision/core/pypy.sh create mode 100755 images/macos/provision/core/python.sh create mode 100644 images/macos/provision/core/reboot.sh create mode 100755 images/macos/provision/core/ruby.sh create mode 100755 images/macos/provision/core/rubygem.sh create mode 100644 images/macos/provision/core/rust.sh create mode 100644 images/macos/provision/core/stack.sh create mode 100644 images/macos/provision/core/toolcache-high-sierra.sh create mode 100755 images/macos/provision/core/toolcache.sh create mode 100644 images/macos/provision/core/toolset.ps1 create mode 100644 images/macos/provision/core/vcpkg.sh create mode 100644 images/macos/provision/core/vsmac.sh create mode 100644 images/macos/provision/core/xamarin-android-ndk.sh create mode 100755 images/macos/provision/core/xamarin.sh create mode 100644 images/macos/provision/core/xcode-ctl.sh create mode 100644 images/macos/provision/core/xcode-postbuild.sh create mode 100755 images/macos/provision/core/xcode-sims.sh create mode 100755 images/macos/provision/core/xcode-tools.sh create mode 100755 images/macos/provision/utils/utils.sh create mode 100644 images/macos/provision/utils/xamarin-utils.sh create mode 100644 images/macos/provision/utils/xcode-utils.sh create mode 100644 images/macos/software-report/SoftwareReport.Android.psm1 create mode 100644 images/macos/software-report/SoftwareReport.Browsers.psm1 create mode 100644 images/macos/software-report/SoftwareReport.Common.psm1 create mode 100644 images/macos/software-report/SoftwareReport.Generator.ps1 create mode 100644 images/macos/software-report/SoftwareReport.Java.psm1 create mode 100644 images/macos/software-report/SoftwareReport.Toolcache.psm1 create mode 100644 images/macos/software-report/SoftwareReport.Xamarin.psm1 create mode 100644 images/macos/software-report/SoftwareReport.Xcode.psm1 create mode 100644 images/macos/templates/macOS-10.13.json create mode 100644 images/macos/templates/macOS-10.14.json create mode 100644 images/macos/templates/macOS-10.15.json create mode 100644 images/macos/templates/macOS-11.0.json create mode 100644 images/macos/tests/Android.Tests.ps1 create mode 100644 images/macos/tests/Common.Tests.ps1 create mode 100644 images/macos/tests/Java.Tests.ps1 create mode 100644 images/macos/tests/Linters.Tests.ps1 create mode 100644 images/macos/tests/Node.Tests.ps1 create mode 100644 images/macos/tests/Powershell.Tests.ps1 create mode 100644 images/macos/tests/Python.Tests.ps1 create mode 100644 images/macos/tests/Ruby.Tests.ps1 create mode 100644 images/macos/tests/Run-Tests.ps1 create mode 100644 images/macos/tests/Toolcache.Tests.ps1 create mode 100644 images/macos/tests/Xamarin.Tests.ps1 create mode 100644 images/macos/tests/Xcode.Tests.ps1 create mode 100644 images/macos/toolsets/Readme.md create mode 100644 images/macos/toolsets/Toolset.Tests.ps1 create mode 100644 images/macos/toolsets/toolcache-10.13.json create mode 100644 images/macos/toolsets/toolcache-10.14.json create mode 100644 images/macos/toolsets/toolcache-11.0.json create mode 100644 images/macos/toolsets/toolset-10.13.json create mode 100644 images/macos/toolsets/toolset-10.14.json create mode 100644 images/macos/toolsets/toolset-10.15.json create mode 100644 images/macos/toolsets/toolset-11.0.json diff --git a/images/macos/helpers/Common.Helpers.psm1 b/images/macos/helpers/Common.Helpers.psm1 new file mode 100644 index 000000000..aa2ffdc5c --- /dev/null +++ b/images/macos/helpers/Common.Helpers.psm1 @@ -0,0 +1,76 @@ +function Get-CommandResult { + param ( + [Parameter(Mandatory=$true)] + [string] $Command, + [switch] $Multiline + ) + # Bash trick to suppress and show error output because some commands write to stderr (for example, "python --version") + $stdout = & bash -c "$Command 2>&1" + $exitCode = $LASTEXITCODE + return @{ + Output = If ($Multiline -eq $true) { $stdout } else { [string]$stdout } + ExitCode = $exitCode + } +} + +# Gets path to the tool, analogue of 'which tool' +function Get-WhichTool($tool) { + return (Get-Command $tool).Path +} + +# Gets value of environment variable by the name +function Get-EnvironmentVariable($variable) { + return [System.Environment]::GetEnvironmentVariable($variable) +} + +# Returns the object with information about current OS +# It can be used for OS-specific tests +function Get-OSVersion { + $osVersion = [Environment]::OSVersion + return [PSCustomObject]@{ + Version = $osVersion.Version + Platform = $osVersion.Platform + IsHighSierra = $osVersion.Version.Major -eq 17 + IsMojave = $osVersion.Version.Major -eq 18 + IsCatalina = $osVersion.Version.Major -eq 19 + IsBigSur = $osVersion.Version.Major -eq 20 + IsLessThanCatalina = $osVersion.Version.Major -lt 19 + IsLessThanBigSur = $osVersion.Version.Major -lt 20 + IsHigherThanMojave = $osVersion.Version.Major -gt 18 + } +} + +function Get-ChildItemWithoutSymlinks { + param ( + [Parameter(Mandatory)] + [string] $Path, + [string] $Filter + ) + + $files = Get-ChildItem -Path $Path -Filter $Filter + $files = $files | Where-Object { !$_.LinkType } # cut symlinks + return $files +} + +# Get the value of specific toolset node +# Example, invoke `Get-ToolsetValue "xamarin.bundles"` to get value of `$toolsetJson.xamarin.bundles` +function Get-ToolsetValue { + param ( + [Parameter(Mandatory = $true)] + [string] $KeyPath + ) + $toolsetPath = Join-Path $env:HOME "image-generation" "toolset.json" + $jsonNode = Get-Content -Raw $toolsetPath | ConvertFrom-Json + + $pathParts = $KeyPath.Split(".") + # try to walk through all arguments consequentially to resolve specific json node + $pathParts | ForEach-Object { + $jsonNode = $jsonNode.$_ + } + return $jsonNode +} + +function Get-ToolcachePackages { + $toolcachePath = Join-Path $env:HOME "image-generation" "toolcache.json" + return Get-Content -Raw $toolcachePath | ConvertFrom-Json +} \ No newline at end of file diff --git a/images/macos/helpers/SoftwareReport.Helpers.psm1 b/images/macos/helpers/SoftwareReport.Helpers.psm1 new file mode 100644 index 000000000..2742bad15 --- /dev/null +++ b/images/macos/helpers/SoftwareReport.Helpers.psm1 @@ -0,0 +1,32 @@ +function Run-Command { + param ( + [Parameter(Mandatory=$true)] + [string] $Command, + [switch] $SuppressStderr + ) + # Bash trick to suppress and show error output because some commands write to stderr (for example, "python --version") + $redirectOutputArguments = If ($SuppressStderr) { "2> /dev/null" } Else { "2>&1" } + $stdout = & bash -c "${Command} ${redirectOutputArguments}" + + return $stdout +} + +function Take-Part { + param ( + [Parameter(ValueFromPipeline)] + [string] $toolOutput, + [string] $Delimiter = " ", + [int[]] $Part + ) + $parts = $toolOutput.Split($Delimiter, [System.StringSplitOptions]::RemoveEmptyEntries) + $selectedParts = $parts[$Part] + return [string]::Join($Delimiter, $selectedParts) +} + +function New-MDNewLine { + param ( + [int] $Count = 1 + ) + $newLineSymbol = [System.Environment]::NewLine + return $newLineSymbol * $Count +} diff --git a/images/macos/helpers/Tests.Helpers.psm1 b/images/macos/helpers/Tests.Helpers.psm1 new file mode 100644 index 000000000..621f2124c --- /dev/null +++ b/images/macos/helpers/Tests.Helpers.psm1 @@ -0,0 +1,87 @@ +# Invokes command and validate that the exit code is 0 +function Validate-ZeroExitCode($command) { + $result = Get-CommandResult $command + $result.ExitCode | Should -Be 0 -Because $result.Output +} + +# Validates that tool is installed and in PATH +function Validate-ToolExist($tool) { + Get-Command $tool -ErrorAction SilentlyContinue | Should -BeTrue +} + +function Validate-ArrayWithoutDuplicates { + param ( + [AllowEmptyCollection()] + [Parameter(Mandatory = $true)] + [array] $Items, + [string] $Because + ) + $uniqueList = @() + $Items | ForEach-Object { + $uniqueList | Should -Not -Contain $_ -Because $Because + $uniqueList += $_ + } +} + +function Validate-Url { + param ( + [Parameter(Mandatory)] + [ValidateNotNullOrEmpty()] + [string] $Url + ) + + $result = $true + try { + $requestResult = Invoke-WebRequest $Url -DisableKeepAlive -UseBasicParsing -Method Head + $result = ($requestResult.StatusCode -eq 200) + } catch { + $result = $false + } + + $result | Should -BeTrue -Because "'$Url' should be available, but it is not" +} + +function Validate-IdenticalFileContent { + param ( + [Parameter(Mandatory)] + [string] $File1, + [Parameter(Mandatory)] + [string] $File2 + ) + + $File1 | Should -Exist -Because "The content of '$File1' should be identical with content of '$File2' but '$File1' doesn't exist" + $File2 | Should -Exist -Because "The content of '$File1' should be identical with content of '$File2' but '$File2' doesn't exist" + + $content1 = Get-Content -Raw $File1 + $content2 = Get-Content -Raw $File2 + $content1 | Should -Be $content2 -Because "The content of '$File1' should be identical with content of '$File2' but they are different" +} + +function ShouldReturnZeroExitCode { + Param( + [String] $ActualValue, + [switch] $Negate, + [string] $Because # This parameter is unused by we need it to match Pester asserts signature + ) + + $result = Get-CommandResult $ActualValue + + [bool]$succeeded = $result.ExitCode -eq 0 + if ($Negate) { $succeeded = -not $succeeded } + + if (-not $succeeded) + { + $commandOutputIndent = " " * 4 + $commandOutput = ($result.Output | ForEach-Object { "${commandOutputIndent}${_}" }) -join "`n" + $failureMessage = "Command '${ActualValue}' has finished with exit code ${actualExitCode}`n${commandOutput}" + } + + return [PSCustomObject] @{ + Succeeded = $succeeded + FailureMessage = $failureMessage + } +} + +If (Get-Command -Name Add-AssertionOperator -ErrorAction SilentlyContinue) { + Add-AssertionOperator -Name ReturnZeroExitCode -InternalName ShouldReturnZeroExitCode -Test ${function:ShouldReturnZeroExitCode} +} \ No newline at end of file diff --git a/images/macos/helpers/Xcode.Helpers.psm1 b/images/macos/helpers/Xcode.Helpers.psm1 new file mode 100644 index 000000000..6f3dcf730 --- /dev/null +++ b/images/macos/helpers/Xcode.Helpers.psm1 @@ -0,0 +1,94 @@ +function Get-XcodeRootPath { + Param ( + [Parameter(Mandatory)] + [string] $Version + ) + + return "/Applications/Xcode_$Version.app" +} + +function Get-DefaultXcodeRootPath { + $defaultXcodePath = "/Applications/Xcode.app" + $defaultXcodeItem = Get-Item -Path $defaultXcodePath + return $defaultXcodeItem.Target +} + +function Get-XcodeToolPath { + param ( + [Parameter(ParameterSetName = 'Version')] + [string] $Version, + [Parameter(ParameterSetName = 'Path')] + [string] $XcodeRootPath, + [string] $ToolName + ) + + if ($PSCmdlet.ParameterSetName -eq "Version") { + $XcodeRootPath = Get-XcodeRootPath $Version + } + + return Join-Path $XcodeRootPath "Contents/Developer/usr/bin" $ToolName +} + +function Switch-Xcode { + param ( + [Parameter(ParameterSetName = 'Version')] + [string] $Version, + [Parameter(ParameterSetName = 'Path')] + [string] $XcodeRootPath + ) + + if ($PSCmdlet.ParameterSetName -eq "Version") { + $XcodeRootPath = Get-XcodeRootPath $Version + } + + Write-Verbose "Switching Xcode to '${XcodeRootPath}'" + Invoke-Expression "sudo xcode-select --switch ${XcodeRootPath}" +} + +function Get-XcodeSimulatorsInfo { + param( + [string] $Filter + ) + + [string]$rawSimulatorsInfo = Invoke-Expression "xcrun simctl list --json" + $jsonSimulatorsInfo = $rawSimulatorsInfo | ConvertFrom-Json + + if ($Filter) { + return $jsonSimulatorsInfo | Select-Object -ExpandProperty $Filter + } + + return $jsonSimulatorsInfo +} + +function Get-XcodeDevicesList { + $result = @() + + $runtimes = Get-XcodeSimulatorsInfo -Filter "devices" + $runtimes.PSObject.Properties | ForEach-Object { + $runtimeName = $_.Name + $devices = $_.Value + $devices | Where-Object { + $availability = $_.availability + $isAvailable = $_.isAvailable + return (($availability -eq "(available)") -or ($isAvailable -eq "YES") -or ($isAvailable -eq $true)) + } | ForEach-Object { + $deviceName = $_.name + $result += "$runtimeName $deviceName" + } + } + return $result +} + +function Get-XcodePairsList { + $result = @() + + $runtimes = Get-XcodeSimulatorsInfo -Filter "pairs" + $runtimes.PSObject.Properties | Where-Object { + return $_.Value.state -match "active" + } | ForEach-Object { + $watchName = $_.Value.watch.name + $phoneName = $_.Value.phone.name + $result += "$watchName $phoneName" + } + return $result +} \ No newline at end of file diff --git a/images/macos/provision/bootstrap-provisioner/change_password b/images/macos/provision/bootstrap-provisioner/change_password new file mode 100755 index 000000000..d3516ff20 --- /dev/null +++ b/images/macos/provision/bootstrap-provisioner/change_password @@ -0,0 +1,18 @@ +#!/bin/bash +USERNAME="$1" +OLD_PASSWD="$2" +NEW_PASSWD="$3" + +export PATH=/usr/bin:/usr/sbin:/usr/local/bin:/bin:/sbin + +macosver="$(sw_vers | grep ProductVersion | awk {'print $2'})" + +if [[ $macosver =~ 10.13.* ]]; then + sudo /usr/bin/dscl . -passwd /Users/$USERNAME "$NEW_PASSWD" +else + sudo /usr/sbin/sysadminctl -resetPasswordFor $USERNAME -newPassword "$NEW_PASSWD" -adminUser $USERNAME -adminPassword "$OLD_PASSWD" +fi + +sudo /usr/bin/python /Users/$USERNAME/bootstrap/kcpassword.py "$NEW_PASSWD" +sudo /usr/bin/defaults write /Library/Preferences/com.apple.loginwindow autoLoginUser "$USERNAME" +/usr/bin/security set-keychain-password -o "$OLD_PASSWD" -p "$NEW_PASSWD" /Users/$USERNAME/Library/Keychains/login.keychain \ No newline at end of file diff --git a/images/macos/provision/bootstrap-provisioner/installNewProvisioner.sh b/images/macos/provision/bootstrap-provisioner/installNewProvisioner.sh new file mode 100644 index 000000000..79a3afdf2 --- /dev/null +++ b/images/macos/provision/bootstrap-provisioner/installNewProvisioner.sh @@ -0,0 +1,40 @@ +#!/bin/bash +BOOTSTRAP_PATH="$1" +ProvisionerPackageUri="$2" +ProvisionerScriptUri="$3" +ScriptName="$4" +ScriptParam="$5" +Username="$6" + +export PATH=/usr/bin:/usr/sbin:/usr/local/bin:/bin:/sbin + +PROVISIONER_ROOT=/usr/local/opt/${Username} +mkdir -p ${PROVISIONER_ROOT} +chown ${Username} ${PROVISIONER_ROOT} + +tee -a ${PROVISIONER_ROOT}/runprovisioner.sh > /dev/null <<\EOF +#!/bin/bash + +. ${HOME}/.bashrc + +/usr/local/opt/$USER/provisioner/provisioner +EOF + +chmod +x $PROVISIONER_ROOT/runprovisioner.sh + +aria2c \ + --enable-color=false \ + --file-allocation=none \ + -d ${BOOTSTRAP_PATH} "${ProvisionerPackageUri}" >> ${BOOTSTRAP_PATH}/download.log + +aria2c \ + --enable-color=false \ + --file-allocation=none \ + -d ${BOOTSTRAP_PATH} "${ProvisionerScriptUri}" >> ${BOOTSTRAP_PATH}/download.log + +chmod +x ${BOOTSTRAP_PATH}/${ScriptName} + +# Install Provisioner with provided scripts +eval "$BOOTSTRAP_PATH/$ScriptName $BOOTSTRAP_PATH/$ScriptParam $Username" 2>&1 | tee "$BOOTSTRAP_PATH/install.log" +# State File +touch $BOOTSTRAP_PATH/provisionerDone \ No newline at end of file diff --git a/images/macos/provision/bootstrap-provisioner/kcpassword.py b/images/macos/provision/bootstrap-provisioner/kcpassword.py new file mode 100755 index 000000000..6b34121e1 --- /dev/null +++ b/images/macos/provision/bootstrap-provisioner/kcpassword.py @@ -0,0 +1,46 @@ +#!/usr/bin/env python + +# Port of Gavin Brock's Perl kcpassword generator to Python, by Tom Taylor +# . +# Perl version: http://www.brock-family.org/gavin/perl/kcpassword.html +# This script was taken from https://github.com/timsutton/osx-vm-templates/blob/master/scripts/support/set_kcpassword.py +# Distributed by MIT license, license can be found at the bottom of this script + +import sys +import os + +def kcpassword(passwd): + # The magic 11 bytes - these are just repeated + # 0x7D 0x89 0x52 0x23 0xD2 0xBC 0xDD 0xEA 0xA3 0xB9 0x1F + key = [125,137,82,35,210,188,221,234,163,185,31] + key_len = len(key) + + passwd = [ord(x) for x in list(passwd)] + # pad passwd length out to an even multiple of key length + r = len(passwd) % key_len + if (r > 0): + passwd = passwd + [0] * (key_len - r) + + for n in range(0, len(passwd), len(key)): + ki = 0 + for j in range(n, min(n+len(key), len(passwd))): + passwd[j] = passwd[j] ^ key[ki] + ki += 1 + + passwd = [chr(x) for x in passwd] + return "".join(passwd) + +if __name__ == "__main__": + passwd = kcpassword(sys.argv[1]) + fd = os.open('/etc/kcpassword', os.O_WRONLY | os.O_CREAT, 0o600) + file = os.fdopen(fd, 'w') + file.write(passwd) + file.close() + +""" +The MIT License (MIT) +Copyright (c) 2013-2017 Timothy Sutton +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +""" \ No newline at end of file diff --git a/images/macos/provision/configuration/add-network-interface-detection.sh b/images/macos/provision/configuration/add-network-interface-detection.sh new file mode 100755 index 000000000..e939f04b6 --- /dev/null +++ b/images/macos/provision/configuration/add-network-interface-detection.sh @@ -0,0 +1,40 @@ +#!/bin/sh + +# This script was taken from https://github.com/timsutton/osx-vm-templates/blob/master/scripts/add-network-interface-detection.sh +# Distributed by MIT license, license can be found at the bottom of this script + +# This script adds a Mac OS Launch Daemon, which runs every time the +# machine is booted. The daemon will re-detect the attached network +# interfaces. If this is not done, network devices may not work. +PLIST=/Library/LaunchDaemons/sonoma.detectnewhardware.plist +cat < "${PLIST}" + + + + + Label + sonoma.detectnewhardware + ProgramArguments + + /usr/sbin/networksetup + -detectnewhardware + + RunAtLoad + + + +EOF + +# These should be already set as follows, but since they're required +# in order to load properly, we set them explicitly. +/bin/chmod 644 "${PLIST}" +/usr/sbin/chown root:wheel "${PLIST}" + + +: ' +The MIT License (MIT) +Copyright (c) 2013-2017 Timothy Sutton +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +' \ No newline at end of file diff --git a/images/macos/provision/configuration/autologin.sh b/images/macos/provision/configuration/autologin.sh new file mode 100755 index 000000000..caa29a6b9 --- /dev/null +++ b/images/macos/provision/configuration/autologin.sh @@ -0,0 +1,16 @@ +# This script was taken from https://github.com/timsutton/osx-vm-templates/blob/master/scripts/autologin.sh +# Distributed by MIT license, license can be found at the bottom of this script + +echo "Enabling automatic GUI login for the '$USERNAME' user.." + +python $HOME/bootstrap/kcpassword.py "$PASSWORD" + +/usr/bin/defaults write /Library/Preferences/com.apple.loginwindow autoLoginUser "$USERNAME" + +: ' +The MIT License (MIT) +Copyright (c) 2013-2017 Timothy Sutton +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +' \ No newline at end of file diff --git a/images/macos/provision/configuration/configure-hostname.sh b/images/macos/provision/configuration/configure-hostname.sh new file mode 100644 index 000000000..477e09807 --- /dev/null +++ b/images/macos/provision/configuration/configure-hostname.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +# Add script for changing hostname to run on startup to prevent duplicate hostnames across the environment. Hostname and Computername should contain .local in name to avoid name resolution issues +tee -a /usr/local/bin/change_hostname.sh > /dev/null <<\EOF +#!/bin/bash + +name="Mac-$(python -c 'from time import time; print int(round(time() * 1000))')" +scutil --set HostName "${name}.local" +scutil --set LocalHostName $name +scutil --set ComputerName "${name}.local" +EOF + +chmod +x "/usr/local/bin/change_hostname.sh" + +sudo tee -a /Library/LaunchDaemons/change_hostname.plist > /dev/null <<\EOF + + + + + Label + change-hostname + Program + /usr/local/bin/change_hostname.sh + RunAtLoad + + + +EOF \ No newline at end of file diff --git a/images/macos/provision/configuration/configure-machine.sh b/images/macos/provision/configuration/configure-machine.sh new file mode 100644 index 000000000..d34d7002a --- /dev/null +++ b/images/macos/provision/configuration/configure-machine.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +# Enable firewall. SSH and VNC opened. Can't did it at bootstrap step, so placed it here +defaults write /Library/Preferences/com.apple.alf globalstate -int 1 + +# Setting correct time zone +echo "Configuring system time to GMT..." +rm -f /etc/localtime +ln -sf /usr/share/zoneinfo/UTC /etc/localtime + +# https://developer.apple.com/documentation/webkit/testing_with_webdriver_in_safari +# Safari’s executable is located at /usr/bin/safaridriver +# Configure Safari to Enable WebDriver Support +sudo safaridriver --enable + +# Turn off hibernation and get rid of the sleepimage +sudo pmset hibernatemode 0 +sudo rm -f /var/vm/sleepimage + +# Change screen resolution to the maximum supported for 4Mb video memory +sudo "/Library/Application Support/VMware Tools/vmware-resolutionSet" 1176 885 \ No newline at end of file diff --git a/images/macos/provision/configuration/configure-ssh.sh b/images/macos/provision/configuration/configure-ssh.sh new file mode 100755 index 000000000..f85e9efa2 --- /dev/null +++ b/images/macos/provision/configuration/configure-ssh.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +[[ ! -d ~/.ssh ]] && mkdir ~/.ssh 2>/dev/null +chmod 777 ~/.ssh + +ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts +ssh-keyscan -t rsa ssh.dev.azure.com >> ~/.ssh/known_hosts diff --git a/images/macos/provision/configuration/disable-auto-updates.sh b/images/macos/provision/configuration/disable-auto-updates.sh new file mode 100755 index 000000000..3a35f5be7 --- /dev/null +++ b/images/macos/provision/configuration/disable-auto-updates.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +# Disabling automatic updates +sudo softwareupdate --schedule off +defaults write com.apple.SoftwareUpdate AutomaticDownload -int 0 +defaults write com.apple.SoftwareUpdate CriticalUpdateInstall -int 0 +defaults write com.apple.commerce AutoUpdate -bool false +defaults write com.apple.SoftwareUpdate AutomaticCheckEnabled -bool false \ No newline at end of file diff --git a/images/macos/provision/configuration/environment/bashprofile b/images/macos/provision/configuration/environment/bashprofile new file mode 100644 index 000000000..223689e83 --- /dev/null +++ b/images/macos/provision/configuration/environment/bashprofile @@ -0,0 +1 @@ +[ -f $HOME/.bashrc ] && source $HOME/.bashrc \ No newline at end of file diff --git a/images/macos/provision/configuration/environment/bashrc b/images/macos/provision/configuration/environment/bashrc new file mode 100644 index 000000000..26fd14327 --- /dev/null +++ b/images/macos/provision/configuration/environment/bashrc @@ -0,0 +1,32 @@ +export LC_CTYPE=en_US.UTF-8 +export LC_ALL=en_US.UTF-8 +export LANG=en_US.UTF-8 + +export ANDROID_HOME=${HOME}/Library/Android/sdk +export ANDROID_NDK_HOME=${ANDROID_HOME}/ndk-bundle + +export NUNIT_BASE_PATH=/Library/Developer/nunit +export NUNIT3_PATH=/Library/Developer/nunit/3.6.0 + +export CONDA=/usr/local/miniconda +export AGENT_TOOLSDIRECTORY=$HOME/hostedtoolcache +export RUNNER_TOOL_CACHE=$HOME/hostedtoolcache + +export PATH=/Library/Frameworks/Mono.framework/Versions/Current/Commands:$PATH +export PATH=$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools:$ANDROID_NDK_HOME:$PATH +export PATH=/usr/local/go/bin:$PATH +export PATH=/usr/local/bin:/usr/local/sbin:~/bin:~/.yarn/bin:$PATH +export PATH="/usr/local/opt/curl/bin:$PATH" +export PATH="/usr/local/opt/ruby/bin:$PATH" +GEM_PATH=`gem env|awk '/EXECUTABLE DIRECTORY/ {print $4}'` +export PATH="$GEM_PATH:$PATH" +export PATH=$HOME/.cargo/bin:$PATH + +export RCT_NO_LAUNCH_PACKAGER=1 +export DOTNET_ROOT=$HOME/.dotnet +export DOTNET_MULTILEVEL_LOOKUP=0 + +export HOMEBREW_NO_AUTO_UPDATE=1 +export HOMEBREW_CASK_OPTS="--no-quarantine" + +export BOOTSTRAP_HASKELL_NONINTERACTIVE=1 diff --git a/images/macos/provision/configuration/finalize-vm.sh b/images/macos/provision/configuration/finalize-vm.sh new file mode 100644 index 000000000..b01b3c232 --- /dev/null +++ b/images/macos/provision/configuration/finalize-vm.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +# Close all finder windows because they can interfere with UI tests +osascript -e 'tell application "Finder" to close windows' + +# Ignore available updates to prevent system pop-ups +updateName=$(softwareupdate -l | grep "Title: " | awk -F[:,] '{print $2}' | awk '{$1=$1};1') +if [ ! -z "$updateName" ]; then + sudo softwareupdate --ignore "$updateName" +fi + +# Put documentation to $HOME root +cp $HOME/image-generation/output/software-report/systeminfo.txt $HOME/image-generation/output/software-report/systeminfo.md $HOME/ + +# Clean up npm cache which collected during image-generation +# we have to do that here because `npm install` is run in a few different places during image-generation +npm cache clean --force + +# Clean up temporary directories +rm -rf ~/utils ~/image-generation \ No newline at end of file diff --git a/images/macos/provision/configuration/max-files.sh b/images/macos/provision/configuration/max-files.sh new file mode 100755 index 000000000..a6e41f120 --- /dev/null +++ b/images/macos/provision/configuration/max-files.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +set -e + +Launch_Daemons="/Library/LaunchDaemons" + +# EOF in quotes to disable variable expansion +echo "Creating limit.maxfiles.plist" +cat > "${Launch_Daemons}/limit.maxfiles.plist" << EOF + + + + + Label + limit.maxfiles + ProgramArguments + + launchctl + limit + maxfiles + 52428 + 524288 + + RunAtLoad + + ServiceIPC + + + +EOF + +echo "limit.maxfiles.plist permissions changing" +chown root:wheel "${Launch_Daemons}/limit.maxfiles.plist" +chmod 0644 "${Launch_Daemons}/limit.maxfiles.plist" + + +echo "Done, limit.maxfiles has been updated" + diff --git a/images/macos/provision/configuration/ntpconf.sh b/images/macos/provision/configuration/ntpconf.sh new file mode 100755 index 000000000..09916cc37 --- /dev/null +++ b/images/macos/provision/configuration/ntpconf.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +echo Additional NTP servers adding into /etc/ntp.conf file... +cat > /etc/ntp.conf << EOF +server 0.pool.ntp.org +server 1.pool.ntp.org +server 2.pool.ntp.org +server 3.pool.ntp.org +server time.apple.com +server time.windows.com +EOF + +# Set the timezone to UTC. +echo The Timezone setting to UTC... +ln -sf /usr/share/zoneinfo/UTC /etc/localtime diff --git a/images/macos/provision/configuration/preimagedata.sh b/images/macos/provision/configuration/preimagedata.sh new file mode 100644 index 000000000..c269a1492 --- /dev/null +++ b/images/macos/provision/configuration/preimagedata.sh @@ -0,0 +1,29 @@ +#!/bin/bash +source ~/utils/utils.sh + +imagedata_file="$HOME/imagedata.json" +image_version=$(echo $IMAGE_VERSION | cut -d _ -f 2) +os_name=$(sw_vers -productName) +os_version=$(sw_vers -productVersion) +os_build=$(sw_vers -buildVersion) +label_version=$(echo $os_version | cut -d. -f1,2) +image_label="macos-${label_version}" +software_url="https://github.com/actions/virtual-environments/blob/${image_label}/${image_version}/images/macos/${image_label}-Readme.md" + +if is_Catalina || is_BigSur; then + cat < $imagedata_file + [ + { + "group": "Operating System", + "detail": "${os_name}\n${os_version}\n${os_build}" + }, + { + "group": "Virtual Environment", + "detail": "Environment: ${image_label}\nVersion: ${image_version}\nIncluded Software: ${software_url}" + } + ] +EOF +fi + +echo "export ImageVersion=$image_version" >> $HOME/.bashrc +echo "export ImageOS=$IMAGE_OS" >> $HOME/.bashrc \ No newline at end of file diff --git a/images/macos/provision/configuration/screensaver-off.sh b/images/macos/provision/configuration/screensaver-off.sh new file mode 100755 index 000000000..c154f8d8f --- /dev/null +++ b/images/macos/provision/configuration/screensaver-off.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# set screensaver idleTime to 0, to prevent turning screensaver on +macUUID=`ioreg -rd1 -c IOPlatformExpertDevice | grep -i "UUID" | cut -c27-62` + +rm -rf /Users/$USERNAME/Library/Preferences/com.apple.screensaver.$macUUID.plist +rm -rf /Users/$USERNAME/Library/Preferences/ByHost/com.apple.screensaver.$macUUID.plist +rm -rf /Users/$USERNAME/Library/Preferences/com.apple.screensaver.plist +rm -rf /Users/$USERNAME/Library/Preferences/ByHost/com.apple.screensaver.plist + +defaults write /Users/$USERNAME/Library/Preferences/com.apple.screensaver.$macUUID.plist idleTime -string 0 +defaults write /Users/$USERNAME/Library/Preferences/com.apple.screensaver.$macUUID.plist CleanExit "YES" +defaults write /Users/$USERNAME/Library/Preferences/ByHost/com.apple.screensaver.$macUUID.plist idleTime -string 0 +defaults write /Users/$USERNAME/Library/Preferences/ByHost/com.apple.screensaver.$macUUID.plist CleanExit "YES" +defaults write /Users/$USERNAME/Library/Preferences/com.apple.screensaver.plist idleTime -string 0 +defaults write /Users/$USERNAME/Library/Preferences/com.apple.screensaver.plist CleanExit "YES" +defaults write /Users/$USERNAME/Library/Preferences/ByHost/com.apple.screensaver.plist idleTime -string 0 +defaults write /Users/$USERNAME/Library/Preferences/ByHost/com.apple.screensaver.plist CleanExit "YES" + +chown -R $USERNAME:staff /Users/$USERNAME/Library/Preferences/ByHost/ +chown -R $USERNAME:staff /Users/$USERNAME/Library/Preferences/ + +killall cfprefsd + +# Set values to 0, to prevent sleep at all +pmset -a displaysleep 0 sleep 0 disksleep 0 diff --git a/images/macos/provision/configuration/shell-change.sh b/images/macos/provision/configuration/shell-change.sh new file mode 100644 index 000000000..a84216cbb --- /dev/null +++ b/images/macos/provision/configuration/shell-change.sh @@ -0,0 +1,3 @@ +echo "Changing shell to bash" +sudo chsh -s /bin/bash $USERNAME +sudo chsh -s /bin/bash root \ No newline at end of file diff --git a/images/macos/provision/core/android-toolsets.sh b/images/macos/provision/core/android-toolsets.sh new file mode 100755 index 000000000..a3b8aa97f --- /dev/null +++ b/images/macos/provision/core/android-toolsets.sh @@ -0,0 +1,92 @@ +#!/bin/bash -e +source ~/utils/utils.sh + +ANDROID_PLATFORM_LIST=($(get_toolset_value '.android."platform-list"[]')) +ANDROID_BUILD_TOOLS=($(get_toolset_value '.android."build-tools"[]')) +ANDROID_EXTRA_LIST=($(get_toolset_value '.android."extra-list"[]')) +ANDROID_ADDON_LIST=($(get_toolset_value '.android."addon-list"[]')) + +# Get the latest command line tools from https://developer.android.com/studio/index.html +# Release note: https://developer.android.com/studio/releases/sdk-tools.html +ANDROID_OSX_SDK_LOCATION="https://dl.google.com/android/repository/sdk-tools-darwin-3859397.zip" +ANDROID_HOME=$HOME/Library/Android/sdk +ANDROID_OSX_SDK_FILE=tools-macosx.zip + +pushd $HOME + +# Prevent the warning of sdkmanager +mkdir $HOME/.android +echo "count=0" >> $HOME/.android/repositories.cfg + +echo "Downloading android sdk..." +curl -L -o $ANDROID_OSX_SDK_FILE $ANDROID_OSX_SDK_LOCATION + +echo "Uncompressing android sdk..." +unzip -q $ANDROID_OSX_SDK_FILE && rm -f $ANDROID_OSX_SDK_FILE +rm -rf $HOME/Library/Android/sdk +mkdir -p $HOME/Library/Android/sdk + +echo ANDROID_HOME is $ANDROID_HOME +mv tools $ANDROID_HOME + +export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/tools/bin + +SDKMANAGER=$ANDROID_HOME/tools/bin/sdkmanager + +# Mark the different Android licenses as accepted +mkdir -p $ANDROID_HOME/licenses +echo "8933bad161af4178b1185d1a37fbf41ea5269c55 +d56f5187479451eabf01fb78af6dfcb131a6481e" >> $ANDROID_HOME/licenses/android-sdk-license +echo "84831b9409646a918e30573bab4c9c91346d8abd" >> $ANDROID_HOME/licenses/android-sdk-preview-license + +echo "Installing latest tools & platform tools..." +echo y | $SDKMANAGER "tools" "platform-tools" + +echo "Installing latest CMake..." +echo y | $SDKMANAGER "cmake;3.6.4111459" + +echo "Installing latest ndk..." +echo y | $SDKMANAGER "ndk-bundle" + +for platform_name in "${ANDROID_PLATFORM_LIST[@]}" +do + echo "Installing platform $platform_name ..." + echo y | $SDKMANAGER "platforms;$platform_name" +done + +for build_tools_version in "${ANDROID_BUILD_TOOLS[@]}" +do + echo "Installing build tools $build_tools_version ..." + echo y | $SDKMANAGER "build-tools;$build_tools_version" +done + +for extra_name in "${ANDROID_EXTRA_LIST[@]}" +do + echo "Installing extra $extra_name ..." + echo y | $SDKMANAGER "extras;$extra_name" +done + +# Intel x86 Emulator Accelerator (HAXM installer) +# see Issue 31164 notes +# Command needs to be run under sudo. +chmod +x $ANDROID_HOME/extras/intel/Hardware_Accelerated_Execution_Manager/silent_install.sh +sudo $ANDROID_HOME/extras/intel/Hardware_Accelerated_Execution_Manager/silent_install.sh + +for addon_name in "${ANDROID_ADDON_LIST[@]}" +do + echo "Installing add-on $addon_name ..." + echo y | $SDKMANAGER "add-ons;$addon_name" +done + +popd + +echo "Installing ProGuard-5..." +PROGUARD_LOCATION="https://github.com/Guardsquare/proguard/archive/proguard5.3.3.tar.gz" +pushd $ANDROID_HOME +cd tools +mv proguard proguard4 +mkdir proguard && cd proguard +curl -L -o proguard5.tgz $PROGUARD_LOCATION +tar xzf proguard5.tgz --strip 1 && rm -f proguard5.tgz +cp ../proguard4/proguard-*.txt . # Copy the Proguard Android definitions from the previous version +popd diff --git a/images/macos/provision/core/audiodevice.sh b/images/macos/provision/core/audiodevice.sh new file mode 100644 index 000000000..705490de2 --- /dev/null +++ b/images/macos/provision/core/audiodevice.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +echo "install soundflower" +brew cask install soundflower + +echo "install switchaudio-osx" +brew install switchaudio-osx + +echo "install sox" +brew install sox + +echo "set Soundflower (2ch) as input/output device" +SwitchAudioSource -s "Soundflower (2ch)" -t input +SwitchAudioSource -s "Soundflower (2ch)" -t output + +echo "grant microphone permission for simulators" +sudo sqlite3 ~/Library/Application\ Support/com.apple.TCC/TCC.db "insert into access values('kTCCServiceMicrophone','com.apple.CoreSimulator.SimulatorTrampoline', 0,1,1,NULL,NULL,NULL,'UNUSED',NULL,NULL,1576347152)" +sudo sqlite3 /Library/Application\ Support/com.apple.TCC/TCC.db "insert into access values('kTCCServiceMicrophone','/usr/local/opt/runner/runprovisioner.sh', 1,1,1,NULL,NULL,NULL,'UNUSED',NULL,NULL,1576661342)" +sudo sqlite3 ~/Library/Application\ Support/com.apple.TCC/TCC.db "insert into access values('kTCCServiceMicrophone','/usr/local/opt/runner/runprovisioner.sh', 1,1,1,NULL,NULL,NULL,'UNUSED',NULL,NULL,1576661342)" diff --git a/images/macos/provision/core/aws.sh b/images/macos/provision/core/aws.sh new file mode 100644 index 000000000..9e0063be1 --- /dev/null +++ b/images/macos/provision/core/aws.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +echo Installing aws... +brew install awscli + +echo Installing aws sam cli... +brew tap aws/tap +brew install aws-sam-cli + +echo "Install aws cli session manager" +brew cask install session-manager-plugin diff --git a/images/macos/provision/core/azcopy.sh b/images/macos/provision/core/azcopy.sh new file mode 100755 index 000000000..56b848e92 --- /dev/null +++ b/images/macos/provision/core/azcopy.sh @@ -0,0 +1,13 @@ +#!/bin/bash +set -e + +AZCOPY_DOWNLOAD_URL="https://aka.ms/downloadazcopy-v10-mac" + +wget -O "$HOME/azcopy.zip" "$AZCOPY_DOWNLOAD_URL" +unzip azcopy.zip -d azcopy +AZCOPY_EXTRACTED=$(echo azcopy/azcopy*) +cp "$AZCOPY_EXTRACTED/azcopy" "/usr/local/bin/azcopy" +chmod +x "/usr/local/bin/azcopy" + +echo "Done, cleaning up" +rm -rf azcopy* diff --git a/images/macos/provision/core/build-xcode-symlinks.sh b/images/macos/provision/core/build-xcode-symlinks.sh new file mode 100644 index 000000000..0cee8df88 --- /dev/null +++ b/images/macos/provision/core/build-xcode-symlinks.sh @@ -0,0 +1,20 @@ +set -e + +source ~/utils/utils.sh + +# Link the existing Xcodes into the correct location for provisionator. + +# These symlinks are necessary for Xamarin team to make sure that xamarin-provisionator can find them. + +# Old style provisionator directories. This is maintained for +# backwards compatibility only. Do not add new xcodes here. +ln -sf /Applications/Xcode_8.app /Applications/Xcode8.app +ln -sf /Applications/Xcode_8.1.app /Applications/Xcode81.app +ln -sf /Applications/Xcode_9.app /Applications/Xcode9.app +ln -sf /Applications/Xcode_9.1.app /Applications/Xcode91.app +ln -sf /Applications/Xcode_9.2.app /Applications/Xcode92.app +ln -sf /Applications/Xcode_9.3.app /Applications/Xcode93.app +ln -sf /Applications/Xcode_9.3.app /Applications/Xcode_9.3_beta.app +ln -sf /Applications/Xcode_9.4.app /Applications/Xcode_9.4-beta.app +ln -sf /Applications/Xcode_9.4.app /Applications/Xcode_9.4_beta.app +ln -sf /Applications/Xcode_9.4.app /Applications/Xcode_9.4_beta_2.app \ No newline at end of file diff --git a/images/macos/provision/core/chrome.sh b/images/macos/provision/core/chrome.sh new file mode 100644 index 000000000..203faee74 --- /dev/null +++ b/images/macos/provision/core/chrome.sh @@ -0,0 +1,11 @@ +echo "Installing Chrome..." +brew cask install google-chrome + +echo "Installing Chrome Driver" +brew cask install chromedriver + +echo "Installing Selenium" +brew install selenium-server-standalone + +CHROMEWEBDRIVER_DIR=$(readlink $(which chromedriver) | xargs dirname) +echo "export CHROMEWEBDRIVER=$CHROMEWEBDRIVER_DIR" >> "${HOME}/.bashrc" \ No newline at end of file diff --git a/images/macos/provision/core/cocoapods.sh b/images/macos/provision/core/cocoapods.sh new file mode 100755 index 000000000..edf2a85f2 --- /dev/null +++ b/images/macos/provision/core/cocoapods.sh @@ -0,0 +1,9 @@ +#!/bin/sh +echo "Installing Cocoapods..." + +# Setup the Cocoapods master repo +echo Setting up the Cocoapods master repository... +pod setup + +# Create a symlink to /usr/local/bin since it was removed due to Homebrew change. +ln -sf $(which pod) /usr/local/bin/pod \ No newline at end of file diff --git a/images/macos/provision/core/commonutils.sh b/images/macos/provision/core/commonutils.sh new file mode 100644 index 000000000..efa4d0160 --- /dev/null +++ b/images/macos/provision/core/commonutils.sh @@ -0,0 +1,53 @@ +#!/bin/sh + +set -e + +source ~/utils/utils.sh +# brew install +binst_common_utils=( + carthage + xctool + cmake + bats + parallel + subversion + go + gnupg + llvm + libpq + zstd + packer + helm + aliyun-cli + bazelisk + github/gh/gh + p7zip + ant + yamllint + aria2 +) + +for package in ${binst_common_utils[@]}; do + echo "Install $package" + brew install $package +done + +# brew cask install +bcask_common_utils=( + julia + virtualbox + vagrant + r +) + +for package in ${bcask_common_utils[@]}; do + echo "Install $package" + brew cask install $package +done + +if ! is_HighSierra; then + brew install swiftlint +fi + +# Invoke bazel to download the latest bazel version via bazelisk +bazel diff --git a/images/macos/provision/core/delete-duplicate-sims.rb b/images/macos/provision/core/delete-duplicate-sims.rb new file mode 100644 index 000000000..d7ee50a13 --- /dev/null +++ b/images/macos/provision/core/delete-duplicate-sims.rb @@ -0,0 +1,155 @@ +#!/usr/bin/env ruby + +# What is this for? +# This script fixes an issue appeared for some Xcode users where it would show long identifiers +# in the list of simulators instead of usual short names. This is caused by duplicate simulators +# being sometimes created after switching between Xcode versions, with the same +# device type + runtime pair occurring more than once in your list of available simulators. +# Instead of showing the same simulator name twice, Xcode defaults to simulator identifiers. +# +# What it does? +# The script queries Xcode's `simctl` utility for all simulators you have, finds duplicate type + runtime pairs, +# and offers you to delete them. After that, Xcode should return to displaying the list of simulators normally. +# When searching for duplicates, the script sorts simulators by their creation time to make sure it deletes +# the copy that was created more recently. +# +# License +# This script was taken from https://gist.github.com/vlas-voloshin/f9982128200345cd3fb7 and some modifications made +# Distributed by MIT license, license can be found at the bottom of this script + +class SimDevice + + attr_accessor :runtime + attr_accessor :name + attr_accessor :identifier + attr_accessor :timestamp + + def initialize(runtime, name, identifier, timestamp) + @runtime = runtime + @name = name + @identifier = identifier + @timestamp = timestamp + end + + def to_s + return "#{@name} - #{@runtime} (#{@identifier}) [#{@timestamp}]" + end + + def equivalent_to_device(device) + return @runtime == device.runtime && @name == device.name + end + + end + + # Executes a shell command and returns the result from stdout + def execute_simctl_command(command) + return %x[xcrun simctl #{command}] + end + + # Retrieves the creation date/time of simulator with specified identifier + def simulator_creation_date(identifier) + directory = Dir.home() + "/Library/Developer/CoreSimulator/Devices/" + identifier + if (Dir.exists?(directory)) + if (File::Stat.method_defined?(:birthtime)) + return File.stat(directory).birthtime + else + return File.stat(directory).ctime + end + else + # Simulator directory is not yet created - treat it as if it was created right now (happens with new iOS 9 sims) + return Time.now + end + end + + # Deletes specified simulator + def delete_device(device) + execute_simctl_command("delete #{device.identifier}") + end + + puts("Searching for simulators...") + + # Retrieve the list of existing simulators + devices = [] + runtime = "" + execute_simctl_command("list devices").lines.each do |line| + case line[0] + when '=' + # First header, skip it + when '-' + # Runtime header + runtime = line.scan(/-- (.+?) --/).flatten[0] + else + name_and_identifier = line.scan(/\s+(.+?) \(([\w\d]+-[\w\d]+-[\w\d-]+)\)/)[0] + name = name_and_identifier[0] + identifier = name_and_identifier[1] + timestamp = simulator_creation_date(identifier) + device = SimDevice.new(runtime, name, identifier, timestamp) + devices.push(device) + end + end + + # Sort the simulators by their creation timestamp, ascending + devices = devices.sort { |a, b| a.timestamp <=> b.timestamp } + + duplicates = {} + # Enumerate all devices except for the last one + for i in 0..devices.count-2 + device = devices[i] + # Enumerate all devices *after* this one (created *later*) + for j in i+1..devices.count-1 + potential_duplicate = devices[j] + if potential_duplicate.equivalent_to_device(device) + duplicates[potential_duplicate] = device + # Break out of the inner loop if a duplicate is found - if another duplicate exists, + # it will be found when this one is reached in the outer loop + break + end + end + end + + if duplicates.count == 0 + puts("You don't have duplicate simulators!") + exit() + end + + puts("Looks like you have #{duplicates.count} duplicate simulator#{duplicates.count > 1 ? "s" : ""}:") + duplicates.each_pair do |duplicate, original| + puts + puts("#{duplicate}") + puts("--- duplicate of ---") + puts("#{original}") + end + puts + + puts("Each duplicate was determined as the one created later than the 'original'.") + + puts("Deleting...") + duplicates.each_key do |duplicate| + delete_device(duplicate) + end + + puts("Done!") + +=begin +MIT License + +Copyright (c) 2015-2019 Vlas Voloshin + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +=end \ No newline at end of file diff --git a/images/macos/provision/core/dotnet.sh b/images/macos/provision/core/dotnet.sh new file mode 100755 index 000000000..4e8f7dfaa --- /dev/null +++ b/images/macos/provision/core/dotnet.sh @@ -0,0 +1,68 @@ +#!/bin/sh + +########################################################################### +# The main idea of this script is to automate dotnet installs +# Based on: +# https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-install-script +# +########################################################################### + +source ~/utils/utils.sh + +export DOTNET_CLI_TELEMETRY_OPTOUT=1 + +# Download installer from dot.net and keep it locally +DOTNET_INSTALL_SCRIPT="https://dotnet.microsoft.com/download/dotnet-core/scripts/v1/dotnet-install.sh" +curl -o "dotnet-install.sh" "$DOTNET_INSTALL_SCRIPT" +chmod +x ./dotnet-install.sh + +ARGS_LIST=() +echo "Parsing dotnet SDK (except rc and preview versions) from .json..." + +if is_Less_Catalina; then + DOTNET_CHANNELS=( + 'https://raw.githubusercontent.com/dotnet/core/master/release-notes/2.1/releases.json' + ) +else + DOTNET_CHANNELS=( + 'https://raw.githubusercontent.com/dotnet/core/master/release-notes/2.1/releases.json' + 'https://raw.githubusercontent.com/dotnet/core/master/release-notes/3.0/releases.json' + 'https://raw.githubusercontent.com/dotnet/core/master/release-notes/3.1/releases.json' + ) +fi + +for DOTNET_CHANNEL in "${DOTNET_CHANNELS[@]}"; do + # Old Mono versions don't support NuGet versions from .Net sdk >=2.1.6**, exclude them explicitly from Mojave and HS images + # https://rider-support.jetbrains.com/hc/en-us/articles/360004180039 + if is_Less_Catalina; then + ARGS_LIST+=( + $(curl -s "$DOTNET_CHANNEL" | \ + jq -r '.releases[].sdk."version"' | grep -v -E '\-(preview|rc)\d*' | grep -v -E '2.1.[6-9]\d*') + ) + else + ARGS_LIST+=( + $(curl -s "$DOTNET_CHANNEL" | \ + jq -r '.releases[].sdk."version"' | grep -v -E '\-(preview|rc)\d*') + ) + fi +done + +for ARGS in "${ARGS_LIST[@]}"; do + ./dotnet-install.sh --version $ARGS -NoPath +done + +rm ./dotnet-install.sh + +# dotnet installer doesn't create symlink to executable in /user/local/bin +# Moreover at that moment /user/local/bin doesn't exist (though already added to $PATH) +ln -s ~/.dotnet/dotnet /usr/local/bin/dotnet + +# Validate installation +if [ $(dotnet --list-sdks | wc -l) -lt "1" ]; then + echo "The .NET Core SDK is not installed" + exit 1 +fi + +echo 'export PATH="$PATH:$HOME/.dotnet/tools"' >> "$HOME/.bashrc" + +echo "Dotnet operations have been completed successfully..." diff --git a/images/macos/provision/core/edge.sh b/images/macos/provision/core/edge.sh new file mode 100644 index 000000000..81219f680 --- /dev/null +++ b/images/macos/provision/core/edge.sh @@ -0,0 +1,58 @@ +source ~/utils/utils.sh + +echo "Installing Microsoft Edge..." +brew cask install microsoft-edge + +EDGE_INSTALLATION_PATH="/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge" +EDGE_VERSION=$("$EDGE_INSTALLATION_PATH" --version | cut -d' ' -f 3) +EDGE_VERSION_MAJOR=$(echo $EDGE_VERSION | cut -d'.' -f 1) + +echo "Version of Microsoft Edge: ${EDGE_VERSION}" + +echo "Installing Microsoft Edge WebDriver..." + +EDGE_DRIVER_VERSION_URL="https://msedgedriver.azureedge.net/LATEST_RELEASE_${EDGE_VERSION_MAJOR}" +EDGE_DRIVER_LATEST_VERSION=$(curl -s "$EDGE_DRIVER_VERSION_URL" | iconv -f utf-16 -t utf-8 | tr -d '\r') +EDGE_DRIVER_URL="https://msedgedriver.azureedge.net/${EDGE_DRIVER_LATEST_VERSION}/edgedriver_mac64.zip" + +echo "Compatible version of WebDriver: ${EDGE_DRIVER_LATEST_VERSION}" + +pushd "/tmp" > /dev/null +download_with_retries $EDGE_DRIVER_URL "." "edgedriver.zip" + +# Move webdriver to the separate directory to be consistent with the docs +# https://docs.microsoft.com/en-us/azure/devops/pipelines/test/continuous-test-selenium?view=azure-devops#decide-how-you-will-deploy-and-test-your-app + +APPLICATION="/usr/local/bin/msedgedriver" +EDGEDRIVER_DIR="/usr/local/share/edge_driver" +EDGEDRIVER_BIN="$EDGEDRIVER_DIR/msedgedriver" + +mkdir -p $EDGEDRIVER_DIR + +unzip "edgedriver.zip" -d $EDGEDRIVER_DIR +ln -s "$EDGEDRIVER_BIN" $APPLICATION +echo "export EDGEWEBDRIVER=${EDGEDRIVER_DIR}" >> "${HOME}/.bashrc" +popd > /dev/null + +#Delete Microsoft autoupdate service to prevent autoupdates popup +AUTOUPDATE_START="$HOME/Library/Preferences/com.microsoft.autoupdate2.plist" +while [ ! -f "$AUTOUPDATE_START" ] +do + echo "Wait for MS update automatic installation" + sleep 30 +done + +echo "kill autoupdate process" +ps -ef | grep [M]icrosoft | awk '{print $2}' | sudo xargs kill -9 +echo "remove autupdate service" +sudo launchctl remove com.microsoft.autoupdate.helper + +echo "delete autoupdate files" +sudo rm -rf "$HOME/Library/Application Support/Microsoft AU Daemon/" +sudo rm -rf "$HOME/Library/Application Support/Microsoft AutoUpdate/" +sudo rm -rf "$HOME/Library/Preferences/com.microsoft.autoupdate2.plist" +sudo rm -rf "$HOME/Library/Preferences/com.microsoft.autoupdate.fba.plist" +sudo rm -rf "$HOME/Library/Caches/com.microsoft.autoupdate2" +sudo rm -rf "/Library/Application Support/Microsoft/MAU2.0/" +sudo rm -rf "/Library/LaunchAgents/com.microsoft.update.agent.plist" +sudo rm -rf "/Library/PrivelegedHelperTools/com.microsoft.autoupdate.helper" diff --git a/images/macos/provision/core/firefox.sh b/images/macos/provision/core/firefox.sh new file mode 100644 index 000000000..f6a90d619 --- /dev/null +++ b/images/macos/provision/core/firefox.sh @@ -0,0 +1,8 @@ +echo "Installing Firefox..." +brew cask install firefox + +echo "Installing Geckodriver..." +brew install geckodriver + +echo "Add GECKOWEBDRIVER to bashrc..." +echo "export GECKOWEBDRIVER=$(brew --prefix geckodriver)/bin" >> "${HOME}/.bashrc" \ No newline at end of file diff --git a/images/macos/provision/core/gcc.sh b/images/macos/provision/core/gcc.sh new file mode 100644 index 000000000..febc0760c --- /dev/null +++ b/images/macos/provision/core/gcc.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +echo "Installing GCC@8 using homebrew..." +brew install gcc@8 + +echo "Installing GCC@9 using homebrew..." +brew install gcc@9 \ No newline at end of file diff --git a/images/macos/provision/core/git.sh b/images/macos/provision/core/git.sh new file mode 100644 index 000000000..55feb92b0 --- /dev/null +++ b/images/macos/provision/core/git.sh @@ -0,0 +1,28 @@ +echo Installing Git... +brew install git + +echo Installing Git LFS +brew install git-lfs +# Update global git config +git lfs install +# Update system git config +sudo git lfs install --system + +echo Installing Hub +brew install hub + +echo Disable all the Git help messages... +git config --global advice.pushUpdateRejected false +git config --global advice.pushNonFFCurrent false +git config --global advice.pushNonFFMatching false +git config --global advice.pushAlreadyExists false +git config --global advice.pushFetchFirst false +git config --global advice.pushNeedsForce false +git config --global advice.statusHints false +git config --global advice.statusUoption false +git config --global advice.commitBeforeMerge false +git config --global advice.resolveConflict false +git config --global advice.implicitIdentity false +git config --global advice.detachedHead false +git config --global advice.amWorkDir false +git config --global advice.rmHints false \ No newline at end of file diff --git a/images/macos/provision/core/haskell.sh b/images/macos/provision/core/haskell.sh new file mode 100644 index 000000000..1c272b435 --- /dev/null +++ b/images/macos/provision/core/haskell.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh +export PATH="$HOME/.ghcup/bin:$PATH" +echo 'export PATH="$PATH:$HOME/.ghcup/bin"' >> "$HOME/.bashrc" + +availableVersions=$(ghcup list | grep "ghc " | awk '{print $3}') +minorMajorVersions=$(echo "$availableVersions" | cut -d"." -f 1,2 | uniq | tail -n3) +for majorMinorVersion in $minorMajorVersions; do + fullVersion=$(echo "$availableVersions" | grep "$majorMinorVersion." | tail -n1) + echo "install ghc version $fullVersion..." + ghcup install $fullVersion + ghcup set $fullVersion +done + +echo "install cabal..." +ghcup install-cabal diff --git a/images/macos/provision/core/homebrew.sh b/images/macos/provision/core/homebrew.sh new file mode 100755 index 000000000..01b0fb0f3 --- /dev/null +++ b/images/macos/provision/core/homebrew.sh @@ -0,0 +1,24 @@ +#!/bin/sh +echo "Installing Homebrew..." + +source ~/utils/utils.sh + +echo Installing Homebrew... +HOMEBREW_INSTALL_URL="https://raw.githubusercontent.com/Homebrew/install/master/install.sh" + +/bin/bash -c "$(curl -fsSL ${HOMEBREW_INSTALL_URL})" + +echo Disabling Homebrew analytics... +brew analytics off + +echo Installing the last version of curl +brew install curl + +echo Installing wget... +brew install wget + +echo Installing jq +brew install jq + +# init brew bundle feature +brew tap Homebrew/bundle \ No newline at end of file diff --git a/images/macos/provision/core/miniconda.sh b/images/macos/provision/core/miniconda.sh new file mode 100644 index 000000000..b214b352e --- /dev/null +++ b/images/macos/provision/core/miniconda.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +MINICONDA_INSTALLER="/tmp/miniconda.sh" +curl -sL https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -o $MINICONDA_INSTALLER +chmod +x $MINICONDA_INSTALLER +sudo $MINICONDA_INSTALLER -b -p /usr/local/miniconda + +sudo ln -s /usr/local/miniconda/bin/conda /usr/local/bin/conda + +if [ -d "$HOME/.conda" ]; then + sudo chown -R $USER "$HOME/.conda" +fi \ No newline at end of file diff --git a/images/macos/provision/core/mongodb.sh b/images/macos/provision/core/mongodb.sh new file mode 100644 index 000000000..1b6a5a8d9 --- /dev/null +++ b/images/macos/provision/core/mongodb.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +# MongoDB object-value database +# installs last version of MongoDB Community Edition +# https://docs.mongodb.com/manual/tutorial/install-mongodb-on-os-x/v + +echo "Installing mongodb..." + +brew tap mongodb/brew +brew install mongodb-community \ No newline at end of file diff --git a/images/macos/provision/core/node.sh b/images/macos/provision/core/node.sh new file mode 100644 index 000000000..f5bb099f7 --- /dev/null +++ b/images/macos/provision/core/node.sh @@ -0,0 +1,45 @@ +source ~/utils/utils.sh + +node_common_modules=( + node-gyp + mobile-center-cli +) + +node_catalina_modules=( + appcenter-cli + newman +) + +if is_Less_Catalina; then + echo Installing the latest Node JS 8... + TMP_FILE=/tmp/node-v8.17.0.pkg + NODEURL=https://nodejs.org/dist/latest-v8.x/node-v8.17.0.pkg + curl "${NODEURL}" -o "${TMP_FILE}" + sudo installer -pkg "${TMP_FILE}" -target / + rm -rf "${TMP_FILE}" + sudo chown -R $USER "/usr/local/lib/node_modules" + + echo Installing NPM 3.x.x... + npm install -g npm@3 + npm config set prefix /usr/local + + echo Installing App Center CLI... + npm install -g appcenter-cli@^1.0.0 +else + # Install Node.JS 12 for macOS >= 10.15 + brew install node@12 + brew link node@12 --force + + for module in ${node_catalina_modules[@]}; do + echo "Install $module" + npm install -g $module + done +fi + +echo Installing yarn... +curl -o- -L https://yarnpkg.com/install.sh | bash + +for module in ${node_common_modules[@]}; do + echo "Install $module" + npm install -g $module +done diff --git a/images/macos/provision/core/nvm.sh b/images/macos/provision/core/nvm.sh new file mode 100755 index 000000000..544bf2a32 --- /dev/null +++ b/images/macos/provision/core/nvm.sh @@ -0,0 +1,35 @@ +#!/bin/sh + +########################################################################### +# The script installs node version manager with node versions 6,8,10 and 12 +# +########################################################################### +source ~/utils/utils.sh + +curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.35.3/install.sh | bash + +if [ $? -eq 0 ]; then + . ~/.bashrc + nvm --version + nvm install lts/boron # 6.x + nvm install lts/carbon # 8.x + nvm install lts/dubnium # 10.x + nvm install lts/erbium # 12.x + nvm install v13 # 13.x + nvm install v14 # 14.x + nvm alias node6 lts/boron + nvm alias node8 lts/carbon + nvm alias node10 lts/dubnium + nvm alias node12 lts/erbium + nvm alias node13 v13 + nvm alias node14 v14 + + if is_Catalina || is_BigSur; then + # set system node as default + nvm alias default system + fi +else + echo error +fi + +echo "Node version manager has been installed successfully" diff --git a/images/macos/provision/core/openjdk.sh b/images/macos/provision/core/openjdk.sh new file mode 100644 index 000000000..ca2c5f017 --- /dev/null +++ b/images/macos/provision/core/openjdk.sh @@ -0,0 +1,53 @@ +#!/bin/sh + +set -e + +source ~/utils/utils.sh + +installAzulJDK() { + local URL=$1 + local TMP_FILE=/tmp/openjdk.dmg + local TMP_MOUNT=`/usr/bin/mktemp -d /tmp/zulu.XXXX` + # Download dmg + curl "${URL}" -o "${TMP_FILE}" + # Attach dmg + hdiutil attach "${TMP_FILE}" -mountpoint "${TMP_MOUNT}" + # Install pkg + sudo installer -pkg "${TMP_MOUNT}/"*.pkg -target / + # Detach dmg + hdiutil detach "${TMP_MOUNT}" + # Remove dmg + rm -rf "${TMP_FILE}" +} + +createEnvironmentVariable() { + local VARIABLE_NAME=$1 + local JAVA_VERSION=$2 + if [[ $JAVA_VERSION == "7" || $JAVA_VERSION == "8" ]]; then + JAVA_VERSION="1.${JAVA_VERSION}" + fi + local JAVA_PATH=$(/usr/libexec/java_home -v${JAVA_VERSION}) + echo "export ${VARIABLE_NAME}=${JAVA_PATH}" >> "${HOME}/.bashrc" +} + +brew tap AdoptOpenJDK/openjdk + +JAVA_VERSIONS_LIST=($(get_toolset_value '.java.versions | .[]')) +JAVA_DEFAULT=$(get_toolset_value '.java.default') +for JAVA_VERSION in "${JAVA_VERSIONS_LIST[@]}" +do + if [[ $JAVA_VERSION == "7" ]]; then + installAzulJDK "https://cdn.azul.com/zulu/bin/zulu7.40.0.15-ca-jdk7.0.272-macosx_x64.dmg" + else + brew cask install "adoptopenjdk${JAVA_VERSION}" + fi + createEnvironmentVariable "JAVA_HOME_${JAVA_VERSION}_X64" $JAVA_VERSION +done + +createEnvironmentVariable "JAVA_HOME" $JAVA_DEFAULT + +echo Installing Maven... +brew install maven + +echo Installing Gradle ... +brew install gradle \ No newline at end of file diff --git a/images/macos/provision/core/openssl.sh b/images/macos/provision/core/openssl.sh new file mode 100755 index 000000000..7a0f3844c --- /dev/null +++ b/images/macos/provision/core/openssl.sh @@ -0,0 +1,21 @@ +#!/bin/sh +echo "Installing OpenSSL..." +export PATH="/usr/local/bin:/usr/local/sbin:~/bin:$PATH" + +echo Installing OpenSSL... +/usr/local/bin/brew install openssl +/usr/local/bin/brew link openssl --force + +# Install OpenSSL 1.0.2t +# https://www.openssl.org/policies/releasestrat.html - Version 1.0.2 will be supported until 2019-12-31 (LTS) +# To preserve backward compatibility with ruby-toolcache +brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/8b9d6d688f483a0f33fcfc93d433de501b9c3513/Formula/openssl.rb + +# Set OpenSSL 1.0.2t as default +ln -sf /usr/local/Cellar/openssl/1.*/bin/openssl /usr/local/bin/openssl + +# Resolve dot net core openssl dependency issue for agent +# https://github.com/microsoft/azure-pipelines-agent/blob/master/docs/start/envosx.md +mkdir -p /usr/local/lib/ +ln -s /usr/local/opt/openssl*/lib/libcrypto.1.0.*.dylib /usr/local/lib/ +ln -s /usr/local/opt/openssl*/lib/libssl.1.0.*.dylib /usr/local/lib/ \ No newline at end of file diff --git a/images/macos/provision/core/php.sh b/images/macos/provision/core/php.sh new file mode 100644 index 000000000..08c19f942 --- /dev/null +++ b/images/macos/provision/core/php.sh @@ -0,0 +1,8 @@ +#!/bin/sh +set -e + +echo Installing PHP +brew install php + +echo Installing composer +brew install composer \ No newline at end of file diff --git a/images/macos/provision/core/postgresql.sh b/images/macos/provision/core/postgresql.sh new file mode 100644 index 000000000..f69e078aa --- /dev/null +++ b/images/macos/provision/core/postgresql.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +#Install latest version of postgresql +brew install postgres + +#Service postgresql should be started before use. +brew services start postgresql + +#Verify that PostgreSQL is ready for accept incoming connections. +# exit codes: +# ready - 0 +# reject - 1 +# connection timeout - 2 +# incorrect credentials or parameters - 3 +pg_isready + +#Stop postgresql +brew services stop postgresql \ No newline at end of file diff --git a/images/macos/provision/core/powershell.sh b/images/macos/provision/core/powershell.sh new file mode 100644 index 000000000..5717adc74 --- /dev/null +++ b/images/macos/provision/core/powershell.sh @@ -0,0 +1,34 @@ +source ~/utils/utils.sh + +echo Installing Azure CLI... +brew install azure-cli + +echo Installing PowerShell... +brew cask install powershell + +# A dummy call of `az` to initialize ~/.azure directory before the modules are installed +az -v + +# Install PowerShell modules +psModules=$(get_toolset_value '.powershellModules[].name') +for module in ${psModules[@]}; do + echo "Installing $module module" + moduleVersions="$(get_toolset_value ".powershellModules[] | select(.name==\"$module\") | .versions[]?")" + if [[ -z "$moduleVersions" ]];then + pwsh -command "& {Install-Module $module -Force -Scope AllUsers}" + else + for version in ${moduleVersions[@]}; do + echo " - $version" + pwsh -command "& {Install-Module $module -RequiredVersion $version -Force -Scope AllUsers}" + done + fi +done + +# Enables AzureRm prefix aliases for Az modules +sudo pwsh -command "& {Import-Module Az; Enable-AzureRmAlias -Scope LocalMachine}" + +# powershell link was removed in powershell-6.0.0-beta9 +sudo ln -s /usr/local/bin/pwsh /usr/local/bin/powershell + +# fix ~/.azure directory permissions +sudo chown -R ${USER}: $HOME/.azure \ No newline at end of file diff --git a/images/macos/provision/core/pypy.sh b/images/macos/provision/core/pypy.sh new file mode 100644 index 000000000..a57f0ebb0 --- /dev/null +++ b/images/macos/provision/core/pypy.sh @@ -0,0 +1,84 @@ +#!/bin/bash +################################################################################ +## File: pypy.sh +## Desc: Installs PyPy +################################################################################ +source ~/utils/utils.sh +set -e + +function InstallPyPy +{ + PACKAGE_URL=$1 + + PACKAGE_TAR_NAME=$(echo $PACKAGE_URL | awk -F/ '{print $NF}') + echo "Downloading tar archive '$PACKAGE_TAR_NAME' - '$PACKAGE_URL'" + PACKAGE_TAR_TEMP_PATH="/tmp/$PACKAGE_TAR_NAME" + wget -q -O $PACKAGE_TAR_TEMP_PATH $PACKAGE_URL + + echo "Expand '$PACKAGE_TAR_NAME' to the /tmp folder" + tar xf $PACKAGE_TAR_TEMP_PATH -C /tmp + + # Get Python version + PACKAGE_NAME=${PACKAGE_TAR_NAME/.tar.bz2/} + MAJOR_VERSION=$(echo ${PACKAGE_NAME/pypy/} | cut -d. -f1) + PYTHON_MAJOR="python$MAJOR_VERSION" + + if [ $MAJOR_VERSION != 2 ]; then + PYPY_MAJOR="pypy$MAJOR_VERSION" + else + PYPY_MAJOR="pypy" + fi + + PACKAGE_TEMP_FOLDER="/tmp/$PACKAGE_NAME" + PYTHON_FULL_VERSION=$("$PACKAGE_TEMP_FOLDER/bin/$PYPY_MAJOR" -c "import sys;print('{}.{}.{}'.format(sys.version_info[0],sys.version_info[1],sys.version_info[2]))") + + # PyPy folder structure + PYPY_TOOLCACHE_PATH=$AGENT_TOOLSDIRECTORY/PyPy + PYPY_TOOLCACHE_VERSION_PATH=$PYPY_TOOLCACHE_PATH/$PYTHON_FULL_VERSION + PYPY_TOOLCACHE_VERSION_ARCH_PATH=$PYPY_TOOLCACHE_VERSION_PATH/x64 + + echo "Check if PyPy hostedtoolcache folder exist..." + if [ ! -d $PYPY_TOOLCACHE_PATH ]; then + mkdir -p $PYPY_TOOLCACHE_PATH + fi + + echo "Create PyPy '$PYPY_TOOLCACHE_VERSION_PATH' folder" + mkdir $PYPY_TOOLCACHE_VERSION_PATH + + echo "Move PyPy '$PACKAGE_TEMP_FOLDER' binaries to '$PYPY_TOOLCACHE_VERSION_ARCH_PATH' folder" + mv $PACKAGE_TEMP_FOLDER $PYPY_TOOLCACHE_VERSION_ARCH_PATH + + echo "Create additional symlinks (Required for UsePythonVersion Azure DevOps task)" + cd $PYPY_TOOLCACHE_VERSION_ARCH_PATH/bin + ln -s $PYPY_MAJOR $PYTHON_MAJOR + ln -s $PYTHON_MAJOR python + + chmod +x ./python ./$PYTHON_MAJOR + + echo "Install latest Pip" + ./python -m ensurepip + ./python -m pip install --ignore-installed pip + + echo "Create complete file" + touch $PYPY_TOOLCACHE_VERSION_PATH/x64.complete + + echo "Remove '$PACKAGE_TAR_TEMP_PATH'" + rm -f $PACKAGE_TAR_TEMP_PATH +} + +# PyPy 7.3.1 relies on system libffi.6.dylib, which is not existed in in libffi 3.3 release. As a workaround symlink can be created +ln -s libffi.7.dylib /usr/local/opt/libffi/lib/libffi.6.dylib + +uri="https://downloads.python.org/pypy/" +pypyVersions=$(curl -4 -s --compressed $uri | grep 'osx64' | awk -v uri="$uri" -F'>|<' '{print uri$5}') + +toolsetVersions=$(get_toolset_value '.toolcache[] | select(.name | contains("PyPy")) | .versions[]') + +for toolsetVersion in $toolsetVersions; do + latestMajorPyPyVersion=$(echo "${pypyVersions}" | grep -E "pypy${toolsetVersion}-v[0-9]+\.[0-9]+\.[0-9]+-" | head -1) + if [[ -z "$latestMajorPyPyVersion" ]]; then + echo "Failed to get PyPy version '$toolsetVersion'" + exit 1 + fi + InstallPyPy $latestMajorPyPyVersion +done \ No newline at end of file diff --git a/images/macos/provision/core/python.sh b/images/macos/provision/core/python.sh new file mode 100755 index 000000000..05b135e1e --- /dev/null +++ b/images/macos/provision/core/python.sh @@ -0,0 +1,10 @@ +echo "Installing Python Tooling" + +echo "Brew Installing Python 3" +/usr/local/bin/brew install python3 + +echo "Brew Installing Python 2" +# Create local tap with formula due to python2 formula depreciation +/usr/local/bin/brew tap-new local/python2 +FORMULA_PATH=$(/usr/local/bin/brew extract python@2 local/python2 | grep "Homebrew/Library/Taps") +/usr/local/bin/brew install $FORMULA_PATH diff --git a/images/macos/provision/core/reboot.sh b/images/macos/provision/core/reboot.sh new file mode 100644 index 000000000..a6e444351 --- /dev/null +++ b/images/macos/provision/core/reboot.sh @@ -0,0 +1,2 @@ +#!/bin/bash +shutdown -r now \ No newline at end of file diff --git a/images/macos/provision/core/ruby.sh b/images/macos/provision/core/ruby.sh new file mode 100755 index 000000000..912b00054 --- /dev/null +++ b/images/macos/provision/core/ruby.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +set -e + +if [ $(id -u) -eq 0 ]; then + echo "This script can not run as root. Aborting..." + exit 1 +fi + +# We can't install latest ruby 2.7 as a default version related with bug +# https://github.com/fastlane/fastlane/issues/15397 +echo Installing Ruby... +/usr/local/bin/brew install ruby@2.6 +ln -sf /usr/local/opt/ruby\@2.6 /usr/local/opt/ruby diff --git a/images/macos/provision/core/rubygem.sh b/images/macos/provision/core/rubygem.sh new file mode 100755 index 000000000..6872e57e7 --- /dev/null +++ b/images/macos/provision/core/rubygem.sh @@ -0,0 +1,29 @@ +#!/bin/sh +source ~/utils/utils.sh + +echo Updating RubyGems... +gem update --system + +echo Installing xcode-install utility... +gem install xcode-install --force + +echo Installing CocoaPods... +gem install cocoapods + +# fix nomad-cli installation +if is_HighSierra; then + brew install libxml2 + gem install nokogiri -v 1.6.8.1 -- --use-system-libraries --with-xml2-include=$(brew --prefix libxml2)/include/libxml2 +fi + +echo Installing nomad-cli... +gem install nomad-cli + +echo Installing xcpretty... +gem install xcpretty + +echo Installing bundler... +gem install bundler --force + +echo Installing fastlane tools... +gem install fastlane \ No newline at end of file diff --git a/images/macos/provision/core/rust.sh b/images/macos/provision/core/rust.sh new file mode 100644 index 000000000..5ef7675ca --- /dev/null +++ b/images/macos/provision/core/rust.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +set -e + +echo Installing Rustup... +brew install rustup-init + +echo Installing Rust language... +rustup-init -y --no-modify-path --default-toolchain=stable --profile=minimal + +echo Initialize environment variables... +CARGO_HOME=$HOME/.cargo +source $CARGO_HOME/env + +echo Install common tools... +cargo install bindgen cbindgen cargo-audit cargo-outdated + +echo Cleanup Cargo registry cached data... +rm -rf $CARGO_HOME/registry/* \ No newline at end of file diff --git a/images/macos/provision/core/stack.sh b/images/macos/provision/core/stack.sh new file mode 100644 index 000000000..81b41fa8a --- /dev/null +++ b/images/macos/provision/core/stack.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +echo "Get the latest Stack version..." +StackRelease=$(curl -s "https://api.github.com/repos/commercialhaskell/stack/releases/latest") +DownloadUrl=$(echo $StackRelease | jq -r '.assets[].browser_download_url | select(contains("osx-x86_64.tar.gz"))' | head -n 1) +StackVersion=$(echo $StackRelease | jq -r '.name' | cut -c2-) +StackArchive="/tmp/stack.tar.gz" + +echo "Download stack version $StackVersion..." +wget $DownloadUrl -O $StackArchive + +StackToolcachePath="$AGENT_TOOLSDIRECTORY/stack/$StackVersion" +DestinationPath="$StackToolcachePath/x64" + +mkdir -p $DestinationPath + +echo "Unzip stack archive..." +tar -xzf $StackArchive -C $DestinationPath --strip 1 + +touch $StackToolcachePath/x64.complete + +echo "export PATH="\$PATH":$DestinationPath" >> "$HOME/.bashrc" diff --git a/images/macos/provision/core/toolcache-high-sierra.sh b/images/macos/provision/core/toolcache-high-sierra.sh new file mode 100644 index 000000000..61a3cc8c1 --- /dev/null +++ b/images/macos/provision/core/toolcache-high-sierra.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +########################################################################### +# The script downloads macos hosted tool cache for several Python versions +# and installs them onto the system +# +########################################################################### + +SOURCE_URL="https://vstsagenttools.blob.core.windows.net/tools" +PACKAGES_DIR=/tmp/hostedtoolcache + +# Download hosted tool cache with azcopy +azcopy copy $SOURCE_URL $PACKAGES_DIR --include-path "hostedtoolcache/macos-10.13" --recursive +mv $PACKAGES_DIR/tools/hostedtoolcache/macos-10.13/* $PACKAGES_DIR + +if [ $? -ne 0 ]; then + echo "An error occured while downloading hostedtoolcache" + exit 1 +fi + +# Install the tools from the hosted tool cache +packages=$(find $PACKAGES_DIR -name package.json) +for package in $packages; do + pushd $(dirname $package) + npm install + popd +done; diff --git a/images/macos/provision/core/toolcache.sh b/images/macos/provision/core/toolcache.sh new file mode 100755 index 000000000..eb6dc905e --- /dev/null +++ b/images/macos/provision/core/toolcache.sh @@ -0,0 +1,38 @@ +#!/bin/sh + +# Download hosted tool cache with npm +NPM_FEED="npm.pkg.github.com" +TOOLSET_PATH="$HOME/image-generation/toolcache.json" + +echo "Installing npm-toolcache..." +PACKAGE_LIST=($(jq -r 'keys | .[]' $TOOLSET_PATH)) + +# Execute in /tmp folder to avoid node_modules creation in $HOME +pushd /tmp + +# GitHub Package Registry doesn't support downloading public packages without auth so we have to authorize +# Put the .npmrc to /tmp directory on the image to make sure that it will deleted after image generation +echo "Configure auth for github package registry" +echo "@actions:registry=https://${NPM_FEED}/" >> ".npmrc" +echo "//${NPM_FEED}/:_authToken=${GITHUB_FEED_TOKEN}" >> ".npmrc" + +echo "Install packages..." +for PACKAGE_NAME in ${PACKAGE_LIST[@]}; do + PACKAGE_VERSIONS=($(jq -r ".[\"$PACKAGE_NAME\"] | .[]" $TOOLSET_PATH)) + for PACKAGE_VERSION in ${PACKAGE_VERSIONS[@]}; do + echo "Install ${PACKAGE_NAME}@${PACKAGE_VERSION}" + + npm install ${PACKAGE_NAME}@${PACKAGE_VERSION} + + exit_code=$? + if [ $exit_code -ne 0 ]; then + echo "${PACKAGE_NAME}@${PACKAGE_VERSION} installation failure; Error:${exit_code}" + + exit 1 + fi + done; +done; + +rm -f ".npmrc" + +popd \ No newline at end of file diff --git a/images/macos/provision/core/toolset.ps1 b/images/macos/provision/core/toolset.ps1 new file mode 100644 index 000000000..bc016c4b3 --- /dev/null +++ b/images/macos/provision/core/toolset.ps1 @@ -0,0 +1,58 @@ +################################################################################ +## File: toolset.ps1 +## Team: CI-Build +## Desc: Install toolset +################################################################################ + +Function Get-ToolcacheFromToolset { + $toolsetPath = Join-Path $env:HOME "image-generation" "toolset.json" + $toolsetJson = Get-Content -Raw $toolsetPath | ConvertFrom-Json + return $toolsetJson.toolcache +} + +Function Install-Asset { + param( + [Parameter(Mandatory=$true)] + [object] $ReleaseAsset + ) + + $assetFolderPath = Join-Path "/tmp" "$($ReleaseAsset.filename)-temp-dir" + New-Item -ItemType Directory -Path $assetFolderPath | Out-Null + $assetArchivePath = Join-Path $assetFolderPath $ReleaseAsset.filename + + Write-Host "Download $($ReleaseAsset.filename) archive to the $assetFolderPath folder..." + wget -P $assetFolderPath $ReleaseAsset.download_url --retry-connrefused --retry-on-http-error=429,500,503 --wait=30 --no-verbose + + Write-Host "Extract $($ReleaseAsset.filename) content..." + tar -xzf $assetArchivePath -C $assetFolderPath + + Write-Host "Invoke installation script..." + Push-Location -Path $assetFolderPath + Invoke-Expression "bash ./setup.sh" + Pop-Location +} + +# Get toolcache content from toolset +$toolsToInstall = @("Python", "Node", "Go") +$tools = Get-ToolcacheFromToolset | Where-Object {$ToolsToInstall -contains $_.Name} + +foreach ($tool in $tools) { + # Get versions manifest for current tool + $assets = Invoke-RestMethod $tool.url + + # Get github release asset for each version + foreach ($version in $tool.versions) { + $asset = $assets | Where-Object version -like $version ` + | Select-Object -ExpandProperty files ` + | Where-Object { ($_.platform -eq $tool.platform) -and ($_.arch -eq $tool.arch) -and ($_.platform_version -eq $tool.platform_version)} ` + | Select-Object -First 1 + + Write-Host "Installing $($tool.name) $version..." + if ($null -ne $asset) { + Install-Asset -ReleaseAsset $asset + } else { + Write-Host "Asset was not found in versions manifest" + exit 1 + } + } +} \ No newline at end of file diff --git a/images/macos/provision/core/vcpkg.sh b/images/macos/provision/core/vcpkg.sh new file mode 100644 index 000000000..289d7ba49 --- /dev/null +++ b/images/macos/provision/core/vcpkg.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +set -e +source ~/utils/utils.sh + +# Set env variable for vcpkg +VCPKG_INSTALLATION_ROOT=/usr/local/share/vcpkg +echo "export VCPKG_INSTALLATION_ROOT=${VCPKG_INSTALLATION_ROOT}" | tee -a ~/.bashrc + +# Install vcpkg +git clone --depth=1 https://github.com/Microsoft/vcpkg $VCPKG_INSTALLATION_ROOT +$VCPKG_INSTALLATION_ROOT/bootstrap-vcpkg.sh +$VCPKG_INSTALLATION_ROOT/vcpkg integrate install +chmod -R 0777 $VCPKG_INSTALLATION_ROOT +ln -sf $VCPKG_INSTALLATION_ROOT/vcpkg /usr/local/bin diff --git a/images/macos/provision/core/vsmac.sh b/images/macos/provision/core/vsmac.sh new file mode 100644 index 000000000..9774e486f --- /dev/null +++ b/images/macos/provision/core/vsmac.sh @@ -0,0 +1,27 @@ +#!/bin/sh +source ~/utils/utils.sh +source ~/utils/xamarin-utils.sh + +VSMAC_VERSION=$(get_toolset_value '.xamarin.vsmac') +VSMAC_DOWNLOAD_URL=$(buildVSMacDownloadUrl $VSMAC_VERSION) + +TMPMOUNT=`/usr/bin/mktemp -d /tmp/visualstudio.XXXX` +TMPMOUNT_DOWNLOADS="$TMPMOUNT/downloads" +mkdir $TMPMOUNT_DOWNLOADS + +download_with_retries $VSMAC_DOWNLOAD_URL $TMPMOUNT_DOWNLOADS + +echo "Mounting Visual studio..." +VISUAL_STUDIO_NAME=${VSMAC_DOWNLOAD_URL##*/} +hdiutil attach "$TMPMOUNT_DOWNLOADS/$VISUAL_STUDIO_NAME" -mountpoint "$TMPMOUNT" + +echo "Moving Visual Studio to /Applications/..." +pushd $TMPMOUNT +tar cf - "./Visual Studio.app" | tar xf - -C /Applications/ + +echo "Launching vstools..." +/Applications/Visual\ Studio.app/Contents/MacOS/vstool + +popd +sudo hdiutil detach "$TMPMOUNT" +sudo rm -rf "$TMPMOUNT" \ No newline at end of file diff --git a/images/macos/provision/core/xamarin-android-ndk.sh b/images/macos/provision/core/xamarin-android-ndk.sh new file mode 100644 index 000000000..35e4d0064 --- /dev/null +++ b/images/macos/provision/core/xamarin-android-ndk.sh @@ -0,0 +1,64 @@ +#!/bin/sh +source ~/utils/utils.sh + +ANDROID_HOME=$HOME/Library/Android/sdk +ANDROID_NDK_HOME=$ANDROID_HOME/ndk-bundle +SDKMANAGER=$ANDROID_HOME/tools/bin/sdkmanager + +# Android NDK v16 is not compatible with old Xamarin.Android SDK +# and fails builds with BundleAssemblies enabled +ANDROID_NDK_15_HOME=$HOME/Library/Android/sdk/android-ndk-r15c +ANDROID_NDK_PACKAGE="android-ndk-r15c-darwin-x86_64.zip" +ANDROID_NDK_URL="https://dl.google.com/android/repository/${ANDROID_NDK_PACKAGE}" + +echo "Install and setup Android NDK v15..." +cd $HOME + +download_with_retries $ANDROID_NDK_URL + +echo "Unzipping $ANDROID_NDK_URL..." +unzip -q $ANDROID_NDK_PACKAGE -d ${ANDROID_HOME} + +echo "Removing $ANDROID_NDK_URL..." +rm -rf "$ANDROID_NDK_PACKAGE" + +XAMARIN_ANDROID_NDK_PATH=$HOME/Library/Developer/Xamarin +mkdir -p $XAMARIN_ANDROID_NDK_PATH + +echo "Preparing symlink for $ANDROID_NDK_15_HOME ..." +ln -s $ANDROID_NDK_15_HOME $XAMARIN_ANDROID_NDK_PATH/android-ndk + +# NDK r17 does not include MIPS/MIPS64 toolchains anymore, NDK r16b still provides this a supplement +echo "Checking NDK installation contains required MIPS toolchains…" +NDK_BUNDLE_TOOLCHAINS=$ANDROID_NDK_HOME/toolchains +ANDROID_NDK_R16B_PATH=$ANDROID_HOME/ndk/16.1.4479499 +MIPS64_TOOLCHAIN=$NDK_BUNDLE_TOOLCHAINS/mips64el-linux-android-4.9/prebuilt/darwin-x86_64/bin +MIPS_TOOLCHAIN=$NDK_BUNDLE_TOOLCHAINS/mipsel-linux-android-4.9/prebuilt/darwin-x86_64/bin + +if [ -d $MIPS64_TOOLCHAIN ] && [ -d $MIPS_TOOLCHAIN ]; then + echo "MIPS64 and MIPS toolchain already installed for NDK bundle - not reinstalling." +else + pushd $ANDROID_HOME + + echo "Installing ndk r16b..." + echo y | $SDKMANAGER "ndk;16.1.4479499" + + echo "Cleaning potential pre-existing MIPS toolchain directories" + rm -rf ndk-bundle/toolchains/mips* + + echo "Moving MIPS toolchains to $ANDROID_NDK_HOME/toolchains" + mv $ANDROID_NDK_R16B_PATH/toolchains/mips** ndk-bundle/toolchains/ + + echo "Delete ndk r16b..." + rm -rf $ANDROID_NDK_R16B_PATH + + if [ ! -d $MIPS64_TOOLCHAIN ] || [ ! -d $MIPS_TOOLCHAIN ]; then + echo "MIPS toolchains not installed correctly! Check whether $ANDROID_NDK_HOME/toolchains/mips* does not exist." + fi + popd +fi + +# Latest versions of NDK doesn't include GCC, NDK r18 does +echo "Installing ndk r18B..." +echo y | $SDKMANAGER "ndk;18.1.5063045" +echo "export ANDROID_NDK_18R_PATH=${ANDROID_HOME}/ndk/18.1.5063045" >> "${HOME}/.bashrc" \ No newline at end of file diff --git a/images/macos/provision/core/xamarin.sh b/images/macos/provision/core/xamarin.sh new file mode 100755 index 000000000..0f0801d7b --- /dev/null +++ b/images/macos/provision/core/xamarin.sh @@ -0,0 +1,81 @@ +#!/bin/sh +source ~/utils/utils.sh +source ~/utils/xamarin-utils.sh + +MONO_VERSIONS=($(get_toolset_value '.xamarin."mono-versions" | reverse | .[]')) +XAMARIN_IOS_VERSIONS=($(get_toolset_value '.xamarin."ios-versions" | reverse | .[]')) +XAMARIN_MAC_VERSIONS=($(get_toolset_value '.xamarin."mac-versions" | reverse | .[]')) +XAMARIN_ANDROID_VERSIONS=($(get_toolset_value '.xamarin."android-versions" | reverse | .[]')) +LATEST_SDK_SYMLINK=$(get_toolset_value '.xamarin.bundles[0].symlink') +CURRENT_SDK_SYMLINK=$(get_toolset_value '.xamarin."bundle-default"') + +if [ "$CURRENT_SDK_SYMLINK" == "latest" ]; then + CURRENT_SDK_SYMLINK=$LATEST_SDK_SYMLINK +fi + +MONO_VERSIONS_PATH='/Library/Frameworks/Mono.framework/Versions' +IOS_VERSIONS_PATH='/Library/Frameworks/Xamarin.iOS.framework/Versions' +ANDROID_VERSIONS_PATH='/Library/Frameworks/Xamarin.Android.framework/Versions' +MAC_VERSIONS_PATH='/Library/Frameworks/Xamarin.Mac.framework/Versions' + +TMPMOUNT=`/usr/bin/mktemp -d /tmp/visualstudio.XXXX` +TMPMOUNT_FRAMEWORKS="$TMPMOUNT/frameworks" +createBackupFolders + +pushd $TMPMOUNT + +# Download NUnit console +downloadNUnitConsole + +# Install Mono sdks +for VERSION in "${MONO_VERSIONS[@]}"; do installMono $VERSION; done +sudo mv -v $TMPMOUNT_FRAMEWORKS/mono/* $MONO_VERSIONS_PATH/ + +# Install Xamarin.iOS sdks +for VERSION in "${XAMARIN_IOS_VERSIONS[@]}"; do installXamarinIOS $VERSION; done +sudo mv -v $TMPMOUNT_FRAMEWORKS/ios/* $IOS_VERSIONS_PATH/ + +# Install Xamarin.Mac sdks +for VERSION in "${XAMARIN_MAC_VERSIONS[@]}"; do installXamarinMac $VERSION; done +sudo mv -v $TMPMOUNT_FRAMEWORKS/mac/* $MAC_VERSIONS_PATH/ + +# Install Xamarin.Android sdks +for VERSION in "${XAMARIN_ANDROID_VERSIONS[@]}"; do installXamarinAndroid $VERSION; done +sudo mv -v $TMPMOUNT_FRAMEWORKS/android/* $ANDROID_VERSIONS_PATH/ + + +# Create bundles +BUNDLES_COUNT=$(get_toolset_value '.xamarin.bundles | length') +for ((BUNDLE_INDEX=0; BUNDLE_INDEX 11.3.1, 11.2 -> 11.2.1 +if is_Catalina; then + ln -sf /Applications/Xcode_11.2.1.app /Applications/Xcode_11.2.app + ln -sf /Applications/Xcode_11.3.1.app /Applications/Xcode_11.3.app +fi + +echo "Setting Xcode ${DEFAULT_XCODE_VERSION} as default" +sudo xcode-select -s "/Applications/Xcode_${DEFAULT_XCODE_VERSION}.app/Contents/Developer" + +echo "Adding symlink '/Applications/Xcode_${DEFAULT_XCODE_VERSION}.app' -> '/Applications/Xcode.app'" +ln -s "/Applications/Xcode_${DEFAULT_XCODE_VERSION}.app" "/Applications/Xcode.app" + +echo "Enabling developer mode" +sudo /usr/sbin/DevToolsSecurity --enable + +echo "Setting environment variables 'XCODE__DEVELOPER_DIR'" +setXcodeDeveloperDirVariables + +# Cleanup +echo "Doing cleanup. Emptying ${WORK_DIR}..." +rm -rf "$WORK_DIR" diff --git a/images/macos/provision/utils/utils.sh b/images/macos/provision/utils/utils.sh new file mode 100755 index 000000000..6a924e03d --- /dev/null +++ b/images/macos/provision/utils/utils.sh @@ -0,0 +1,94 @@ +download_with_retries() { +# Due to restrictions of bash functions, positional arguments are used here. +# In case if you using latest argument NAME, you should also set value to all previous parameters. +# Example: download_with_retries $ANDROID_SDK_URL "." "android_sdk.zip" + local URL="$1" + local DEST="${2:-.}" + local NAME="${3:-${URL##*/}}" + + echo "Downloading $URL..." + wget $URL --output-document="$DEST/$NAME" \ + --tries=30 \ + --wait 30 \ + --retry-connrefused \ + --retry-on-host-error \ + --retry-on-http-error=429,500,502,503 \ + --no-verbose + + if [ $? != 0 ]; then + echo "Could not download $URL; Exiting build!" + exit 1 + fi + + return 0 +} + +is_BigSur() { + if [ "$OSTYPE" = "darwin20" ]; then + true + else + false + fi +} + +is_Catalina() { + if [ "$OSTYPE" = "darwin19" ]; then + true + else + false + fi +} + +is_Mojave() { + if [ "$OSTYPE" = "darwin18" ]; then + true + else + false + fi +} + +is_HighSierra() { + if [ "$OSTYPE" = "darwin17" ]; then + true + else + false + fi +} + +is_Less_Catalina() { + if is_HighSierra || is_Mojave; then + true + else + false + fi +} + +is_Less_BigSur() { + if is_HighSierra || is_Mojave || is_Catalina; then + true + else + false + fi +} + +get_toolset_path() { + echo "$HOME/image-generation/toolset.json" +} + +get_toolset_value() { + local toolset_path=$(get_toolset_path) + local query=$1 + echo "$(jq -r "$query" $toolset_path)" +} + +get_xcode_list_from_toolset() { + echo $(get_toolset_value '.xcode.versions | reverse | .[]') +} + +get_latest_xcode_from_toolset() { + echo $(get_toolset_value '.xcode.versions[0]') +} + +get_default_xcode_from_toolset() { + echo $(get_toolset_value '.xcode.default') +} \ No newline at end of file diff --git a/images/macos/provision/utils/xamarin-utils.sh b/images/macos/provision/utils/xamarin-utils.sh new file mode 100644 index 000000000..dd6d7ae95 --- /dev/null +++ b/images/macos/provision/utils/xamarin-utils.sh @@ -0,0 +1,233 @@ +#!/bin/sh + +# Xamarin can clean their SDKs while updating to newer versions, +# so we should be able to detect it during image generation +downloadAndInstallPKG() { + local PKG_URL=$1 + local PKG_NAME=${PKG_URL##*/} + + download_with_retries $PKG_URL + + echo "Installing $PKG_NAME..." + sudo installer -pkg "$TMPMOUNT/$PKG_NAME" -target / +} + +buildVSMacDownloadUrl() { + echo "https://dl.xamarin.com/VsMac/VisualStudioForMac-${1}.dmg" +} + +buildMonoDownloadUrl() { + echo "https://dl.xamarin.com/MonoFrameworkMDK/Macx86/MonoFramework-MDK-${1}.macos10.xamarin.universal.pkg" +} + +buildXamariniIOSDownloadUrl() { + echo "https://dl.xamarin.com/MonoTouch/Mac/xamarin.ios-${1}.pkg" +} + +buildXamarinMacDownloadUrl() { + echo "https://dl.xamarin.com/XamarinforMac/Mac/xamarin.mac-${1}.pkg" +} + +buildXamarinAndroidDownloadUrl() { + echo "https://dl.xamarin.com/MonoforAndroid/Mac/xamarin.android-${1}.pkg" +} + +installMono() { + local VERSION=$1 + + echo "Installing Mono ${VERSION}..." + local MONO_FOLDER_NAME=$(echo $VERSION | cut -d. -f 1,2,3) + local SHORT_VERSION=$(echo $VERSION | cut -d. -f 1,2) + local PKG_URL=$(buildMonoDownloadUrl $VERSION) + downloadAndInstallPKG $PKG_URL + + echo "Installing nunit3-console for Mono "$VERSION + installNunitConsole $MONO_FOLDER_NAME + + echo "Creating short symlink '${SHORT_VERSION}'" + sudo ln -s ${MONO_VERSIONS_PATH}/${MONO_FOLDER_NAME} ${MONO_VERSIONS_PATH}/${SHORT_VERSION} + + echo "Move to backup folder" + sudo mv -v $MONO_VERSIONS_PATH/* $TMPMOUNT_FRAMEWORKS/mono/ +} + +installXamarinIOS() { + local VERSION=$1 + + echo "Installing Xamarin.iOS ${VERSION}..." + local SHORT_VERSION=$(echo $VERSION | cut -d. -f 1,2) + local PKG_URL=$(buildXamariniIOSDownloadUrl $VERSION) + downloadAndInstallPKG $PKG_URL + + echo "Creating short symlink '${SHORT_VERSION}'" + sudo ln -s ${IOS_VERSIONS_PATH}/${VERSION} ${IOS_VERSIONS_PATH}/${SHORT_VERSION} + + echo "Move to backup folder" + sudo mv -v $IOS_VERSIONS_PATH/* $TMPMOUNT_FRAMEWORKS/ios/ +} + +installXamarinMac() { + local VERSION=$1 + + echo "Installing Xamarin.Mac ${VERSION}..." + local SHORT_VERSION=$(echo $VERSION | cut -d. -f 1,2) + local PKG_URL=$(buildXamarinMacDownloadUrl $VERSION) + downloadAndInstallPKG $PKG_URL + + echo "Creating short symlink '${SHORT_VERSION}'" + sudo ln -s ${MAC_VERSIONS_PATH}/${VERSION} ${MAC_VERSIONS_PATH}/${SHORT_VERSION} + + echo "Move to backup folder" + sudo mv -v $MAC_VERSIONS_PATH/* $TMPMOUNT_FRAMEWORKS/mac/ +} + +installXamarinAndroid() { + local VERSION=$1 + + echo "Installing Xamarin.Android ${VERSION}..." + local SHORT_VERSION=$(echo $VERSION | cut -d. -f 1,2) + local PKG_URL=$(buildXamarinAndroidDownloadUrl $VERSION) + downloadAndInstallPKG $PKG_URL + + if [ "$VERSION" == "9.4.1.0" ]; then + # Fix symlinks for broken Xamarin.Android + fixXamarinAndroidSymlinksInLibDir $VERSION + fi + + echo "Creating short symlink '${SHORT_VERSION}'" + sudo ln -s ${ANDROID_VERSIONS_PATH}/${VERSION} ${ANDROID_VERSIONS_PATH}/${SHORT_VERSION} + + echo "Move to backup folder" + sudo mv -v $ANDROID_VERSIONS_PATH/* $TMPMOUNT_FRAMEWORKS/android/ +} + +createBundle() { + local SYMLINK=$1 + local MONO_SDK=$2 + local IOS_SDK=$3 + local MAC_SDK=$4 + local ANDROID_SDK=$5 + + echo "Creating bundle '$SYMLINK' (Mono $MONO_SDK; iOS $IOS_SDK; Mac $MAC_SDK; Android $ANDROID_SDK" + deleteSymlink ${SYMLINK} + sudo ln -s ${MONO_VERSIONS_PATH}/${MONO_SDK} ${MONO_VERSIONS_PATH}/${SYMLINK} + sudo ln -s ${IOS_VERSIONS_PATH}/${IOS_SDK} ${IOS_VERSIONS_PATH}/${SYMLINK} + sudo ln -s ${MAC_VERSIONS_PATH}/${MAC_SDK} ${MAC_VERSIONS_PATH}/${SYMLINK} + sudo ln -s ${ANDROID_VERSIONS_PATH}/${ANDROID_SDK} ${ANDROID_VERSIONS_PATH}/${SYMLINK} +} + +createBundleLink() { + local SOURCE=$1 + local TARGET=$2 + echo "Creating bundle symlink '$SOURCE' -> '$TARGET'" + deleteSymlink ${TARGET} + sudo ln -s ${MONO_VERSIONS_PATH}/$SOURCE ${MONO_VERSIONS_PATH}/$TARGET + sudo ln -s ${IOS_VERSIONS_PATH}/$SOURCE ${IOS_VERSIONS_PATH}/$TARGET + sudo ln -s ${MAC_VERSIONS_PATH}/$SOURCE ${MAC_VERSIONS_PATH}/$TARGET + sudo ln -s ${ANDROID_VERSIONS_PATH}/$SOURCE ${ANDROID_VERSIONS_PATH}/$TARGET +} + +# https://github.com/xamarin/xamarin-android/issues/3457 +# Recreate missing symlinks in lib for new Xamarin.Android package +# Symlink path /Library/Frameworks/Xamarin.Android.framework/Libraries +# xbuild -> xamarin.android/xbuild +# xbuild-frameworks -> xamarin.android/xbuild-frameworks +fixXamarinAndroidSymlinksInLibDir() { + local XAMARIN_ANDROID_VERSION=$1 + local XAMARIN_ANDROID_LIB_PATH="${ANDROID_VERSIONS_PATH}/${XAMARIN_ANDROID_VERSION}/lib" + + if [ -d "${XAMARIN_ANDROID_LIB_PATH}" ]; then + pushd "${XAMARIN_ANDROID_LIB_PATH}" > /dev/null + + local XAMARIN_ANDROID_XBUILD_DIR="${XAMARIN_ANDROID_LIB_PATH}/xbuild" + if [ ! -d "${XAMARIN_ANDROID_XBUILD_DIR}" ]; then + echo "${XAMARIN_ANDROID_XBUILD_DIR}" + sudo ln -sf xamarin.android/xbuild xbuild + fi + + local XAMARIN_ANDROID_XBUILD_FRAMEWORKS_DIR="${XAMARIN_ANDROID_LIB_PATH}/xbuild-frameworks" + if [ ! -d "${XAMARIN_ANDROID_XBUILD_FRAMEWORKS_DIR}" ]; then + echo "${XAMARIN_ANDROID_XBUILD_FRAMEWORKS_DIR}" + sudo ln -sf xamarin.android/xbuild-frameworks xbuild-frameworks + fi + + popd > /dev/null + fi +} + +installNunitConsole() { + local MONO_VERSION=$1 + + cat < ${TMPMOUNT}/${NUNIT3_CONSOLE_BIN} +#!/bin/sh +exec /Library/Frameworks/Mono.framework/Versions/${MONO_VERSION}/bin/mono --debug \$MONO_OPTIONS $NUNIT3_PATH/nunit3-console.exe "\$@" +EOF + sudo chmod +x ${TMPMOUNT}/${NUNIT3_CONSOLE_BIN} + sudo mv ${TMPMOUNT}/${NUNIT3_CONSOLE_BIN} ${MONO_VERSIONS_PATH}/${MONO_VERSION}/Commands/${NUNIT3_CONSOLE_BIN} +} + +downloadNUnitConsole() { + echo "Downloading NUnit 3..." + local NUNIT3_LOCATION='https://github.com/nunit/nunit-console/releases/download/3.6.1/NUnit.Console-3.6.1.zip' + local NUNIT_PATH="/Library/Developer/nunit" + NUNIT3_PATH="$NUNIT_PATH/3.6.1" + + pushd $TMPMOUNT + + sudo mkdir -p $NUNIT3_PATH + sudo curl -L -o nunit3.zip $NUNIT3_LOCATION + + echo "Installing NUnit 3..." + sudo unzip nunit3.zip -d $NUNIT3_PATH + NUNIT3_CONSOLE_BIN=nunit3-console + + popd +} + +installNuget() { + local MONO_VERSION=$1 + local NUGET_VERSION=$2 + local NUGET_URL="https://dist.nuget.org/win-x86-commandline/v${NUGET_VERSION}/nuget.exe" + echo "Installing nuget $NUGET_VERSION for Mono $MONO_VERSION" + cd ${MONO_VERSIONS_PATH}/${MONO_VERSION}/lib/mono/nuget + sudo mv nuget.exe nuget_old.exe + sudo curl -L -o nuget.exe $NUGET_URL + sudo chmod a+x nuget.exe +} + +createUWPShim() { + echo "Creating UWP Shim to hack UWP build failure..." + cat < ${TMPMOUNT}/Microsoft.Windows.UI.Xaml.CSharp.Targets + + + + +EOF + + local UWPTARGET_PATH=/Library/Frameworks/Mono.framework/External/xbuild/Microsoft/WindowsXaml + + sudo mkdir -p $UWPTARGET_PATH/v11.0/ + sudo cp ${TMPMOUNT}/Microsoft.Windows.UI.Xaml.CSharp.Targets $UWPTARGET_PATH/v11.0/ + sudo mkdir -p $UWPTARGET_PATH/v12.0/ + sudo cp ${TMPMOUNT}/Microsoft.Windows.UI.Xaml.CSharp.Targets $UWPTARGET_PATH/v12.0/ + sudo mkdir -p $UWPTARGET_PATH/v14.0/ + sudo cp ${TMPMOUNT}/Microsoft.Windows.UI.Xaml.CSharp.Targets $UWPTARGET_PATH/v14.0/ + sudo mkdir -p $UWPTARGET_PATH/v15.0/ + sudo cp ${TMPMOUNT}/Microsoft.Windows.UI.Xaml.CSharp.Targets $UWPTARGET_PATH/v15.0/ + sudo mkdir -p $UWPTARGET_PATH/v16.0/ + sudo cp ${TMPMOUNT}/Microsoft.Windows.UI.Xaml.CSharp.Targets $UWPTARGET_PATH/v16.0/ +} + +createBackupFolders() { + mkdir -p $TMPMOUNT_FRAMEWORKS/mono + mkdir -p $TMPMOUNT_FRAMEWORKS/ios + mkdir -p $TMPMOUNT_FRAMEWORKS/mac + mkdir -p $TMPMOUNT_FRAMEWORKS/android +} + +deleteSymlink() { + sudo rm -f ${MONO_VERSIONS_PATH}/${1} + sudo rm -f ${IOS_VERSIONS_PATH}/${1} + sudo rm -f ${MAC_VERSIONS_PATH}/${1} + sudo rm -f ${ANDROID_VERSIONS_PATH}/${1} +} \ No newline at end of file diff --git a/images/macos/provision/utils/xcode-utils.sh b/images/macos/provision/utils/xcode-utils.sh new file mode 100644 index 000000000..9cd795f03 --- /dev/null +++ b/images/macos/provision/utils/xcode-utils.sh @@ -0,0 +1,81 @@ +createXamarinProvisionatorSymlink() { + local XCODE_VERSION="$1" + local FULL_VERSION=$(echo "${XCODE_VERSION}.0.0" | cut -d'.' -f 1,2,3) + + if [ $FULL_VERSION != $XCODE_VERSION ]; then + ln -sf "/Applications/Xcode_${XCODE_VERSION}.app" "/Applications/Xcode_${FULL_VERSION}.app" + fi +} + +getXcodeVersionToInstall() { + local XCODE_VERSION="$1" + + if [[ ! $XCODE_VERSION =~ "_beta" ]]; then + echo "$XCODE_VERSION" + else + local XCODE_BETA="${XCODE_VERSION/_/ }" + echo "$(xcversion list | sort -r | grep -m 1 "$XCODE_BETA")" + fi +} + +validateXcodeIntegrity() { + local WORKING_DIR="$1" + local XCODE_VERSION="$2" + + if echo $XCODE_VERSION | grep "beta"; then + return 0 + fi + + spctl --assess --raw "${WORKING_DIR}/Xcode.app" +} + +approveLicense() { + local XCODE_VERSION="$1" + sudo "/Applications/Xcode_${XCODE_VERSION}.app/Contents/Developer/usr/bin/xcodebuild" -license accept +} + +installAdditionalPackages() { + # should be called only for old High Sierra and Mojave + local XCODE_VERSION="$1" + find /Applications/Xcode_${XCODE_VERSION}.app/Contents/Resources/Packages/ -name '*.pkg' | xargs -I '{}' sudo installer -pkg '{}' -target / -allowUntrusted +} + +runFirstLaunch() { + local XCODE_VERSION="$1" + sudo "/Applications/Xcode_${XCODE_VERSION}.app/Contents/Developer/usr/bin/xcodebuild" -runFirstLaunch +} + +setXcodeDeveloperDirVariables() { + stable_xcode_versions=$(get_xcode_list_from_toolset | tr " " "\n" | grep -v "beta") + major_versions=($(echo ${stable_xcode_versions[@]} | tr " " "\n" | cut -d '.' -f 1 | uniq)) + for MAJOR_VERSION in "${major_versions[@]}" + do + LATEST_STABLE_VERSION=$(echo "${stable_xcode_versions[*]}" | grep "${MAJOR_VERSION}" | tail -n 1) + echo "export XCODE_${MAJOR_VERSION}_DEVELOPER_DIR=/Applications/Xcode_${LATEST_STABLE_VERSION}.app/Contents/Developer" >> "$HOME/.bashrc" + done +} + +extractXcodeXip() { + local WORKING_DIR="$1" + local XCODE_VERSION="$2" + XCODE_XIP="${WORKING_DIR}/Xcode_${XCODE_VERSION// /_}.xip" + echo "XCODE_XIP = $XCODE_XIP" + + open -W $XCODE_XIP + + if [[ -d "${WORKING_DIR}/Xcode-beta.app" ]]; then + mv -f "${WORKING_DIR}/Xcode-beta.app" "${WORKING_DIR}/Xcode.app" + fi + + if [[ ! -d "${WORKING_DIR}/Xcode.app" ]]; then + echo "'Xcode.app' doesn't exist after Xcode XIP extraction" + exit 1 + fi +} + +createBetaSymlink() { + local XCODE_VERSION=$1 + if [[ $XCODE_VERSION =~ 1[01].* ]] || [[ $XCODE_VERSION == "12" ]] || [[ $XCODE_VERSION == "12_beta" ]]; then + ln -sf "/Applications/Xcode_${XCODE_VERSION}.app" "/Applications/Xcode_${XCODE_VERSION}_beta.app" + fi +} \ No newline at end of file diff --git a/images/macos/software-report/SoftwareReport.Android.psm1 b/images/macos/software-report/SoftwareReport.Android.psm1 new file mode 100644 index 000000000..8145b248f --- /dev/null +++ b/images/macos/software-report/SoftwareReport.Android.psm1 @@ -0,0 +1,166 @@ +Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1" + +$os = Get-OSVersion + +function Split-TableRowByColumns { + param( + [string] $Row + ) + return $Row.Split("|") | ForEach-Object { $_.trim() } +} + +function Build-AndroidTableObject { + param( + [string] $PackageName, + [string] $Description + ) + return [PSCustomObject] @{ + "Package Name" = $PackageName + "Description" = $Description + } +} + +function Get-AndroidSDKRoot { + return Join-Path $env:HOME "Library" "Android" "sdk" +} + +function Get-AndroidSDKManagerPath { + $androidSDKDir = Get-AndroidSDKRoot + return Join-Path $androidSDKDir "tools" "bin" "sdkmanager" +} + +function Get-AndroidInstalledPackages { + $androidSDKManagerPath = Get-AndroidSDKManagerPath + $androidSDKManagerList = Invoke-Expression "$androidSDKManagerPath --list --include_obsolete" + $androidInstalledPackages = @() + foreach($packageInfo in $androidSDKManagerList) { + if($packageInfo -Match "Available Packages:") { + break + } + + $androidInstalledPackages += $packageInfo + } + return $androidInstalledPackages +} + +function Build-AndroidSDKToolsTable { + param ( + [Parameter(Mandatory)] + [object] $packageInfo + ) + + return $packageInfo | ForEach-Object { + $packageInfoParts = Split-TableRowByColumns $_ + $packageName = $packageInfoParts[0] + $packageDescription = $packageInfoParts[2] + ", Revision " + $packageInfoParts[1] + return Build-AndroidTableObject -PackageName $packageName -Description $packageDescription + } +} + +function Build-AndroidSDKPlatformTable { + param ( + [Parameter(Mandatory)] + [object] $packageInfo + ) + + return $packageInfo | ForEach-Object { + $packageInfoParts = Split-TableRowByColumns $_ + $packageName = $packageInfoParts[0].split(";")[1] + $packageDescription = $packageInfoParts[2] + ", Revision " + $packageInfoParts[1] + return Build-AndroidTableObject -PackageName $packageName -Description $packageDescription + } +} + +function Build-AndroidSDKBuildToolsTable { + param ( + [Parameter(Mandatory)] + [object] $packageInfo + ) + + return $packageInfo | ForEach-Object { + $packageInfoParts = Split-TableRowByColumns $_ + $packageName = $packageInfoParts[0].replace(";", "-") + $packageDescription = "Android SDK Build-Tools, Revision " + $packageInfoParts[1] + return Build-AndroidTableObject -PackageName $packageName -Description $packageDescription + } +} + +function Build-AndroidNDKTable { + param ( + [Parameter(Mandatory)][AllowEmptyString()] + [string[]] $installedPackages + ) + + $ndkInfo = @() + + if ($os.IsLessThanBigSur) { + $ndkInfo += [PSCustomObject] @{ + # Hardcode NDK 15 as a separate case since it is installed manually without sdk-manager (to none default location) + "Version" = "15.2.4203891" + "Path" = Join-Path (Get-AndroidSDKRoot) "android-ndk-r15c" + } + + $ndkFolderPath = Join-Path (Get-AndroidSDKRoot) "ndk" + $ndkInfo += Get-ChildItem -Path $ndkFolderPath | ForEach-Object { + return [PSCustomObject] @{ + "Version" = $_.Name + "Path" = $_.FullName + } + } + } + + $ndkBundleInfo = $installedPackages | Where-Object { $_ -Match "ndk-bundle" } | Select-Object -First 1 + $ndkBundleVersion = (Split-TableRowByColumns $ndkBundleInfo)[1] + $ndkInfo += [PSCustomObject] @{ + "Version" = $ndkBundleVersion + "Path" = Join-Path (Get-AndroidSDKRoot) "ndk-bundle" + } + + $ndkInfo | ForEach-Object { + $_.Path = $_.Path.Replace($env:HOME, '$HOME') + } + + return $ndkInfo +} + +function Build-AndroidUtilsTable { + param ( + [Parameter(Mandatory)][AllowEmptyString()] + [string[]] $installedPackages + ) + + $utilsList = @("cmake", "Android Emulator") + return $utilsList | ForEach-Object { + $packageName = $_ + $packageInfo = $installedPackages | Where-Object { $_ -Match $packageName } | Select-Object -First 1 + $packageInfoParts = Split-TableRowByColumns $packageInfo + return [PSCustomObject] @{ + "Package Name" = $packageName + "Version" = $packageInfoParts[1] + } + } +} + +function Build-AndroidExtraPackagesTable { + param ( + [Parameter(Mandatory)][AllowEmptyString()] + [string[]] $installedPackages + ) + + $extraPackages = @( + "Android Support Repository", + "Google Play services", + "Google Repository", + "Hardware_Accelerated_Execution_Manager" + ) + + return $extraPackages | ForEach-Object { + $packageId = $_ + $packageInfo = $installedPackages | Where-Object { $_ -Like "*${packageId}*" } | Select-Object -First 1 + $packageInfoParts = Split-TableRowByColumns $packageInfo + return [PSCustomObject] @{ + "Package Name" = $packageInfoParts[2] + "Version" = $packageInfoParts[1] + } + } +} \ No newline at end of file diff --git a/images/macos/software-report/SoftwareReport.Browsers.psm1 b/images/macos/software-report/SoftwareReport.Browsers.psm1 new file mode 100644 index 000000000..4e46f79f4 --- /dev/null +++ b/images/macos/software-report/SoftwareReport.Browsers.psm1 @@ -0,0 +1,52 @@ +function Get-BrowserSection { + return New-MDList -Style Unordered -Lines @( + (Get-SafariVersion), + (Get-SafariDriverVersion), + (Get-ChromeVersion), + (Get-ChromeDriverVersion), + (Get-EdgeVersion), + (Get-EdgeDriverVersion), + (Get-FirefoxVersion), + (Get-GeckodriverVersion) + ) +} + +function Get-SafariVersion { + $version = Run-Command "defaults read /Applications/Safari.app/Contents/Info CFBundleShortVersionString" + $build = Run-Command "defaults read /Applications/Safari.app/Contents/Info CFBundleVersion" + "Safari $version ($build)" +} + +function Get-SafariDriverVersion { + $version = Run-Command "safaridriver --version" | Take-Part -Part 3,4 + "SafariDriver $version" +} + +function Get-ChromeVersion { + $chromePath = "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" + return Run-Command "'${chromePath}' --version" +} + +function Get-ChromeDriverVersion { + $rawOutput = Run-Command "chromedriver --version" + $version = $rawOutput | Take-Part -Part 1 + return "ChromeDriver ${version}" +} + +function Get-EdgeVersion { + $edgePath = "/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge" + return Run-Command "'${edgePath}' --version" +} + +function Get-EdgeDriverVersion { + return Run-Command "msedgedriver --version" | Take-Part -Part 0,1 +} + +function Get-FirefoxVersion { + $firefoxPath = "/Applications/Firefox.app/Contents/MacOS/firefox" + return Run-Command "'${firefoxPath}' --version" +} + +function Get-GeckodriverVersion { + return Run-Command "geckodriver --version" | Select-Object -First 1 +} \ No newline at end of file diff --git a/images/macos/software-report/SoftwareReport.Common.psm1 b/images/macos/software-report/SoftwareReport.Common.psm1 new file mode 100644 index 000000000..cd3cce626 --- /dev/null +++ b/images/macos/software-report/SoftwareReport.Common.psm1 @@ -0,0 +1,117 @@ +Import-Module "$PSScriptRoot/../helpers/SoftwareReport.Helpers.psm1" -DisableNameChecking + +function Get-DotnetVersionList { + $sdkRawList = Run-Command "dotnet --list-sdks" + $sdkVersionList = $sdkRawList | ForEach-Object { Take-Part $_ -Part 0 } + return ".NET SDK " + [string]::Join(" ", $sdkVersionList) +} + +function Get-GoVersion { + $goOutput = Run-Command "go version" | Take-Part -Part 2 + if ($goOutput.StartsWith("go")) { + $goOutput = $goOutput.Substring(2) + } + + return $goOutput +} + +function Get-RVersion { + $rVersion = Run-Command "R --version | grep 'R version'" | Take-Part -Part 2 + return "R $rVersion" +} +function Get-RustVersion { + $rustVersion = Run-Command "rustc --version" | Take-Part -Part 1 + return "${rustVersion}" +} + +function Get-Bindgen { + $bindgenVersion = Run-Command "bindgen --version" | Take-Part -Part 1 + return "Bindgen $bindgenVersion" +} + +function Get-Cbindgen { + $cbindgenVersion = Run-Command "cbindgen --version" | Take-Part -Part 1 + return "Cbindgen $cbindgenVersion" +} + +function Get-Cargooutdated { + $cargoOutdatedVersion = Run-Command "cargo outdated --version" | Take-Part -Part 1 + return "Cargo-outdated $cargoOutdatedVersion" +} + +function Get-Cargoaudit { + $cargoAuditVersion = Run-Command "cargo audit --version" | Take-Part -Part 1 + return "Cargo-audit $cargoAuditVersion" +} + +function Get-RustupVersion { + $rustupVersion = Run-Command "rustup --version" | Take-Part -Part 1 + return "Rustup ${rustupVersion}" +} + +function Get-VcpkgVersion { + $vcpkgVersion = Run-Command "vcpkg version" | Select-Object -First 1 | Take-Part -Part 5 | Take-Part -Part 0 -Delimiter "-" + return "Vcpkg ${vcpkgVersion}" +} + +function Get-GccVersion { + $versionList = @("8", "9") + $versionList | Foreach-Object { + $version = Run-Command "gcc-${_} --version" | Select-Object -First 1 + "$version — available by ``gcc-${_}`` alias" + } +} + +function Get-FortranVersion { + $versionList = @("8", "9") + $versionList | Foreach-Object { + $version = Run-Command "gfortran-${_} --version" | Select-Object -First 1 + "$version — available by ``gfortran-${_}`` alias" + } +} + +function Get-ClangLLVMVersion { + $clangLLVMVersion = Run-Command "$(brew --prefix llvm)/bin/clang --version" | Select-Object -First 1 | Take-Part -Part 2 + "Clang/LLVM $clangLLVMVersion" +} + +function Get-NVMVersion { + $nvmPath = Join-Path $env:HOME ".nvm" "nvm.sh" + $nvmInitCommand = ". ${nvmPath} > /dev/null 2>&1 || true" + $nodejsVersion = Run-Command "${nvmInitCommand} && nvm --version" + return $nodejsVersion +} + +function Get-PipVersion { + param ( + [Parameter(Mandatory)][ValidateRange(2, 3)] + [int] $Version + ) + + $command = If ($Version -eq 2) { "pip --version" } Else { "pip3 --version" } + $commandOutput = Run-Command $command + $versionPart1 = $commandOutput | Take-Part -Part 1 + $versionPart2 = $commandOutput | Take-Part -Part 4 + $versionPart3 = $commandOutput | Take-Part -Part 5 + return "${versionPart1} ${versionPart2} ${versionPart3}" +} + +function Get-NVMNodeVersionList { + $nvmPath = Join-Path $env:HOME ".nvm" "nvm.sh" + $nvmInitCommand = ". ${nvmPath} > /dev/null 2>&1 || true" + $nodejsVersionsRaw = Run-Command "${nvmInitCommand} && nvm ls" + $nodeVersions = $nodejsVersionsRaw | ForEach-Object { $_.TrimStart(" ").TrimEnd(" *") } | Where-Object { $_.StartsWith("v") } + return [string]::Join(" ", $nodeVersions) +} + +function Build-OSInfoSection { + $fieldsToInclude = @("System Version:", "Kernel Version:") + $rawSystemInfo = Invoke-Expression "system_profiler SPSoftwareDataType" + $parsedSystemInfo = $rawSystemInfo | Where-Object { -not ($_ | Select-String -NotMatch $fieldsToInclude) } | ForEach-Object { $_.Trim() } + $output = "" + $parsedSystemInfo[0] -match "System Version: macOS (?\d+\.\d+)" | Out-Null + $version = $Matches.Version + $output += New-MDHeader "macOS $version info" -Level 1 + $output += New-MDList -Style Unordered -Lines $parsedSystemInfo -NoNewLine + return $output +} \ No newline at end of file diff --git a/images/macos/software-report/SoftwareReport.Generator.ps1 b/images/macos/software-report/SoftwareReport.Generator.ps1 new file mode 100644 index 000000000..5d2984f6d --- /dev/null +++ b/images/macos/software-report/SoftwareReport.Generator.ps1 @@ -0,0 +1,361 @@ +param ( + [Parameter(Mandatory)][string] + $OutputDirectory, + $ImageName +) + +Import-Module MarkdownPS +Import-Module "$PSScriptRoot/SoftwareReport.Common.psm1" -DisableNameChecking +Import-Module "$PSScriptRoot/SoftwareReport.Xcode.psm1" -DisableNameChecking +Import-Module "$PSScriptRoot/SoftwareReport.Android.psm1" -DisableNameChecking +Import-Module "$PSScriptRoot/SoftwareReport.Java.psm1" -DisableNameChecking +Import-Module "$PSScriptRoot/SoftwareReport.Xamarin.psm1" -DisableNameChecking +Import-Module "$PSScriptRoot/SoftwareReport.Toolcache.psm1" -DisableNameChecking +Import-Module "$PSScriptRoot/SoftwareReport.Browsers.psm1" -DisableNameChecking +Import-Module "$PSScriptRoot/../helpers/SoftwareReport.Helpers.psm1" +Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1" +Import-Module "$PSScriptRoot/../helpers/Xcode.Helpers.psm1" + +# Operating System info +$os = Get-OSVersion + +# Language and Runtime +$nodejsVersion = Run-Command "node --version" +$nvmVersion = Get-NVMVersion +$nvmCachedVersions = Get-NVMNodeVersionList +$pythonVersion = Run-Command "python --version" +$python3Version = Run-Command "python3 --version" +$rubyVersion = Run-Command "ruby --version" | Take-Part -Part 1 +$goVersion = Get-GoVersion +$phpVersion = Run-Command "php --version" | Select-Object -First 1 | Take-Part -Part 0,1 +$juliaVersion = Run-Command "julia --version" | Take-Part -Part 0,2 + +$markdown = "" + +# Get announcements +if ($env:ANNOUNCEMENTS) { + $markdown += $env:ANNOUNCEMENTS + $markdown += New-MDNewLine + $markdown += "***" + $markdown += New-MDNewLine +} + +# OS info +$markdown += Build-OSInfoSection +$markdown += New-MDList -Style Unordered -Lines ("Image Version: {0}" -f $ImageName.Split('_')[1]) +# Software report +$markdown += New-MDHeader "Installed Software" -Level 2 +$markdown += New-MDHeader "Language and Runtime" -Level 3 + +if ( -not $os.IsHighSierra) { + $clangLLVMVersion = Get-ClangLLVMVersion + $gccVersion = Get-GccVersion + $gfortranVersion = Get-FortranVersion + $lines = @($clangLLVMVersion, $gccVersion, $gfortranVersion) | ForEach-Object {$_} + $markdown += New-MDList -Style Unordered -NoNewLine -Lines $lines +} + +$markdown += New-MDList -Style Unordered -Lines @( + "Node.js ${nodejsVersion}" + "NVM ${nvmVersion}" + "NVM - Cached node versions: ${nvmCachedVersions}" + $pythonVersion, + $python3Version, + "Ruby ${rubyVersion}", + (Get-DotnetVersionList), + (Get-RVersion), + "Go ${goVersion}", + "$phpVersion", + "$juliaVersion" +) + +# Package Management +$bundlerVersion = Run-Command "bundle --version" +$carthageVersion = Run-Command "carthage version" -SuppressStderr +$cocoaPodsVersion = Run-Command "pod --version" +$homebrewVersion = Run-Command "brew --version" | Select-Object -First 1 +$npmVersion = Run-Command "npm --version" +$yarnVersion = Run-Command "yarn --version" +$nugetVersion = Run-Command "nuget help" | Select-Object -First 1 | Take-Part -Part 2 +$pipVersion = Get-PipVersion -Version 2 +$pip3Version = Get-PipVersion -Version 3 +$condaVersion = Invoke-Expression "conda --version" +$rubyGemsVersion = Run-Command "gem --version" +$composerVersion = Run-Command "composer --version" | Take-Part -Part 2 + +$markdown += New-MDHeader "Package Management" -Level 3 +if ($os.IsHigherThanMojave) { + $vcpkgVersion = Get-VcpkgVersion + $markdown += New-MDList -Lines $vcpkgVersion -Style Unordered -NoNewLine +} +$markdown += New-MDList -Style Unordered -Lines @( + $bundlerVersion, + "Carthage ${carthageVersion}", + "CocoaPods ${cocoaPodsVersion}", + $homebrewVersion, + "NPM ${npmVersion}", + "Yarn ${yarnVersion}", + "NuGet ${nugetVersion}", + "Pip ${pipVersion}", + "Pip ${pip3Version}", + "Mini${condaVersion}", + "RubyGems ${rubyGemsVersion}", + "Composer ${composerVersion}" +) + +# Project Management +$mavenVersion = Run-Command "mvn -version" | Select-Object -First 1 | Take-Part -Part 2 +#gradle output differs on the first launch – a welcome message, that we don't need is rendered. The solution is to take the last "Gradle" occurrence from the output +$gradleVersion = (Run-Command "gradle --version" | Select-String "Gradle")[-1] +$apacheAnt = Run-Command "ant -version" | Take-Part -Part 0,1,3 + +$markdown += New-MDHeader "Project Management" -Level 3 +$markdown += New-MDList -Style Unordered -Lines @( + "Apache Maven ${mavenVersion}", + $gradleVersion, + $apacheAnt +) + +# Utilities +$curlVersion = Run-Command "curl --version" | Select-Object -First 1 | Take-Part -Part 1 +$gitVersion = Run-Command "git --version" | Take-Part -Part 2 +$ghVersion = Run-Command "gh --version" | Select-String "gh version" | Select-Object -First 1 | Take-Part -Part 2 +$gitLFSVersion = Run-Command "git-lfs version" | Take-Part -Part 0 | Take-Part -Part 1 -Delimiter "/" +$hubVersion = Run-Command "hub version | grep 'hub version'" | Take-Part -Part 2 +$wgetVersion = Run-Command "wget --version" | Select-String "GNU Wget" | Take-Part -Part 2 +$svnVersion = Run-Command "svn --version --quiet" +$parallelVersion = Run-Command "parallel --version" | Select-String "GNU parallel" | Select-Object -First 1 +$jqVersion = Run-Command "jq --version" | Take-Part -Part 1 -Delimiter "-" +$opensslVersion = Get-Item /usr/local/opt/openssl | ForEach-Object {"{0} ``({1} -> {2})``" -f (Run-Command "openssl version"), $_.FullName, $_.Target} +$gpgVersion = Run-Command "gpg --version" | Select-String 'gpg (GnuPG)' -SimpleMatch +$postgresClientVersion = Run-Command "psql --version" +$postgresServerVersion = Run-Command "pg_config --version" +$aria2Version = Run-Command "aria2c --version" | Select-Object -First 1 | Take-Part -Part 2 +$azcopyVersion = Run-Command "azcopy --version" | Take-Part -Part 2 +$zstdVersion = Run-Command "zstd --version" | Take-Part -Part 1 -Delimiter "v" | Take-Part -Part 0 -Delimiter "," +$bazelVersion = Run-Command "bazel --version" | Take-Part -Part 0 -Delimiter "-" +$bazeliskVersion = Run-Command "bazelisk version" | Select-String "Bazelisk version:" | Take-Part -Part 1 -Delimiter ":" +$packerVersion = Run-Command "packer --version" +$helmVersion = Run-Command "helm version --short" +$vbox = Run-Command "vboxmanage -v" +$vagrant = Run-Command "vagrant -v" +$mongo = Run-Command "mongo --version" | Select-String "MongoDB shell version" | Take-Part -Part 3 +$mongod = Run-Command "mongod --version" | Select-String "db version " | Take-Part -Part 2 +$p7zip = Run-Command "7z i" | Select-String "7-Zip" | Take-Part -Part 0,2 + +$markdown += New-MDHeader "Utilities" -Level 3 +$markdown += New-MDList -Style Unordered -NoNewLine -Lines @( + "Curl ${curlVersion}", + "Git: ${gitVersion}", + "Git LFS: ${gitLFSVersion}", + "GitHub CLI: ${ghVersion}", + "Hub CLI: ${hubVersion}", + "GNU Wget ${wgetVersion}", + "Subversion (SVN) ${svnVersion}", + "Packer $packerVersion", + $parallelVersion, + $opensslVersion, + "jq ${jqVersion}", + $gpgVersion, + $postgresClientVersion, + $postgresServerVersion, + "aria2 $aria2Version", + "azcopy $azcopyVersion", + "zstd $zstdVersion", + $bazelVersion, + "bazelisk $($bazeliskVersion.Trim())", + "helm $helmVersion", + "virtualbox $vbox", + "mongo $mongo", + "mongod $mongod", + "$vagrant", + $p7zip +) +if ($os.IsHigherThanMojave) { + $newmanVersion = Run-Command "newman --version" + $markdown += New-MDList -Lines "Newman $newmanVersion" -Style Unordered +} +$markdown += New-MDNewLine + +# Tools +$fastlaneVersion = Run-Command "fastlane --version" | Select-String "fastlane [0-9]" | Take-Part -Part 1 +$cmakeVersion = Run-Command "cmake --version" | Select-Object -First 1 | Take-Part -Part 2 +$appcenterCLIVersion = Run-Command "appcenter --version" | Take-Part -Part 2 +$azureCLIVersion = Run-Command "az -v" | Select-String "^azure-cli" | Take-Part -Part 1 +$awsVersion = Run-Command "aws --version" | Take-Part -Part 0 | Take-Part -Delimiter "/" -Part 1 +$aliyunVersion = Run-Command "aliyun --version" | Select-String "Alibaba Cloud Command Line Interface Version " | Take-Part -Part 6 +$awsSamVersion = Run-Command "sam --version" | Take-Part -Part 3 +$awsSessionManagerVersion = Run-Command "session-manager-plugin --version" +$ghcUpVersion = Run-Command "ghcup --version" | Take-Part -Part 5 +$ghcVersion = Run-Command "ghc --version" | Take-Part -Part 7 +$cabalVersion = Run-Command "cabal --version" | Take-Part -Part 3 +$stackVersion = Run-Command "stack --version" | Take-Part -Part 1 | ForEach-Object {$_.replace(",","")} + +$markdown += New-MDHeader "Tools" -Level 3 +$markdown += New-MDList -Style Unordered -NoNewLine -Lines @( + "Fastlane ${fastlaneVersion}", + "Cmake ${cmakeVersion}", + "App Center CLI ${appcenterCLIVersion}", + "Azure CLI ${azureCLIVersion}", + "AWS CLI ${awsVersion}", + "AWS SAM CLI ${awsSamVersion}", + "AWS Session Manager CLI ${awsSessionManagerVersion}", + "Aliyun CLI ${aliyunVersion}" +) + +if( -not $os.IsHighSierra) { + $markdown += New-MDList -Style Unordered -Lines @( + "GHCup ${ghcUpVersion}", + "GHC ${ghcVersion}", + "Cabal ${cabalVersion}", + "Stack ${stackVersion}" + ) +} + +# Linters +$markdown += New-MDHeader "Linters" -Level 3 +$yamllintVersion = Run-Command "yamllint --version" +$markdown += New-MDList -Style Unordered -NoNewLine -Lines @( + $yamllintVersion +) + +if ( -not $os.IsHighSierra) { + $swiftlintVersion = Run-Command "swiftlint version" + $markdown += New-MDList -Style Unordered -Lines @( + "SwiftLint ${swiftlintVersion}" + ) +} + +$markdown += New-MDHeader "Browsers" -Level 3 +$markdown += Get-BrowserSection + +$markdown += New-MDHeader "Java" -Level 3 +$markdown += Get-JavaVersions | New-MDTable + +# Toolcache +$markdown += Build-ToolcacheSection + +if ( -not $os.IsHighSierra) { + $rustVersion = Get-RustVersion + $markdown += New-MDHeader "Rust Tools" -Level 3 + $markdown += New-MDList -Style Unordered -Lines @( + "Rust $rustVersion", + (Get-RustupVersion) + ) + $markdown += New-MDHeader "Packages" -Level 4 + $markdown += New-MDList -Style Unordered -Lines @( + (Get-Bindgen), + (Get-Cbindgen), + (Get-Cargooutdated), + (Get-Cargoaudit) + ) +} + +$markdown += New-MDHeader "PowerShell Tools" -Level 3 +$powershellVersion = Run-Command "powershell --version" +$markdown += New-MDList -Lines $powershellVersion -Style Unordered + +$markdown += New-MDHeader "PowerShell Modules" -Level 4 +$markdown += Get-PowerShellModules | New-MDTable +$markdown += New-MDNewLine + +# Xamarin section +$markdown += New-MDHeader "Xamarin" -Level 3 +$markdown += New-MDHeader "Visual Studio for Mac" -Level 4 +$markdown += New-MDList -Lines @(Get-VSMacVersion) -Style Unordered + +$markdown += New-MDHeader "Mono" -Level 4 +$markdown += New-MDList -Lines (Build-MonoList) -Style Unordered + +$markdown += New-MDHeader "Xamarin.iOS" -Level 4 +$markdown += New-MDList -Lines (Build-XamarinIOSList) -Style Unordered + +$markdown += New-MDHeader "Xamarin.Mac" -Level 4 +$markdown += New-MDList -Lines (Build-XamarinMacList) -Style Unordered + +$markdown += New-MDHeader "Xamarin.Android" -Level 4 +$markdown += New-MDList -Lines (Build-XamarinAndroidList) -Style Unordered + +$markdown += New-MDHeader "Unit Test Framework" -Level 4 +$markdown += New-MDList -Lines @(Get-NUnitVersion) -Style Unordered + +# Xcode section +$xcodeInfo = Get-XcodeInfoList +$markdown += New-MDHeader "Xcode" -Level 3 +$markdown += Build-XcodeTable $xcodeInfo | New-MDTable +$markdown += New-MDNewLine + +$markdown += Build-XcodeSupportToolsSection + +$markdown += New-MDHeader "Installed SDKs" -Level 4 +$markdown += Build-XcodeSDKTable $xcodeInfo | New-MDTable +$markdown += New-MDNewLine + +# Disable simulators table on 11.0 beta for now since "simctl" tool doesn't work properly +if (-not $os.IsBigSur) { + $markdown += New-MDHeader "Installed Simulators" -Level 4 + $markdown += Build-XcodeSimulatorsTable $xcodeInfo | New-MDTable + $markdown += New-MDNewLine +} + +# Android section +$markdown += New-MDHeader "Android" -Level 3 +$androidInstalledPackages = Get-AndroidInstalledPackages + +$markdown += New-MDHeader "Android SDK Tools" -Level 4 +$androidSDKTools = $androidInstalledPackages | Where-Object { $_ -Match "Android SDK Tools" } +$markdown += Build-AndroidSDKToolsTable $androidSDKTools | New-MDTable +$markdown += New-MDNewLine + +$markdown += New-MDHeader "Android SDK Platform-Tools" -Level 4 +$androidSDKPlatformTools = $androidInstalledPackages | Where-Object { $_ -Match "Android SDK Platform-Tools" } +$markdown += Build-AndroidSDKToolsTable $androidSDKPlatformTools | New-MDTable +$markdown += New-MDNewLine + +$markdown += New-MDHeader "Android SDK Platforms" -Level 4 +$androidSDKPlatforms = $androidInstalledPackages | Where-Object { $_ -Match "Android SDK Platform " } +$markdown += Build-AndroidSDKPlatformTable $androidSDKPlatforms | New-MDTable +$markdown += New-MDNewLine + +$markdown += New-MDHeader "Android SDK Build-Tools" -Level 4 +$androidSDKBuildTools = $androidInstalledPackages | Where-Object { $_ -Match "Android SDK Build-Tools" } +$markdown += Build-AndroidSDKBuildtoolsTable $androidSDKBuildTools | New-MDTable +$markdown += New-MDNewLine + +$markdown += New-MDHeader "Android NDKs" -Level 4 +$markdown += Build-AndroidNDKTable $androidInstalledPackages | New-MDTable +$markdown += New-MDNewLine + +$markdown += New-MDHeader "Android Utils" -Level 4 +$markdown += Build-AndroidUtilsTable $androidInstalledPackages | New-MDTable +$markdown += New-MDNewLine + +$androidGoogleAPIsTable = $androidInstalledPackages | Where-Object { $_ -Match "Google APIs" } +if ($androidGoogleAPIsTable.Count -gt 0) { + $markdown += New-MDHeader "Android Google APIs" -Level 4 + $markdown += Build-AndroidSDKPlatformTable $androidGoogleAPIsTable | New-MDTable + $markdown += New-MDNewLine +} + +$markdown += New-MDHeader "Extra Packages" -Level 4 +$markdown += Build-AndroidExtraPackagesTable $androidInstalledPackages | New-MDTable +$markdown += New-MDNewLine + +# +# Generate systeminfo.txt with information about image (for debug purpose) +# +$dateTime = (Get-Date).ToString("yyyy-MM-dd HH:mm:ss") +$systemInfo = [string]::Join([System.Environment]::NewLine, @( + "Date: ${dateTime}", + "Image name: ${ImageName}" +)) + + +if (-not (Test-Path $OutputDirectory)) { New-Item -Path $OutputDirectory -ItemType Directory | Out-Null } + +# +# Write final reports +# +Write-Host $markdownExtended +$systemInfo | Out-File -FilePath "${OutputDirectory}/systeminfo.txt" -Encoding UTF8NoBOM +$markdown | Out-File -FilePath "${OutputDirectory}/systeminfo.md" -Encoding UTF8NoBOM \ No newline at end of file diff --git a/images/macos/software-report/SoftwareReport.Java.psm1 b/images/macos/software-report/SoftwareReport.Java.psm1 new file mode 100644 index 000000000..f66597cba --- /dev/null +++ b/images/macos/software-report/SoftwareReport.Java.psm1 @@ -0,0 +1,30 @@ +function Get-JavaFullVersion { + param($JavaRootPath) + + $javaBinPath = Join-Path $javaRootPath "/bin/java" + $javaVersionOutput = (Get-CommandResult "$javaBinPath -version").Output + $matchResult = $javaVersionOutput | Select-String '^openjdk version \"([\d\._]+)\"' + return $matchResult.Matches.Groups[1].Value +} + +function Get-JavaVersions { + $defaultJavaPath = Get-Item env:JAVA_HOME + $javaVersions = Get-Item env:JAVA_HOME_*_X64 + $sortRules = @{ + Expression = { [Int32]$_.Name.Split("_")[2] } + Descending = $false + } + + return $javaVersions | Sort-Object $sortRules | ForEach-Object { + $javaPath = $_.Value + $version = Get-JavaFullVersion $javaPath + $vendor = $version.StartsWith("1.7") ? "Zulu" : "AdoptOpenJDK" + $defaultPostfix = ($javaPath -eq $defaultJavaPath) ? " (default)" : "" + + [PSCustomObject] @{ + "Version" = $version + $defaultPostfix + "Vendor" = $vendor + "Environment Variable" = $_.Name + } + } +} \ No newline at end of file diff --git a/images/macos/software-report/SoftwareReport.Toolcache.psm1 b/images/macos/software-report/SoftwareReport.Toolcache.psm1 new file mode 100644 index 000000000..717f614ff --- /dev/null +++ b/images/macos/software-report/SoftwareReport.Toolcache.psm1 @@ -0,0 +1,72 @@ +Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1" + +$os = Get-OSVersion + +function Get-ToolcacheRubyVersions { + $toolcachePath = Join-Path $env:HOME "hostedtoolcache" "Ruby" + return Get-ChildItem $toolcachePath -Name | Sort-Object { [Version]$_ } +} + +function Get-ToolcachePythonVersions { + $toolcachePath = Join-Path $env:HOME "hostedtoolcache" "Python" + return Get-ChildItem $toolcachePath -Name | Sort-Object { [Version]$_ } +} + +function Get-ToolcachePyPyVersions { + $toolcachePath = Join-Path $env:HOME "hostedtoolcache/PyPy/*/x64" + Get-ChildItem -Path $toolcachePath | Sort-Object { [Version] $_.Parent.Name } | ForEach-Object { + $foundVersionPath = $_.FullName + $foundVersionName = (Get-Item ($foundVersionPath -replace "x64") | Sort-Object -Property {[version]$_.name} -Descending | Select-Object -First 1).name + $arrPyPyVersion = ((& "$foundVersionPath/bin/python" -c "import sys;print(sys.version.split('\n')[1])") -split " ") + $pypyVersion = "$($arrPyPyVersion[0]) $($arrPyPyVersion[1])" + return "{0} {1}]" -f $foundVersionName, $pypyVersion + } +} + +function Get-ToolcacheNodeVersions { + $toolcachePath = Join-Path $env:HOME "hostedtoolcache" "Node" + return Get-ChildItem $toolcachePath -Name | Sort-Object { [Version]$_ } +} + +function Get-ToolcacheGoVersions { + $toolcachePath = Join-Path $env:HOME "hostedtoolcache" "Go" + return Get-ChildItem $toolcachePath -Name | Sort-Object { [Version]$_ } +} + +function Build-ToolcacheSection { + $output = "" + $output += New-MDHeader "Cached Tools" -Level 3 + $output += New-MDHeader "Ruby" -Level 4 + $output += New-MDList -Lines (Get-ToolcacheRubyVersions) -Style Unordered + $output += New-MDHeader "Python" -Level 4 + $output += New-MDList -Lines (Get-ToolcachePythonVersions) -Style Unordered + + if ($os.IsLessThanBigSur) { + $output += New-MDHeader "PyPy" -Level 4 + $output += New-MDList -Lines (Get-ToolcachePyPyVersions) -Style Unordered + } + + if( -not $os.IsHighSierra) { + $output += New-MDHeader "Node.js" -Level 4 + $output += New-MDList -Lines (Get-ToolcacheNodeVersions) -Style Unordered + $output += New-MDHeader "Go" -Level 4 + $output += New-MDList -Lines (Get-ToolcacheGoVersions) -Style Unordered + } + + return $output +} + +function Get-PowerShellModules { + $modules = (Get-ToolsetValue powershellModules).name + + $psModules = Get-Module -Name $modules -ListAvailable | Sort-Object Name | Group-Object Name + $psModules | ForEach-Object { + $moduleName = $_.Name + $moduleVersions = ($_.group.Version | Sort-Object -Unique) -join '
' + + [PSCustomObject]@{ + Module = $moduleName + Version = $moduleVersions + } + } +} \ No newline at end of file diff --git a/images/macos/software-report/SoftwareReport.Xamarin.psm1 b/images/macos/software-report/SoftwareReport.Xamarin.psm1 new file mode 100644 index 000000000..de1eca6cd --- /dev/null +++ b/images/macos/software-report/SoftwareReport.Xamarin.psm1 @@ -0,0 +1,78 @@ +$sortRulesByVersion = @{ + Expression = { [System.Version]::Parse($_) } + Descending = $true +} + +function Get-VSMacVersion { + $plistPath = "/Applications/Visual Studio.app/Contents/Info.plist" + return Run-Command "/usr/libexec/PlistBuddy -c 'Print CFBundleVersion' '$plistPath'" +} + +function Get-NUnitVersion { + $version = Run-Command "nunit3-console --version" | Select-Object -First 1 | Take-Part -Part 3 + return "NUnit ${version}" +} + +function Build-MonoList { + $monoVersionsPath = "/Library/Frameworks/Mono.framework/Versions" + $monoFolders = Get-ChildItemWithoutSymlinks $monoVersionsPath + + $monoVersionList = $monoFolders | ForEach-Object { + $versionFilePath = Join-Path $_.FullName "Version" + if (Test-Path $versionFilePath) { + return Get-Content -Raw $versionFilePath + } + + return $_.Name + } | ForEach-Object { $_.Trim() } + + return $monoVersionList | Sort-Object -Property $sortRulesByVersion +} + +function Build-XamarinIOSList { + $sdkVersionsPath = "/Library/Frameworks/Xamarin.iOS.framework/Versions" + $sdkFolders = Get-ChildItemWithoutSymlinks $sdkVersionsPath + + $sdkVersionList = $sdkFolders | ForEach-Object { + $versionFilePath = Join-Path $_.FullName "Version" + if (Test-Path $versionFilePath) { + return Get-Content -Raw $versionFilePath + } + + return $_.Name + } | ForEach-Object { $_.Trim() } + + return $sdkVersionList | Sort-Object -Property $sortRulesByVersion +} + +function Build-XamarinMacList { + $sdkVersionsPath = "/Library/Frameworks/Xamarin.Mac.framework/Versions" + $sdkFolders = Get-ChildItemWithoutSymlinks $sdkVersionsPath + + $sdkVersionList = $sdkFolders | ForEach-Object { + $versionFilePath = Join-Path $_.FullName "Version" + if (Test-Path $versionFilePath) { + return Get-Content -Raw $versionFilePath + } + + return $_.Name + } | ForEach-Object { $_.Trim() } + + return $sdkVersionList | Sort-Object -Property $sortRulesByVersion +} + +function Build-XamarinAndroidList { + $sdkVersionsPath = "/Library/Frameworks/Xamarin.Android.framework/Versions" + $sdkFolders = Get-ChildItemWithoutSymlinks $sdkVersionsPath + + $sdkVersionList = $sdkFolders | ForEach-Object { + $versionFilePath = Join-Path $_.FullName "Version" + if (Test-Path $versionFilePath) { + return Get-Content -Raw $versionFilePath + } + + return $_.Name + } | ForEach-Object { $_.Trim() } + + return $sdkVersionList | Sort-Object -Property $sortRulesByVersion +} \ No newline at end of file diff --git a/images/macos/software-report/SoftwareReport.Xcode.psm1 b/images/macos/software-report/SoftwareReport.Xcode.psm1 new file mode 100644 index 000000000..d4cda2eb6 --- /dev/null +++ b/images/macos/software-report/SoftwareReport.Xcode.psm1 @@ -0,0 +1,236 @@ +function Get-XcodePaths { + $xcodePaths = Get-ChildItemWithoutSymlinks "/Applications" -Filter "Xcode_*.app" + return $xcodePaths | Select-Object -ExpandProperty Fullname +} + +function Get-XcodeVersionInfo { + [string]$output = Invoke-Expression "xcodebuild -version" + $versionOutputParts = $output.Split(" ") + return @{ + Version = [System.Version]::Parse($versionOutputParts[1]) + Build = $versionOutputParts[4] + } +} + +function Get-XcodeSDKList { + $versionInfo = Get-XcodeVersionInfo + if ($versionInfo.Version -le [System.Version]::Parse("9.4.1")) { + $output = Invoke-Expression "xcodebuild -showsdks" + $sdkList = $output | Where-Object { $_ -Match "-sdk" } + + return $sdkList | ForEach-Object { + $displayName, $canonicalName = $_.Split("-sdk") + return @{ + canonicalName = $canonicalName.Trim() + displayName = $displayName.Trim() + } + } + } + + [string]$output = Invoke-Expression "xcodebuild -showsdks -json" + return $output | ConvertFrom-Json +} + +function Get-XcodeInfoList { + $defaultXcodeRootPath = Get-DefaultXcodeRootPath + + $xcodeInfo = @{} + Get-XcodePaths | ForEach-Object { + $xcodeRootPath = $_ + Switch-Xcode -XcodeRootPath $xcodeRootPath + + $versionInfo = Get-XcodeVersionInfo + $versionInfo.Path = $xcodeRootPath + $versionInfo.IsDefault = ($xcodeRootPath -eq $defaultXcodeRootPath) + + $xcodeInfo.Add($versionInfo.Version.ToString(), [PSCustomObject] @{ + VersionInfo = $versionInfo + SDKInfo = Get-XcodeSDKList + SimulatorsInfo = Get-XcodeSimulatorsInfo + }) + } + + Switch-Xcode -XcodeRootPath $defaultXcodeRootPath + + return $xcodeInfo +} + +function Get-XcodePlatformOrder { + param ( + [Parameter(Mandatory)] + [string] $PlatformName + ) + + Switch ($PlatformName) { + "macOS" { 1 } + "iOS" { 2 } + "Simulator - iOS" { 3 } + "tvOS" { 4 } + "Simulator - tvOS" { 5 } + "watchOS" { 6 } + "Simulator - watchOS" { 7 } + Default { 100 } + } +} + +function Build-XcodeTable { + param ( + [Parameter(Mandatory)] + [hashtable] $xcodeInfo + ) + + $sortRules = @{ + Expression = { $_.Version } + Descending = $true + } + + $xcodeList = $xcodeInfo.Values | ForEach-Object { $_.VersionInfo } | Sort-Object $sortRules + return $xcodeList | ForEach-Object { + $defaultPostfix = If ($_.IsDefault) { " (default)" } else { "" } + return [PSCustomObject] @{ + "Version" = $_.Version.ToString() + $betaPostfix + $defaultPostfix + "Build" = $_.Build + "Path" = $_.Path + } + } +} + +function Get-XcodeDevicesList { + param ( + [Parameter(Mandatory)][object] $XcodeInfo, + [Parameter(Mandatory)][object] $Runtime + ) + + $runtimeId = $Runtime.identifier + $runtimeName = $Runtime.name + $output = $XcodeInfo.SimulatorsInfo.devices.$runtimeId + if ($null -eq $output) { + $output = $XcodeInfo.SimulatorsInfo.devices.$runtimeName + } + + return $output +} + +function Build-XcodeSDKTable { + param ( + [Parameter(Mandatory)] + [hashtable] $xcodeInfo + ) + + $sdkNames = @() + $xcodeInfo.Values | ForEach-Object { + $_.SDKInfo | ForEach-Object { + $sdkNames += $_.canonicalName + } + } + + $sdkNames = $sdkNames | Select-Object -Unique + return $sdkNames | ForEach-Object { + $sdkName = $_ + $sdkDisplayName = "" + $xcodeList = @() + $xcodeInfo.Values | ForEach-Object { + $sdk = $_.SDKInfo | Where-Object { $_.canonicalName -eq $sdkName } | Select-Object -First 1 + if ($sdk) { + $sdkDisplayName = $sdk.displayName + $xcodeList += $_.VersionInfo.Version + } + } + + $xcodeList = $xcodeList | Sort-Object + + return [PSCustomObject] @{ + "SDK" = $sdkDisplayName + "SDK Name" = $sdkName + "Xcode Version" = [String]::Join(", ", $xcodeList) + } + } | Sort-Object { + # Sort rule 1 + $sdkNameParts = $_."SDK".Split(" ") + $platformName = [String]::Join(" ", $sdkNameParts[0..($sdkNameParts.Length - 2)]) + return Get-XcodePlatformOrder $platformName + }, { + # Sort rule 2 + $sdkNameParts = $_."SDK".Split(" ") + return [System.Version]::Parse($sdkNameParts[-1]) + } +} + +function Format-XcodeSimulatorName { + param([Parameter(Mandatory)][string] $Device) + return $Device.Replace("Ê€", "R") +} + +function Build-XcodeSimulatorsTable { + param ( + [Parameter(Mandatory)] + [hashtable] $xcodeInfo + ) + + $runtimes = @() + $xcodeInfo.Values | ForEach-Object { + $_.SimulatorsInfo.runtimes | ForEach-Object { + $runtimes += $_ + } + } + + $runtimes = $runtimes | Sort-Object @{ Expression = { $_.identifier } } -Unique + + return $runtimes | ForEach-Object { + $runtime = $_ + $runtimeDevices = @() + $xcodeList = @() + + $xcodeInfo.Values | ForEach-Object { + $runtimeFound = $_.SimulatorsInfo.runtimes | Where-Object { $_.identifier -eq $runtime.identifier } | Select-Object -First 1 + if ($runtimeFound) { + $devicesToAdd = Get-XcodeDevicesList -XcodeInfo $_ -Runtime $runtimeFound + $runtimeDevices += $devicesToAdd | Select-Object -ExpandProperty name + $xcodeList += $_.VersionInfo.Version + } + } + + $xcodeList = $xcodeList | Sort-Object + $runtimeDevices = $runtimeDevices | ForEach-Object { Format-XcodeSimulatorName $_ } | Select-Object -Unique + $sortedRuntimeDevices = $runtimeDevices | Sort-Object @{ + Expression = { $_.Split(" ")[0] }; + Descending = $true; + }, { + $_.Split(" ") | Select-Object -Skip 1 | Join-String -Separator " " + } + + return [PSCustomObject] @{ + "OS" = $runtime.name + "Xcode Version" = [String]::Join("
", $xcodeList) + "Simulators" = [String]::Join("
", $sortedRuntimeDevices) + } + } | Sort-Object { + # Sort rule 1 + $sdkNameParts = $_."OS".Split(" ") + $platformName = [String]::Join(" ", $sdkNameParts[0..($sdkNameParts.Length - 2)]) + return Get-XcodePlatformOrder $platformName + }, { + # Sort rule 2 + $sdkNameParts = $_."OS".Split(" ") + return [System.Version]::Parse($sdkNameParts[-1]) + } +} + +function Build-XcodeSupportToolsSection { + $nomadCLI = Run-Command "gem -v nomad-cli" + $nomadIPA = Run-Command "ipa -version" + $xcpretty = Run-Command "xcpretty --version" + $xctool = Run-Command "xctool --version" + $xcversion = Run-Command "xcversion --version" | Select-String "^[0-9]" + + $output = "" + $output += New-MDHeader "Xcode Support Tools" -Level 4 + $output += New-MDList -Style Unordered -Lines @( + "Nomad CLI $nomadCLI", + "Nomad CLI IPA $nomadIPA", + "xcpretty $xcpretty", + "xctool $xctool", + "xcversion $xcversion" + ) + return $output +} \ No newline at end of file diff --git a/images/macos/templates/macOS-10.13.json b/images/macos/templates/macOS-10.13.json new file mode 100644 index 000000000..74a5e61d1 --- /dev/null +++ b/images/macos/templates/macOS-10.13.json @@ -0,0 +1,211 @@ +{ + "variables": { + "vcenter_server": null, + "vcenter_username": null, + "vcenter_password": null, + "vcenter_datacenter": null, + "cluster_or_esxi_host": null, + "esxi_datastore": null, + "build_id": null, + "baseimage_name": null, + "output_folder": null, + "vm_username": null, + "vm_password": null, + "github_feed_token": null, + "xcode_install_user": null, + "xcode_install_password": null, + "image_os": "macos1013", + "announcements": "{{env `ANNOUNCEMENTS`}}" + }, + "builders": [ + { + "type": "vsphere-clone", + "vcenter_server": "{{user `vcenter_server`}}", + "username": "{{user `vcenter_username`}}", + "password": "{{user `vcenter_password`}}", + "insecure_connection": true, + "datacenter": "{{ user `vcenter_datacenter` }}", + "template": "{{ user `baseimage_name` }}", + "folder": "{{user `output_folder` }}", + "host": "{{user `cluster_or_esxi_host`}}", + "datastore": "{{user `esxi_datastore`}}", + "vm_name": "{{user `build_id`}}", + "ssh_username": "{{user `vm_username`}}", + "ssh_password": "{{user `vm_password`}}", + "CPUs": "4", + "RAM": "12288", + "NestedHV": "true", + "shutdown_timeout": "15m" + } + ], + "provisioners": [ + { + "type": "shell", + "inline": "mkdir ~/image-generation" + }, + { + "type": "file", + "source": "./tests", + "destination": "~/image-generation/" + }, + { + "type": "file", + "source": "./software-report", + "destination": "~/image-generation/" + }, + { + "type": "file", + "source": "./helpers", + "destination": "~/image-generation/" + }, + { + "type": "file", + "source": "./provision/configuration/environment/bashrc", + "destination": "~/.bashrc" + }, + { + "type": "file", + "source": "./provision/configuration/environment/bashprofile", + "destination": "~/.bash_profile" + }, + { + "type": "file", + "source": "./provision/utils", + "destination": "~/" + }, + { + "type": "file", + "source": "./provision/bootstrap-provisioner", + "destination": "~/bootstrap" + }, + { + "type": "file", + "source": "./toolsets/toolset-10.13.json", + "destination": "~/image-generation/toolset.json" + }, + { + "type": "file", + "source": "./toolsets/toolcache-10.13.json", + "destination": "~/image-generation/toolcache.json" + }, + { + "type": "shell", + "execute_command": "chmod +x {{ .Path }}; sudo {{ .Vars }} {{ .Path }}", + "scripts": [ + "./provision/configuration/add-network-interface-detection.sh", + "./provision/configuration/autologin.sh", + "./provision/configuration/disable-auto-updates.sh", + "./provision/configuration/screensaver-off.sh", + "./provision/configuration/ntpconf.sh", + "./provision/configuration/max-files.sh" + ], + "environment_vars": [ + "PASSWORD={{user `vm_password`}}", + "USERNAME={{user `vm_username`}}" + ] + }, + { + "type": "shell", + "execute_command": "chmod +x {{ .Path }}; {{ .Vars }} {{ .Path }}", + "scripts": [ + "./provision/configuration/preimagedata.sh", + "./provision/configuration/configure-ssh.sh", + "./provision/configuration/configure-machine.sh" + ], + "environment_vars": [ + "IMAGE_VERSION={{user `build_id`}}", + "IMAGE_OS={{user `image_os`}}" + ] + }, + { + "type": "shell", + "execute_command": "chmod +x {{ .Path }}; sudo {{ .Vars }} {{ .Path }}", + "script": "./provision/core/reboot.sh", + "expect_disconnect": true + }, + { + "type": "shell", + "execute_command": "chmod +x {{ .Path }}; {{ .Vars }} {{ .Path }}", + "pause_before": "30s", + "scripts": [ + "./provision/core/homebrew.sh", + "./provision/core/dotnet.sh", + "./provision/core/python.sh", + "./provision/core/azcopy.sh", + "./provision/core/openssl.sh", + "./provision/core/ruby.sh", + "./provision/core/rubygem.sh", + "./provision/core/powershell.sh", + "./provision/core/git.sh", + "./provision/core/node.sh" + ] + }, + { + "type": "shell", + "execute_command": "chmod +x {{ .Path }}; {{ .Vars }} {{ .Path }}", + "scripts": [ + "./provision/core/xcode-tools.sh", + "./provision/core/xcode-sims.sh", + "./provision/core/build-xcode-symlinks.sh" + ], + "environment_vars": [ + "XCODE_INSTALL_USER={{user `xcode_install_user`}}", + "XCODE_INSTALL_PASSWORD={{user `xcode_install_password`}}" + ] + }, + { + "type": "shell", + "execute_command": "chmod +x {{ .Path }}; sudo {{ .Vars }} {{ .Path }}", + "script": "./provision/core/reboot.sh", + "expect_disconnect": true + }, + { + "type": "shell", + "execute_command": "chmod +x {{ .Path }}; {{ .Vars }} {{ .Path }}", + "scripts": [ + "./provision/core/commonutils.sh", + "./provision/core/openjdk.sh", + "./provision/core/php.sh", + "./provision/core/aws.sh", + "./provision/core/cocoapods.sh", + "./provision/core/android-toolsets.sh", + "./provision/core/xamarin.sh", + "./provision/core/xamarin-android-ndk.sh", + "./provision/core/vsmac.sh", + "./provision/core/nvm.sh", + "./provision/core/postgresql.sh", + "./provision/core/mongodb.sh", + "./provision/core/miniconda.sh", + "./provision/core/chrome.sh", + "./provision/core/edge.sh", + "./provision/core/firefox.sh", + "./provision/core/toolcache-high-sierra.sh", + "./provision/core/pypy.sh" + ] + }, + { + "type": "shell", + "inline": [ + "pwsh -File \"$HOME/image-generation/software-report/SoftwareReport.Generator.ps1\" -OutputDirectory \"$HOME/image-generation/output/software-report\" -ImageName {{user `build_id`}}", + "pwsh -File \"$HOME/image-generation/tests/Run-Tests.ps1\" -WorkingDirectory \"$HOME/image-generation/tests\" -OutputFile \"$HOME/image-generation/output/tests/test-results.xml\"" + ], + "environment_vars": [ + "ANNOUNCEMENTS={{user `announcements`}}" + ] + }, + { + "type": "file", + "direction": "download", + "source": "~/image-generation/output/*", + "destination": "../image-output/" + }, + { + "type": "shell", + "execute_command": "chmod +x {{ .Path }}; {{ .Vars }} {{ .Path }}", + "scripts": [ + "./provision/configuration/configure-hostname.sh", + "./provision/configuration/finalize-vm.sh" + ] + } + ] +} diff --git a/images/macos/templates/macOS-10.14.json b/images/macos/templates/macOS-10.14.json new file mode 100644 index 000000000..269ffa71f --- /dev/null +++ b/images/macos/templates/macOS-10.14.json @@ -0,0 +1,231 @@ +{ + "variables": { + "vcenter_server": null, + "vcenter_username": null, + "vcenter_password": null, + "vcenter_datacenter": null, + "cluster_or_esxi_host": null, + "esxi_datastore": null, + "build_id": null, + "baseimage_name": null, + "output_folder": null, + "vm_username": null, + "vm_password": null, + "github_feed_token": null, + "xcode_install_user": null, + "xcode_install_password": null, + "image_os": "macos1014", + "announcements": "{{env `ANNOUNCEMENTS`}}" + }, + "builders": [ + { + "type": "vsphere-clone", + "vcenter_server": "{{user `vcenter_server`}}", + "username": "{{user `vcenter_username`}}", + "password": "{{user `vcenter_password`}}", + "insecure_connection": true, + "datacenter": "{{ user `vcenter_datacenter` }}", + "template": "{{ user `baseimage_name` }}", + "folder": "{{user `output_folder` }}", + "host": "{{user `cluster_or_esxi_host`}}", + "datastore": "{{user `esxi_datastore`}}", + "vm_name": "{{user `build_id`}}", + "ssh_username": "{{user `vm_username`}}", + "ssh_password": "{{user `vm_password`}}", + "CPUs": "4", + "RAM": "12288", + "NestedHV": "true", + "shutdown_timeout": "15m" + } + ], + "provisioners": [ + { + "type": "shell", + "inline": "mkdir ~/image-generation" + }, + { + "type": "file", + "source": "./tests", + "destination": "~/image-generation/" + }, + { + "type": "file", + "source": "./software-report", + "destination": "~/image-generation/" + }, + { + "type": "file", + "source": "./helpers", + "destination": "~/image-generation/" + }, + { + "type": "file", + "source": "./provision/configuration/environment/bashrc", + "destination": "~/.bashrc" + }, + { + "type": "file", + "source": "./provision/configuration/environment/bashprofile", + "destination": "~/.bash_profile" + }, + { + "type": "file", + "source": "./provision/utils", + "destination": "~/" + }, + { + "type": "file", + "source": "./provision/bootstrap-provisioner", + "destination": "~/bootstrap" + }, + { + "type": "file", + "source": "./toolsets/toolset-10.14.json", + "destination": "~/image-generation/toolset.json" + }, + { + "type": "file", + "source": "./toolsets/toolcache-10.14.json", + "destination": "~/image-generation/toolcache.json" + }, + { + "type": "shell", + "execute_command": "chmod +x {{ .Path }}; sudo {{ .Vars }} {{ .Path }}", + "scripts": [ + "./provision/configuration/add-network-interface-detection.sh", + "./provision/configuration/autologin.sh", + "./provision/configuration/disable-auto-updates.sh", + "./provision/configuration/screensaver-off.sh", + "./provision/configuration/ntpconf.sh", + "./provision/configuration/max-files.sh" + ], + "environment_vars": [ + "PASSWORD={{user `vm_password`}}", + "USERNAME={{user `vm_username`}}" + ] + }, + { + "type": "shell", + "execute_command": "chmod +x {{ .Path }}; {{ .Vars }} {{ .Path }}", + "scripts": [ + "./provision/configuration/preimagedata.sh", + "./provision/configuration/configure-ssh.sh", + "./provision/configuration/configure-machine.sh" + ], + "environment_vars": [ + "IMAGE_VERSION={{user `build_id`}}", + "IMAGE_OS={{user `image_os`}}" + ] + }, + { + "type": "shell", + "execute_command": "chmod +x {{ .Path }}; sudo {{ .Vars }} {{ .Path }}", + "script": "./provision/core/reboot.sh", + "expect_disconnect": true + }, + { + "type": "shell", + "execute_command": "chmod +x {{ .Path }}; {{ .Vars }} {{ .Path }}", + "pause_before": "30s", + "scripts": [ + "./provision/core/homebrew.sh", + "./provision/core/dotnet.sh", + "./provision/core/python.sh", + "./provision/core/azcopy.sh", + "./provision/core/openssl.sh", + "./provision/core/ruby.sh", + "./provision/core/rubygem.sh", + "./provision/core/powershell.sh", + "./provision/core/git.sh", + "./provision/core/node.sh" + ] + }, + { + "type": "shell", + "execute_command": "chmod +x {{ .Path }}; {{ .Vars }} {{ .Path }}", + "scripts": [ + "./provision/core/xcode-tools.sh", + "./provision/core/xcode-sims.sh" + ], + "environment_vars": [ + "XCODE_INSTALL_USER={{user `xcode_install_user`}}", + "XCODE_INSTALL_PASSWORD={{user `xcode_install_password`}}" + ] + }, + { + "type": "shell", + "execute_command": "chmod +x {{ .Path }}; sudo {{ .Vars }} {{ .Path }}", + "script": "./provision/core/reboot.sh", + "expect_disconnect": true + }, + { + "type": "shell", + "execute_command": "chmod +x {{ .Path }}; {{ .Vars }} {{ .Path }}", + "scripts": [ + "./provision/core/commonutils.sh", + "./provision/core/openjdk.sh", + "./provision/core/php.sh", + "./provision/core/aws.sh", + "./provision/core/rust.sh", + "./provision/core/gcc.sh", + "./provision/core/haskell.sh", + "./provision/core/stack.sh", + "./provision/core/cocoapods.sh", + "./provision/core/android-toolsets.sh", + "./provision/core/xamarin.sh", + "./provision/core/xamarin-android-ndk.sh", + "./provision/core/vsmac.sh", + "./provision/core/nvm.sh", + "./provision/core/postgresql.sh", + "./provision/core/mongodb.sh", + "./provision/core/audiodevice.sh", + "./provision/core/chrome.sh", + "./provision/core/edge.sh", + "./provision/core/firefox.sh", + "./provision/core/miniconda.sh", + "./provision/core/xcode-postbuild.sh", + "./provision/core/toolcache.sh", + "./provision/core/pypy.sh" + ], + "environment_vars": [ + "GITHUB_FEED_TOKEN={{user `github_feed_token`}}" + ] + }, + { + "type": "shell", + "execute_command": "chmod +x {{ .Path }}; {{ .Vars }} pwsh -f {{ .Path }}", + "scripts": "./provision/core/toolset.ps1" + }, + { + "type": "shell", + "execute_command": "ruby {{ .Path }}", + "scripts": [ + "./provision/core/delete-duplicate-sims.rb" + ] + }, + { + "type": "shell", + "inline": [ + "pwsh -File \"$HOME/image-generation/software-report/SoftwareReport.Generator.ps1\" -OutputDirectory \"$HOME/image-generation/output/software-report\" -ImageName {{user `build_id`}}", + "pwsh -File \"$HOME/image-generation/tests/Run-Tests.ps1\" -WorkingDirectory \"$HOME/image-generation/tests\" -OutputFile \"$HOME/image-generation/output/tests/test-results.xml\"" + ], + "environment_vars": [ + "ANNOUNCEMENTS={{user `announcements`}}" + ] + }, + { + "type": "file", + "direction": "download", + "source": "~/image-generation/output/*", + "destination": "../image-output/" + }, + { + "type": "shell", + "execute_command": "chmod +x {{ .Path }}; {{ .Vars }} {{ .Path }}", + "scripts": [ + "./provision/configuration/configure-hostname.sh", + "./provision/configuration/finalize-vm.sh" + ] + } + ] +} diff --git a/images/macos/templates/macOS-10.15.json b/images/macos/templates/macOS-10.15.json new file mode 100644 index 000000000..3dcc3d33e --- /dev/null +++ b/images/macos/templates/macOS-10.15.json @@ -0,0 +1,230 @@ +{ + "variables": { + "vcenter_server": null, + "vcenter_username": null, + "vcenter_password": null, + "vcenter_datacenter": null, + "cluster_or_esxi_host": null, + "esxi_datastore": null, + "build_id": null, + "baseimage_name": null, + "output_folder": null, + "vm_username": null, + "vm_password": null, + "github_feed_token": null, + "xcode_install_user": null, + "xcode_install_password": null, + "image_os": "macos1015", + "announcements": "{{env `ANNOUNCEMENTS`}}" + }, + "builders": [ + { + "type": "vsphere-clone", + "vcenter_server": "{{user `vcenter_server`}}", + "username": "{{user `vcenter_username`}}", + "password": "{{user `vcenter_password`}}", + "insecure_connection": true, + "datacenter": "{{ user `vcenter_datacenter` }}", + "template": "{{ user `baseimage_name` }}", + "folder": "{{user `output_folder` }}", + "host": "{{user `cluster_or_esxi_host`}}", + "datastore": "{{user `esxi_datastore`}}", + "vm_name": "{{user `build_id`}}", + "ssh_username": "{{user `vm_username`}}", + "ssh_password": "{{user `vm_password`}}", + "CPUs": "4", + "RAM": "12288", + "NestedHV": "true", + "shutdown_timeout": "15m" + } + ], + "provisioners": [ + { + "type": "shell", + "inline": "mkdir ~/image-generation" + }, + { + "type": "file", + "source": "./tests", + "destination": "~/image-generation/" + }, + { + "type": "file", + "source": "./software-report", + "destination": "~/image-generation/" + }, + { + "type": "file", + "source": "./helpers", + "destination": "~/image-generation/" + }, + { + "type": "file", + "source": "./provision/configuration/environment/bashrc", + "destination": "~/.bashrc" + }, + { + "type": "file", + "source": "./provision/configuration/environment/bashprofile", + "destination": "~/.bash_profile" + }, + { + "type": "file", + "source": "./provision/utils", + "destination": "~/" + }, + { + "type": "file", + "source": "./provision/bootstrap-provisioner", + "destination": "~/bootstrap" + }, + { + "type": "file", + "source": "./toolsets/toolset-10.15.json", + "destination": "~/image-generation/toolset.json" + }, + { + "type": "file", + "source": "./toolsets/toolcache-10.14.json", + "destination": "~/image-generation/toolcache.json" + }, + { + "type": "shell", + "execute_command": "chmod +x {{ .Path }}; sudo {{ .Vars }} {{ .Path }}", + "scripts": [ + "./provision/configuration/add-network-interface-detection.sh", + "./provision/configuration/autologin.sh", + "./provision/configuration/disable-auto-updates.sh", + "./provision/configuration/screensaver-off.sh", + "./provision/configuration/ntpconf.sh", + "./provision/configuration/max-files.sh", + "./provision/configuration/shell-change.sh" + ], + "environment_vars": [ + "PASSWORD={{user `vm_password`}}", + "USERNAME={{user `vm_username`}}" + ] + }, + { + "type": "shell", + "execute_command": "chmod +x {{ .Path }}; {{ .Vars }} {{ .Path }}", + "scripts": [ + "./provision/configuration/preimagedata.sh", + "./provision/configuration/configure-ssh.sh", + "./provision/configuration/configure-machine.sh" + ], + "environment_vars": [ + "IMAGE_VERSION={{user `build_id`}}", + "IMAGE_OS={{user `image_os`}}" + ] + }, + { + "type": "shell", + "execute_command": "chmod +x {{ .Path }}; sudo {{ .Vars }} {{ .Path }}", + "script": "./provision/core/reboot.sh", + "expect_disconnect": true + }, + { + "type": "shell", + "execute_command": "chmod +x {{ .Path }}; {{ .Vars }} {{ .Path }}", + "pause_before": "30s", + "scripts": [ + "./provision/core/homebrew.sh", + "./provision/core/dotnet.sh", + "./provision/core/python.sh", + "./provision/core/azcopy.sh", + "./provision/core/openssl.sh", + "./provision/core/ruby.sh", + "./provision/core/rubygem.sh", + "./provision/core/powershell.sh", + "./provision/core/git.sh", + "./provision/core/node.sh" + ] + }, + { + "type": "shell", + "execute_command": "chmod +x {{ .Path }}; {{ .Vars }} {{ .Path }}", + "script": "./provision/core/xcode-tools.sh", + "environment_vars": [ + "XCODE_INSTALL_USER={{user `xcode_install_user`}}", + "XCODE_INSTALL_PASSWORD={{user `xcode_install_password`}}" + ] + }, + { + "type": "shell", + "execute_command": "chmod +x {{ .Path }}; sudo {{ .Vars }} {{ .Path }}", + "script": "./provision/core/reboot.sh", + "expect_disconnect": true + }, + { + "type": "shell", + "execute_command": "chmod +x {{ .Path }}; {{ .Vars }} {{ .Path }}", + "scripts": [ + "./provision/core/commonutils.sh", + "./provision/core/openjdk.sh", + "./provision/core/php.sh", + "./provision/core/aws.sh", + "./provision/core/rust.sh", + "./provision/core/gcc.sh", + "./provision/core/haskell.sh", + "./provision/core/stack.sh", + "./provision/core/cocoapods.sh", + "./provision/core/android-toolsets.sh", + "./provision/core/xamarin.sh", + "./provision/core/xamarin-android-ndk.sh", + "./provision/core/vsmac.sh", + "./provision/core/nvm.sh", + "./provision/core/postgresql.sh", + "./provision/core/mongodb.sh", + "./provision/core/audiodevice.sh", + "./provision/core/vcpkg.sh", + "./provision/core/miniconda.sh", + "./provision/core/chrome.sh", + "./provision/core/edge.sh", + "./provision/core/firefox.sh", + "./provision/core/xcode-postbuild.sh", + "./provision/core/toolcache.sh", + "./provision/core/pypy.sh" + ], + "environment_vars": [ + "GITHUB_FEED_TOKEN={{user `github_feed_token`}}" + ] + }, + { + "type": "shell", + "execute_command": "chmod +x {{ .Path }}; {{ .Vars }} pwsh -f {{ .Path }}", + "scripts": "./provision/core/toolset.ps1" + }, + { + "type": "shell", + "execute_command": "ruby {{ .Path }}", + "scripts": [ + "./provision/core/delete-duplicate-sims.rb" + ] + }, + { + "type": "shell", + "inline": [ + "pwsh -File \"$HOME/image-generation/software-report/SoftwareReport.Generator.ps1\" -OutputDirectory \"$HOME/image-generation/output/software-report\" -ImageName {{user `build_id`}}", + "pwsh -File \"$HOME/image-generation/tests/Run-Tests.ps1\" -WorkingDirectory \"$HOME/image-generation/tests\" -OutputFile \"$HOME/image-generation/output/tests/test-results.xml\"" + ], + "environment_vars": [ + "ANNOUNCEMENTS={{user `announcements`}}" + ] + }, + { + "type": "file", + "direction": "download", + "source": "~/image-generation/output/*", + "destination": "../image-output/" + }, + { + "type": "shell", + "execute_command": "chmod +x {{ .Path }}; {{ .Vars }} {{ .Path }}", + "scripts": [ + "./provision/configuration/configure-hostname.sh", + "./provision/configuration/finalize-vm.sh" + ] + } + ] +} diff --git a/images/macos/templates/macOS-11.0.json b/images/macos/templates/macOS-11.0.json new file mode 100644 index 000000000..7cf7db8ed --- /dev/null +++ b/images/macos/templates/macOS-11.0.json @@ -0,0 +1,226 @@ +{ + "variables": { + "vcenter_server": null, + "vcenter_username": null, + "vcenter_password": null, + "vcenter_datacenter": null, + "cluster_or_esxi_host": null, + "esxi_datastore": null, + "build_id": null, + "baseimage_name": null, + "output_folder": null, + "vm_username": null, + "vm_password": null, + "github_feed_token": null, + "xcode_install_user": null, + "xcode_install_password": null, + "image_os": "macos11", + "announcements": "{{env `ANNOUNCEMENTS`}}" + }, + "builders": [ + { + "type": "vsphere-clone", + "vcenter_server": "{{user `vcenter_server`}}", + "username": "{{user `vcenter_username`}}", + "password": "{{user `vcenter_password`}}", + "insecure_connection": true, + "datacenter": "{{ user `vcenter_datacenter` }}", + "template": "{{ user `baseimage_name` }}", + "folder": "{{user `output_folder` }}", + "host": "{{user `cluster_or_esxi_host`}}", + "datastore": "{{user `esxi_datastore`}}", + "vm_name": "{{user `build_id`}}", + "ssh_username": "{{user `vm_username`}}", + "ssh_password": "{{user `vm_password`}}", + "CPUs": "4", + "RAM": "12288", + "NestedHV": "true", + "shutdown_timeout": "15m" + } + ], + "provisioners": [ + { + "type": "shell", + "inline": "mkdir ~/image-generation" + }, + { + "type": "file", + "source": "./tests", + "destination": "~/image-generation/" + }, + { + "type": "file", + "source": "./software-report", + "destination": "~/image-generation/" + }, + { + "type": "file", + "source": "./helpers", + "destination": "~/image-generation/" + }, + { + "type": "file", + "source": "./provision/configuration/environment/bashrc", + "destination": "~/.bashrc" + }, + { + "type": "file", + "source": "./provision/configuration/environment/bashprofile", + "destination": "~/.bash_profile" + }, + { + "type": "file", + "source": "./provision/utils", + "destination": "~/" + }, + { + "type": "file", + "source": "./provision/bootstrap-provisioner", + "destination": "~/bootstrap" + }, + { + "type": "file", + "source": "./toolsets/toolset-11.0.json", + "destination": "~/image-generation/toolset.json" + }, + { + "type": "file", + "source": "./toolsets/toolcache-11.0.json", + "destination": "~/image-generation/toolcache.json" + }, + { + "type": "shell", + "execute_command": "chmod +x {{ .Path }}; sudo {{ .Vars }} {{ .Path }}", + "scripts": [ + "./provision/configuration/add-network-interface-detection.sh", + "./provision/configuration/autologin.sh", + "./provision/configuration/disable-auto-updates.sh", + "./provision/configuration/screensaver-off.sh", + "./provision/configuration/ntpconf.sh", + "./provision/configuration/max-files.sh", + "./provision/configuration/shell-change.sh" + ], + "environment_vars": [ + "PASSWORD={{user `vm_password`}}", + "USERNAME={{user `vm_username`}}" + ] + }, + { + "type": "shell", + "execute_command": "chmod +x {{ .Path }}; {{ .Vars }} {{ .Path }}", + "scripts": [ + "./provision/configuration/preimagedata.sh", + "./provision/configuration/configure-ssh.sh", + "./provision/configuration/configure-machine.sh" + ], + "environment_vars": [ + "IMAGE_VERSION={{user `build_id`}}", + "IMAGE_OS={{user `image_os`}}" + ] + }, + { + "type": "shell", + "execute_command": "chmod +x {{ .Path }}; sudo {{ .Vars }} {{ .Path }}", + "script": "./provision/core/reboot.sh", + "expect_disconnect": true + }, + { + "type": "shell", + "execute_command": "chmod +x {{ .Path }}; {{ .Vars }} {{ .Path }}", + "pause_before": "30s", + "scripts": [ + "./provision/core/homebrew.sh", + "./provision/core/dotnet.sh", + "./provision/core/python.sh", + "./provision/core/azcopy.sh", + "./provision/core/openssl.sh", + "./provision/core/ruby.sh", + "./provision/core/rubygem.sh", + "./provision/core/powershell.sh", + "./provision/core/git.sh", + "./provision/core/node.sh" + ] + }, + { + "type": "shell", + "execute_command": "chmod +x {{ .Path }}; {{ .Vars }} {{ .Path }}", + "script": "./provision/core/xcode-tools.sh", + "environment_vars": [ + "XCODE_INSTALL_USER={{user `xcode_install_user`}}", + "XCODE_INSTALL_PASSWORD={{user `xcode_install_password`}}" + ] + }, + { + "type": "shell", + "execute_command": "chmod +x {{ .Path }}; sudo {{ .Vars }} {{ .Path }}", + "script": "./provision/core/reboot.sh", + "expect_disconnect": true + }, + { + "type": "shell", + "execute_command": "chmod +x {{ .Path }}; {{ .Vars }} {{ .Path }}", + "scripts": [ + "./provision/core/commonutils.sh", + "./provision/core/openjdk.sh", + "./provision/core/php.sh", + "./provision/core/aws.sh", + "./provision/core/rust.sh", + "./provision/core/gcc.sh", + "./provision/core/haskell.sh", + "./provision/core/stack.sh", + "./provision/core/cocoapods.sh", + "./provision/core/android-toolsets.sh", + "./provision/core/xamarin.sh", + "./provision/core/vsmac.sh", + "./provision/core/nvm.sh", + "./provision/core/postgresql.sh", + "./provision/core/mongodb.sh", + "./provision/core/vcpkg.sh", + "./provision/core/miniconda.sh", + "./provision/core/chrome.sh", + "./provision/core/edge.sh", + "./provision/core/firefox.sh", + "./provision/core/toolcache.sh" + ], + "environment_vars": [ + "GITHUB_FEED_TOKEN={{user `github_feed_token`}}" + ] + }, + { + "type": "shell", + "execute_command": "chmod +x {{ .Path }}; {{ .Vars }} pwsh -f {{ .Path }}", + "scripts": "./provision/core/toolset.ps1" + }, + { + "type": "shell", + "execute_command": "ruby {{ .Path }}", + "scripts": [ + "./provision/core/delete-duplicate-sims.rb" + ] + }, + { + "type": "shell", + "inline": [ + "pwsh -File \"$HOME/image-generation/software-report/SoftwareReport.Generator.ps1\" -OutputDirectory \"$HOME/image-generation/output/software-report\" -ImageName {{user `build_id`}}", + "pwsh -File \"$HOME/image-generation/tests/Run-Tests.ps1\" -WorkingDirectory \"$HOME/image-generation/tests\" -OutputFile \"$HOME/image-generation/output/tests/test-results.xml\"" + ], + "environment_vars": [ + "ANNOUNCEMENTS={{user `announcements`}}" + ] + }, + { + "type": "file", + "direction": "download", + "source": "~/image-generation/output/*", + "destination": "../image-output/" + }, + { + "type": "shell", + "execute_command": "chmod +x {{ .Path }}; {{ .Vars }} {{ .Path }}", + "scripts": [ + "./provision/configuration/configure-hostname.sh", + "./provision/configuration/finalize-vm.sh" + ] + } + ] +} diff --git a/images/macos/tests/Android.Tests.ps1 b/images/macos/tests/Android.Tests.ps1 new file mode 100644 index 000000000..a7420b23e --- /dev/null +++ b/images/macos/tests/Android.Tests.ps1 @@ -0,0 +1,91 @@ +Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1" +Import-Module "$PSScriptRoot/../helpers/Tests.Helpers.psm1" + +$os = Get-OSVersion + +Describe "Android" { + $androidNdkToolchains = @("mips64el-linux-android-4.9", "mipsel-linux-android-4.9") + + $androidPackages = @( + "tools", + "platform-tools", + "tools/proguard", + "ndk-bundle", + "cmake", + (Get-ToolsetValue "android.platform-list" | ForEach-Object { "platforms/${_}" }), + (Get-ToolsetValue "android.build-tools" | ForEach-Object { "build-tools/${_}" }), + (Get-ToolsetValue "android.extra-list" | ForEach-Object { "extras/${_}" }), + (Get-ToolsetValue "android.addon-list" | ForEach-Object { "add-ons/${_}" }) + ) | ForEach-Object { $_ } + + BeforeAll { + $ANDROID_SDK_DIR = Join-Path $env:HOME "Library" "Android" "sdk" + + function Validate-AndroidPackage { + param ( + [Parameter(Mandatory=$true)] + [string]$PackageName + ) + + # Convert 'm2repository;com;android;support;constraint;constraint-layout-solver;1.0.0-beta1' -> + # 'm2repository/com/android/support/constraint/constraint-layout-solver/1.0.0-beta1' + $PackageName = $PackageName.Replace(";", "/") + $targetPath = Join-Path $ANDROID_SDK_DIR $PackageName + $targetPath | Should -Exist + } + } + + + Context "Packages" { + $testCases = $androidPackages | ForEach-Object { @{ PackageName = $_ } } + + It "" -TestCases $testCases { + param ([string] $PackageName) + Validate-AndroidPackage $PackageName + } + } + + Context "NDK toolchains" -Skip:($os.IsBigSur) { + $testCases = $androidNdkToolchains | ForEach-Object { @{AndroidNdkToolchain = $_} } + + It "" -TestCases $testCases { + param ([string] $AndroidNdkToolchain) + + $toolchainPath = Join-Path $ANDROID_SDK_DIR "ndk-bundle" "toolchains" $AndroidNdkToolchain + $toolchainPath | Should -Exist + } + } + + Context "Legacy NDK versions" -Skip:($os.IsBigSur) { + It "Android NDK version is 21" { + $ndkBundlePath = Join-Path $ANDROID_SDK_DIR "ndk-bundle" "source.properties" + $rawContent = Get-Content $ndkBundlePath -Raw + $rawContent | Should -BeLikeExactly "*Revision = 21.*" + } + + It "Android NDK version r18b is installed" { + $ndk18BundlePath = Join-Path $ANDROID_SDK_DIR "ndk" "18.1.5063045" "source.properties" + $rawContent = Get-Content $ndk18BundlePath -Raw + $rawContent | Should -BeLikeExactly "*Revision = 18.*" + } + } + + It "HAXM is installed" { + $haxmPath = Join-Path $ANDROID_SDK_DIR "extras" "intel" "Hardware_Accelerated_Execution_Manager" "silent_install.sh" + "$haxmPath -v" | Should -ReturnZeroExitCode + } +} + +Describe "Gradle" { + It "Gradle is installed" { + "gradle --version" | Should -ReturnZeroExitCode + } + + It "Gradle is installed to /usr/local/bin" { + (Get-Command "gradle").Path | Should -BeExactly "/usr/local/bin/gradle" + } + + It "Gradle is compatible with init.d plugins" { + "cd /tmp && gradle tasks" | Should -ReturnZeroExitCode + } +} \ No newline at end of file diff --git a/images/macos/tests/Common.Tests.ps1 b/images/macos/tests/Common.Tests.ps1 new file mode 100644 index 000000000..ed813f58c --- /dev/null +++ b/images/macos/tests/Common.Tests.ps1 @@ -0,0 +1,372 @@ +Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1" +Import-Module "$PSScriptRoot/../helpers/Tests.Helpers.psm1" + +$os = Get-OSVersion + +Describe "Disk free space" { + It "Image has more than 10GB free space" { + # we should have at least 10 GB of free space on macOS images + # https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/hosted?view=azure-devops#capabilities-and-limitations + $freeSpace = (Get-PSDrive "/").Free + $freeSpace | Should -BeGreaterOrEqual 10GB + } +} + +Describe "Git" { + It "git is installed" { + "git --version" | Should -ReturnZeroExitCode + } + + It "git lfs is installed" { + "git lfs version" | Should -ReturnZeroExitCode + } + + It "hub CLI is installed" { + "hub --version" | Should -ReturnZeroExitCode + } +} + +Describe "Audio device" -Skip:($os.IsHighSierra -or $os.IsBigSur) { + It "Sox is installed" { + "sox --version" | Should -ReturnZeroExitCode + } + + It "SwitchAudioSource is installed" { + "SwitchAudioSource -c" | Should -ReturnZeroExitCode + } + + It "Audio channel Soundflower (2ch)" { + SwitchAudioSource -c | Should -BeLikeExactly "Soundflower (2ch)" + } +} + +Describe "Common utilities" { + It "Homebrew" { + "brew --version" | Should -ReturnZeroExitCode + } + + It "DotNet" { + "dotnet --version" | Should -ReturnZeroExitCode + } + + It "Go" { + "go version" | Should -ReturnZeroExitCode + } + + It "Bundler" { + "bundler --version" | Should -ReturnZeroExitCode + } + + It "Maven" { + "mvn --version" | Should -ReturnZeroExitCode + } + + It "CocoaPods" { + "pod --version" | Should -ReturnZeroExitCode + } + + It "Carthage" { + "carthage version" | Should -ReturnZeroExitCode + } + + It "App Center CLI" { + "appcenter --version" | Should -ReturnZeroExitCode + } + + It "Azure CLI" { + "az -v" | Should -ReturnZeroExitCode + } + + Describe "AWS" { + It "AWS CLI" { + "aws --version" | Should -ReturnZeroExitCode + } + It "AWS SAM CLI" { + "sam --version" | Should -ReturnZeroExitCode + } + + It "AWS Session Manager CLI" { + "session-manager-plugin --version" | Should -ReturnZeroExitCode + } + } + + It "Aliyun CLI" { + "aliyun --version" | Should -ReturnZeroExitCode + } + + It "Mobile Center CLI" { + "mobile-center --version" | Should -ReturnZeroExitCode + } + + It "Nomad CLI" { + $result = Get-CommandResult "gem list" + $result.Output | Should -BeLike "*nomad-cli*" + } + + It "Nomad CLI IPA" { + "ipa --version" | Should -ReturnZeroExitCode + } + + It "Conda" { + Get-EnvironmentVariable "CONDA" | Should -Not -BeNullOrEmpty + $condaBinPath = Join-Path $env:CONDA "bin" "conda" + "$condaBinPath --version" | Should -ReturnZeroExitCode + } + + It "Fastlane" { + "fastlane --version" | Should -ReturnZeroExitCode + } + + It "Subversion" { + "svn --version" | Should -ReturnZeroExitCode + } + + It "cmake" { + "cmake --version" | Should -ReturnZeroExitCode + } + + It "curl" { + "curl --version" | Should -ReturnZeroExitCode + } + + It "xctool" { + "xctool --version" | Should -ReturnZeroExitCode + } + + It "xcpretty" { + "xcpretty --version" | Should -ReturnZeroExitCode + } + + It "wget" { + "wget --version" | Should -ReturnZeroExitCode + } + + It "mongodb" { + "mongo --version" | Should -ReturnZeroExitCode + "mongod --version"| Should -ReturnZeroExitCode + } + + It "jq" { + "jq --version" | Should -ReturnZeroExitCode + } + + It "OpenSSL" { + "openssl version" | Should -ReturnZeroExitCode + } + + It "GnuPG" { + "gpg --version" | Should -ReturnZeroExitCode + } + + It "PostgreSQL-Client" { + "psql --version" | Should -ReturnZeroExitCode + } + + It "PostgreSQL-Server" { + "pg_config --version" | Should -ReturnZeroExitCode + } + + It "Aria2" { + "aria2c --version" | Should -ReturnZeroExitCode + } + + It "Azcopy" { + "azcopy --version" | Should -ReturnZeroExitCode + } + + It "PHP" { + Get-WhichTool "php" | Should -Not -BeLike "/usr/bin/php*" + "php --version" | Should -ReturnZeroExitCode + } + + It "Composer" { + "composer --version" | Should -ReturnZeroExitCode + } + + It "R" -Skip:($os.IsBigSur) { + "R --version" | Should -ReturnZeroExitCode + } + + It "zstd" { + "zstd --version" | Should -ReturnZeroExitCode + } + + It "bazel" { + "bazel --version" | Should -ReturnZeroExitCode + } + + It "bazelisk" { + "bazelisk version" | Should -ReturnZeroExitCode + } + + It "Julia" { + "julia --version" | Should -ReturnZeroExitCode + } + + It "Packer" { + "packer --version" | Should -ReturnZeroExitCode + } + + It "Helm" { + "helm version --short" | Should -ReturnZeroExitCode + } + + It "virtualbox" { + "vboxmanage -v" | Should -ReturnZeroExitCode + } + + It "vagrant" { + "vagrant --version" | Should -ReturnZeroExitCode + } + + It "GitHub CLI" { + "gh --version" | Should -ReturnZeroExitCode + } + + It "7-Zip" { + "7z i" | Should -ReturnZeroExitCode + } + + It "Apache Ant" { + "ant -version" | Should -ReturnZeroExitCode + } +} + +Describe "Browsers" { + It "Chrome" { + $chromeLocation = "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" + $chromeLocation | Should -Exist + "'$chromeLocation' --version" | Should -ReturnZeroExitCode + } + + It "Chrome Driver" { + "chromedriver --version" | Should -ReturnZeroExitCode + } + + It "Microsoft Edge" { + $edgeLocation = "/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge" + $edgeLocation | Should -Exist + "'$edgeLocation' --version" | Should -ReturnZeroExitCode + } + + It "Microsoft Edge Driver" { + "msedgedriver --version" | Should -ReturnZeroExitCode + } + + It "Firefox" { + $firefoxLocation = "/Applications/Firefox.app/Contents/MacOS/firefox" + $firefoxLocation | Should -Exist + "'$firefoxLocation' --version" | Should -ReturnZeroExitCode + } + + It "Geckodriver" { + "geckodriver --version" | Should -ReturnZeroExitCode + } +} + +Describe "Rust" -Skip:($os.IsHighSierra) { + It "Rustup is installed" { + "rustup --version" | Should -ReturnZeroExitCode + } + + It "Rustc is installed" { + "rustc --version" | Should -ReturnZeroExitCode + } + + It "Cargo is installed" { + "cargo --version" | Should -ReturnZeroExitCode + } + + Context "Cargo dependencies" { + It "bindgen" { + "bindgen --version" | Should -ReturnZeroExitCode + } + + It "cbindgen" { + "cbindgen --version" | Should -ReturnZeroExitCode + } + + It "Cargo audit" { + "cargo audit --version" | Should -ReturnZeroExitCode + } + + It "Cargo outdated" { + "cargo outdated --version" | Should -ReturnZeroExitCode + } + } +} + +Describe "Haskell" -Skip:($os.IsHighSierra) { + It "GHCup" { + "ghcup --version" | Should -ReturnZeroExitCode + } + + It "GHC" { + "ghc --version" | Should -ReturnZeroExitCode + } + + It "Cabal" { + "cabal --version" | Should -ReturnZeroExitCode + } + + It "Stack" { + "stack --version" | Should -ReturnZeroExitCode + } +} + +Describe "Clang/LLVM" -Skip:($os.IsHighSierra) { + It "Clang/LLVM is installed" { + "$(brew --prefix llvm)/bin/clang --version" | Should -ReturnZeroExitCode + } +} + +Describe "Gcc" -Skip:($os.IsHighSierra) { + $testCases = @("8", "9") | ForEach-Object { @{GccVersion = $_} } + + It "Gcc " -TestCases $testCases { + param ( + [string] $GccVersion + ) + + "gcc-$GccVersion --version" | Should -ReturnZeroExitCode + } +} + +Describe "Gfortran" -Skip:($os.IsHighSierra) { + $testCases = @("8", "9") | ForEach-Object { @{GfortranVersion = $_} } + + It "Gfortran " -TestCases $testCases { + param ( + [string] $GfortranVersion + ) + + "gfortran-$GfortranVersion --version" | Should -ReturnZeroExitCode + } +} + +Describe "Screen Resolution" -Skip:($os.IsHighSierra) { + It "Screen Resolution" { + system_profiler SPDisplaysDataType | Select-String "Resolution" | Should -Match "1176 x 885" + } +} + +Describe "vcpkg" -Skip:($os.IsHighSierra -or $os.IsMojave) { + It "vcpkg" { + "vcpkg version" | Should -ReturnZeroExitCode + } +} + +Describe "Newman" -Skip:($os.IsHighSierra -or $os.IsMojave) { + It "Newman" { + "newman --version" | Should -ReturnZeroExitCode + } +} + +Describe "Visual Studio For Mac" { + It "VS4Mac is installed" { + $vsPath = "/Applications/Visual Studio.app" + $vstoolPath = Join-Path $vsPath "Contents/MacOS/vstool" + $vsPath | Should -Exist + $vstoolPath | Should -Exist + } +} \ No newline at end of file diff --git a/images/macos/tests/Java.Tests.ps1 b/images/macos/tests/Java.Tests.ps1 new file mode 100644 index 000000000..9171eb5b1 --- /dev/null +++ b/images/macos/tests/Java.Tests.ps1 @@ -0,0 +1,61 @@ +Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1" +Import-Module "$PSScriptRoot/../helpers/Tests.Helpers.psm1" + +#Java tests are disabled because Java is not working properly on macOS 11.0 yet. +$os = Get-OSVersion +function Get-NativeVersionFormat { + param($Version) + if ($Version -in "7", "8") { + return "1.${Version}" + } + return $Version +} + +Describe "Java" -Skip:($os.IsBigSur) { + BeforeAll { + function Validate-JavaVersion { + param($JavaCommand, $ExpectedVersion) + + $commandResult = Get-CommandResult $JavaCommand + $commandResult.ExitCode | Should -Be 0 + $matchResult = $commandResult.Output | Select-String '^openjdk version \"([\d\._]+)\"' + $matchResult.Matches.Success | Should -BeTrue + $version = $matchResult.Matches.Groups[1].Value + $version | Should -BeLike "${ExpectedVersion}*" + } + } + + $versionsList = Get-ToolsetValue "java.versions" + $defaultJava = Get-ToolsetValue "java.default" + + $testCases = $versionsList | ForEach-Object { @{ Title = $_; Version = (Get-NativeVersionFormat $_); EnvVariable = "JAVA_HOME_${_}_X64" } } + $testCases += @{ Title = "Default"; Version = (Get-NativeVersionFormat $defaultJava); EnvVariable = "JAVA_HOME" } + + $testCases | ForEach-Object { + Context $_.Title { + It "Version is found by 'java_home'" -TestCases $_ { + "/usr/libexec/java_home -v${Version}" | Should -ReturnZeroExitCode + } + + It "Version is valid" -TestCases $_ { + $javaRootPath = (Get-CommandResult "/usr/libexec/java_home -v${Version}").Output + $javaBinPath = Join-Path $javaRootPath "/bin/java" + Validate-JavaVersion -JavaCommand "$javaBinPath -version" -ExpectedVersion $Version + } + + It "" -TestCases $_ { + $envVariablePath = Get-EnvironmentVariable $EnvVariable + $commandResult = Get-CommandResult "/usr/libexec/java_home -v${Version}" + $commandResult.ExitCode | Should -Be 0 + $commandResult.Output | Should -Not -BeNullOrEmpty + $commandResult.Output | Should -Be $envVariablePath + } + + if ($_.Title -eq "Default") { + It "Version is default" -TestCases $_ { + Validate-JavaVersion -JavaCommand "java -version" -ExpectedVersion $Version + } + } + } + } +} \ No newline at end of file diff --git a/images/macos/tests/Linters.Tests.ps1 b/images/macos/tests/Linters.Tests.ps1 new file mode 100644 index 000000000..3b7b8e0df --- /dev/null +++ b/images/macos/tests/Linters.Tests.ps1 @@ -0,0 +1,13 @@ +Import-Module "$PSScriptRoot/../helpers/Tests.Helpers.psm1" + +$os = Get-OSVersion + +Describe "Linters" { + It "yamllint" { + "yamllint --version" | Should -ReturnZeroExitCode + } + + It "SwiftLint" -Skip:($os.IsHighSierra) { + "swiftlint version" | Should -ReturnZeroExitCode + } +} \ No newline at end of file diff --git a/images/macos/tests/Node.Tests.ps1 b/images/macos/tests/Node.Tests.ps1 new file mode 100644 index 000000000..7fde021d1 --- /dev/null +++ b/images/macos/tests/Node.Tests.ps1 @@ -0,0 +1,50 @@ +Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1" +Import-Module "$PSScriptRoot/../helpers/Tests.Helpers.psm1" + +Describe "Node.JS" { + BeforeAll { + $os = Get-OSVersion + $expectedNodeVersion = if ($os.IsHigherThanMojave) { "v12.*" } else { "v8.*" } + } + + It "Node.JS is installed" { + "node --version" | Should -ReturnZeroExitCode + } + + It "Node.JS $expectedNodeVersion is default" { + (Get-CommandResult "node --version").Output | Should -BeLike $expectedNodeVersion + } + + It "NPM is installed" { + "npm --version" | Should -ReturnZeroExitCode + } + + It "Yarn is installed" { + "yarn --version" | Should -ReturnZeroExitCode + } +} + +Describe "NVM" { + BeforeAll { + $nvmPath = Join-Path $env:HOME ".nvm" "nvm.sh" + $nvmInitCommand = ". $nvmPath > /dev/null 2>&1 || true" + } + + It "Nvm is installed" { + $nvmPath | Should -Exist + "$nvmInitCommand && nvm --version" | Should -ReturnZeroExitCode + } + + Context "Nvm versions" { + $NVM_VERSIONS = @(6, 8, 10, 12) + $testCases = $NVM_VERSIONS | ForEach-Object { @{NvmVersion = $_} } + + It "" -TestCases $testCases { + param ( + [string] $NvmVersion + ) + + "$nvmInitCommand && nvm ls $($NvmVersion)" | Should -ReturnZeroExitCode + } + } +} diff --git a/images/macos/tests/Powershell.Tests.ps1 b/images/macos/tests/Powershell.Tests.ps1 new file mode 100644 index 000000000..42db9ddab --- /dev/null +++ b/images/macos/tests/Powershell.Tests.ps1 @@ -0,0 +1,41 @@ +Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1" +Import-Module "$PSScriptRoot/../helpers/Tests.Helpers.psm1" + +Describe "Powershell" { + It "Powershell is installed" { + "pwsh -v" | Should -ReturnZeroExitCode + } + + Context "Powershell Modules" { + $modules = Get-ToolsetValue powershellModules + $withoutVersionsModules = $modules | Where-Object {-not $_.versions} | ForEach-Object { + @{moduleName = $_.name} + } + + $withVersionsModules = $modules | Where-Object {$_.versions} | ForEach-Object { + $moduleName = $_.name + $_.versions | ForEach-Object { + @{moduleName = $moduleName; expectedVersion = $_} + } + } + + It " is installed" -TestCases $withoutVersionsModules { + param ( + [string] $moduleName + ) + + Get-Module -Name $moduleName -ListAvailable | Should -BeTrue + } + + if ($withVersionsModules) { + It " with is installed" -TestCases $withVersionsModules { + param ( + [string] $moduleName, + [string] $expectedVersion + ) + + (Get-Module -Name $moduleName -ListAvailable).Version -contains $expectedVersion | Should -BeTrue + } + } + } +} \ No newline at end of file diff --git a/images/macos/tests/Python.Tests.ps1 b/images/macos/tests/Python.Tests.ps1 new file mode 100644 index 000000000..7b5f8348d --- /dev/null +++ b/images/macos/tests/Python.Tests.ps1 @@ -0,0 +1,32 @@ +Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1" +Import-Module "$PSScriptRoot/../helpers/Tests.Helpers.psm1" + +Describe "Python" { + It "Python 2 is available" { + "python --version" | Should -ReturnZeroExitCode + } + + It "Python 2 is real 2.x" { + (Get-CommandResult "python --version").Output | Should -BeLike "Python 2.*" + } + + It "Python 2 is installed under /usr/local/bin" { + Get-WhichTool "python" | Should -BeLike "/usr/local/bin*" + } + + It "Python 3 is available" { + "python3 --version" | Should -ReturnZeroExitCode + } + + It "Python 3 is installed under /usr/local/bin" { + Get-WhichTool "python3" | Should -BeLike "/usr/local/bin*" + } + + It "Pip 2 is available" { + "pip --version" | Should -ReturnZeroExitCode + } + + It "Pip 3 is available" { + "pip3 --version" | Should -ReturnZeroExitCode + } +} \ No newline at end of file diff --git a/images/macos/tests/Ruby.Tests.ps1 b/images/macos/tests/Ruby.Tests.ps1 new file mode 100644 index 000000000..116f09378 --- /dev/null +++ b/images/macos/tests/Ruby.Tests.ps1 @@ -0,0 +1,24 @@ +Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1" +Import-Module "$PSScriptRoot/../helpers/Tests.Helpers.psm1" + +Describe "Ruby" { + It "Ruby is available" { + "ruby --version" | Should -ReturnZeroExitCode + } + + It "Ruby is installed via HomeBrew" { + Get-WhichTool "ruby" | Should -Not -BeLike "/usr/bin/ruby*" + } + + It "Ruby tools are consistent" { + $expectedPrefix = "/usr/local" + Get-WhichTool "ruby" | Should -Match "$($expectedPrefix)*" + Get-WhichTool "gem" | Should -Match "$($expectedPrefix)*" + Get-WhichTool "bundler" | Should -Match "$($expectedPrefix)*" + } + + It "Ruby gems permissions are valid" { + "gem install bundle" | Should -ReturnZeroExitCode + "gem uninstall bundle" | Should -ReturnZeroExitCode + } +} \ No newline at end of file diff --git a/images/macos/tests/Run-Tests.ps1 b/images/macos/tests/Run-Tests.ps1 new file mode 100644 index 000000000..3af5fac30 --- /dev/null +++ b/images/macos/tests/Run-Tests.ps1 @@ -0,0 +1,25 @@ +param ( + [Parameter(Mandatory=$true)] + $WorkingDirectory, + [Parameter(Mandatory=$true)] + $OutputFile +) + +$ErrorActionPreference = "Stop" + +Import-Module Pester +Set-Location -Path $WorkingDirectory + +$parentDirectory = Split-Path $OutputFile -Parent +if (-not (Test-Path $parentDirectory)) { New-Item -Path $parentDirectory -ItemType Directory | Out-Null } + +$configuration = [PesterConfiguration] @{ + Output = @{ Verbosity = "Detailed" } + TestResult = @{ + Enabled = $true + OutputPath = $OutputFile; + OutputFormat = "NUnitXML" + } +} + +Invoke-Pester -Configuration $configuration \ No newline at end of file diff --git a/images/macos/tests/Toolcache.Tests.ps1 b/images/macos/tests/Toolcache.Tests.ps1 new file mode 100644 index 000000000..fc4a37295 --- /dev/null +++ b/images/macos/tests/Toolcache.Tests.ps1 @@ -0,0 +1,240 @@ +Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1" +Import-Module "$PSScriptRoot/../helpers/Tests.Helpers.psm1" + +$os = Get-OSVersion + +Describe "Toolcache" { + $toolcacheDirectory = Join-Path $env:HOME "hostedtoolcache" + $packages = (Get-ToolcachePackages).PSObject.Properties | ForEach-Object { + $packageNameParts = $_.Name.Split("-") + return [PSCustomObject] @{ + ToolName = $packageNameParts[1] + Arch = $packageNameParts[4] + Versions = $_.Value + } + } + + [array]$packages += Get-ToolsetValue -KeyPath "toolcache" | ForEach-Object { + return [PSCustomObject] @{ + ToolName = ($_.name).ToLower() + Arch = $_.arch + Versions = $_.versions | ForEach-Object { $_.Replace(".*", "") } + } + } + + Context "Python" { + $pythonDirectory = Join-Path $toolcacheDirectory "Python" + $pythonPackage = $packages | Where-Object { $_.ToolName -eq "python" } | Select-Object -First 1 + $testCase = @{ PythonDirectory = $pythonDirectory } + + It "Toolcache directory exists" -TestCases $testCase { + param ( [string] $PythonDirectory ) + + $PythonDirectory | Should -Exist + } + + It "Toolcache directory contains at least one version of Python" -TestCases $testCase { + param ( [string] $PythonDirectory ) + + (Get-ChildItem -Path $PythonDirectory -Directory).Count | Should -BeGreaterThan 0 + } + + $pythonPackage.Versions | Where-Object { $_ } | ForEach-Object { + Context "$_" { + $versionDirectory = Get-ChildItem -Path $pythonDirectory -Directory -Filter "$_*" | Select-Object -First 1 + $pythonBinPath = Join-Path $versionDirectory.FullName $pythonPackage.Arch "python" + $testCase = @{ PythonVersion = $_; PythonBinPath = $pythonBinPath } + + It "Version" -TestCases $testCase { + param ( + [string] $PythonVersion, + [string] $PythonBinPath + ) + + $result = Get-CommandResult "$PythonBinPath --version" + $result.Output | Should -BeLike "*$PythonVersion*" + $result.ExitCode | Should -Be 0 + } + + It "Run test script" -TestCases $testCase { + param ( [string] $PythonBinPath ) + + "$PythonBinPath -c 'import sys;print(sys.version)'" | Should -ReturnZeroExitCode + } + } + } + } + + Context "Ruby" { + $rubyDirectory = Join-Path $toolcacheDirectory "Ruby" + $rubyPackage = $packages | Where-Object { $_.ToolName -eq "ruby" } | Select-Object -First 1 + $testCase = @{ RubyDirectory = $rubyDirectory } + + It "Toolcache directory exists" -TestCases $testCase { + param ( [string] $RubyDirectory ) + + $RubyDirectory | Should -Exist + } + + It "Toolcache directory contains at least one version of Ruby" -TestCases $testCase { + param ( [string] $RubyDirectory ) + + (Get-ChildItem -Path $RubyDirectory -Directory).Count | Should -BeGreaterThan 0 + } + + $rubyPackage.Versions | Where-Object { $_ } | ForEach-Object { + Context "$_" { + $versionDirectory = Get-ChildItem -Path $rubyDirectory -Directory -Filter "$_*" | Select-Object -First 1 + $rubyBinPath = Join-Path $versionDirectory.FullName $rubyPackage.Arch "bin" "ruby" + $testCase = @{ RubyVersion = $_; RubyBinPath = $rubyBinPath } + + It "Version" -TestCases $testCase { + param ( + [string] $RubyVersion, + [string] $RubyBinPath + ) + + $result = Get-CommandResult "$RubyBinPath --version" + $result.Output | Should -BeLike "*$RubyVersion*" + $result.ExitCode | Should -Be 0 + } + + It "Run test script" -TestCases $testCase { + param ( [string] $RubyBinPath ) + + "$RubyBinPath -e 'puts RUBY_VERSION'" | Should -ReturnZeroExitCode + } + } + } + } + Context "PyPy" -Skip:($os.IsBigSur) { + $pypyDirectory = Join-Path $toolcacheDirectory "PyPy" + $pypyPackage = $packages | Where-Object { $_.ToolName -eq "pypy" } | Select-Object -First 1 + $testCase = @{ PypyDirectory = $pypyDirectory } + + It "Toolcache directory exists" -TestCases $testCase { + param ( [string] $PypyDirectory ) + + $PypyDirectory | Should -Exist + } + + It "Toolcache directory contains at least one version of PyPy" -TestCases $testCase { + param ( [string] $PypyDirectory ) + + (Get-ChildItem -Path $PypyDirectory -Directory).Count | Should -BeGreaterThan 0 + } + + $pypyPackage.Versions | Where-Object { $_ } | ForEach-Object { + Context "$_" { + $versionDirectory = Get-ChildItem -Path $pypyDirectory -Directory -Filter "$_*" | Select-Object -First 1 + $binFilename = If ($_.StartsWith("3")) { "pypy3" } else { "pypy" } + $pypyBinPath = Join-Path $versionDirectory.FullName $pypyPackage.Arch "bin" $binFilename + $testCase = @{ PypyVersion = $_; PypyBinPath = $pypyBinPath } + + It "Version" -TestCases $testCase { + param ( + [string] $PypyVersion, + [string] $PypyBinPath + ) + + $result = Get-CommandResult "$PypyBinPath --version" + $result.Output | Should -BeLike "*$PypyVersion*" + $result.ExitCode | Should -Be 0 + } + + It "Run test script" -TestCases $testCase { + param ( [string] $PypyBinPath ) + + "$PypyBinPath -c 'import sys;print(sys.version)'" | Should -ReturnZeroExitCode + } + } + } + } + + Context "Node" -Skip:($os.IsHighSierra) { + $nodeDirectory = Join-Path $toolcacheDirectory "node" + $nodePackage = $packages | Where-Object { $_.ToolName -eq "node" } | Select-Object -First 1 + $testCase = @{ NodeDirectory = $nodeDirectory } + + It "Toolcache directory exists" -TestCases $testCase { + param ( [string] $NodeDirectory ) + + $NodeDirectory | Should -Exist + } + + It "Toolcache directory contains at least one version of Node" -TestCases $testCase { + param ( [string] $NodeDirectory ) + + (Get-ChildItem -Path $NodeDirectory -Directory).Count | Should -BeGreaterThan 0 + } + + $nodePackage.Versions | Where-Object { $_ } | ForEach-Object { + Context "$_" { + $versionDirectory = Get-ChildItem -Path $nodeDirectory -Directory -Filter "$_*" | Select-Object -First 1 + $nodeBinPath = Join-Path $versionDirectory.FullName $nodePackage.Arch "bin" "node" + $npmBinPath = Join-Path $versionDirectory.FullName $nodePackage.Arch "bin" "npm" + $testCase = @{ NodeVersion = $_; NodeBinPath = $nodeBinPath; NpmBinPath = $npmBinPath } + + It "Version Node" -TestCases $testCase { + param ( + [string] $NodeVersion, + [string] $NodeBinPath + ) + + $result = Get-CommandResult "$NodeBinPath --version" + $result.Output | Should -BeLike "*$NodeVersion*" + $result.ExitCode | Should -Be 0 + } + + It "Version Npm" -TestCases $testCase { + param ( [string] $NpmBinPath ) + + "$NpmBinPath --version" | Should -ReturnZeroExitCode + } + + It "Run test script" -TestCases $testCase { + param ( [string] $NodeBinPath ) + + "$NodeBinPath -e 'console.log(process.version)'" | Should -ReturnZeroExitCode + } + } + } + } + + Context "Go" -Skip:($os.IsHighSierra) { + $goDirectory = Join-Path $toolcacheDirectory "go" + $goPackage = $packages | Where-Object { $_.ToolName -eq "go" } | Select-Object -First 1 + $testCase = @{ GoDirectory = $goDirectory } + + It "Toolcache directory exists" -TestCases $testCase { + param ( [string] $GoDirectory ) + + $GoDirectory | Should -Exist + } + + It "Toolcache directory contains at least one version of Go" -TestCases $testCase { + param ( [string] $GoDirectory ) + + (Get-ChildItem -Path $GoDirectory -Directory).Count | Should -BeGreaterThan 0 + } + + $goPackage.Versions | Where-Object { $_ } | ForEach-Object { + Context "$_" { + $versionDirectory = Get-ChildItem -Path $goDirectory -Directory -Filter "$_*" | Select-Object -First 1 + $goBinPath = Join-Path $versionDirectory.FullName $goPackage.Arch "bin" "go" + $testCase = @{ GoVersion = $_; GoBinPath = $goBinPath } + + It "Version Go" -TestCases $testCase { + param ( + [string] $GoVersion, + [string] $GoBinPath + ) + + $result = Get-CommandResult "$GoBinPath version" + $result.Output | Should -BeLike "*$GoVersion*" + $result.ExitCode | Should -Be 0 + } + } + } + } +} \ No newline at end of file diff --git a/images/macos/tests/Xamarin.Tests.ps1 b/images/macos/tests/Xamarin.Tests.ps1 new file mode 100644 index 000000000..5e60f5366 --- /dev/null +++ b/images/macos/tests/Xamarin.Tests.ps1 @@ -0,0 +1,289 @@ +Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1" +Import-Module "$PSScriptRoot/../helpers/Tests.Helpers.psm1" + +$MONO_VERSIONS = Get-ToolsetValue "xamarin.mono-versions" +$XAMARIN_IOS_VERSIONS = Get-ToolsetValue "xamarin.ios-versions" +$XAMARIN_MAC_VERSIONS = Get-ToolsetValue "xamarin.mac-versions" +$XAMARIN_ANDROID_VERSIONS = Get-ToolsetValue "xamarin.android-versions" + +BeforeAll { + function Get-ShortSymlink { + param ( + [string] $Version + ) + + $versionParts = $Version.Split(".") + return [String]::Join(".", $versionParts[0..1]) + } +} + +Describe "Mono" { + $MONO_VERSIONS | ForEach-Object { + Context "$_" { + $MONO_VERSIONS_PATH = "/Library/Frameworks/Mono.framework/Versions" + $versionFolderPath = Join-Path $MONO_VERSIONS_PATH ([System.Version]::Parse($_).ToString(3)) + $testCase = @{ MonoVersion = $_; VersionFolderPath = $versionFolderPath; MonoVersionsPath = $MONO_VERSIONS_PATH } + + It "is installed" -TestCases $testCase { + param ( [string] $VersionFolderPath ) + + $monoBinPath = Join-Path $VersionFolderPath "bin" "mono" + $VersionFolderPath | Should -Exist + $monoBinPath | Should -Exist + } + + It "is available via short link" -TestCases $testCase { + param ( + [string] $MonoVersion, + [string] $MonoVersionsPath, + [string] $VersionFolderPath + ) + + $shortSymlink = Get-ShortSymlink $MonoVersion # only 'major.minor' + $shortSymlinkFolderPath = Join-Path $MonoVersionsPath $shortSymlink + if ($shortSymlink -eq "4.8") { return } # Skip this test for Mono 4.8 because it doesn't contain VERSION file + $shortVersionPath = Join-Path $shortSymlinkFolderPath "VERSION" + $fullVersionPath = Join-Path $VersionFolderPath "VERSION" + + Validate-IdenticalFileContent -File1 $shortVersionPath -File2 $fullVersionPath + } + + It "NUnit console is installed" -TestCases $testCase { + param ( [string] $VersionFolderPath ) + + $nunitPath = Join-Path $VersionFolderPath "Commands" "nunit3-console" + $nunitPath | Should -Exist + } + + It "Nuget is installed" -TestCases $testCase { + param ( [string] $VersionFolderPath ) + + $nugetBinaryPath = Join-Path $VersionFolderPath "lib" "mono" "nuget" "nuget.exe" + $nugetBinaryWrapperPath = Join-Path $VersionFolderPath "bin" "nuget" + $nugetCommandPath = Join-Path $VersionFolderPath "Commands" "nuget" + + $nugetBinaryPath | Should -Exist + $nugetCommandPath | Should -Exist + $nugetBinaryWrapperPath | Should -Exist + } + + It "Nuget is valid" -TestCases $testCase { + param ( [string] $VersionFolderPath ) + + $nugetBinaryWrapperPath = Join-Path $VersionFolderPath "bin" "nuget" + "$nugetBinaryWrapperPath" | Should -ReturnZeroExitCode + } + } + } +} + +Describe "Xamarin.iOS" { + $XAMARIN_IOS_VERSIONS | ForEach-Object { + Context "$_" { + $XAMARIN_IOS_VERSIONS_PATH = "/Library/Frameworks/Xamarin.iOS.framework/Versions" + $versionFolderPath = Join-Path $XAMARIN_IOS_VERSIONS_PATH $_ + $testCase = @{ XamarinIosVersion = $_; VersionFolderPath = $versionFolderPath; IosVersionsPath = $XAMARIN_IOS_VERSIONS_PATH } + + It "is installed" -TestCases $testCase { + param ( [string] $VersionFolderPath ) + + $xamarinBinPath = Join-Path $VersionFolderPath "bin" + $VersionFolderPath | Should -Exist + $xamarinBinPath | Should -Exist + } + + It "is available via short link" -TestCases $testCase { + param ( + [string] $XamarinIosVersion, + [string] $IosVersionsPath, + [string] $VersionFolderPath + ) + + $shortSymlink = Get-ShortSymlink $XamarinIosVersion # only 'major.minor' + $shortSymlinkFolderPath = Join-Path $IosVersionsPath $shortSymlink + $shortVersionPath = Join-Path $shortSymlinkFolderPath "VERSION" + $fullVersionPath = Join-Path $VersionFolderPath "VERSION" + + Validate-IdenticalFileContent -File1 $shortVersionPath -File2 $fullVersionPath + } + } + } +} + +Describe "Xamarin.Mac" { + $XAMARIN_MAC_VERSIONS | ForEach-Object { + Context "$_" { + $XAMARIN_MAC_VERSIONS_PATH = "/Library/Frameworks/Xamarin.Mac.framework/Versions" + $versionFolderPath = Join-Path $XAMARIN_MAC_VERSIONS_PATH $_ + $testCase = @{ XamarinMacVersion = $_; VersionFolderPath = $versionFolderPath; MacVersionsPath = $XAMARIN_MAC_VERSIONS_PATH } + + It "is installed" -TestCases $testCase { + param ( [string] $VersionFolderPath ) + + $xamarinBinPath = Join-Path $VersionFolderPath "bin" + $VersionFolderPath | Should -Exist + $xamarinBinPath | Should -Exist + } + + It "is available via short link" -TestCases $testCase { + param ( + [string] $XamarinMacVersion, + [string] $MacVersionsPath, + [string] $VersionFolderPath + ) + + $shortSymlink = Get-ShortSymlink $XamarinMacVersion # only 'major.minor' + $shortSymlinkFolderPath = Join-Path $MacVersionsPath $shortSymlink + $shortVersionPath = Join-Path $shortSymlinkFolderPath "VERSION" + $fullVersionPath = Join-Path $VersionFolderPath "VERSION" + + Validate-IdenticalFileContent -File1 $shortVersionPath -File2 $fullVersionPath + } + } + } +} + +Describe "Xamarin.Android" { + $XAMARIN_ANDROID_VERSIONS | ForEach-Object { + Context "$_" { + $XAMARIN_ANDROID_VERSIONS_PATH = "/Library/Frameworks/Xamarin.Android.framework/Versions" + $versionFolderPath = Join-Path $XAMARIN_ANDROID_VERSIONS_PATH $_ + $testCase = @{ XamarinAndroidVersion = $_; VersionFolderPath = $versionFolderPath; AndroidVersionsPath = $XAMARIN_ANDROID_VERSIONS_PATH } + + It "is installed" -TestCases $testCase { + param ( [string] $VersionFolderPath ) + + $xamarinLibPath = Join-Path $VersionFolderPath "lib" + $xamarinLibPath | Should -Exist + } + + It "is available via short link" -TestCases $testCase { + param ( + [string] $XamarinAndroidVersion, + [string] $AndroidVersionsPath, + [string] $VersionFolderPath + ) + + $shortSymlink = Get-ShortSymlink $XamarinAndroidVersion # only 'major.minor' + $shortSymlinkFolderPath = Join-Path $AndroidVersionsPath $shortSymlink + $shortVersionPath = Join-Path $shortSymlinkFolderPath "VERSION" + $fullVersionPath = Join-Path $VersionFolderPath "VERSION" + + Validate-IdenticalFileContent -File1 $shortVersionPath -File2 $fullVersionPath + } + + It "has correct symlinks" -TestCases $testCase { + param ( [string] $VersionFolderPath ) + + $xamarinLibPath = Join-Path $VersionFolderPath "lib" + Join-Path $xamarinLibPath "xbuild" | Should -Exist + Join-Path $xamarinLibPath "xbuild-frameworks" | Should -Exist + } + } + } +} + +Describe "Xamarin Bundles" { + BeforeAll { + $MONO_VERSIONS_PATH = "/Library/Frameworks/Mono.framework/Versions" + $XAMARIN_IOS_VERSIONS_PATH = "/Library/Frameworks/Xamarin.iOS.framework/Versions" + $XAMARIN_MAC_VERSIONS_PATH = "/Library/Frameworks/Xamarin.Mac.framework/Versions" + $XAMARIN_ANDROID_VERSIONS_PATH = "/Library/Frameworks/Xamarin.Android.framework/Versions" + } + + $XAMARIN_BUNDLES = Get-ToolsetValue "xamarin.bundles" + $XAMARIN_DEFAULT_BUNDLE = Get-ToolsetValue "xamarin.bundle-default" + If ($XAMARIN_DEFAULT_BUNDLE -eq "latest") { $XAMARIN_DEFAULT_BUNDLE = $XAMARIN_BUNDLES[0].symlink } + + $currentBundle = [PSCustomObject] @{ + symlink = "Current" + mono = $XAMARIN_DEFAULT_BUNDLE + ios = $XAMARIN_DEFAULT_BUNDLE + mac = $XAMARIN_DEFAULT_BUNDLE + android = $XAMARIN_DEFAULT_BUNDLE + } + + $latestBundle = [PSCustomObject] @{ + symlink = "Latest" + mono = $XAMARIN_BUNDLES[0].mono + ios = $XAMARIN_BUNDLES[0].ios + mac = $XAMARIN_BUNDLES[0].mac + android = $XAMARIN_BUNDLES[0].android + } + + $bundles = $XAMARIN_BUNDLES + $currentBundle + $latestBundle + $allBundles = $bundles | ForEach-Object { @{BundleSymlink = $_.symlink; BundleMono = $_.mono; BundleIos = $_.ios; BundleMac = $_.mac; BundleAndroid = $_.android} } + + It "Mono symlink exists" -TestCases $allBundles { + param ( [string] $BundleSymlink ) + + (Join-Path $MONO_VERSIONS_PATH $BundleSymlink) | Should -Exist + } + + It "Mono symlink points to the correct version" -TestCases $allBundles { + param ( + [string] $BundleSymlink, + [string] $BundleMono + ) + + if ($BundleMono -eq "4.8") { return } # Skip this test for Mono 4.8 because it doesn't contain VERSION file + $sourceVersionPath = Join-Path $MONO_VERSIONS_PATH $BundleMono "VERSION" + $targetVersionPath = Join-Path $MONO_VERSIONS_PATH $BundleSymlink "VERSION" + + Validate-IdenticalFileContent -File1 $targetVersionPath -File2 $sourceVersionPath + } + + It "iOS symlink exists" -TestCases $allBundles { + param ( [string] $BundleSymlink ) + + (Join-Path $XAMARIN_IOS_VERSIONS_PATH $BundleSymlink) | Should -Exist + } + + It "iOS symlink points to the correct version" -TestCases $allBundles { + param ( + [string] $BundleSymlink, + [string] $BundleIos + ) + + $sourceVersionPath = Join-Path $XAMARIN_IOS_VERSIONS_PATH $BundleIos "VERSION" + $targetVersionPath = Join-Path $XAMARIN_IOS_VERSIONS_PATH $BundleSymlink "VERSION" + + Validate-IdenticalFileContent -File1 $targetVersionPath -File2 $sourceVersionPath + } + + It "Mac symlink exists" -TestCases $allBundles { + param ( [string] $BundleSymlink ) + + (Join-Path $XAMARIN_MAC_VERSIONS_PATH $BundleSymlink) | Should -Exist + } + + It "Mac symlink points to the correct version" -TestCases $allBundles { + param ( + [string] $BundleSymlink, + [string] $BundleMac + ) + + $sourceVersionPath = Join-Path $XAMARIN_MAC_VERSIONS_PATH $BundleMac "VERSION" + $targetVersionPath = Join-Path $XAMARIN_MAC_VERSIONS_PATH $BundleSymlink "VERSION" + + Validate-IdenticalFileContent -File1 $targetVersionPath -File2 $sourceVersionPath + } + + It "Xamarin.Android symlink exists" -TestCases $allBundles { + param ( [string] $BundleSymlink ) + + (Join-Path $XAMARIN_ANDROID_VERSIONS_PATH $BundleSymlink) | Should -Exist + } + + It "Android symlink points to the correct version" -TestCases $allBundles { + param ( + [string] $BundleSymlink, + [string] $BundleAndroid + ) + + $sourceVersionPath = Join-Path $XAMARIN_ANDROID_VERSIONS_PATH $BundleAndroid "VERSION" + $targetVersionPath = Join-Path $XAMARIN_ANDROID_VERSIONS_PATH $BundleSymlink "VERSION" + + Validate-IdenticalFileContent -File1 $targetVersionPath -File2 $sourceVersionPath + } +} \ No newline at end of file diff --git a/images/macos/tests/Xcode.Tests.ps1 b/images/macos/tests/Xcode.Tests.ps1 new file mode 100644 index 000000000..543a715db --- /dev/null +++ b/images/macos/tests/Xcode.Tests.ps1 @@ -0,0 +1,107 @@ +Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1" +Import-Module "$PSScriptRoot/../helpers/Xcode.Helpers.psm1" +Import-Module "$PSScriptRoot/../helpers/Tests.Helpers.psm1" + +$XCODE_VERSIONS = Get-ToolsetValue "xcode.versions" +$DEFAULT_XCODE = Get-ToolsetValue "xcode.default" +$LATEST_XCODE_VERSION = $XCODE_VERSIONS | Select-Object -First 1 +$OS = Get-OSVersion + +Describe "Xcode" { + It "Default Xcode is $DEFAULT_XCODE" { + "xcodebuild -version" | Should -ReturnZeroExitCode + (Get-CommandResult "xcodebuild -version").Output | Should -BeLike "Xcode $DEFAULT_XCODE*" + } + + # Cut "_beta" postfix for test cases + $testCases = $XCODE_VERSIONS | ForEach-Object { @{XcodeVersion = $_.Split("_")[0] } } + + It "" -TestCases $testCases { + param ( [string] $XcodeVersion ) + + $xcodebuildPath = Get-XcodeToolPath -Version $XcodeVersion -ToolName "xcodebuild" + "$xcodebuildPath -version" | Should -ReturnZeroExitCode + } + + It "Xcode tools are installed" -TestCases $testCases -Skip:($os.IsHighSierra) { + param ( [string] $XcodeVersion ) + + $TOOLS_NOT_INSTALLED_EXIT_CODE = 69 + $xcodebuildPath = Get-XcodeToolPath -Version $XcodeVersion -ToolName "xcodebuild" + $result = Get-CommandResult "$xcodebuildPath -checkFirstLaunchStatus" + + if ($XcodeVersion -ne $LATEST_XCODE_VERSION) { + $result.ExitCode | Should -Not -Be $TOOLS_NOT_INSTALLED_EXIT_CODE + } else { + $result.ExitCode | Should -BeIn (0, $TOOLS_NOT_INSTALLED_EXIT_CODE) + } + } + + It "Xcode has correct beta symlink" -TestCases $testCases { + param ( [string] $XcodeVersion ) + + $xcodesWithBetaSymlink = @("12", "12_beta", "9.3", "9.4") + $shouldBetaSymlinkExists = $XcodeVersion.StartsWith("10") -or $XcodeVersion.StartsWith("11") -or ($XcodeVersion -in $xcodesWithBetaSymlink) + + $betaSymlinkPath = Get-XcodeRootPath -Version "${XcodeVersion}_beta" + Test-Path $betaSymlinkPath | Should -Be $shouldBetaSymlinkExists + } + + It "/Applications/Xcode* symlinks are valid" { + $symlinks = Get-ChildItem "/Applications" -Filter "Xcode*" | Where-Object { $_.LinkType } + + $symlinks.Target | ForEach-Object { + $_ | Should -Exist + } + } + + Context "XCODE_DEVELOPER_DIR" { + $stableXcodeVersions = $XCODE_VERSIONS | Where-Object { -not ($_ -match "beta") } + $majorXcodeVersions = $stableXcodeVersions | ForEach-Object { $_.Split(".")[0] } | Select-Object -Unique + $testCases = $majorXcodeVersions | ForEach-Object { + $majorXcodeVersion = $_ + $expectedVersion = $stableXcodeVersions | Where-Object { $_.StartsWith("$majorXcodeVersion") } | Select-Object -First 1 + return @{ + MajorXcodeVersion = $majorXcodeVersion + ExpectedVersion = $expectedVersion + } + } + + It "XCODE__DEVELOPER_DIR" -TestCases $testCases { + param ( + [string] $MajorXcodeVersion, + [string] $ExpectedVersion + ) + + $variableName = "XCODE_${MajorXcodeVersion}_DEVELOPER_DIR" + $actualPath = Get-EnvironmentVariable $variableName + $expectedPath = Join-Path (Get-XcodeRootPath -Version $ExpectedVersion) "Contents/Developer" + + $actualPath | Should -Exist + $actualPath | Should -Be $expectedPath + } + } +} + +Describe "Xcode simulators" { + $XCODE_VERSIONS | ForEach-Object { + Switch-Xcode -Version $_ + + Context "$_" { + It "No duplicates in devices" { + [array]$devicesList = @(Get-XcodeDevicesList | Where-Object { $_ }) + Validate-ArrayWithoutDuplicates $devicesList -Because "Found duplicate device simulators" + } + + It "No duplicates in pairs" { + [array]$pairsList = @(Get-XcodePairsList | Where-Object { $_ }) + Validate-ArrayWithoutDuplicates $pairsList -Because "Found duplicate pairs simulators" + } + } + } + + AfterAll { + $DEFAULT_XCODE = Get-ToolsetValue "xcode.default" + Switch-Xcode -Version $DEFAULT_XCODE + } +} \ No newline at end of file diff --git a/images/macos/toolsets/Readme.md b/images/macos/toolsets/Readme.md new file mode 100644 index 000000000..671ef4826 --- /dev/null +++ b/images/macos/toolsets/Readme.md @@ -0,0 +1,82 @@ +# Toolset JSON structure +## Xcode +- `default` - version of Xcode to set as default + **Example:** `"11.2.1"` + +- `versions` - the array of versions of Xcode to install + **Example:** `[ "11.3", "11.2.1", "11.2", "11.1", "11" ]` + +## Xamarin +- `vsmac` - version of Visual Studio For Mac to install. + **Example:** `"8.3.11.1"` + +- `mono-versions` - the array of Mono versions to install. + **Example:** `[ "6.4.0.208", "6.0.0.334" ]` + +- `ios-versions` - the array of Xamarin iOS versions to install. + **Example:** `[ "13.6.0.12", "13.4.0.2", "13.2.0.47" ]` + +- `mac-versions` - the array of Xamarin iOS versions to install. + **Example:** `[ "6.6.0.12", "6.4.0.2", "6.2.0.47" ]` + +- `android-versions` - the array of Xamarin iOS versions to install. + **Example:** `[ "10.0.6.2", "9.4.1.0" ]` + +**Note:** More than one version of SDK with the same major.minor version should not be installed. It applies to `mono-versions`, `ios-versions`, `mac-versions`, `android-versions` fields. +For example, if Mono `6.4.0.100` is installed and Mono `6.4.1.2` was released recently, we should not install both, just update `6.4.0.100` -> `6.4.1.2`. Only major and minor version changes can break backward compatibility so it is safe. + +
+ +- `bundle-default` - the symlink of the bundle that will be set as default on the image. +This bundle will be set as `Current`. + **Example:** `"5_12_0"` (set bundle with symlink `5_12_0` as default) + **Example:** `"latest"` (set latest bundle as default) + +- `bundles` - the array of objects that describe bundles that will be created on image after sdk installation. +The first bundle in the list will be as `Latest`. + + Each object should contain the following fields: + - `symlink` - unique id of the bundle (usually looks like "__") + - `mono` - version of Mono that will be set in this bundle. Only two numbers (`major.minor`) should be specified. + - `ios` - version of Xamarin.iOS that will be set in this bundle. Only two numbers (`major.minor`) should be specified. + - `mac` - version of Xamarin.Mac that will be set in this bundle. Only two numbers (`major.minor`) should be specified. + - `android` - version of Xamarin.Android that will be set in this bundle. Only two numbers (`major.minor`) should be specified. + + + **Example:** +``` + [ + { + "symlink": "6_4_2", + "mono": "6.4", + "ios": "13.6", + "mac": "6.6", + "android": "10.0" + }, + { + "symlink": "6_4_1", + "mono": "6.4", + "ios": "13.4", + "mac": "6.4", + "android": "10.0" + } + ] +``` + +## Android +- `platform-list` - the array of android platforms to install. + **Example:** `[ "android-29", "android-28", "android-27" ]` + +- `build-tools` - the array of android build tools to install. + **Example:** `[ "29.0.2", "29.0.1", "29.0.0", "28.0.3" ]` + +- `extra-list` - the array of android extra items to install. + **Example:** `[ "google;google_play_services", "intel;Hardware_Accelerated_Execution_Manager" ]` + +- `addon-list` - the array of android addons to install. + **Example:** `[ "addon-google_apis-google-24", "addon-google_apis-google-23" ]` + + +# Toolset JSON validation +File `Toolset.Tests.ps1` contains PowerShell [Pester](https://github.com/Pester/Pester) tests that validate JSON toolset files. +Type `Invoke-Pester` in the current folder in PowerShell to run tests. \ No newline at end of file diff --git a/images/macos/toolsets/Toolset.Tests.ps1 b/images/macos/toolsets/Toolset.Tests.ps1 new file mode 100644 index 000000000..12bbee49c --- /dev/null +++ b/images/macos/toolsets/Toolset.Tests.ps1 @@ -0,0 +1,144 @@ +Import-Module "$PSScriptRoot/../helpers/Tests.Helpers.psm1" + +$toolsets = Get-ChildItem -Path $PSScriptRoot -Filter "toolset_*.json" + +function Get-ShortVersion([System.Version] $Version) { + return [System.Version]::Parse($Version).ToString(2) +} + +function Invoke-BashUtilsFunction([string] $FunctionName, [string]$parameter) { + $xamarinUtilsPath = "$PSScriptRoot/../provision/utils/xamarin-utils.sh" + return Invoke-Expression "bash -c `"source $xamarinUtilsPath && $FunctionName $parameter`"" +} + +Describe "Toolset JSON validation" { + $toolsets | ForEach-Object { + It "$($_.Name) is valid" { + $jsonContent = Get-Content -Raw $_.Fullname + $jsonContent | Test-Json | Should -BeTrue + } + } +} + +$toolsets | ForEach-Object { + Describe "$($_.Name)" { + $toolset = Get-Content -Raw $_.Fullname | ConvertFrom-Json + + Context "Xcode" { + It "Default Xcode should be defined" { + $toolset.xcode.default | Should -BeTrue + } + + It "Default Xcode is listed in Xcode list" { + $toolset.xcode.versions | Should -Contain $toolset.xcode.default + } + } + + Context "VSMac" { + $vsmacVersion = $toolset.xamarin.vsmac + + It "Version '$vsmacVersion' is available and can be downloaded" { + $vsmacUrl = Invoke-BashUtilsFunction("buildVSMacDownloadUrl", $vsmacVersion) + Validate-Url $vsmacUrl + } + } + + Context "Mono" { + $sdkVersions = $toolset.xamarin."mono-versions" + + $sdkVersions | ForEach-Object { + It "Version '$_' is available and can be downloaded" { + $sdkUrl = Invoke-BashUtilsFunction("buildMonoDownloadUrl", $_) + Validate-Url $sdkUrl + } + } + + It "Version list doesn't contain versions with the same major/minor version" { + $versions = $sdkVersions | ForEach-Object { Get-ShortVersion $_ } + Validate-ArrayWithoutDuplicates $versions -Because "It doesn't allow to install more than one version with the same major/minor" + } + } + + Context "Xamarin.iOS" { + $sdkVersions = $toolset.xamarin."ios-versions" + + $sdkVersions | ForEach-Object { + It "Version '$_' is available and can be downloaded" { + $sdkUrl = Invoke-BashUtilsFunction("buildXamariniIOSDownloadUrl", $_) + Validate-Url $sdkUrl + } + } + + It "Version list doesn't contain versions with the same major/minor version" { + $versions = $sdkVersions | ForEach-Object { Get-ShortVersion $_ } + Validate-ArrayWithoutDuplicates $versions -Because "It doesn't allow to install more than one version with the same major/minor" + } + } + + Context "Xamarin.Mac" { + $sdkVersions = $toolset.xamarin."mac-versions" + + $sdkVersions | ForEach-Object { + It "Version '$_' is available and can be downloaded" { + $sdkUrl = Invoke-BashUtilsFunction("buildXamarinMacDownloadUrl", $_) + Validate-Url $sdkUrl + } + } + + It "Version list doesn't contain versions with the same major/minor version" { + $versions = $sdkVersions | ForEach-Object { Get-ShortVersion $_ } + Validate-ArrayWithoutDuplicates $versions -Because "It doesn't allow to install more than one version with the same major/minor" + } + } + + Context "Xamarin.Android" { + $sdkVersions = $toolset.xamarin."android-versions" + + $sdkVersions | ForEach-Object { + It "Version '$_' is available and can be downloaded" { + $sdkUrl = Invoke-BashUtilsFunction("buildXamarinAndroidDownloadUrl", $_) + Validate-Url $sdkUrl + } + } + + It "Version list doesn't contain versions with the same major/minor version" { + $versions = $sdkVersions | ForEach-Object { $_.Replace("-", ".") } | ForEach-Object { Get-ShortVersion $_ } + Validate-ArrayWithoutDuplicates $versions -Because "It doesn't allow to install more than one version with the same major/minor" + } + } + + Context "Xamarin bundles" { + $monoVersions = $toolset.xamarin."mono-versions" | ForEach-Object { Get-ShortVersion $_ } + $iOSVersions = $toolset.xamarin."ios-versions" | ForEach-Object { Get-ShortVersion $_ } + $macVersions = $toolset.xamarin."mac-versions" | ForEach-Object { Get-ShortVersion $_ } + # Old Xamarin.Android version looks like "9.0.0-18" that doesn't support by System.Version + $androidVersions = $toolset.xamarin."android-versions" | ForEach-Object { Get-ShortVersion $_.Replace("-", ".") } + + + $bundles = $toolset.xamarin.bundles + $bundles | ForEach-Object { + It "'$($_.symlink)' is valid" { + $monoVersions | Should -Contain $_.mono + $iOSVersions | Should -Contain $_.ios + $macVersions | Should -Contain $_.mac + $androidVersions | Should -Contain $_.android + } + } + + It "Each bundle has unique symlink" { + $symlinks = $bundles | ForEach-Object { $_.symlink } + Validate-ArrayWithoutDuplicates $symlinks -Because "Bundle symlinks should be unique" + } + + It "Current bundle is valid" { + $currentBundleSymlink = $toolset.xamarin."bundle-default" + if ($currentBundleSymlink -ne "latest") { + $bundleSymlinks = $bundles | ForEach-Object { $_.symlink } + $bundleSymlinks | Should -Contain $currentBundleSymlink -Because "Current bundle should be installed" + } + + } + + } + } +} \ No newline at end of file diff --git a/images/macos/toolsets/toolcache-10.13.json b/images/macos/toolsets/toolcache-10.13.json new file mode 100644 index 000000000..1d415ac7d --- /dev/null +++ b/images/macos/toolsets/toolcache-10.13.json @@ -0,0 +1,8 @@ +{ + "@actions/toolcache-python-macos-1013-x64": [ + "2.7", "3.5", "3.6", "3.7", "3.8" + ], + "@actions/toolcache-ruby-macos-1013-x64": [ + "2.4", "2.5", "2.6", "2.7" + ] +} \ No newline at end of file diff --git a/images/macos/toolsets/toolcache-10.14.json b/images/macos/toolsets/toolcache-10.14.json new file mode 100644 index 000000000..4826303ec --- /dev/null +++ b/images/macos/toolsets/toolcache-10.14.json @@ -0,0 +1,5 @@ +{ + "@actions/toolcache-ruby-macos-1013-x64": [ + "2.4", "2.5", "2.6", "2.7" + ] +} \ No newline at end of file diff --git a/images/macos/toolsets/toolcache-11.0.json b/images/macos/toolsets/toolcache-11.0.json new file mode 100644 index 000000000..4826303ec --- /dev/null +++ b/images/macos/toolsets/toolcache-11.0.json @@ -0,0 +1,5 @@ +{ + "@actions/toolcache-ruby-macos-1013-x64": [ + "2.4", "2.5", "2.6", "2.7" + ] +} \ No newline at end of file diff --git a/images/macos/toolsets/toolset-10.13.json b/images/macos/toolsets/toolset-10.13.json new file mode 100644 index 000000000..fdb14d084 --- /dev/null +++ b/images/macos/toolsets/toolset-10.13.json @@ -0,0 +1,202 @@ +{ + "xcode": { + "default": "10.1", + "versions": [ + "10.1", "10", "9.4.1", "9.4", "9.3.1", "9.3", "9.2", "9.1", "9", "8.3.3", "8.2.1", "8.1", "8" + ] + }, + "xamarin": { + "vsmac": "8.3.11.1", + "mono-versions": [ + "6.4.0.208", "6.0.0.334", "5.18.1.3", "5.16.1.0", "5.12.0.309", "5.10.1.57", "5.8.1.0", "5.4.1.7", "5.2.0.224", "5.0.1.1", "4.8.1.0" + ], + "ios-versions": [ + "13.6.0.12", "13.4.0.2", "13.2.0.47", "12.14.0.114", "12.10.0.157", "12.8.0.2", "12.6.0.25", "12.2.1.16", "12.0.0.15", "11.14.0.13", "11.12.0.4", "11.9.1.24", "11.8.0.20", "11.6.1.4", "11.2.0.11", "11.0.0.0", "10.10.0.36", "10.6.0.10" + ], + "mac-versions": [ + "6.6.0.12", "6.4.0.2", "6.2.0.47", "5.16.1.24", "5.10.0.157", "5.8.0.0", "5.6.0.25", "5.3.1.28", "5.2.1.16" , "4.6.0.13", "4.4.1.193", "4.2.1.28", "4.0.0.216", "3.8.0.49", "3.6.3.3", "3.4.0.36", "3.0.0.398" + ], + "android-versions": [ + "10.0.6.2", "9.4.1.0", "9.3.0-23", "9.2.3-0", "9.1.8-0", "9.0.0-20", "8.3.3-2", "8.2.0-16", "8.1.5-0", "8.0.0-33", "7.4.5-1", "7.3.1-2", "7.1.0-43" + ], + "bundle-default": "5_12_0", + "bundles": [ + { + "symlink": "6_4_2", + "mono": "6.4", + "ios": "13.6", + "mac": "6.6", + "android": "10.0" + }, + { + "symlink": "6_4_1", + "mono": "6.4", + "ios": "13.4", + "mac": "6.4", + "android": "10.0" + }, + { + "symlink": "6_4_0", + "mono": "6.4", + "ios": "13.2", + "mac": "6.2", + "android": "10.0" + }, + { + "symlink": "6_0_0", + "mono": "6.0", + "ios": "12.14", + "mac": "5.16", + "android": "9.4" + }, + { + "symlink": "5_18_3", + "mono": "5.18", + "ios": "12.10", + "mac": "5.10", + "android": "9.3" + }, + { + "symlink": "5_18_2", + "mono": "5.18", + "ios": "12.8", + "mac": "5.8", + "android": "9.2" + }, + { + "symlink": "5_18_1", + "mono": "5.18", + "ios": "12.6", + "mac": "5.6", + "android": "9.2" + }, + { + "symlink": "5_16_0_0", + "mono": "5.16", + "ios": "12.2", + "mac": "5.2", + "android": "9.1" + }, + { + "symlink": "5_16_0", + "mono": "5.16", + "ios": "12.2", + "mac": "5.2", + "android": "9.1" + }, + { + "symlink": "5_12_0_3", + "mono": "5.12", + "ios": "12.2", + "mac": "5.3", + "android": "9.0" + }, + { + "symlink": "5_12_0_XC10_PRE", + "mono": "5.12", + "ios": "12.0", + "mac": "5.2", + "android": "9.0" + }, + { + "symlink": "5_12_0", + "mono": "5.12", + "ios": "11.14", + "mac": "4.6", + "android": "9.0" + }, + { + "symlink": "5_10_1", + "mono": "5.10", + "ios": "11.12", + "mac": "4.4", + "android": "8.3" + }, + { + "symlink": "5_8_1", + "mono": "5.8", + "ios": "11.9", + "mac": "4.2", + "android": "8.2" + }, + { + "symlink": "5_8_0", + "mono": "5.8", + "ios": "11.8", + "mac": "4.2", + "android": "8.2" + }, + { + "symlink": "5_4_1", + "mono": "5.4", + "ios": "11.6", + "mac": "4.0", + "android": "8.1" + }, + { + "symlink": "5_4_0", + "mono": "5.4", + "ios": "11.2", + "mac": "3.8", + "android": "8.0" + }, + { + "symlink": "5_2_0", + "mono": "5.2", + "ios": "11.0", + "mac": "3.6", + "android": "7.4" + }, + { + "symlink": "Legacy_5_0_1", + "mono": "5.0", + "ios": "10.10", + "mac": "3.4", + "android": "7.3" + }, + { + "symlink": "Legacy_4_8_1", + "mono": "4.8", + "ios": "10.6", + "mac": "3.0", + "android": "7.1" + } + ] + }, + "java": { + "default": "8", + "versions": [ + "7", "8", "11", "12", "13", "14" + ] + }, + "android": { + "platform-list": [ + "android-30", "android-29", "android-28", "android-27", "android-26", "android-25", "android-24", "android-23", "android-22", "android-21", "android-20", "android-19", "android-18", "android-17", "android-16", "android-15" + ], + "build-tools": [ + "30.0.1", "30.0.0", "29.0.3", "29.0.2", "29.0.1", "29.0.0", "28.0.3", "28.0.2", "28.0.1", "28.0.0", "27.0.3", "27.0.2", "27.0.1", "27.0.0", "26.0.3", "26.0.2", "26.0.1", "26.0.0", "25.0.3", "25.0.2", "25.0.1", "25.0.0", "24.0.3", "24.0.2", "24.0.1", "24.0.0", "23.0.3", "23.0.2", "23.0.1", "23.0.0", "22.0.1", "21.1.2", "20.0.0", "19.1.0", "17.0.0" + ], + "extra-list": [ + "android;m2repository", "google;m2repository", "google;google_play_services", "intel;Hardware_Accelerated_Execution_Manager", "m2repository;com;android;support;constraint;constraint-layout-solver;1.0.0-beta1", "m2repository;com;android;support;constraint;constraint-layout-solver;1.0.0-beta2", "m2repository;com;android;support;constraint;constraint-layout-solver;1.0.0-beta3", "m2repository;com;android;support;constraint;constraint-layout-solver;1.0.0-beta4", "m2repository;com;android;support;constraint;constraint-layout-solver;1.0.0-beta5", "m2repository;com;android;support;constraint;constraint-layout-solver;1.0.0", "m2repository;com;android;support;constraint;constraint-layout-solver;1.0.1", "m2repository;com;android;support;constraint;constraint-layout-solver;1.0.2", "m2repository;com;android;support;constraint;constraint-layout;1.0.0-beta1", "m2repository;com;android;support;constraint;constraint-layout;1.0.0-beta2", "m2repository;com;android;support;constraint;constraint-layout;1.0.0-beta3", "m2repository;com;android;support;constraint;constraint-layout;1.0.0-beta4", "m2repository;com;android;support;constraint;constraint-layout;1.0.0-beta5", "m2repository;com;android;support;constraint;constraint-layout;1.0.0", "m2repository;com;android;support;constraint;constraint-layout;1.0.1", "m2repository;com;android;support;constraint;constraint-layout;1.0.2" + ], + "addon-list": [ + "addon-google_apis-google-24", "addon-google_apis-google-23", "addon-google_apis-google-22", "addon-google_apis-google-21" + ] + }, + "powershellModules": [ + {"name": "Az"}, + {"name": "MarkdownPS"}, + {"name": "Pester"} + ], + "toolcache": [ + { + "name": "PyPy", + "arch": "x64", + "platform" : "darwin", + "versions": [ + "2.7", + "3.6" + ] + } + ] +} \ No newline at end of file diff --git a/images/macos/toolsets/toolset-10.14.json b/images/macos/toolsets/toolset-10.14.json new file mode 100644 index 000000000..e868f7699 --- /dev/null +++ b/images/macos/toolsets/toolset-10.14.json @@ -0,0 +1,261 @@ +{ + "xcode": { + "default": "11.3.1", + "versions": [ + "11.3.1", "11.3", "11.2.1", "11.2", "11.1", "11", "10.3", "10.2.1", "10.2", "10.1", "10", "9.4.1" + ] + }, + "xamarin": { + "vsmac": "8.5.0.3183", + "mono-versions": [ + "6.8.0.123", "6.6.0.166", "6.4.0.208", "6.0.0.334", "5.18.1.3", "5.16.1.0", "5.12.0.309", "5.10.1.57", "5.8.1.0", "5.4.1.7", "5.2.0.224", "5.0.1.1", "4.8.1.0" + ], + "ios-versions": [ + "13.14.1.39", "13.10.0.21", "13.8.3.0", "13.6.0.12", "13.4.0.2", "13.2.0.47", "12.14.0.114", "12.10.0.157", "12.8.0.2", "12.6.0.25", "12.2.1.16", "12.0.0.15", "11.14.0.13", "11.12.0.4", "11.9.1.24", "11.8.0.20", "11.6.1.4", "11.2.0.11", "11.0.0.0", "10.10.0.36", "10.6.0.10" + ], + "mac-versions": [ + "6.14.1.39", "6.10.0.21", "6.8.3.0", "6.6.0.12", "6.4.0.2", "6.2.0.47", "5.16.1.24", "5.10.0.157", "5.8.0.0", "5.6.0.25", "5.3.1.28", "5.2.1.16" , "4.6.0.13", "4.4.1.193", "4.2.1.28", "4.0.0.216", "3.8.0.49", "3.6.3.3", "3.4.0.36", "3.0.0.398" + ], + "android-versions": [ + "10.2.0.100", "10.1.3.7", "10.0.6.2", "9.4.1.0", "9.3.0-23", "9.2.3-0", "9.1.8-0", "9.0.0-20", "8.3.3-2", "8.2.0-16", "8.1.5-0", "8.0.0-33", "7.4.5-1", "7.3.1-2", "7.1.0-43" + ], + "bundle-default": "5_12_0", + "bundles": [ + { + "symlink": "6_8_0", + "mono": "6.8", + "ios": "13.14", + "mac": "6.14", + "android": "10.2" + }, + { + "symlink": "6_6_1", + "mono": "6.6", + "ios": "13.10", + "mac": "6.10", + "android": "10.1" + }, + { + "symlink": "6_6_0", + "mono": "6.6", + "ios": "13.8", + "mac": "6.8", + "android": "10.1" + }, + { + "symlink": "6_4_2", + "mono": "6.4", + "ios": "13.6", + "mac": "6.6", + "android": "10.0" + }, + { + "symlink": "6_4_1", + "mono": "6.4", + "ios": "13.4", + "mac": "6.4", + "android": "10.0" + }, + { + "symlink": "6_4_0", + "mono": "6.4", + "ios": "13.2", + "mac": "6.2", + "android": "10.0" + }, + { + "symlink": "6_0_0", + "mono": "6.0", + "ios": "12.14", + "mac": "5.16", + "android": "9.4" + }, + { + "symlink": "5_18_3", + "mono": "5.18", + "ios": "12.10", + "mac": "5.10", + "android": "9.3" + }, + { + "symlink": "5_18_2", + "mono": "5.18", + "ios": "12.8", + "mac": "5.8", + "android": "9.2" + }, + { + "symlink": "5_18_1", + "mono": "5.18", + "ios": "12.6", + "mac": "5.6", + "android": "9.2" + }, + { + "symlink": "5_16_0_0", + "mono": "5.16", + "ios": "12.2", + "mac": "5.2", + "android": "9.1" + }, + { + "symlink": "5_16_0", + "mono": "5.16", + "ios": "12.2", + "mac": "5.2", + "android": "9.1" + }, + { + "symlink": "5_12_0_3", + "mono": "5.12", + "ios": "12.2", + "mac": "5.3", + "android": "9.0" + }, + { + "symlink": "5_12_0_XC10_PRE", + "mono": "5.12", + "ios": "12.0", + "mac": "5.2", + "android": "9.0" + }, + { + "symlink": "5_12_0", + "mono": "5.12", + "ios": "11.14", + "mac": "4.6", + "android": "9.0" + }, + { + "symlink": "5_10_1", + "mono": "5.10", + "ios": "11.12", + "mac": "4.4", + "android": "8.3" + }, + { + "symlink": "5_8_1", + "mono": "5.8", + "ios": "11.9", + "mac": "4.2", + "android": "8.2" + }, + { + "symlink": "5_8_0", + "mono": "5.8", + "ios": "11.8", + "mac": "4.2", + "android": "8.2" + }, + { + "symlink": "5_4_1", + "mono": "5.4", + "ios": "11.6", + "mac": "4.0", + "android": "8.1" + }, + { + "symlink": "5_4_0", + "mono": "5.4", + "ios": "11.2", + "mac": "3.8", + "android": "8.0" + }, + { + "symlink": "5_2_0", + "mono": "5.2", + "ios": "11.0", + "mac": "3.6", + "android": "7.4" + }, + { + "symlink": "Legacy_5_0_1", + "mono": "5.0", + "ios": "10.10", + "mac": "3.4", + "android": "7.3" + }, + { + "symlink": "Legacy_4_8_1", + "mono": "4.8", + "ios": "10.6", + "mac": "3.0", + "android": "7.1" + } + ] + }, + "java": { + "default": "8", + "versions": [ + "7", "8", "11", "12", "13", "14" + ] + }, + "android": { + "platform-list": [ + "android-30", "android-29", "android-28", "android-27", "android-26", "android-25", "android-24", "android-23", "android-22", "android-21", "android-20", "android-19", "android-18", "android-17", "android-16", "android-15" + ], + "build-tools": [ + "30.0.2", "30.0.1", "30.0.0", "29.0.3", "29.0.2", "29.0.1", "29.0.0", "28.0.3", "28.0.2", "28.0.1", "28.0.0", "27.0.3", "27.0.2", "27.0.1", "27.0.0", "26.0.3", "26.0.2", "26.0.1", "26.0.0", "25.0.3", "25.0.2", "25.0.1", "25.0.0", "24.0.3", "24.0.2", "24.0.1", "24.0.0", "23.0.3", "23.0.2", "23.0.1", "23.0.0", "22.0.1", "21.1.2", "20.0.0", "19.1.0", "17.0.0" + ], + "extra-list": [ + "android;m2repository", "google;m2repository", "google;google_play_services", "intel;Hardware_Accelerated_Execution_Manager", "m2repository;com;android;support;constraint;constraint-layout-solver;1.0.0-beta1", "m2repository;com;android;support;constraint;constraint-layout-solver;1.0.0-beta2", "m2repository;com;android;support;constraint;constraint-layout-solver;1.0.0-beta3", "m2repository;com;android;support;constraint;constraint-layout-solver;1.0.0-beta4", "m2repository;com;android;support;constraint;constraint-layout-solver;1.0.0-beta5", "m2repository;com;android;support;constraint;constraint-layout-solver;1.0.0", "m2repository;com;android;support;constraint;constraint-layout-solver;1.0.1", "m2repository;com;android;support;constraint;constraint-layout-solver;1.0.2", "m2repository;com;android;support;constraint;constraint-layout;1.0.0-beta1", "m2repository;com;android;support;constraint;constraint-layout;1.0.0-beta2", "m2repository;com;android;support;constraint;constraint-layout;1.0.0-beta3", "m2repository;com;android;support;constraint;constraint-layout;1.0.0-beta4", "m2repository;com;android;support;constraint;constraint-layout;1.0.0-beta5", "m2repository;com;android;support;constraint;constraint-layout;1.0.0", "m2repository;com;android;support;constraint;constraint-layout;1.0.1", "m2repository;com;android;support;constraint;constraint-layout;1.0.2" + ], + "addon-list": [ + "addon-google_apis-google-24", "addon-google_apis-google-23", "addon-google_apis-google-22", "addon-google_apis-google-21" + ] + }, + "powershellModules": [ + {"name": "Az"}, + {"name": "MarkdownPS"}, + {"name": "Pester"} + ], + "toolcache": [ + { + "name": "Python", + "url" : "https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json", + "arch": "x64", + "platform" : "darwin", + "versions": [ + "2.7.*", + "3.5.*", + "3.6.*", + "3.7.*", + "3.8.*" + ] + }, + { + "name": "PyPy", + "arch": "x64", + "platform" : "darwin", + "versions": [ + "2.7", + "3.6" + ] + }, + { + "name": "Node", + "url" : "https://raw.githubusercontent.com/actions/node-versions/main/versions-manifest.json", + "platform" : "darwin", + "arch": "x64", + "versions": [ + "8.*", + "10.*", + "12.*", + "14.*" + ] + }, + { + "name": "Go", + "url" : "https://raw.githubusercontent.com/actions/go-versions/main/versions-manifest.json", + "arch": "x64", + "platform" : "darwin", + "versions": [ + "1.11.*", + "1.12.*", + "1.13.*", + "1.14.*", + "1.15.*" + ] + } + ] +} \ No newline at end of file diff --git a/images/macos/toolsets/toolset-10.15.json b/images/macos/toolsets/toolset-10.15.json new file mode 100644 index 000000000..21eb61a0d --- /dev/null +++ b/images/macos/toolsets/toolset-10.15.json @@ -0,0 +1,163 @@ +{ + "xcode": { + "default": "11.7", + "versions": [ + "12_beta", "11.7", "11.6", "11.5", "11.4.1", "11.4", "11.3.1", "11.2.1", "11.1", "11", "10.3" + ] + }, + "xamarin": { + "vsmac": "8.7.4.38", + "mono-versions": [ + "6.12.0.90", "6.10.0.106", "6.8.0.123", "6.6.0.166", "6.4.0.208" + ], + "ios-versions": [ + "13.20.2.2", "13.18.2.1", "13.16.0.13", "13.14.1.39", "13.10.0.21", "13.8.3.0", "13.6.0.12", "13.4.0.2", "13.2.0.47" + ], + "mac-versions": [ + "6.20.2.2", "6.18.3.2", "6.16.0.13", "6.14.1.39", "6.10.0.21", "6.8.3.0", "6.6.0.12", "6.4.0.2", "6.2.0.47" + ], + "android-versions": [ + "11.0.2.0", "10.3.1.4", "10.2.0.100", "10.1.3.7", "10.0.6.2" + ], + "bundle-default": "latest", + "bundles": [ + { + "symlink": "6_12_0", + "mono":"6.12", + "ios": "13.20", + "mac": "6.20", + "android": "11.0" + }, + { + "symlink": "6_10_0", + "mono":"6.10", + "ios": "13.18", + "mac": "6.18", + "android": "10.3" + }, + { + "symlink": "6_8_1", + "mono":"6.8", + "ios": "13.16", + "mac": "6.16", + "android": "10.2" + }, + { + "symlink": "6_8_0", + "mono": "6.8", + "ios": "13.14", + "mac": "6.14", + "android": "10.2" + }, + { + "symlink": "6_6_1", + "mono": "6.6", + "ios": "13.10", + "mac": "6.10", + "android": "10.1" + }, + { + "symlink": "6_6_0", + "mono": "6.6", + "ios": "13.8", + "mac": "6.8", + "android": "10.1" + }, + { + "symlink": "6_4_2", + "mono": "6.4", + "ios": "13.6", + "mac": "6.6", + "android": "10.0" + }, + { + "symlink": "6_4_1", + "mono": "6.4", + "ios": "13.4", + "mac": "6.4", + "android": "10.0" + }, + { + "symlink": "6_4_0", + "mono": "6.4", + "ios": "13.2", + "mac": "6.2", + "android": "10.0" + } + ] + }, + "java": { + "default": "8", + "versions": [ + "7", "8", "11", "12", "13", "14" + ] + }, + "android": { + "platform-list": [ + "android-30", "android-29", "android-28", "android-27", "android-26", "android-25", "android-24" + ], + "build-tools": [ + "30.0.2", "30.0.1", "30.0.0", "29.0.3", "29.0.2", "29.0.1", "29.0.0", "28.0.3", "28.0.2", "28.0.1", "28.0.0", "27.0.3", "27.0.2", "27.0.1", "27.0.0", "26.0.3", "26.0.2", "26.0.1", "26.0.0", "25.0.3", "25.0.2", "25.0.1", "25.0.0", "24.0.3", "24.0.2", "24.0.1", "24.0.0" + ], + "extra-list": [ + "android;m2repository", "google;m2repository", "google;google_play_services", "intel;Hardware_Accelerated_Execution_Manager", "m2repository;com;android;support;constraint;constraint-layout-solver;1.0.0-beta1", "m2repository;com;android;support;constraint;constraint-layout-solver;1.0.0-beta2", "m2repository;com;android;support;constraint;constraint-layout-solver;1.0.0-beta3", "m2repository;com;android;support;constraint;constraint-layout-solver;1.0.0-beta4", "m2repository;com;android;support;constraint;constraint-layout-solver;1.0.0-beta5", "m2repository;com;android;support;constraint;constraint-layout-solver;1.0.0", "m2repository;com;android;support;constraint;constraint-layout-solver;1.0.1", "m2repository;com;android;support;constraint;constraint-layout-solver;1.0.2", "m2repository;com;android;support;constraint;constraint-layout;1.0.0-beta1", "m2repository;com;android;support;constraint;constraint-layout;1.0.0-beta2", "m2repository;com;android;support;constraint;constraint-layout;1.0.0-beta3", "m2repository;com;android;support;constraint;constraint-layout;1.0.0-beta4", "m2repository;com;android;support;constraint;constraint-layout;1.0.0-beta5", "m2repository;com;android;support;constraint;constraint-layout;1.0.0", "m2repository;com;android;support;constraint;constraint-layout;1.0.1", "m2repository;com;android;support;constraint;constraint-layout;1.0.2" + ], + "addon-list": [ + "addon-google_apis-google-24", "addon-google_apis-google-23", "addon-google_apis-google-22", "addon-google_apis-google-21" + ] + }, + "powershellModules": [ + {"name": "Az"}, + {"name": "MarkdownPS"}, + {"name": "Pester"} + ], + "toolcache": [ + { + "name": "Python", + "url" : "https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json", + "arch": "x64", + "platform" : "darwin", + "versions": [ + "2.7.*", + "3.5.*", + "3.6.*", + "3.7.*", + "3.8.*" + ] + }, + { + "name": "PyPy", + "arch": "x64", + "platform" : "darwin", + "versions": [ + "2.7", + "3.6" + ] + }, + { + "name": "Node", + "url" : "https://raw.githubusercontent.com/actions/node-versions/main/versions-manifest.json", + "platform" : "darwin", + "arch": "x64", + "versions": [ + "8.*", + "10.*", + "12.*", + "14.*" + ] + }, + { + "name": "Go", + "url" : "https://raw.githubusercontent.com/actions/go-versions/main/versions-manifest.json", + "arch": "x64", + "platform" : "darwin", + "versions": [ + "1.11.*", + "1.12.*", + "1.13.*", + "1.14.*", + "1.15.*" + ] + } + ] +} \ No newline at end of file diff --git a/images/macos/toolsets/toolset-11.0.json b/images/macos/toolsets/toolset-11.0.json new file mode 100644 index 000000000..5a8f8ee57 --- /dev/null +++ b/images/macos/toolsets/toolset-11.0.json @@ -0,0 +1,99 @@ +{ + "xcode": { + "default": "11.6", + "versions": [ + "12_beta", "11.6" + ] + }, + "xamarin": { + "vsmac": "8.7.1.15", + "mono-versions": [ + "6.12.0.90", "6.10.0.106" + ], + "ios-versions": [ + "13.20.2.2", "13.18.2.1" + ], + "mac-versions": [ + "6.20.2.2", "6.18.3.2" + ], + "android-versions": [ + "11.0.0.3", "10.3.1.4" + ], + "bundle-default": "latest", + "bundles": [ + { + "symlink": "6_12_0", + "mono":"6.12", + "ios": "13.20", + "mac": "6.20", + "android": "11.0" + }, + { + "symlink": "6_10_0", + "mono":"6.10", + "ios": "13.18", + "mac": "6.18", + "android": "10.3" + } + ] + }, + "java": { + "default": "8", + "versions": [ + "8", "11" + ] + }, + "android": { + "platform-list": [ + "android-30", "android-29", "android-28", "android-27" + ], + "build-tools": [ + "30.0.1", "30.0.0", "29.0.3", "29.0.2", "29.0.1", "29.0.0", "28.0.3", "28.0.2", "28.0.1", "28.0.0", "27.0.3", "27.0.2", "27.0.1", "27.0.0" + ], + "extra-list": [ + "android;m2repository", "google;m2repository", "google;google_play_services", "intel;Hardware_Accelerated_Execution_Manager" + ], + "addon-list": [] + }, + "powershellModules": [ + {"name": "Az"}, + {"name": "MarkdownPS"}, + {"name": "Pester"} + ], + "toolcache": [ + { + "name": "Python", + "url" : "https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json", + "arch": "x64", + "platform" : "darwin", + "versions": [ + "2.7.*", + "3.5.*", + "3.6.*", + "3.7.*", + "3.8.*" + ] + }, + { + "name": "Node", + "url" : "https://raw.githubusercontent.com/actions/node-versions/main/versions-manifest.json", + "platform" : "darwin", + "arch": "x64", + "versions": [ + "10.*", + "12.*", + "14.*" + ] + }, + { + "name": "Go", + "url" : "https://raw.githubusercontent.com/actions/go-versions/main/versions-manifest.json", + "arch": "x64", + "platform" : "darwin", + "versions": [ + "1.14.*", + "1.15.*" + ] + } + ] +} \ No newline at end of file From 128244b89b8532a3604a2ad227eecd05b7a54065 Mon Sep 17 00:00:00 2001 From: Leonid Lapshin Date: Thu, 10 Sep 2020 17:04:24 +0300 Subject: [PATCH 28/50] removed VS buildtools installation --- .../scripts/ImageHelpers/ImageHelpers.psm1 | 3 +- .../scripts/ImageHelpers/InstallHelpers.ps1 | 28 +++++++++ .../ImageHelpers/VisualStudioHelpers.ps1 | 57 +++---------------- images/win/scripts/Installers/Install-VS.ps1 | 25 ++++---- .../SoftwareReport.Generator.ps1 | 7 +-- .../SoftwareReport.VisualStudio.psm1 | 10 ++-- .../scripts/Tests/SSDTExtensions.Tests.ps1 | 4 +- .../win/scripts/Tests/VisualStudio.Tests.ps1 | 18 ++---- images/win/scripts/Tests/WDK.Tests.ps1 | 2 +- images/win/scripts/Tests/Wix.Tests.ps1 | 4 +- images/win/toolsets/toolset-2016.json | 3 - images/win/toolsets/toolset-2019.json | 3 - 12 files changed, 68 insertions(+), 96 deletions(-) diff --git a/images/win/scripts/ImageHelpers/ImageHelpers.psm1 b/images/win/scripts/ImageHelpers/ImageHelpers.psm1 index 07b406621..e150e1a12 100644 --- a/images/win/scripts/ImageHelpers/ImageHelpers.psm1 +++ b/images/win/scripts/ImageHelpers/ImageHelpers.psm1 @@ -35,7 +35,8 @@ Export-ModuleMember -Function @( 'Get-EnvironmentVariable' 'Invoke-PesterTests' 'Get-VsCatalogJsonPath' + 'Get-VisualStudioPath' 'Install-AndroidSDKPackages' - 'Get-VisualStudioProduct' + 'Get-VisualStudioPackages' 'Get-VisualStudioComponents' ) diff --git a/images/win/scripts/ImageHelpers/InstallHelpers.ps1 b/images/win/scripts/ImageHelpers/InstallHelpers.ps1 index 9f1a32f6a..282c03762 100644 --- a/images/win/scripts/ImageHelpers/InstallHelpers.ps1 +++ b/images/win/scripts/ImageHelpers/InstallHelpers.ps1 @@ -258,6 +258,34 @@ function Install-VsixExtension } } +function Get-VSExtensionVersion +{ + Param + ( + [Parameter(Mandatory=$true)] + [string] $packageName + ) + + $instanceFolders = Get-ChildItem -Path "C:\ProgramData\Microsoft\VisualStudio\Packages\_Instances" + if ($instanceFolders -is [array]) + { + Write-Host "More than one instance installed" + exit 1 + } + + $stateContent = Get-Content -Path (Join-Path $instanceFolders.FullName '\state.packages.json') + $state = $stateContent | ConvertFrom-Json + $packageVersion = ($state.packages | Where-Object { $_.id -eq $packageName }).version + + if (-not $packageVersion) + { + Write-Host "installed package $packageName for Visual Studio 2019 was not found" + exit 1 + } + + return $packageVersion +} + function Get-ToolcachePackages { $toolcachePath = Join-Path $env:ROOT_FOLDER "toolcache.json" diff --git a/images/win/scripts/ImageHelpers/VisualStudioHelpers.ps1 b/images/win/scripts/ImageHelpers/VisualStudioHelpers.ps1 index d9478390f..0fd6bc8b6 100644 --- a/images/win/scripts/ImageHelpers/VisualStudioHelpers.ps1 +++ b/images/win/scripts/ImageHelpers/VisualStudioHelpers.ps1 @@ -60,60 +60,21 @@ Function Install-VisualStudio } } -function Get-VisualStudioInstancePath { - return "C:\ProgramData\Microsoft\VisualStudio\Packages\_Instances\" + (Get-VisualStudioProduct -ProductType "VisualStudio").InstanceId -} - function Get-VsCatalogJsonPath { - return Join-Path (Get-VisualStudioInstancePath) "catalog.json" + $instanceFolder = Get-Item "C:\ProgramData\Microsoft\VisualStudio\Packages\_Instances\*" | Select-Object -First 1 + return Join-Path $instanceFolder.FullName "catalog.json" } -function Get-VisualStudioProduct { - Param - ( - [Parameter(Mandatory)] - [ValidateSet('VisualStudio','BuildTools')] - [String] $ProductType - ) +function Get-VisualStudioPath { + return (Get-VSSetupInstance | Select-VSSetupInstance -Product *).InstallationPath +} - if ($ProductType -eq "VisualStudio") - { - $VSSelectionType = "*Enterprise*" - } - elseif ($ProductType -eq "BuildTools") - { - $VSSelectionType = "*Build*" - } - return Get-VSSetupInstance | Where-Object -Property DisplayName -like $VSSelectionType +function Get-VisualStudioPackages { + return (Get-VSSetupInstance | Select-VSSetupInstance -Product *).Packages } function Get-VisualStudioComponents { - Param - ( - [Parameter(Mandatory)] - [String] $ProductType - ) - (Get-VisualStudioProduct -ProductType $ProductType).Packages | Where-Object type -in 'Component', 'Workload' | + Get-VisualStudioPackages | Where-Object type -in 'Component', 'Workload' | Sort-Object Id, Version | Select-Object @{n = 'Package'; e = {$_.Id}}, Version | Where-Object { $_.Package -notmatch "[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}" } -} - -function Get-VSExtensionVersion -{ - Param - ( - [Parameter(Mandatory=$true)] - [string] $PackageName - ) - - $state = Get-Content -Path (Join-Path (Get-VisualStudioInstancePath) '\state.packages.json') | ConvertFrom-Json - $packageVersion = ($state.packages | Where-Object { $_.id -eq $PackageName }).version - - if (-not $packageVersion) - { - Write-Host "installed package $PackageName for Visual Studio 2019 was not found" - exit 1 - } - - return $packageVersion -} +} \ No newline at end of file diff --git a/images/win/scripts/Installers/Install-VS.ps1 b/images/win/scripts/Installers/Install-VS.ps1 index be776dded..ed4fca73f 100644 --- a/images/win/scripts/Installers/Install-VS.ps1 +++ b/images/win/scripts/Installers/Install-VS.ps1 @@ -1,35 +1,38 @@ ################################################################################ ## File: Install-VS.ps1 -## Desc: Install Visual Studio and build tools +## Desc: Install Visual Studio ################################################################################ $ErrorActionPreference = "Stop" $toolset = Get-ToolsetContent $requiredComponents = $toolset.visualStudio.workloads | ForEach-Object { "--add $_" } -$buildToolsRequiredComponents = $toolset.visualStudio.buildtools_workloads | ForEach-Object { "--add $_" } $workLoads = @( "--allWorkloads --includeRecommended" $requiredComponents "--remove Component.CPython3.x64" ) $workLoadsArgument = [String]::Join(" ", $workLoads) -$buildToolsWorkloads= @( - "--includeRecommended" - $buildToolsRequiredComponents -) -$buildWorkLoadsArgument = [String]::Join(" ", $buildToolsWorkloads) $releaseInPath = $toolset.visualStudio.edition $subVersion = $toolset.visualStudio.subversion $bootstrapperUrl = "https://aka.ms/vs/${subVersion}/release/vs_${releaseInPath}.exe" -$buildbootstrapperUrl = "https://aka.ms/vs/${subVersion}/release/vs_buildtools.exe" -# Install VS and VS Build tools +# Install VS Install-VisualStudio -BootstrapperUrl $bootstrapperUrl -WorkLoads $workLoadsArgument -Install-VisualStudio -BootstrapperUrl $buildbootstrapperUrl -WorkLoads $buildWorkLoadsArgument -$vsInstallRoot = (Get-VisualStudioProduct -ProductType "VisualStudio").InstallationPath +# Find the version of VS installed for this instance +# Only supports a single instance +$vsProgramData = Get-Item -Path "C:\ProgramData\Microsoft\VisualStudio\Packages\_Instances" +$instanceFolders = Get-ChildItem -Path $vsProgramData.FullName + +if ($instanceFolders -is [array]) +{ + Write-Host "More than one instance installed" + exit 1 +} + +$vsInstallRoot = Get-VisualStudioPath # Initialize Visual Studio Experimental Instance & "$vsInstallRoot\Common7\IDE\devenv.exe" /RootSuffix Exp /ResetSettings General.vssettings /Command File.Exit diff --git a/images/win/scripts/SoftwareReport/SoftwareReport.Generator.ps1 b/images/win/scripts/SoftwareReport/SoftwareReport.Generator.ps1 index 5ff886c77..eb8b35f0d 100644 --- a/images/win/scripts/SoftwareReport/SoftwareReport.Generator.ps1 +++ b/images/win/scripts/SoftwareReport/SoftwareReport.Generator.ps1 @@ -171,12 +171,7 @@ $markdown += New-MDNewLine $markdown += New-MDHeader "Workloads, components and extensions:" -Level 4 $markdown += New-MDNewLine -$markdown += ((Get-VisualStudioComponents -ProductType "VisualStudio") + (Get-VisualStudioExtensions)) | New-MDTable -$markdown += New-MDNewLine - -$markdown += New-MDHeader "Build Tools Workloads:" -Level 4 -$markdown += New-MDNewLine -$markdown += (Get-VisualStudioComponents -ProductType "BuildTools") | New-MDTable +$markdown += ((Get-VisualStudioComponents) + (Get-VisualStudioExtensions)) | New-MDTable $markdown += New-MDNewLine $markdown += New-MDHeader "Microsoft Visual C++:" -Level 4 diff --git a/images/win/scripts/SoftwareReport/SoftwareReport.VisualStudio.psm1 b/images/win/scripts/SoftwareReport/SoftwareReport.VisualStudio.psm1 index 9427ccc3b..0004c168b 100644 --- a/images/win/scripts/SoftwareReport/SoftwareReport.VisualStudio.psm1 +++ b/images/win/scripts/SoftwareReport/SoftwareReport.VisualStudio.psm1 @@ -23,18 +23,18 @@ function Get-VisualStudioExtensions { # Wix $vs = (Get-VisualStudioVersion).Name.Split()[-1] $wixPackageVersion = Get-WixVersion - $wixExtensionVersion = ((Get-VisualStudioProduct -ProductType "VisualStudio").Packages | Where-Object {$_.Id -match 'WixToolset.VisualStudioExtension.Dev' -and $_.type -eq 'vsix'}).Version + $wixExtensionVersion = (Get-VisualStudioPackages | Where-Object {$_.Id -match 'WixToolset.VisualStudioExtension.Dev' -and $_.type -eq 'vsix'}).Version # WDK - $wdkPackageVersion = Get-VSExtensionVersion -PackageName 'Microsoft.Windows.DriverKit' + $wdkPackageVersion = Get-VSExtensionVersion -packageName 'Microsoft.Windows.DriverKit' $wdkExtensionVersion = Get-WDKVersion # SSDT - $analysisPackageVersion = Get-VSExtensionVersion -PackageName '04a86fc2-dbd5-4222-848e-911638e487fe' - $reportingPackageVersion = Get-VSExtensionVersion -PackageName '717ad572-c4b7-435c-c166-c2969777f718' + $analysisPackageVersion = Get-VSExtensionVersion -packageName '04a86fc2-dbd5-4222-848e-911638e487fe' + $reportingPackageVersion = Get-VSExtensionVersion -packageName '717ad572-c4b7-435c-c166-c2969777f718' $integrationPackageName = ($vs -match "2019") ? '851E7A09-7B2B-4F06-A15D-BABFCB26B970' : 'D1B09713-C12E-43CC-9EF4-6562298285AB' - $integrationPackageVersion = Get-VSExtensionVersion -PackageName $integrationPackageName + $integrationPackageVersion = Get-VSExtensionVersion -packageName $integrationPackageName $extensions = @( @{Package = 'SSDT Microsoft Analysis Services Projects'; Version = $analysisPackageVersion} diff --git a/images/win/scripts/Tests/SSDTExtensions.Tests.ps1 b/images/win/scripts/Tests/SSDTExtensions.Tests.ps1 index 5b6031de5..7d1c6ee0b 100644 --- a/images/win/scripts/Tests/SSDTExtensions.Tests.ps1 +++ b/images/win/scripts/Tests/SSDTExtensions.Tests.ps1 @@ -9,12 +9,12 @@ Describe "SSDTExtensions" { ) It "Extensions id=" -TestCases $testExtenions { - $version = Get-VSExtensionVersion -PackageName "${id}" + $version = Get-VSExtensionVersion -packageName "${id}" $version | Should -Not -BeNullOrEmpty } } else { It "Extension SSDT" { - $version = Get-VSExtensionVersion -PackageName "SSDT" + $version = Get-VSExtensionVersion -packageName "SSDT" $version | Should -Not -BeNullOrEmpty } } diff --git a/images/win/scripts/Tests/VisualStudio.Tests.ps1 b/images/win/scripts/Tests/VisualStudio.Tests.ps1 index 56869cc91..142a9917e 100644 --- a/images/win/scripts/Tests/VisualStudio.Tests.ps1 +++ b/images/win/scripts/Tests/VisualStudio.Tests.ps1 @@ -5,27 +5,17 @@ Describe "Visual Studio" { } It "Devenv.exe" { - $vsInstallRoot = (Get-VisualStudioProduct -ProductType "VisualStudio").InstallationPath + $vsInstallRoot = Get-VisualStudioPath $devenvexePath = "${vsInstallRoot}\Common7\IDE\devenv.exe" $devenvexePath | Should -Exist } } Context "Visual Studio components" { - $testCases = (Get-ToolsetContent).visualStudio.workloads | ForEach-Object { @{ComponentName = $_} } + $expectedComponents = Get-ToolsetContent | Select-Object -ExpandProperty visualStudio | Select-Object -ExpandProperty workloads + $testCases = $expectedComponents | ForEach-Object { @{ComponentName = $_} } BeforeAll { - $installedComponents = Get-VisualStudioComponents -ProductType "VisualStudio" | Select-Object -ExpandProperty Package - } - - It "" -TestCases $testCases { - $installedComponents | Should -Contain $ComponentName - } - } - - Context "Visual Studio Build Tools components" { - $testCases = (Get-ToolsetContent).visualStudio.buildtools_workloads | ForEach-Object { @{ComponentName = $_} } - BeforeAll { - $installedComponents = Get-VisualStudioComponents -ProductType "BuildTools" | Select-Object -ExpandProperty Package + $installedComponents = Get-VisualStudioComponents | Select-Object -ExpandProperty Package } It "" -TestCases $testCases { diff --git a/images/win/scripts/Tests/WDK.Tests.ps1 b/images/win/scripts/Tests/WDK.Tests.ps1 index 0f8e76770..c67586e79 100644 --- a/images/win/scripts/Tests/WDK.Tests.ps1 +++ b/images/win/scripts/Tests/WDK.Tests.ps1 @@ -5,7 +5,7 @@ Describe "WDK" { } It "WDK version from system" { - $version = Get-VSExtensionVersion -PackageName "Microsoft.Windows.DriverKit" + $version = Get-VSExtensionVersion -packageName "Microsoft.Windows.DriverKit" $version | Should -Not -BeNullOrEmpty } } diff --git a/images/win/scripts/Tests/Wix.Tests.ps1 b/images/win/scripts/Tests/Wix.Tests.ps1 index bd22bef36..2a12261e2 100644 --- a/images/win/scripts/Tests/Wix.Tests.ps1 +++ b/images/win/scripts/Tests/Wix.Tests.ps1 @@ -12,11 +12,11 @@ Describe "Wix" { It "Wix Toolset version from system" { if (Test-IsWin19) { - $exVersion = Get-VSExtensionVersion -PackageName "WixToolset.VisualStudioExtension.Dev16" + $exVersion = Get-VSExtensionVersion -packageName "WixToolset.VisualStudioExtension.Dev16" } else { - $exVersion = Get-VSExtensionVersion -PackageName "WixToolset.VisualStudioExtension.Dev15" + $exVersion = Get-VSExtensionVersion -packageName "WixToolset.VisualStudioExtension.Dev15" } $exVersion | Should -Not -BeNullOrEmpty } diff --git a/images/win/toolsets/toolset-2016.json b/images/win/toolsets/toolset-2016.json index c292c7af9..a76246e60 100644 --- a/images/win/toolsets/toolset-2016.json +++ b/images/win/toolsets/toolset-2016.json @@ -227,9 +227,6 @@ "Microsoft.VisualStudio.Component.VC.Runtimes.ARM64.Spectre", "Microsoft.VisualStudio.Component.Workflow", "Microsoft.VisualStudio.Workload.Office" - ], - "buildtools_workloads": [ - "Microsoft.VisualStudio.Workload.WebBuildTools" ] } } diff --git a/images/win/toolsets/toolset-2019.json b/images/win/toolsets/toolset-2019.json index db7919f9a..a2a7ec4a5 100644 --- a/images/win/toolsets/toolset-2019.json +++ b/images/win/toolsets/toolset-2019.json @@ -259,9 +259,6 @@ "Microsoft.VisualStudio.Workload.VisualStudioExtension", "Component.MDD.Linux", "Component.MDD.Linux.GCC.arm" - ], - "buildtools_workloads": [ - "Microsoft.VisualStudio.Workload.WebBuildTools" ] } } From a963caf625d56a4ec140aad03de2b46f3bb2ae4a Mon Sep 17 00:00:00 2001 From: Leonid Lapshin Date: Fri, 11 Sep 2020 08:58:54 +0300 Subject: [PATCH 29/50] cobertura jars link changed --- images/win/scripts/Installers/Install-JavaTools.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/images/win/scripts/Installers/Install-JavaTools.ps1 b/images/win/scripts/Installers/Install-JavaTools.ps1 index 759d132fc..04a56a914 100644 --- a/images/win/scripts/Installers/Install-JavaTools.ps1 +++ b/images/win/scripts/Installers/Install-JavaTools.ps1 @@ -119,7 +119,7 @@ setx M2_REPO $m2_repo /M setx MAVEN_OPTS $maven_opts /M # Download cobertura jars -$uri = 'https://ayera.dl.sourceforge.net/project/cobertura/cobertura/2.1.1/cobertura-2.1.1-bin.zip' +$uri = 'https://downloads.sourceforge.net/project/cobertura/cobertura/2.1.1/cobertura-2.1.1-bin.zip' $coberturaPath = "C:\cobertura-2.1.1" $archivePath = Start-DownloadWithRetry -Url $uri -Name "cobertura.zip" From 3ea5c7d183c9d100fbb6e920142659829b151869 Mon Sep 17 00:00:00 2001 From: Aleksandr Chebotov Date: Fri, 11 Sep 2020 14:59:17 +0300 Subject: [PATCH 30/50] Add markdown file's generation to Ubuntu images --- .../SoftwareReport.Android.psm1 | 147 +++++++++ .../SoftwareReport.Browsers.psm1 | 19 ++ .../SoftwareReport.CachedTools.psm1 | 65 ++++ .../SoftwareReport/SoftwareReport.Common.psm1 | 296 ++++++++++++++++++ .../SoftwareReport.Databases.psm1 | 19 ++ .../SoftwareReport.Generator.ps1 | 221 +++++++++++++ .../SoftwareReport.Helpers.psm1 | 52 +++ .../SoftwareReport/SoftwareReport.Java.psm1 | 30 ++ .../SoftwareReport/SoftwareReport.Tools.psm1 | 249 +++++++++++++++ images/linux/ubuntu1604.json | 17 +- images/linux/ubuntu1804.json | 17 +- images/linux/ubuntu2004.json | 17 +- 12 files changed, 1146 insertions(+), 3 deletions(-) create mode 100644 images/linux/scripts/SoftwareReport/SoftwareReport.Android.psm1 create mode 100644 images/linux/scripts/SoftwareReport/SoftwareReport.Browsers.psm1 create mode 100644 images/linux/scripts/SoftwareReport/SoftwareReport.CachedTools.psm1 create mode 100644 images/linux/scripts/SoftwareReport/SoftwareReport.Common.psm1 create mode 100644 images/linux/scripts/SoftwareReport/SoftwareReport.Databases.psm1 create mode 100644 images/linux/scripts/SoftwareReport/SoftwareReport.Generator.ps1 create mode 100644 images/linux/scripts/SoftwareReport/SoftwareReport.Helpers.psm1 create mode 100644 images/linux/scripts/SoftwareReport/SoftwareReport.Java.psm1 create mode 100644 images/linux/scripts/SoftwareReport/SoftwareReport.Tools.psm1 diff --git a/images/linux/scripts/SoftwareReport/SoftwareReport.Android.psm1 b/images/linux/scripts/SoftwareReport/SoftwareReport.Android.psm1 new file mode 100644 index 000000000..7f34143a9 --- /dev/null +++ b/images/linux/scripts/SoftwareReport/SoftwareReport.Android.psm1 @@ -0,0 +1,147 @@ +function Split-TableRowByColumns { + param( + [string] $Row + ) + return $Row.Split("|") | ForEach-Object { $_.trim() } +} + +function Get-AndroidSDKRoot { + return "/usr/local/lib/android/sdk" +} + +function Get-AndroidSDKManagerPath { + $androidSDKDir = Get-AndroidSDKRoot + return Join-Path $androidSDKDir "tools" "bin" "sdkmanager" +} + +function Get-AndroidInstalledPackages { + $androidSDKManagerPath = Get-AndroidSDKManagerPath + $androidSDKManagerList = Invoke-Expression "$androidSDKManagerPath --list --include_obsolete" + $androidInstalledPackages = @() + foreach($packageInfo in $androidSDKManagerList) { + if($packageInfo -Match "Available Packages:") { + break + } + + $androidInstalledPackages += $packageInfo + } + return $androidInstalledPackages +} + + +function Build-AndroidTable { + $packageInfo = Get-AndroidInstalledPackages + return @( + @{ + "Package" = "Android SDK Platform-Tools" + "Version" = Get-AndroidPackageVersions -PackageInfo $packageInfo -MatchedString "Android SDK Platform-Tools" + }, + @{ + "Package" = "Android SDK Tools" + "Version" = Get-AndroidPackageVersions -PackageInfo $packageInfo -MatchedString "Android SDK Tools" + }, + @{ + "Package" = "Android SDK Platforms" + "Version" = Get-AndroidPlatformVersions -PackageInfo $packageInfo + }, + @{ + "Package" = "Android SDK Build-tools" + "Version" = Get-AndroidBuildToolVersions -PackageInfo $packageInfo + }, + @{ + "Package" = "Google APIs" + "Version" = Get-AndroidGoogleAPIsVersions -PackageInfo $packageInfo + }, + @{ + "Package" = "Android Support Repository" + "Version" = Get-AndroidPackageVersions -PackageInfo $packageInfo -MatchedString "Android Support Repository" + }, + @{ + "Package" = "Google Play services" + "Version" = Get-AndroidPackageVersions -PackageInfo $packageInfo -MatchedString "Google Play services" + }, + @{ + "Package" = "Google Repository" + "Version" = Get-AndroidPackageVersions -PackageInfo $packageInfo -MatchedString "Google Repository" + }, + @{ + "Package" = "SDK Patch Applier v4" + "Version" = Get-AndroidPackageVersions -PackageInfo $packageInfo -MatchedString "SDK Patch Applier v4" + }, + @{ + "Package" = "CMake" + "Version" = Get-AndroidPackageVersions -PackageInfo $packageInfo -MatchedString "cmake" + }, + @{ + "Package" = "NDK" + "Version" = Get-AndroidPackageVersions -PackageInfo $packageInfo -MatchedString "ndk-bundle" + } + ) | Where-Object { $_.Version } | ForEach-Object { + [PSCustomObject] @{ + "Package Name" = $_.Package + "Version" = $_.Version + } + } +} + +function Get-AndroidPackageVersions { + param ( + [Parameter(Mandatory)] + [object] $PackageInfo, + [Parameter(Mandatory)] + [object] $MatchedString + ) + + $versions = $packageInfo | Where-Object { $_ -Match $MatchedString } | ForEach-Object { + $packageInfoParts = Split-TableRowByColumns $_ + return $packageInfoParts[1] + } + return ($versions -Join "
") +} + +function Get-AndroidPlatformVersions { + param ( + [Parameter(Mandatory)] + [object] $PackageInfo + ) + + $versions = $packageInfo | Where-Object { $_ -Match "Android SDK Platform " } | ForEach-Object { + $packageInfoParts = Split-TableRowByColumns $_ + $revision = $packageInfoParts[1] + $version = $packageInfoParts[0].split(";")[1] + return "$version, (rev $revision)" + } + [array]::Reverse($versions) + return ($versions -Join "
") +} + +function Get-AndroidBuildToolVersions { + param ( + [Parameter(Mandatory)] + [object] $PackageInfo + ) + + $versions = $packageInfo | Where-Object { $_ -Match "Android SDK Build-Tools" } | ForEach-Object { + $packageInfoParts = Split-TableRowByColumns $_ + return $packageInfoParts[1] + } + $groupVersions = @() + $versions | ForEach-Object { + $majorVersion = $_.Split(".")[0] + $groupVersions += $versions | Where-Object { $_.StartsWith($majorVersion) } | Join-String -Separator " " + } + return ($groupVersions | Sort-Object -Descending -Unique | Join-String -Separator "
") +} + +function Get-AndroidGoogleAPIsVersions { + param ( + [Parameter(Mandatory)] + [object] $PackageInfo + ) + + $versions = $packageInfo | Where-Object { $_ -Match "Google APIs" } | ForEach-Object { + $packageInfoParts = Split-TableRowByColumns $_ + return $packageInfoParts[0].split(";")[1] + } + return ($versions -Join "
") +} \ No newline at end of file diff --git a/images/linux/scripts/SoftwareReport/SoftwareReport.Browsers.psm1 b/images/linux/scripts/SoftwareReport/SoftwareReport.Browsers.psm1 new file mode 100644 index 000000000..96d05ee08 --- /dev/null +++ b/images/linux/scripts/SoftwareReport/SoftwareReport.Browsers.psm1 @@ -0,0 +1,19 @@ +function Get-ChromeVersion { + $googleChromeVersion = google-chrome --version | Take-Part -Part 2 + return "Google Chrome $googleChromeVersion" +} + +function Get-ChromeDriverVersion { + $chromeDriverVersion = chromedriver --version | Take-Part -Part 1 + return "ChromeDriver $chromeDriverVersion" +} + +function Get-FirefoxVersion { + $firefoxVersion = firefox --version + return $firefoxVersion +} + +function Get-GeckodriverVersion { + $geckodriverVersion = geckodriver --version | Select-Object -First 1 | Take-Part -Part 1 + return "Geckodriver $geckodriverVersion" +} \ No newline at end of file diff --git a/images/linux/scripts/SoftwareReport/SoftwareReport.CachedTools.psm1 b/images/linux/scripts/SoftwareReport/SoftwareReport.CachedTools.psm1 new file mode 100644 index 000000000..536b31255 --- /dev/null +++ b/images/linux/scripts/SoftwareReport/SoftwareReport.CachedTools.psm1 @@ -0,0 +1,65 @@ +function Get-ToolcacheRubyVersions { + $toolcachePath = Join-Path $env:AGENT_TOOLSDIRECTORY "Ruby" + return Get-ChildItem $toolcachePath -Name | Sort-Object { [Version]$_ } +} + +function Get-ToolcachePythonVersions { + $toolcachePath = Join-Path $env:AGENT_TOOLSDIRECTORY "Python" + return Get-ChildItem $toolcachePath -Name | Sort-Object { [Version]$_ } +} + +function Get-ToolcachePyPyVersions { + $toolcachePath = Join-Path $env:AGENT_TOOLSDIRECTORY "PyPy" + Get-ChildItem -Path $toolcachePath -Name | Sort-Object { [Version] $_ } | ForEach-Object { + $pypyRootPath = Join-Path $toolcachePath $_ "x64" + [string]$pypyVersionOutput = & "$pypyRootPath/bin/python" -c "import sys;print(sys.version)" + $pypyVersionOutput -match "^([\d\.]+) \(.+\) \[PyPy ([\d\.]+) .+]$" | Out-Null + return "{0} [PyPy {1}]" -f $Matches[1], $Matches[2] + } +} + +function Get-ToolcacheNodeVersions { + $toolcachePath = Join-Path $env:AGENT_TOOLSDIRECTORY "node" + return Get-ChildItem $toolcachePath -Name | Sort-Object { [Version]$_ } +} + +function Get-ToolcacheGoVersions { + $toolcachePath = Join-Path $env:AGENT_TOOLSDIRECTORY "go" + return Get-ChildItem $toolcachePath -Name | Sort-Object { [Version]$_ } +} + +function Get-ToolcacheBoostVersions { + $toolcachePath = Join-Path $env:AGENT_TOOLSDIRECTORY "boost" + if (-not (Test-Path $toolcachePath)) { + return @() + } + return Get-ChildItem $toolcachePath -Name | Sort-Object { [Version]$_ } +} + +function Build-CachedToolsSection { + $output = "" + + $output += New-MDHeader "Ruby" -Level 4 + $output += New-MDList -Lines (Get-ToolcacheRubyVersions) -Style Unordered + + $output += New-MDHeader "Python" -Level 4 + $output += New-MDList -Lines (Get-ToolcachePythonVersions) -Style Unordered + + $output += New-MDHeader "PyPy" -Level 4 + $output += New-MDList -Lines (Get-ToolcachePyPyVersions) -Style Unordered + + $output += New-MDHeader "Node.js" -Level 4 + $output += New-MDList -Lines (Get-ToolcacheNodeVersions) -Style Unordered + + $output += New-MDHeader "Go" -Level 4 + $output += New-MDList -Lines (Get-ToolcacheGoVersions) -Style Unordered + + $boostVersions = Get-ToolcacheBoostVersions + if ($boostVersions.Count -gt 0) { + $output += New-MDHeader "Boost" -Level 4 + $output += New-MDList -Lines $boostVersions -Style Unordered + } + + + return $output +} \ No newline at end of file diff --git a/images/linux/scripts/SoftwareReport/SoftwareReport.Common.psm1 b/images/linux/scripts/SoftwareReport/SoftwareReport.Common.psm1 new file mode 100644 index 000000000..1d96f5550 --- /dev/null +++ b/images/linux/scripts/SoftwareReport/SoftwareReport.Common.psm1 @@ -0,0 +1,296 @@ +Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Helpers.psm1") -DisableNameChecking + +function Get-OSName { + lsb_release -ds +} + +function Get-CPPVersions { + $cppVersions = & apt list --installed | Where-Object { $_ -match "g\+\+-\d+"} | ForEach-Object { + $_ -match "now (?\d+\.\d+\.\d+)-" | Out-Null + $Matches.version + } + return "GNU C++ " + ($cppVersions -Join ", ") +} + +function Get-FortranVersions { + $fortranVersions = & apt list --installed | Where-Object { $_ -match "^gfortran-\d+"} | ForEach-Object { + $_ -match "now (?\d+\.\d+\.\d+)-" | Out-Null + $Matches.version + } + return "GNU Fortran " + ($fortranVersions -Join ", ") +} + +function Get-ClangVersions { + $clangVersions = @() + $clangVersions = & apt list --installed | Where-Object { $_ -match "^clang-\d+"} | ForEach-Object { + $clangCommand = ($_ -Split "/")[0] + Invoke-Expression "$clangCommand --version" | Where-Object { $_ -match "clang version" } | ForEach-Object { + $_ -match "clang version (?\d+\.\d+\.\d+)-" | Out-Null + $Matches.version + } + } + return "Clang " + ($clangVersions -Join ", ") +} + +function Get-ErlangVersion { + $result = Get-CommandResult "erl -version" + $result.Output -match "version (?\d+\.\d+\.\d+)" | Out-Null + $version = $Matches.version + return "Erlang $version" +} + +function Get-MonoVersion { + $monoVersion = $(mono --version) | Out-String | Take-Part -Part 4 + return "Mono $monoVersion" +} + +function Get-NodeVersion { + $nodeVersion = $(node --version).Substring(1) + return "Node $nodeVersion" +} + +function Get-PythonVersion { + $result = Get-CommandResult "python --version" + $version = $result.Output | Take-Part -Part 1 + return "Python $version" +} + +function Get-Python3Version { + $result = Get-CommandResult "python3 --version" + $version = $result.Output | Take-Part -Part 1 + return "Python3 $version" +} + +function Get-PowershellVersion { + $(pwsh --version) +} + +function Get-RubyVersion { + $rubyVersion = $(ruby --version) | Out-String | Take-Part -Part 1 + return "Ruby $rubyVersion" +} + +function Get-SwiftVersion { + $swiftVersion = $(swift --version) | Out-String | Take-Part -Part 2 + return "Swift $swiftVersion" +} + +function Get-JuliaVersion { + $juliaVersion = $(julia --version) | Out-String | Take-Part -Part 2 + return "Julia $juliaVersion" +} + +function Get-HomebrewVersion { + $result = Get-CommandResult "brew -v" + $result.Output -match "Homebrew (?\d+\.\d+\.\d+)" | Out-Null + $version = $Matches.version + return "Homebrew $version" +} + +function Get-GemVersion { + $(gem --version) -match "(?\d+\.\d+\.\d+)" | Out-Null + $gemVersion = $Matches.version + return "Gem $gemVersion" +} + +function Get-MinicondaVersion { + $condaVersion = $(conda --version) + return "Mini$condaVersion" +} + +function Get-HelmVersion { + $(helm version) -match 'Version:"v(?\d+\.\d+\.\d+)"' | Out-Null + $helmVersion = $Matches.version + return "Helm $helmVersion" +} + +function Get-NpmVersion { + $npmVersion = $(npm --version) + return "Npm $npmVersion" +} + +function Get-YarnVersion { + $yarnVersion = $(yarn --version) + return "Yarn $yarnVersion" +} + +function Get-PipVersion { + $result = Get-CommandResult "pip --version" + $result.Output -match "pip (?\d+\.\d+\.\d+)" | Out-Null + $pipVersion = $Matches.version + return "Pip $pipVersion" +} + +function Get-Pip3Version { + $result = Get-CommandResult "pip3 --version" + $result.Output -match "pip (?\d+\.\d+\.\d+)" | Out-Null + $pipVersion = $Matches.version + return "Pip3 $pipVersion" +} + +function Get-VcpkgVersion { + $result = Get-CommandResult "vcpkg version" + $result.Output -match "version (?\d+\.\d+\.\d+)" | Out-Null + $vcpkgVersion = $Matches.version + return "Vcpkg $vcpkgVersion" +} + +function Get-AntVersion { + $result = $(ant -version) | Out-String + $result -match "version (?\d+\.\d+\.\d+)" | Out-Null + $antVersion = $Matches.version + return "Ant $antVersion" +} + +function Get-GradleVersion { + $result = $(gradle -v) | Out-String + $result -match "Gradle (?\d+\.\d+\.\d+)" | Out-Null + $gradleVersion = $Matches.version + return "Gradle $gradleVersion" +} +function Get-MavenVersion { + $result = $(mvn -version) | Out-String + $result -match "Apache Maven (?\d+\.\d+\.\d+)" | Out-Null + $mavenVersion = $Matches.version + return "Maven $mavenVersion" +} +function Get-SbtVersion { + $result = $(sbt -version) | Out-String + $result -match "sbt script version: (?\d+\.\d+\.\d+)" | Out-Null + $sbtVersion = $Matches.version + return "Sbt $sbtVersion" +} + +function Get-PHPVersions { + return $(apt list --installed) | Where-Object { $_ -match "^php\d+\.\d+/"} | ForEach-Object { + $_ -match "now (?\d+\.\d+\.\d+)-" | Out-Null + $Matches.version + } +} + +function Get-ComposerVersion { + $(composer --version) -match "Composer version (?\d+\.\d+\.\d+)\s" | Out-Null + return $Matches.version +} + +function Get-PHPUnitVersion { + $(phpunit --version | Out-String) -match "PHPUnit (?\d+\.\d+\.\d+)\s" | Out-Null + return $Matches.version +} + +function Build-PHPTable { + $php = @{ + "Tool" = "PHP" + "Version" = "$(Get-PHPVersions -Join '
')" + } + $composer = @{ + "Tool" = "Composer" + "Version" = Get-ComposerVersion + } + $phpunit = @{ + "Tool" = "PHPUnit" + "Version" = Get-PHPUnitVersion + } + return @($php, $composer, $phpunit) | ForEach-Object { + [PSCustomObject] @{ + "Tool" = $_.Tool + "Version" = $_.Version + } + } +} + +function Get-GHCVersion { + $(ghc --version) -match "version (?\d+\.\d+\.\d+)" | Out-Null + $ghcVersion = $Matches.version + return "GHC $ghcVersion" +} + +function Get-CabalVersion { + $(cabal --version | Out-String) -match "cabal-install version (?\d+\.\d+\.\d+\.\d+)" | Out-Null + $cabalVersion = $Matches.version + return "Cabal $cabalVersion" +} + +function Get-StackVersion { + $(stack --version | Out-String) -match "Version (?\d+\.\d+\.\d+)" | Out-Null + $stackVersion = $Matches.version + return "Stack $stackVersion" +} + +function Get-RustVersion { + $rustVersion = $(rustc --version) | Take-Part -Part 1 + return "Rust $rustVersion" +} + +function Get-BindgenVersion { + $bindgenVersion = $(bindgen --version) | Take-Part -Part 1 + return "Bindgen $bindgenVersion" +} + +function Get-CargoVersion { + $cargoVersion = $(cargo --version) | Take-Part -Part 1 + return "Cargo $cargoVersion" +} + +function Get-CargoAuditVersion { + $cargoAuditVersion = $(cargo audit --version) | Take-Part -Part 1 + return "Cargo audit $cargoAuditVersion" +} + +function Get-CargoOutdatedVersion { + $cargoOutdatedVersion = $(cargo outdated --version) | Take-Part -Part 1 -Delimiter "v" + return "Cargo outdated $cargoOutdatedVersion" +} + +function Get-CargoClippyVersion { + $cargoClippyVersion = $(cargo-clippy --version) | Take-Part -Part 1 + return "Cargo clippy $cargoClippyVersion" +} + +function Get-CbindgenVersion { + $cbindgenVersion = $(cbindgen --version) | Take-Part -Part 1 + return "Cbindgen $cbindgenVersion" +} + +function Get-RustupVersion { + $rustupVersion = $(rustup --version) | Take-Part -Part 1 + return "Rustup $rustupVersion" +} + +function Get-RustdocVersion { + $rustdocVersion = $(rustdoc --version) | Take-Part -Part 1 + return "Rustdoc $rustdocVersion" +} + +function Get-RustfmtVersion { + $rustfmtVersion = $(rustfmt --version) | Take-Part -Part 1 | Take-Part -Part 0 -Delimiter "-" + return "Rustfmt $rustfmtVersion" +} + +function Get-AzModuleVersions { + $azModuleVersions = Get-ChildItem /usr/share | Where-Object { $_ -match "az_\d+" } | Foreach-Object { + $_.Name.Split("_")[1] + } + + $azModuleVersions = $azModuleVersions -join " " + return $azModuleVersions +} + +function Get-DotNetCoreSdkVersions { + $unsortedDotNetCoreSdkVersion = dotnet --list-sdks list | ForEach-Object { $_ | Take-Part -Part 0 } + $dotNetCoreSdkVersion = $unsortedDotNetCoreSdkVersion -join " " + return $dotNetCoreSdkVersion +} + +function Get-CachedDockerImages { + $toolsetJson = Get-ToolsetContent + $images = $toolsetJson.docker.images + return $images +} + +function Get-AptPackages { + $toolsetJson = Get-ToolsetContent + $apt = $toolsetJson.apt + $pkgs = ($apt.common_packages + $apt.cmd_packages | Sort-Object) -join ", " + return $pkgs +} \ No newline at end of file diff --git a/images/linux/scripts/SoftwareReport/SoftwareReport.Databases.psm1 b/images/linux/scripts/SoftwareReport/SoftwareReport.Databases.psm1 new file mode 100644 index 000000000..6c274184e --- /dev/null +++ b/images/linux/scripts/SoftwareReport/SoftwareReport.Databases.psm1 @@ -0,0 +1,19 @@ +function Get-PostgreSqlVersion { + $postgreSQLVersion = psql --version | Take-Part -Part 2 + return "Postgre SQL $postgreSQLVersion" +} + +function Get-MongoDbVersion { + $mongoDBVersion = mongod --version | Select-Object -First 1 | Take-Part -Part 2 -Delimiter "v" + return "MongoDB $mongoDBVersion" +} + +function Get-SqliteVersion { + $sqliteVersion = sqlite3 --version | Take-Part -Part 0 + return "sqlite3 $sqliteVersion" +} + +function Get-MySqlVersion { + $mySqlVersion = (mysql --version).Split("/usr/bin/")[1] + return "MySQL ($mySqlVersion)" +} \ No newline at end of file diff --git a/images/linux/scripts/SoftwareReport/SoftwareReport.Generator.ps1 b/images/linux/scripts/SoftwareReport/SoftwareReport.Generator.ps1 new file mode 100644 index 000000000..e63f3719a --- /dev/null +++ b/images/linux/scripts/SoftwareReport/SoftwareReport.Generator.ps1 @@ -0,0 +1,221 @@ +param ( + [Parameter(Mandatory)][string] + $OutputDirectory +) + +# Install MarkdownPS module for software report generation +Install-Module MarkdownPS -Force -Scope CurrentUser +Import-Module MarkdownPS +Import-Module (Join-Path $PSScriptRoot "SoftwareReport.CachedTools.psm1") -DisableNameChecking +Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Common.psm1") -DisableNameChecking +Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Helpers.psm1") -DisableNameChecking +Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Tools.psm1") -DisableNameChecking +Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Java.psm1") -DisableNameChecking +Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Databases.psm1") -DisableNameChecking +Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Browsers.psm1") -DisableNameChecking +Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Android.psm1") -DisableNameChecking + +$markdown = "" + +if ($env:ANNOUNCEMENTS) { + $markdown += $env:ANNOUNCEMENTS + $markdown += New-MDNewLine + $markdown += "***" + $markdown += New-MDNewLine +} + +$OSName = Get-OSName +$markdown += New-MDHeader "$OSName" -Level 1 + +$markdown += New-MDList -Style Unordered -Lines @( + "Image Version: $env:ImageVersion" +) + +$markdown += New-MDHeader "Installed Software" -Level 2 +$markdown += New-MDHeader "Language and Runtime" -Level 3 + +$markdown += New-MDList -Style Unordered -Lines @( + (Get-CPPVersions), + (Get-FortranVersions), + (Get-ClangVersions), + (Get-ErlangVersion), + (Get-MonoVersion), + (Get-NodeVersion), + (Get-PythonVersion), + (Get-Python3Version), + (Get-PowershellVersion), + (Get-RubyVersion), + (Get-SwiftVersion), + (Get-JuliaVersion) +) + +$markdown += New-MDHeader "Package Management" -Level 3 +$markdown += New-MDList -Style Unordered -Lines @( + (Get-HomebrewVersion), + (Get-GemVersion), + (Get-MinicondaVersion), + (Get-HelmVersion), + (Get-NpmVersion), + (Get-YarnVersion), + (Get-PipVersion), + (Get-Pip3Version), + (Get-VcpkgVersion) +) + +$markdown += New-MDHeader "Project Management" -Level 3 +$markdown += New-MDList -Style Unordered -Lines @( + (Get-AntVersion), + (Get-GradleVersion), + (Get-MavenVersion), + (Get-SbtVersion) +) + +$markdown += New-MDHeader "Tools" -Level 3 +$toolsList = @( + (Get-7zipVersion), + (Get-AnsibleVersion), + (Get-AzCopy7Version), + (Get-AzCopy10Version), + (Get-BazelVersion), + (Get-BazeliskVersion), + (Get-CMakeVersion), + (Get-CurlVersion), + (Get-DockerComposeVersion), + (Get-DockerMobyVersion), + (Get-DockerBuildxVersion), + (Get-GitVersion), + (Get-GitLFSVersion), + (Get-GitFTPVersion), + (Get-GoogleCloudSDKVersion), + (Get-HavegedVersion), + (Get-HerokuVersion), + (Get-HHVMVersion), + (Get-SVNVersion), + (Get-JqVersion), + (Get-KindVersion), + (Get-KubectlVersion), + (Get-KustomizeVersion), + (Get-LeiningenVersion), + (Get-M4Version), + (Get-HGVersion), + (Get-MinikubeVersion), + (Get-NewmanVersion), + (Get-NvmVersion), + (Get-PackerVersion), + (Get-PhantomJSVersion), + (Get-SwigVersion), + (Get-TerraformVersion), + (Get-UnZipVersion), + (Get-WgetVersion), + (Get-ZipVersion), + (Get-ZstdVersion) +) + +if (-not (Test-IsUbuntu16)) { + $toolsList += @( + (Get-PodManVersion), + (Get-BuildahVersion), + (Get-SkopeoVersion) + ) +} + +$markdown += New-MDList -Style Unordered -Lines ($toolsList | Sort-Object) + +$markdown += New-MDHeader "CLI Tools" -Level 3 +$markdown += New-MDList -Style Unordered -Lines @( + (Get-AlibabaCloudCliVersion), + (Get-AWSCliVersion), + (Get-AWSCliSessionManagerPluginVersion), + (Get-AWSSAMVersion), + (Get-AzureCliVersion), + (Get-AzureDevopsVersion), + (Get-GitHubCliVersion), + (Get-HubCliVersion), + (Get-NetlifyCliVersion), + (Get-OCCliVersion), + (Get-ORASCliVersion), + (Get-VerselCliversion) +) + +$markdown += New-MDHeader "Java" -Level 3 +$markdown += Get-JavaVersions | New-MDTable +$markdown += New-MDNewLine + +$markdown += New-MDHeader "PHP" -Level 3 +$markdown += Build-PHPTable | New-MDTable +$markdown += New-MDNewLine + +$markdown += New-MDHeader "Haskell" -Level 3 +$markdown += New-MDList -Style Unordered -Lines @( + (Get-GHCVersion), + (Get-CabalVersion), + (Get-StackVersion) +) + +$markdown += New-MDHeader "Rust Tools" -Level 3 +$markdown += New-MDList -Style Unordered -Lines @( + (Get-RustVersion), + (Get-RustupVersion), + (Get-RustdocVersion), + (Get-CargoVersion) +) + +$markdown += New-MDHeader "Packages" -Level 4 +$markdown += New-MDList -Style Unordered -Lines @( + (Get-BindgenVersion), + (Get-CargoAuditVersion), + (Get-CargoOutdatedVersion), + (Get-CargoClippyVersion), + (Get-CbindgenVersion), + (Get-RustfmtVersion) +) + +$markdown += New-MDHeader "Browsers and Drivers" -Level 3 +$markdown += New-MDList -Style Unordered -Lines @( + (Get-ChromeVersion), + (Get-ChromeDriverVersion), + (Get-FirefoxVersion), + (Get-GeckodriverVersion) +) + +$markdown += New-MDHeader ".NET Core SDK" -Level 3 +$markdown += New-MDList -Style Unordered -Lines @( + (Get-DotNetCoreSdkVersions) +) + +$markdown += New-MDHeader "Az Module" -Level 3 +$markdown += New-MDList -Style Unordered -Lines @( + (Get-AzModuleVersions) +) + +$markdown += New-MDHeader "Databases" -Level 3 +$markdown += New-MDList -Style Unordered -Lines @( + (Get-PostgreSqlVersion), + (Get-MongoDbVersion), + (Get-SqliteVersion) +) + +$markdown += New-MDHeader "MySQL" -Level 4 +$markdown += New-MDList -Style Unordered -Lines @( + (Get-MySqlVersion), + "MySQL Server (user:root password:root)", + "MS SQL Server Client Tools" +) +$markdown += New-MDCode -Lines @( + "MySQL service is disabled by default. Use the following command as a part of your job to start the service: 'sudo systemctl start mysql.service'" +) + +$markdown += New-MDHeader "Cached Tools" -Level 3 +$markdown += Build-CachedToolsSection + +$markdown += New-MDHeader "Android" -Level 3 +$markdown += Build-AndroidTable | New-MDTable +$markdown += New-MDNewLine + +$markdown += New-MDHeader "Cached Docker images" -Level 3 +$markdown += New-MDList -Style Unordered -Lines @(Get-CachedDockerImages) + +$markdown += New-MDHeader "Installed apt packages" -Level 3 +$markdown += New-MDList -Style Unordered -Lines @(Get-AptPackages) + +$markdown | Out-File -FilePath "${OutputDirectory}/Ubuntu-Readme.md" diff --git a/images/linux/scripts/SoftwareReport/SoftwareReport.Helpers.psm1 b/images/linux/scripts/SoftwareReport/SoftwareReport.Helpers.psm1 new file mode 100644 index 000000000..6f2701c92 --- /dev/null +++ b/images/linux/scripts/SoftwareReport/SoftwareReport.Helpers.psm1 @@ -0,0 +1,52 @@ +function Get-CommandResult { + param ( + [Parameter(Mandatory=$true)] + [string] $Command, + [switch] $Multiline + ) + # Bash trick to suppress and show error output because some commands write to stderr (for example, "python --version") + $stdout = & bash -c "$Command 2>&1" + $exitCode = $LASTEXITCODE + return @{ + Output = If ($Multiline -eq $true) { $stdout } else { [string]$stdout } + ExitCode = $exitCode + } +} + +function Take-Part { + param ( + [Parameter(ValueFromPipeline)] + [string] $toolOutput, + [string] $Delimiter = " ", + [int[]] $Part + ) + $parts = $toolOutput.Split($Delimiter, [System.StringSplitOptions]::RemoveEmptyEntries) + $selectedParts = $parts[$Part] + return [string]::Join($Delimiter, $selectedParts) +} + +function Test-IsUbuntu16 { + return (lsb_release -rs) -eq "16.04" +} + +function Test-IsUbuntu18 { + return (lsb_release -rs) -eq "18.04" +} + +function Test-IsUbuntu20 { + return (lsb_release -rs) -eq "20.04" +} + +function Get-ToolsetContent +{ + $toolset = Join-Path $env:INSTALLER_SCRIPT_FOLDER "toolset.json" + Get-Content $toolset -Raw | ConvertFrom-Json +} + +function New-MDNewLine { + param ( + [int] $Count = 1 + ) + $newLineSymbol = [System.Environment]::NewLine + return $newLineSymbol * $Count +} diff --git a/images/linux/scripts/SoftwareReport/SoftwareReport.Java.psm1 b/images/linux/scripts/SoftwareReport/SoftwareReport.Java.psm1 new file mode 100644 index 000000000..4e54661ab --- /dev/null +++ b/images/linux/scripts/SoftwareReport/SoftwareReport.Java.psm1 @@ -0,0 +1,30 @@ +function Get-JavaFullVersion { + param($JavaRootPath) + + $javaBinPath = Join-Path $javaRootPath "/bin/java" + $javaVersionOutput = (Get-CommandResult "$javaBinPath -version").Output + $matchResult = $javaVersionOutput | Select-String '^openjdk version \"([\d\._]+)\"' + return $matchResult.Matches.Groups[1].Value +} + +function Get-JavaVersions { + $defaultJavaPath = $env:JAVA_HOME + $javaVersions = Get-Item env:JAVA_HOME_*_X64 + $sortRules = @{ + Expression = { [Int32]$_.Name.Split("_")[2] } + Descending = $false + } + + return $javaVersions | Sort-Object $sortRules | ForEach-Object { + $javaPath = $_.Value + $version = Get-JavaFullVersion $javaPath + $vendor = $version.StartsWith("1.7") ? "Zulu" : "AdoptOpenJDK" + $defaultPostfix = ($javaPath -eq $defaultJavaPath) ? " (default)" : "" + + [PSCustomObject] @{ + "Version" = $version + $defaultPostfix + "Vendor" = $vendor + "Environment Variable" = $_.Name + } + } +} \ No newline at end of file diff --git a/images/linux/scripts/SoftwareReport/SoftwareReport.Tools.psm1 b/images/linux/scripts/SoftwareReport/SoftwareReport.Tools.psm1 new file mode 100644 index 000000000..f66f2e4fc --- /dev/null +++ b/images/linux/scripts/SoftwareReport/SoftwareReport.Tools.psm1 @@ -0,0 +1,249 @@ +function Get-7zipVersion { + $7zVersion = 7z i | Select-String "7-Zip" | Take-Part -Part 2 + return "7-Zip $7zVersion" +} + +function Get-AnsibleVersion { + $ansibleVersion = ansible --version | Select-Object -First 1 | Take-Part -Part 1 + return "Ansible $ansibleVersion" +} + +function Get-AzCopy7Version { + $azcopy7Version = azcopy --version | Take-Part -Part 1 | Take-Part -Part 0 -Delimiter "-" + return "AzCopy7 (available by azcopy alias) $azcopy7Version" +} + +function Get-AzCopy10Version { + $azcopy10Version = azcopy10 --version | Take-Part -Part 2 + return "AzCopy10 (available by azcopy10 alias) $azcopy10Version" +} + +function Get-BazelVersion { + $bazelVersion = bazel --version | Select-String "bazel" | Take-Part -Part 1 + return "Bazel $bazelVersion" +} + +function Get-BazeliskVersion { + $bazeliskVersion = bazelisk version 2>&1 | Select-String "Bazelisk version:" | Take-Part -Part 2 | Take-Part -Part 0 -Delimiter "v" + return "Bazelisk $bazeliskVersion" +} + +function Get-PodManVersion { + $podmanVersion = podman --version | Take-Part -Part 2 + return "Podman $podmanVersion" +} + +function Get-BuildahVersion { + $buildahVersion = buildah --version | Take-Part -Part 2 + return "Buildah $buildahVersion" +} + +function Get-SkopeoVersion { + $skopeoVersion = skopeo --version | Take-Part -Part 2 + return "Skopeo $skopeoVersion" +} + +function Get-CMakeVersion { + $cmakeVersion = cmake --version | Select-Object -First 1 | Take-Part -Part 2 + return "CMake $cmakeVersion" +} + +function Get-CurlVersion { + $curlVersion = curl --version | Select-Object -First 1 | Take-Part -Part 0,1 + return $curlVersion +} + +function Get-DockerComposeVersion { + $composeVersion = docker-compose -v | Take-Part -Part 2 | Take-Part -Part 0 -Delimiter "," + return "Docker Compose $composeVersion" +} + +function Get-DockerMobyVersion { + $dockerVersion = docker -v | Take-Part -Part 2 | Take-Part -Part 0 -Delimiter "+" + return "Docker-Moby $dockerVersion" +} + +function Get-DockerBuildxVersion { + $buildxVersion = docker buildx version | Take-Part -Part 1 | Take-Part -Part 0 -Delimiter "+" + return "Docker-Buildx $buildxVersion" +} + +function Get-GitVersion { + $gitVersion = git --version 2>&1 | Take-Part -Part 2 + return "Git $gitVersion" +} + +function Get-GitLFSVersion { + $gitlfsversion = git-lfs --version 2>&1 | Take-Part -Part 0 | Take-Part -Part 1 -Delimiter "/" + return "Git LFS $gitlfsversion" +} + +function Get-GitFTPVersion { + $gitftpVersion = git-ftp --version | Take-Part -Part 2 + return "Git-ftp $gitftpVersion" +} + +function Get-GoogleCloudSDKVersion { + return "$(gcloud --version | Select-Object -First 1)" +} + +function Get-HavegedVersion { + $havegedVersion = dpkg-query --showformat='${Version}' --show haveged | Take-Part -Part 0 -Delimiter "-" + return "Haveged $havegedVersion" +} + +function Get-HerokuVersion { + $herokuVersion = heroku version | Take-Part -Part 0 | Take-Part -Part 1 -Delimiter "/" + return "Heroku $herokuVersion" +} + +function Get-HHVMVersion { + $hhvmVersion = hhvm --version | Select-Object -First 1 | Take-Part -Part 2 + return "HHVM (HipHop VM) $hhvmVersion" +} + +function Get-SVNVersion { + $svnVersion = svn --version | Select-Object -First 1 | Take-Part -Part 2 + return "SVN $svnVersion" +} + +function Get-KustomizeVersion { + $kustomizeVersion = kustomize version --short | Take-Part -Part 0 | Take-Part -Part 1 -Delimiter "v" + return "Kustomize $kustomizeVersion" +} + +function Get-KindVersion { + $kindVersion = kind version | Take-Part -Part 1 | Take-Part -Part 0 -Delimiter "v" + return "Kind $kindVersion" +} + +function Get-KubectlVersion { + $kubectlVersion = kubectl version --client --short | Take-Part -Part 2 | Take-Part -Part 0 -Delimiter "v" + return "Kubectl $kubectlVersion" +} + +function Get-MinikubeVersion { + $minikubeVersion = minikube version --short | Take-Part -Part 2 | Take-Part -Part 0 -Delimiter "v" + return "Minikube $minikubeVersion" +} + +function Get-HGVersion { + $hgVersion = hg --version | Select-Object -First 1 | Take-Part -Part -1 | Take-Part -Part 0 -Delimiter ")" + return "Mercurial $hgVersion" +} + +function Get-M4Version { + $m4Version = m4 --version | Select-Object -First 1 | Take-Part -Part -1 + return "m4 $m4Version" +} + +function Get-LeiningenVersion { + return "$(lein -v | Take-Part -Part 0,1)" +} + +function Get-NewmanVersion { + return "Newman $(newman --version)" +} + +function Get-NvmVersion { + $nvmVersion = bash -c "source $HOME/.nvm/nvm.sh && nvm --version" + return "nvm $nvmVersion" +} + +function Get-PackerVersion { + return "Packer $(packer --version)" +} + +function Get-PhantomJSVersion { + return "PhantomJS $(phantomjs --version)" +} + +function Get-SwigVersion { + $swigVersion = swig -version | Select-String "SWIG Version" | Take-Part -Part 2 + return "Swig $swigVersion" +} + +function Get-TerraformVersion { + return (terraform version | Select-String "^Terraform").Line.Replace('v','') +} + +function Get-UnZipVersion { + $unzipVersion = unzip -v | Select-Object -First 1 | Take-Part -Part 1 + return "unzip $unzipVersion" +} + +function Get-WgetVersion { + $wgetVersion = wget --version | Select-Object -First 1 | Take-Part -Part 2 + return "wget $wgetVersion" +} + +function Get-ZipVersion { + $zipVersion = zip -v | Select-String "This is Zip" | Take-Part -Part 3 + return "zip $zipVersion" +} + +function Get-ZstdVersion { + $zstdVersion = (zstd --version).Split() -match "v\d+" | ForEach-Object {$_.Replace("v","").Replace(",","")} + return "zstd $zstdVersion" +} + +function Get-JqVersion { + $jqVersion = jq --version | Take-Part -Part 1 -Delimiter "-" + return "jq $jqVersion" +} + +function Get-AzureCliVersion { + $azcliVersion = az -v | Select-String "azure-cli" | Take-Part -Part -1 + return "Azure CLI (azure-cli) $azcliVersion" +} + +function Get-AzureDevopsVersion { + $azdevopsVersion = az -v | Select-String "azure-devops" | Take-Part -Part -1 + return "Azure CLI (azure-devops) $azdevopsVersion" +} + +function Get-AlibabaCloudCliVersion { + return "Alibaba Cloud CLI $(aliyun version)" +} + +function Get-AWSCliVersion { + $awsVersion = aws --version 2>&1 | Take-Part -Part 0 | Take-Part -Part 1 -Delimiter "/" + return "AWS CLI $awsVersion" +} + +function Get-AWSCliSessionManagerPluginVersion { + return "AWS CLI Session manager plugin $(session-manager-plugin --version 2>&1)" +} + +function Get-AWSSAMVersion { + return "AWS SAM CLI $(sam --version | Take-Part -Part -1)" +} + +function Get-HubCliVersion { + $hubVersion = hub --version | Select-String "hub version" | Take-Part -Part 2 + return "Hub CLI $hubVersion" +} + +function Get-GitHubCliVersion { + $ghVersion = gh --version | Select-String "gh version" | Take-Part -Part 2 + return "GitHub CLI $ghVersion" +} + +function Get-NetlifyCliVersion { + $netlifyVersion = netlify --version | Take-Part -Part 0 | Take-Part -Part 1 -Delimiter "/" + return "Netlify CLI $netlifyVersion" +} + +function Get-OCCliVersion { + $ocVersion = oc version | Take-Part -Part 2 | Take-Part -Part 0 -Delimiter "-" + return "oc CLI $ocVersion" +} + +function Get-ORASCliVersion { + $orasVersion = oras version | Select-String "^Version:" | Take-Part -Part 1 + return "ORAS CLI $orasVersion" +} + +function Get-VerselCliversion { + return "$(vercel --version 2>&1 | Select-Object -First 1)" +} diff --git a/images/linux/ubuntu1604.json b/images/linux/ubuntu1604.json index 9d8a11ba7..7ef3122a6 100644 --- a/images/linux/ubuntu1604.json +++ b/images/linux/ubuntu1604.json @@ -88,6 +88,11 @@ "source": "{{template_dir}}/scripts/installers", "destination": "{{user `installer_script_folder`}}" }, + { + "type": "file", + "source": "{{ template_dir }}/scripts/SoftwareReport", + "destination": "{{user `image_folder`}}" + }, { "type": "file", "source": "{{template_dir}}/toolsets/toolcache-1604.json", @@ -287,9 +292,19 @@ ], "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" }, + { + "type": "powershell", + "inline": [ + "pwsh -File '{{user `image_folder`}}/SoftwareReport/SoftwareReport.Generator.ps1' -OutputDirectory '{{user `image_folder`}}'" + ], + "environment_vars":[ + "INSTALLER_SCRIPT_FOLDER={{user `installer_script_folder`}}", + "ANNOUNCEMENTS={{user `announcements`}}" + ] + }, { "type": "file", - "source": "{{user `metadata_file`}}", + "source": "{{user `image_folder`}}/Ubuntu-Readme.md", "destination": "{{template_dir}}/Ubuntu1604-README.md", "direction": "download" }, diff --git a/images/linux/ubuntu1804.json b/images/linux/ubuntu1804.json index aacfe4eea..5f280636d 100644 --- a/images/linux/ubuntu1804.json +++ b/images/linux/ubuntu1804.json @@ -91,6 +91,11 @@ "source": "{{template_dir}}/scripts/installers", "destination": "{{user `installer_script_folder`}}" }, + { + "type": "file", + "source": "{{ template_dir }}/scripts/SoftwareReport", + "destination": "{{user `image_folder`}}" + }, { "type": "file", "source": "{{template_dir}}/toolsets/toolcache-1804.json", @@ -291,9 +296,19 @@ ], "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" }, + { + "type": "powershell", + "inline": [ + "pwsh -File '{{user `image_folder`}}/SoftwareReport/SoftwareReport.Generator.ps1' -OutputDirectory '{{user `image_folder`}}'" + ], + "environment_vars":[ + "INSTALLER_SCRIPT_FOLDER={{user `installer_script_folder`}}", + "ANNOUNCEMENTS={{user `announcements`}}" + ] + }, { "type": "file", - "source": "{{user `metadata_file`}}", + "source": "{{user `image_folder`}}/Ubuntu-Readme.md", "destination": "{{template_dir}}/Ubuntu1804-README.md", "direction": "download" }, diff --git a/images/linux/ubuntu2004.json b/images/linux/ubuntu2004.json index 17e9143d2..604b863a2 100644 --- a/images/linux/ubuntu2004.json +++ b/images/linux/ubuntu2004.json @@ -93,6 +93,11 @@ "source": "{{template_dir}}/scripts/installers", "destination": "{{user `installer_script_folder`}}" }, + { + "type": "file", + "source": "{{ template_dir }}/scripts/SoftwareReport", + "destination": "{{user `image_folder`}}" + }, { "type": "file", "source": "{{template_dir}}/toolsets/toolcache-2004.json", @@ -293,9 +298,19 @@ ], "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" }, + { + "type": "powershell", + "inline": [ + "pwsh -File '{{user `image_folder`}}/SoftwareReport/SoftwareReport.Generator.ps1' -OutputDirectory '{{user `image_folder`}}'" + ], + "environment_vars":[ + "INSTALLER_SCRIPT_FOLDER={{user `installer_script_folder`}}", + "ANNOUNCEMENTS={{user `announcements`}}" + ] + }, { "type": "file", - "source": "{{user `metadata_file`}}", + "source": "{{user `image_folder`}}/Ubuntu-Readme.md", "destination": "{{template_dir}}/Ubuntu2004-README.md", "direction": "download" }, From 370986d0f0b09213b34b42c7e51f433e734eea55 Mon Sep 17 00:00:00 2001 From: Aleksandr Chebotov Date: Mon, 14 Sep 2020 10:09:05 +0300 Subject: [PATCH 31/50] rename Take-Part -> Take-OutputPart --- .../SoftwareReport.Browsers.psm1 | 6 +- .../SoftwareReport.CachedTools.psm1 | 5 +- .../SoftwareReport/SoftwareReport.Common.psm1 | 38 ++++----- .../SoftwareReport.Databases.psm1 | 22 ++++- .../SoftwareReport.Generator.ps1 | 10 +-- .../SoftwareReport.Helpers.psm1 | 2 +- .../SoftwareReport/SoftwareReport.Tools.psm1 | 84 +++++++++---------- 7 files changed, 87 insertions(+), 80 deletions(-) diff --git a/images/linux/scripts/SoftwareReport/SoftwareReport.Browsers.psm1 b/images/linux/scripts/SoftwareReport/SoftwareReport.Browsers.psm1 index 96d05ee08..d65eb5536 100644 --- a/images/linux/scripts/SoftwareReport/SoftwareReport.Browsers.psm1 +++ b/images/linux/scripts/SoftwareReport/SoftwareReport.Browsers.psm1 @@ -1,10 +1,10 @@ function Get-ChromeVersion { - $googleChromeVersion = google-chrome --version | Take-Part -Part 2 + $googleChromeVersion = google-chrome --version | Take-OutputPart -Part 2 return "Google Chrome $googleChromeVersion" } function Get-ChromeDriverVersion { - $chromeDriverVersion = chromedriver --version | Take-Part -Part 1 + $chromeDriverVersion = chromedriver --version | Take-OutputPart -Part 1 return "ChromeDriver $chromeDriverVersion" } @@ -14,6 +14,6 @@ function Get-FirefoxVersion { } function Get-GeckodriverVersion { - $geckodriverVersion = geckodriver --version | Select-Object -First 1 | Take-Part -Part 1 + $geckodriverVersion = geckodriver --version | Select-Object -First 1 | Take-OutputPart -Part 1 return "Geckodriver $geckodriverVersion" } \ No newline at end of file diff --git a/images/linux/scripts/SoftwareReport/SoftwareReport.CachedTools.psm1 b/images/linux/scripts/SoftwareReport/SoftwareReport.CachedTools.psm1 index 536b31255..24283ba64 100644 --- a/images/linux/scripts/SoftwareReport/SoftwareReport.CachedTools.psm1 +++ b/images/linux/scripts/SoftwareReport/SoftwareReport.CachedTools.psm1 @@ -36,7 +36,7 @@ function Get-ToolcacheBoostVersions { return Get-ChildItem $toolcachePath -Name | Sort-Object { [Version]$_ } } -function Build-CachedToolsSection { +function Build-CachedToolsSection { $output = "" $output += New-MDHeader "Ruby" -Level 4 @@ -44,7 +44,7 @@ function Build-CachedToolsSection { $output += New-MDHeader "Python" -Level 4 $output += New-MDList -Lines (Get-ToolcachePythonVersions) -Style Unordered - + $output += New-MDHeader "PyPy" -Level 4 $output += New-MDList -Lines (Get-ToolcachePyPyVersions) -Style Unordered @@ -59,7 +59,6 @@ function Build-CachedToolsSection { $output += New-MDHeader "Boost" -Level 4 $output += New-MDList -Lines $boostVersions -Style Unordered } - return $output } \ No newline at end of file diff --git a/images/linux/scripts/SoftwareReport/SoftwareReport.Common.psm1 b/images/linux/scripts/SoftwareReport/SoftwareReport.Common.psm1 index 1d96f5550..5fafca0f1 100644 --- a/images/linux/scripts/SoftwareReport/SoftwareReport.Common.psm1 +++ b/images/linux/scripts/SoftwareReport/SoftwareReport.Common.psm1 @@ -40,7 +40,7 @@ function Get-ErlangVersion { } function Get-MonoVersion { - $monoVersion = $(mono --version) | Out-String | Take-Part -Part 4 + $monoVersion = $(mono --version) | Out-String | Take-OutputPart -Part 4 return "Mono $monoVersion" } @@ -51,13 +51,13 @@ function Get-NodeVersion { function Get-PythonVersion { $result = Get-CommandResult "python --version" - $version = $result.Output | Take-Part -Part 1 + $version = $result.Output | Take-OutputPart -Part 1 return "Python $version" } function Get-Python3Version { $result = Get-CommandResult "python3 --version" - $version = $result.Output | Take-Part -Part 1 + $version = $result.Output | Take-OutputPart -Part 1 return "Python3 $version" } @@ -66,17 +66,17 @@ function Get-PowershellVersion { } function Get-RubyVersion { - $rubyVersion = $(ruby --version) | Out-String | Take-Part -Part 1 + $rubyVersion = $(ruby --version) | Out-String | Take-OutputPart -Part 1 return "Ruby $rubyVersion" } function Get-SwiftVersion { - $swiftVersion = $(swift --version) | Out-String | Take-Part -Part 2 + $swiftVersion = $(swift --version) | Out-String | Take-OutputPart -Part 2 return "Swift $swiftVersion" } function Get-JuliaVersion { - $juliaVersion = $(julia --version) | Out-String | Take-Part -Part 2 + $juliaVersion = $(julia --version) | Out-String | Take-OutputPart -Part 2 return "Julia $juliaVersion" } @@ -195,7 +195,7 @@ function Build-PHPTable { [PSCustomObject] @{ "Tool" = $_.Tool "Version" = $_.Version - } + } } } @@ -218,52 +218,52 @@ function Get-StackVersion { } function Get-RustVersion { - $rustVersion = $(rustc --version) | Take-Part -Part 1 + $rustVersion = $(rustc --version) | Take-OutputPart -Part 1 return "Rust $rustVersion" } function Get-BindgenVersion { - $bindgenVersion = $(bindgen --version) | Take-Part -Part 1 + $bindgenVersion = $(bindgen --version) | Take-OutputPart -Part 1 return "Bindgen $bindgenVersion" } function Get-CargoVersion { - $cargoVersion = $(cargo --version) | Take-Part -Part 1 + $cargoVersion = $(cargo --version) | Take-OutputPart -Part 1 return "Cargo $cargoVersion" } function Get-CargoAuditVersion { - $cargoAuditVersion = $(cargo audit --version) | Take-Part -Part 1 + $cargoAuditVersion = $(cargo audit --version) | Take-OutputPart -Part 1 return "Cargo audit $cargoAuditVersion" } function Get-CargoOutdatedVersion { - $cargoOutdatedVersion = $(cargo outdated --version) | Take-Part -Part 1 -Delimiter "v" + $cargoOutdatedVersion = $(cargo outdated --version) | Take-OutputPart -Part 1 -Delimiter "v" return "Cargo outdated $cargoOutdatedVersion" } function Get-CargoClippyVersion { - $cargoClippyVersion = $(cargo-clippy --version) | Take-Part -Part 1 + $cargoClippyVersion = $(cargo-clippy --version) | Take-OutputPart -Part 1 return "Cargo clippy $cargoClippyVersion" } function Get-CbindgenVersion { - $cbindgenVersion = $(cbindgen --version) | Take-Part -Part 1 + $cbindgenVersion = $(cbindgen --version) | Take-OutputPart -Part 1 return "Cbindgen $cbindgenVersion" } function Get-RustupVersion { - $rustupVersion = $(rustup --version) | Take-Part -Part 1 + $rustupVersion = $(rustup --version) | Take-OutputPart -Part 1 return "Rustup $rustupVersion" } function Get-RustdocVersion { - $rustdocVersion = $(rustdoc --version) | Take-Part -Part 1 + $rustdocVersion = $(rustdoc --version) | Take-OutputPart -Part 1 return "Rustdoc $rustdocVersion" } function Get-RustfmtVersion { - $rustfmtVersion = $(rustfmt --version) | Take-Part -Part 1 | Take-Part -Part 0 -Delimiter "-" + $rustfmtVersion = $(rustfmt --version) | Take-OutputPart -Part 1 | Take-OutputPart -Part 0 -Delimiter "-" return "Rustfmt $rustfmtVersion" } @@ -271,13 +271,13 @@ function Get-AzModuleVersions { $azModuleVersions = Get-ChildItem /usr/share | Where-Object { $_ -match "az_\d+" } | Foreach-Object { $_.Name.Split("_")[1] } - + $azModuleVersions = $azModuleVersions -join " " return $azModuleVersions } function Get-DotNetCoreSdkVersions { - $unsortedDotNetCoreSdkVersion = dotnet --list-sdks list | ForEach-Object { $_ | Take-Part -Part 0 } + $unsortedDotNetCoreSdkVersion = dotnet --list-sdks list | ForEach-Object { $_ | Take-OutputPart -Part 0 } $dotNetCoreSdkVersion = $unsortedDotNetCoreSdkVersion -join " " return $dotNetCoreSdkVersion } diff --git a/images/linux/scripts/SoftwareReport/SoftwareReport.Databases.psm1 b/images/linux/scripts/SoftwareReport/SoftwareReport.Databases.psm1 index 6c274184e..e6c14381e 100644 --- a/images/linux/scripts/SoftwareReport/SoftwareReport.Databases.psm1 +++ b/images/linux/scripts/SoftwareReport/SoftwareReport.Databases.psm1 @@ -1,19 +1,35 @@ function Get-PostgreSqlVersion { - $postgreSQLVersion = psql --version | Take-Part -Part 2 + $postgreSQLVersion = psql --version | Take-OutputPart -Part 2 return "Postgre SQL $postgreSQLVersion" } function Get-MongoDbVersion { - $mongoDBVersion = mongod --version | Select-Object -First 1 | Take-Part -Part 2 -Delimiter "v" + $mongoDBVersion = mongod --version | Select-Object -First 1 | Take-OutputPart -Part 2 -Delimiter "v" return "MongoDB $mongoDBVersion" } function Get-SqliteVersion { - $sqliteVersion = sqlite3 --version | Take-Part -Part 0 + $sqliteVersion = sqlite3 --version | Take-OutputPart -Part 0 return "sqlite3 $sqliteVersion" } function Get-MySqlVersion { $mySqlVersion = (mysql --version).Split("/usr/bin/")[1] return "MySQL ($mySqlVersion)" +} + +function Build-MySQLSection { + $output = "" + + $output += New-MDHeader "MySQL" -Level 4 + $output += New-MDList -Style Unordered -Lines @( + (Get-MySqlVersion), + "MySQL Server (user:root password:root)", + "MS SQL Server Client Tools" + ) + $output += New-MDCode -Lines @( + "MySQL service is disabled by default. Use the following command as a part of your job to start the service: 'sudo systemctl start mysql.service'" + ) + + return $output } \ No newline at end of file diff --git a/images/linux/scripts/SoftwareReport/SoftwareReport.Generator.ps1 b/images/linux/scripts/SoftwareReport/SoftwareReport.Generator.ps1 index e63f3719a..6a252f407 100644 --- a/images/linux/scripts/SoftwareReport/SoftwareReport.Generator.ps1 +++ b/images/linux/scripts/SoftwareReport/SoftwareReport.Generator.ps1 @@ -195,15 +195,7 @@ $markdown += New-MDList -Style Unordered -Lines @( (Get-SqliteVersion) ) -$markdown += New-MDHeader "MySQL" -Level 4 -$markdown += New-MDList -Style Unordered -Lines @( - (Get-MySqlVersion), - "MySQL Server (user:root password:root)", - "MS SQL Server Client Tools" -) -$markdown += New-MDCode -Lines @( - "MySQL service is disabled by default. Use the following command as a part of your job to start the service: 'sudo systemctl start mysql.service'" -) +$markdown += Build-MySQLSection $markdown += New-MDHeader "Cached Tools" -Level 3 $markdown += Build-CachedToolsSection diff --git a/images/linux/scripts/SoftwareReport/SoftwareReport.Helpers.psm1 b/images/linux/scripts/SoftwareReport/SoftwareReport.Helpers.psm1 index 6f2701c92..4bad753bd 100644 --- a/images/linux/scripts/SoftwareReport/SoftwareReport.Helpers.psm1 +++ b/images/linux/scripts/SoftwareReport/SoftwareReport.Helpers.psm1 @@ -13,7 +13,7 @@ function Get-CommandResult { } } -function Take-Part { +function Take-OutputPart { param ( [Parameter(ValueFromPipeline)] [string] $toolOutput, diff --git a/images/linux/scripts/SoftwareReport/SoftwareReport.Tools.psm1 b/images/linux/scripts/SoftwareReport/SoftwareReport.Tools.psm1 index f66f2e4fc..05032cfb6 100644 --- a/images/linux/scripts/SoftwareReport/SoftwareReport.Tools.psm1 +++ b/images/linux/scripts/SoftwareReport/SoftwareReport.Tools.psm1 @@ -1,85 +1,85 @@ function Get-7zipVersion { - $7zVersion = 7z i | Select-String "7-Zip" | Take-Part -Part 2 + $7zVersion = 7z i | Select-String "7-Zip" | Take-OutputPart -Part 2 return "7-Zip $7zVersion" } function Get-AnsibleVersion { - $ansibleVersion = ansible --version | Select-Object -First 1 | Take-Part -Part 1 + $ansibleVersion = ansible --version | Select-Object -First 1 | Take-OutputPart -Part 1 return "Ansible $ansibleVersion" } function Get-AzCopy7Version { - $azcopy7Version = azcopy --version | Take-Part -Part 1 | Take-Part -Part 0 -Delimiter "-" + $azcopy7Version = azcopy --version | Take-OutputPart -Part 1 | Take-OutputPart -Part 0 -Delimiter "-" return "AzCopy7 (available by azcopy alias) $azcopy7Version" } function Get-AzCopy10Version { - $azcopy10Version = azcopy10 --version | Take-Part -Part 2 + $azcopy10Version = azcopy10 --version | Take-OutputPart -Part 2 return "AzCopy10 (available by azcopy10 alias) $azcopy10Version" } function Get-BazelVersion { - $bazelVersion = bazel --version | Select-String "bazel" | Take-Part -Part 1 + $bazelVersion = bazel --version | Select-String "bazel" | Take-OutputPart -Part 1 return "Bazel $bazelVersion" } function Get-BazeliskVersion { - $bazeliskVersion = bazelisk version 2>&1 | Select-String "Bazelisk version:" | Take-Part -Part 2 | Take-Part -Part 0 -Delimiter "v" + $bazeliskVersion = bazelisk version 2>&1 | Select-String "Bazelisk version:" | Take-OutputPart -Part 2 | Take-OutputPart -Part 0 -Delimiter "v" return "Bazelisk $bazeliskVersion" } function Get-PodManVersion { - $podmanVersion = podman --version | Take-Part -Part 2 + $podmanVersion = podman --version | Take-OutputPart -Part 2 return "Podman $podmanVersion" } function Get-BuildahVersion { - $buildahVersion = buildah --version | Take-Part -Part 2 + $buildahVersion = buildah --version | Take-OutputPart -Part 2 return "Buildah $buildahVersion" } function Get-SkopeoVersion { - $skopeoVersion = skopeo --version | Take-Part -Part 2 + $skopeoVersion = skopeo --version | Take-OutputPart -Part 2 return "Skopeo $skopeoVersion" } function Get-CMakeVersion { - $cmakeVersion = cmake --version | Select-Object -First 1 | Take-Part -Part 2 + $cmakeVersion = cmake --version | Select-Object -First 1 | Take-OutputPart -Part 2 return "CMake $cmakeVersion" } function Get-CurlVersion { - $curlVersion = curl --version | Select-Object -First 1 | Take-Part -Part 0,1 + $curlVersion = curl --version | Select-Object -First 1 | Take-OutputPart -Part 0,1 return $curlVersion } function Get-DockerComposeVersion { - $composeVersion = docker-compose -v | Take-Part -Part 2 | Take-Part -Part 0 -Delimiter "," + $composeVersion = docker-compose -v | Take-OutputPart -Part 2 | Take-OutputPart -Part 0 -Delimiter "," return "Docker Compose $composeVersion" } function Get-DockerMobyVersion { - $dockerVersion = docker -v | Take-Part -Part 2 | Take-Part -Part 0 -Delimiter "+" + $dockerVersion = docker -v | Take-OutputPart -Part 2 | Take-OutputPart -Part 0 -Delimiter "+" return "Docker-Moby $dockerVersion" } function Get-DockerBuildxVersion { - $buildxVersion = docker buildx version | Take-Part -Part 1 | Take-Part -Part 0 -Delimiter "+" + $buildxVersion = docker buildx version | Take-OutputPart -Part 1 | Take-OutputPart -Part 0 -Delimiter "+" return "Docker-Buildx $buildxVersion" } function Get-GitVersion { - $gitVersion = git --version 2>&1 | Take-Part -Part 2 + $gitVersion = git --version 2>&1 | Take-OutputPart -Part 2 return "Git $gitVersion" } function Get-GitLFSVersion { - $gitlfsversion = git-lfs --version 2>&1 | Take-Part -Part 0 | Take-Part -Part 1 -Delimiter "/" + $gitlfsversion = git-lfs --version 2>&1 | Take-OutputPart -Part 0 | Take-OutputPart -Part 1 -Delimiter "/" return "Git LFS $gitlfsversion" } function Get-GitFTPVersion { - $gitftpVersion = git-ftp --version | Take-Part -Part 2 + $gitftpVersion = git-ftp --version | Take-OutputPart -Part 2 return "Git-ftp $gitftpVersion" } @@ -88,57 +88,57 @@ function Get-GoogleCloudSDKVersion { } function Get-HavegedVersion { - $havegedVersion = dpkg-query --showformat='${Version}' --show haveged | Take-Part -Part 0 -Delimiter "-" + $havegedVersion = dpkg-query --showformat='${Version}' --show haveged | Take-OutputPart -Part 0 -Delimiter "-" return "Haveged $havegedVersion" } function Get-HerokuVersion { - $herokuVersion = heroku version | Take-Part -Part 0 | Take-Part -Part 1 -Delimiter "/" + $herokuVersion = heroku version | Take-OutputPart -Part 0 | Take-OutputPart -Part 1 -Delimiter "/" return "Heroku $herokuVersion" } function Get-HHVMVersion { - $hhvmVersion = hhvm --version | Select-Object -First 1 | Take-Part -Part 2 + $hhvmVersion = hhvm --version | Select-Object -First 1 | Take-OutputPart -Part 2 return "HHVM (HipHop VM) $hhvmVersion" } function Get-SVNVersion { - $svnVersion = svn --version | Select-Object -First 1 | Take-Part -Part 2 + $svnVersion = svn --version | Select-Object -First 1 | Take-OutputPart -Part 2 return "SVN $svnVersion" } function Get-KustomizeVersion { - $kustomizeVersion = kustomize version --short | Take-Part -Part 0 | Take-Part -Part 1 -Delimiter "v" + $kustomizeVersion = kustomize version --short | Take-OutputPart -Part 0 | Take-OutputPart -Part 1 -Delimiter "v" return "Kustomize $kustomizeVersion" } function Get-KindVersion { - $kindVersion = kind version | Take-Part -Part 1 | Take-Part -Part 0 -Delimiter "v" + $kindVersion = kind version | Take-OutputPart -Part 1 | Take-OutputPart -Part 0 -Delimiter "v" return "Kind $kindVersion" } function Get-KubectlVersion { - $kubectlVersion = kubectl version --client --short | Take-Part -Part 2 | Take-Part -Part 0 -Delimiter "v" + $kubectlVersion = kubectl version --client --short | Take-OutputPart -Part 2 | Take-OutputPart -Part 0 -Delimiter "v" return "Kubectl $kubectlVersion" } function Get-MinikubeVersion { - $minikubeVersion = minikube version --short | Take-Part -Part 2 | Take-Part -Part 0 -Delimiter "v" + $minikubeVersion = minikube version --short | Take-OutputPart -Part 2 | Take-OutputPart -Part 0 -Delimiter "v" return "Minikube $minikubeVersion" } function Get-HGVersion { - $hgVersion = hg --version | Select-Object -First 1 | Take-Part -Part -1 | Take-Part -Part 0 -Delimiter ")" + $hgVersion = hg --version | Select-Object -First 1 | Take-OutputPart -Part -1 | Take-OutputPart -Part 0 -Delimiter ")" return "Mercurial $hgVersion" } function Get-M4Version { - $m4Version = m4 --version | Select-Object -First 1 | Take-Part -Part -1 + $m4Version = m4 --version | Select-Object -First 1 | Take-OutputPart -Part -1 return "m4 $m4Version" } function Get-LeiningenVersion { - return "$(lein -v | Take-Part -Part 0,1)" + return "$(lein -v | Take-OutputPart -Part 0,1)" } function Get-NewmanVersion { @@ -159,7 +159,7 @@ function Get-PhantomJSVersion { } function Get-SwigVersion { - $swigVersion = swig -version | Select-String "SWIG Version" | Take-Part -Part 2 + $swigVersion = swig -version | Select-String "SWIG Version" | Take-OutputPart -Part 2 return "Swig $swigVersion" } @@ -168,17 +168,17 @@ function Get-TerraformVersion { } function Get-UnZipVersion { - $unzipVersion = unzip -v | Select-Object -First 1 | Take-Part -Part 1 + $unzipVersion = unzip -v | Select-Object -First 1 | Take-OutputPart -Part 1 return "unzip $unzipVersion" } function Get-WgetVersion { - $wgetVersion = wget --version | Select-Object -First 1 | Take-Part -Part 2 + $wgetVersion = wget --version | Select-Object -First 1 | Take-OutputPart -Part 2 return "wget $wgetVersion" } function Get-ZipVersion { - $zipVersion = zip -v | Select-String "This is Zip" | Take-Part -Part 3 + $zipVersion = zip -v | Select-String "This is Zip" | Take-OutputPart -Part 3 return "zip $zipVersion" } @@ -188,17 +188,17 @@ function Get-ZstdVersion { } function Get-JqVersion { - $jqVersion = jq --version | Take-Part -Part 1 -Delimiter "-" + $jqVersion = jq --version | Take-OutputPart -Part 1 -Delimiter "-" return "jq $jqVersion" } function Get-AzureCliVersion { - $azcliVersion = az -v | Select-String "azure-cli" | Take-Part -Part -1 + $azcliVersion = az -v | Select-String "azure-cli" | Take-OutputPart -Part -1 return "Azure CLI (azure-cli) $azcliVersion" } function Get-AzureDevopsVersion { - $azdevopsVersion = az -v | Select-String "azure-devops" | Take-Part -Part -1 + $azdevopsVersion = az -v | Select-String "azure-devops" | Take-OutputPart -Part -1 return "Azure CLI (azure-devops) $azdevopsVersion" } @@ -207,7 +207,7 @@ function Get-AlibabaCloudCliVersion { } function Get-AWSCliVersion { - $awsVersion = aws --version 2>&1 | Take-Part -Part 0 | Take-Part -Part 1 -Delimiter "/" + $awsVersion = aws --version 2>&1 | Take-OutputPart -Part 0 | Take-OutputPart -Part 1 -Delimiter "/" return "AWS CLI $awsVersion" } @@ -216,31 +216,31 @@ function Get-AWSCliSessionManagerPluginVersion { } function Get-AWSSAMVersion { - return "AWS SAM CLI $(sam --version | Take-Part -Part -1)" + return "AWS SAM CLI $(sam --version | Take-OutputPart -Part -1)" } function Get-HubCliVersion { - $hubVersion = hub --version | Select-String "hub version" | Take-Part -Part 2 + $hubVersion = hub --version | Select-String "hub version" | Take-OutputPart -Part 2 return "Hub CLI $hubVersion" } function Get-GitHubCliVersion { - $ghVersion = gh --version | Select-String "gh version" | Take-Part -Part 2 + $ghVersion = gh --version | Select-String "gh version" | Take-OutputPart -Part 2 return "GitHub CLI $ghVersion" } function Get-NetlifyCliVersion { - $netlifyVersion = netlify --version | Take-Part -Part 0 | Take-Part -Part 1 -Delimiter "/" + $netlifyVersion = netlify --version | Take-OutputPart -Part 0 | Take-OutputPart -Part 1 -Delimiter "/" return "Netlify CLI $netlifyVersion" } function Get-OCCliVersion { - $ocVersion = oc version | Take-Part -Part 2 | Take-Part -Part 0 -Delimiter "-" + $ocVersion = oc version | Take-OutputPart -Part 2 | Take-OutputPart -Part 0 -Delimiter "-" return "oc CLI $ocVersion" } function Get-ORASCliVersion { - $orasVersion = oras version | Select-String "^Version:" | Take-Part -Part 1 + $orasVersion = oras version | Select-String "^Version:" | Take-OutputPart -Part 1 return "ORAS CLI $orasVersion" } From 3e90bb832a481b3ef1539a1d2b8238f9af78acce Mon Sep 17 00:00:00 2001 From: Aleksandr Chebotov Date: Mon, 14 Sep 2020 11:31:41 +0300 Subject: [PATCH 32/50] fix environment variable --- .../scripts/SoftwareReport/SoftwareReport.Databases.psm1 | 4 ++-- .../scripts/SoftwareReport/SoftwareReport.Generator.ps1 | 4 ++-- images/linux/ubuntu1604.json | 5 +++-- images/linux/ubuntu1804.json | 5 +++-- images/linux/ubuntu2004.json | 5 +++-- 5 files changed, 13 insertions(+), 10 deletions(-) diff --git a/images/linux/scripts/SoftwareReport/SoftwareReport.Databases.psm1 b/images/linux/scripts/SoftwareReport/SoftwareReport.Databases.psm1 index e6c14381e..7c1605ccc 100644 --- a/images/linux/scripts/SoftwareReport/SoftwareReport.Databases.psm1 +++ b/images/linux/scripts/SoftwareReport/SoftwareReport.Databases.psm1 @@ -13,7 +13,7 @@ function Get-SqliteVersion { return "sqlite3 $sqliteVersion" } -function Get-MySqlVersion { +function Get-MySQLVersion { $mySqlVersion = (mysql --version).Split("/usr/bin/")[1] return "MySQL ($mySqlVersion)" } @@ -23,7 +23,7 @@ function Build-MySQLSection { $output += New-MDHeader "MySQL" -Level 4 $output += New-MDList -Style Unordered -Lines @( - (Get-MySqlVersion), + (Get-MySQLVersion ), "MySQL Server (user:root password:root)", "MS SQL Server Client Tools" ) diff --git a/images/linux/scripts/SoftwareReport/SoftwareReport.Generator.ps1 b/images/linux/scripts/SoftwareReport/SoftwareReport.Generator.ps1 index 6a252f407..ac23a6deb 100644 --- a/images/linux/scripts/SoftwareReport/SoftwareReport.Generator.ps1 +++ b/images/linux/scripts/SoftwareReport/SoftwareReport.Generator.ps1 @@ -4,7 +4,7 @@ param ( ) # Install MarkdownPS module for software report generation -Install-Module MarkdownPS -Force -Scope CurrentUser +Install-Module MarkdownPS -Force Import-Module MarkdownPS Import-Module (Join-Path $PSScriptRoot "SoftwareReport.CachedTools.psm1") -DisableNameChecking Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Common.psm1") -DisableNameChecking @@ -28,7 +28,7 @@ $OSName = Get-OSName $markdown += New-MDHeader "$OSName" -Level 1 $markdown += New-MDList -Style Unordered -Lines @( - "Image Version: $env:ImageVersion" + "Image Version: $env:IMAGE_VERSION" ) $markdown += New-MDHeader "Installed Software" -Level 2 diff --git a/images/linux/ubuntu1604.json b/images/linux/ubuntu1604.json index 7ef3122a6..7d180a0a4 100644 --- a/images/linux/ubuntu1604.json +++ b/images/linux/ubuntu1604.json @@ -293,11 +293,12 @@ "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" }, { - "type": "powershell", + "type": "shell", "inline": [ - "pwsh -File '{{user `image_folder`}}/SoftwareReport/SoftwareReport.Generator.ps1' -OutputDirectory '{{user `image_folder`}}'" + "sudo pwsh -File {{user `image_folder`}}/SoftwareReport/SoftwareReport.Generator.ps1 -OutputDirectory {{user `image_folder`}}" ], "environment_vars":[ + "IMAGE_VERSION={{user `image_version`}}", "INSTALLER_SCRIPT_FOLDER={{user `installer_script_folder`}}", "ANNOUNCEMENTS={{user `announcements`}}" ] diff --git a/images/linux/ubuntu1804.json b/images/linux/ubuntu1804.json index 5f280636d..c5265b9fa 100644 --- a/images/linux/ubuntu1804.json +++ b/images/linux/ubuntu1804.json @@ -297,11 +297,12 @@ "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" }, { - "type": "powershell", + "type": "shell", "inline": [ - "pwsh -File '{{user `image_folder`}}/SoftwareReport/SoftwareReport.Generator.ps1' -OutputDirectory '{{user `image_folder`}}'" + "sudo pwsh -File {{user `image_folder`}}/SoftwareReport/SoftwareReport.Generator.ps1 -OutputDirectory {{user `image_folder`}}" ], "environment_vars":[ + "IMAGE_VERSION={{user `image_version`}}", "INSTALLER_SCRIPT_FOLDER={{user `installer_script_folder`}}", "ANNOUNCEMENTS={{user `announcements`}}" ] diff --git a/images/linux/ubuntu2004.json b/images/linux/ubuntu2004.json index 604b863a2..eccace5ff 100644 --- a/images/linux/ubuntu2004.json +++ b/images/linux/ubuntu2004.json @@ -299,11 +299,12 @@ "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" }, { - "type": "powershell", + "type": "shell", "inline": [ - "pwsh -File '{{user `image_folder`}}/SoftwareReport/SoftwareReport.Generator.ps1' -OutputDirectory '{{user `image_folder`}}'" + "sudo pwsh -File {{user `image_folder`}}/SoftwareReport/SoftwareReport.Generator.ps1 -OutputDirectory {{user `image_folder`}}" ], "environment_vars":[ + "IMAGE_VERSION={{user `image_version`}}", "INSTALLER_SCRIPT_FOLDER={{user `installer_script_folder`}}", "ANNOUNCEMENTS={{user `announcements`}}" ] From e7a8e6a597779e21fb24f5032fa2645285f9ec1a Mon Sep 17 00:00:00 2001 From: Aleksandr Chebotov Date: Mon, 14 Sep 2020 16:25:33 +0300 Subject: [PATCH 33/50] install powershell modules --- .../SoftwareReport.Databases.psm1 | 4 +-- .../installers/Install-PowerShellModules.ps1 | 31 +++++++++++++++++++ images/linux/toolsets/toolset-1604.json | 4 +++ images/linux/toolsets/toolset-1804.json | 4 +++ images/linux/toolsets/toolset-2004.json | 4 +++ images/linux/ubuntu1604.json | 12 ++++++- images/linux/ubuntu1804.json | 12 ++++++- images/linux/ubuntu2004.json | 12 ++++++- 8 files changed, 78 insertions(+), 5 deletions(-) create mode 100644 images/linux/scripts/installers/Install-PowerShellModules.ps1 diff --git a/images/linux/scripts/SoftwareReport/SoftwareReport.Databases.psm1 b/images/linux/scripts/SoftwareReport/SoftwareReport.Databases.psm1 index 7c1605ccc..47f04de24 100644 --- a/images/linux/scripts/SoftwareReport/SoftwareReport.Databases.psm1 +++ b/images/linux/scripts/SoftwareReport/SoftwareReport.Databases.psm1 @@ -14,8 +14,8 @@ function Get-SqliteVersion { } function Get-MySQLVersion { - $mySqlVersion = (mysql --version).Split("/usr/bin/")[1] - return "MySQL ($mySqlVersion)" + $mySQLVersion = mysqld --version | Take-OutputPart -Part 2 | Take-OutputPart -Part 0 -Delimiter "-" + return "MySQL ($mySQLVersion)" } function Build-MySQLSection { diff --git a/images/linux/scripts/installers/Install-PowerShellModules.ps1 b/images/linux/scripts/installers/Install-PowerShellModules.ps1 new file mode 100644 index 000000000..ed100e3c4 --- /dev/null +++ b/images/linux/scripts/installers/Install-PowerShellModules.ps1 @@ -0,0 +1,31 @@ +$ErrorActionPreference = "Stop" + +function Get-ToolsetContent +{ + $toolset = Join-Path $env:INSTALLER_SCRIPT_FOLDER "toolset.json" + Get-Content $toolset -Raw | ConvertFrom-Json +} + +# Specifies the installation policy +Set-PSRepository -InstallationPolicy Trusted -Name PSGallery + +# Install PowerShell modules +$modules = (Get-ToolsetContent).powershellModules + +foreach($module in $modules) +{ + $moduleName = $module.name + Write-Host "Installing ${moduleName} module" + + if ($module.versions) + { + foreach ($version in $module.versions) + { + Write-Host " - $version" + Install-Module -Name $moduleName -RequiredVersion $version -Scope AllUsers -SkipPublisherCheck -Force + } + continue + } + + Install-Module -Name $moduleName -Scope AllUsers -SkipPublisherCheck -Force +} diff --git a/images/linux/toolsets/toolset-1604.json b/images/linux/toolsets/toolset-1604.json index 1204f2a86..c8b2b1510 100644 --- a/images/linux/toolsets/toolset-1604.json +++ b/images/linux/toolsets/toolset-1604.json @@ -91,6 +91,10 @@ "platform-tools" ] }, + "powershellModules": [ + {"name": "MarkdownPS"}, + {"name": "Pester"} + ], "azureModules": [ { "name": "az", diff --git a/images/linux/toolsets/toolset-1804.json b/images/linux/toolsets/toolset-1804.json index 2c399c8fc..6311cc1a1 100644 --- a/images/linux/toolsets/toolset-1804.json +++ b/images/linux/toolsets/toolset-1804.json @@ -87,6 +87,10 @@ "platform-tools" ] }, + "powershellModules": [ + {"name": "MarkdownPS"}, + {"name": "Pester"} + ], "azureModules": [ { "name": "az", diff --git a/images/linux/toolsets/toolset-2004.json b/images/linux/toolsets/toolset-2004.json index 1162b713f..5ac230255 100644 --- a/images/linux/toolsets/toolset-2004.json +++ b/images/linux/toolsets/toolset-2004.json @@ -68,6 +68,10 @@ "platform-tools" ] }, + "powershellModules": [ + {"name": "MarkdownPS"}, + {"name": "Pester"} + ], "apt": { "common_packages": [ "dbus", diff --git a/images/linux/ubuntu1604.json b/images/linux/ubuntu1604.json index 7d180a0a4..27cc6b0bd 100644 --- a/images/linux/ubuntu1604.json +++ b/images/linux/ubuntu1604.json @@ -292,10 +292,20 @@ ], "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" }, + { + "type": "shell", + "scripts":[ + "{{template_dir}}/scripts/installers/Install-PowerShellModules.ps1" + ], + "environment_vars": [ + "INSTALLER_SCRIPT_FOLDER={{user `installer_script_folder`}}" + ], + "execute_command": "sudo sh -c '{{ .Vars }} pwsh -f {{ .Path }}'" + }, { "type": "shell", "inline": [ - "sudo pwsh -File {{user `image_folder`}}/SoftwareReport/SoftwareReport.Generator.ps1 -OutputDirectory {{user `image_folder`}}" + "pwsh -File {{user `image_folder`}}/SoftwareReport/SoftwareReport.Generator.ps1 -OutputDirectory {{user `image_folder`}}" ], "environment_vars":[ "IMAGE_VERSION={{user `image_version`}}", diff --git a/images/linux/ubuntu1804.json b/images/linux/ubuntu1804.json index c5265b9fa..05f4a2691 100644 --- a/images/linux/ubuntu1804.json +++ b/images/linux/ubuntu1804.json @@ -296,10 +296,20 @@ ], "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" }, + { + "type": "shell", + "scripts":[ + "{{template_dir}}/scripts/installers/Install-PowerShellModules.ps1" + ], + "environment_vars": [ + "INSTALLER_SCRIPT_FOLDER={{user `installer_script_folder`}}" + ], + "execute_command": "sudo sh -c '{{ .Vars }} pwsh -f {{ .Path }}'" + }, { "type": "shell", "inline": [ - "sudo pwsh -File {{user `image_folder`}}/SoftwareReport/SoftwareReport.Generator.ps1 -OutputDirectory {{user `image_folder`}}" + "pwsh -File {{user `image_folder`}}/SoftwareReport/SoftwareReport.Generator.ps1 -OutputDirectory {{user `image_folder`}}" ], "environment_vars":[ "IMAGE_VERSION={{user `image_version`}}", diff --git a/images/linux/ubuntu2004.json b/images/linux/ubuntu2004.json index eccace5ff..4a4ff5c5f 100644 --- a/images/linux/ubuntu2004.json +++ b/images/linux/ubuntu2004.json @@ -298,10 +298,20 @@ ], "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" }, + { + "type": "shell", + "scripts":[ + "{{template_dir}}/scripts/installers/Install-PowerShellModules.ps1" + ], + "environment_vars": [ + "INSTALLER_SCRIPT_FOLDER={{user `installer_script_folder`}}" + ], + "execute_command": "sudo sh -c '{{ .Vars }} pwsh -f {{ .Path }}'" + }, { "type": "shell", "inline": [ - "sudo pwsh -File {{user `image_folder`}}/SoftwareReport/SoftwareReport.Generator.ps1 -OutputDirectory {{user `image_folder`}}" + "pwsh -File {{user `image_folder`}}/SoftwareReport/SoftwareReport.Generator.ps1 -OutputDirectory {{user `image_folder`}}" ], "environment_vars":[ "IMAGE_VERSION={{user `image_version`}}", From 8d517bf1884b2ae8b6f7b024c0363e8a7f2e8c4d Mon Sep 17 00:00:00 2001 From: Aleksandr Chebotov Date: Mon, 14 Sep 2020 16:27:20 +0300 Subject: [PATCH 34/50] remove () --- .../linux/scripts/SoftwareReport/SoftwareReport.Databases.psm1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/images/linux/scripts/SoftwareReport/SoftwareReport.Databases.psm1 b/images/linux/scripts/SoftwareReport/SoftwareReport.Databases.psm1 index 47f04de24..973257b10 100644 --- a/images/linux/scripts/SoftwareReport/SoftwareReport.Databases.psm1 +++ b/images/linux/scripts/SoftwareReport/SoftwareReport.Databases.psm1 @@ -15,7 +15,7 @@ function Get-SqliteVersion { function Get-MySQLVersion { $mySQLVersion = mysqld --version | Take-OutputPart -Part 2 | Take-OutputPart -Part 0 -Delimiter "-" - return "MySQL ($mySQLVersion)" + return "MySQL $mySQLVersion" } function Build-MySQLSection { From bcca2214d94907e77af8276d1dc09b8ec76320e5 Mon Sep 17 00:00:00 2001 From: Aleksandr Chebotov Date: Mon, 14 Sep 2020 16:39:49 +0300 Subject: [PATCH 35/50] remove module MarkdownPS installation --- .../linux/scripts/SoftwareReport/SoftwareReport.Generator.ps1 | 2 -- 1 file changed, 2 deletions(-) diff --git a/images/linux/scripts/SoftwareReport/SoftwareReport.Generator.ps1 b/images/linux/scripts/SoftwareReport/SoftwareReport.Generator.ps1 index ac23a6deb..1cd951f3a 100644 --- a/images/linux/scripts/SoftwareReport/SoftwareReport.Generator.ps1 +++ b/images/linux/scripts/SoftwareReport/SoftwareReport.Generator.ps1 @@ -3,8 +3,6 @@ param ( $OutputDirectory ) -# Install MarkdownPS module for software report generation -Install-Module MarkdownPS -Force Import-Module MarkdownPS Import-Module (Join-Path $PSScriptRoot "SoftwareReport.CachedTools.psm1") -DisableNameChecking Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Common.psm1") -DisableNameChecking From 6ed38287599a3bfbcae4e50f8988c75ece2a0517 Mon Sep 17 00:00:00 2001 From: Aleksandr Chebotov Date: Mon, 14 Sep 2020 21:47:31 +0300 Subject: [PATCH 36/50] fix azcopy and rust --- .../SoftwareReport/SoftwareReport.Common.psm1 | 50 ----------------- .../SoftwareReport.Generator.ps1 | 11 ++-- .../SoftwareReport.Helpers.psm1 | 3 +- .../SoftwareReport/SoftwareReport.Rust.psm1 | 54 +++++++++++++++++++ .../SoftwareReport/SoftwareReport.Tools.psm1 | 18 +++---- images/linux/scripts/installers/azcopy.sh | 1 + 6 files changed, 71 insertions(+), 66 deletions(-) create mode 100644 images/linux/scripts/SoftwareReport/SoftwareReport.Rust.psm1 diff --git a/images/linux/scripts/SoftwareReport/SoftwareReport.Common.psm1 b/images/linux/scripts/SoftwareReport/SoftwareReport.Common.psm1 index 5fafca0f1..64c828424 100644 --- a/images/linux/scripts/SoftwareReport/SoftwareReport.Common.psm1 +++ b/images/linux/scripts/SoftwareReport/SoftwareReport.Common.psm1 @@ -217,56 +217,6 @@ function Get-StackVersion { return "Stack $stackVersion" } -function Get-RustVersion { - $rustVersion = $(rustc --version) | Take-OutputPart -Part 1 - return "Rust $rustVersion" -} - -function Get-BindgenVersion { - $bindgenVersion = $(bindgen --version) | Take-OutputPart -Part 1 - return "Bindgen $bindgenVersion" -} - -function Get-CargoVersion { - $cargoVersion = $(cargo --version) | Take-OutputPart -Part 1 - return "Cargo $cargoVersion" -} - -function Get-CargoAuditVersion { - $cargoAuditVersion = $(cargo audit --version) | Take-OutputPart -Part 1 - return "Cargo audit $cargoAuditVersion" -} - -function Get-CargoOutdatedVersion { - $cargoOutdatedVersion = $(cargo outdated --version) | Take-OutputPart -Part 1 -Delimiter "v" - return "Cargo outdated $cargoOutdatedVersion" -} - -function Get-CargoClippyVersion { - $cargoClippyVersion = $(cargo-clippy --version) | Take-OutputPart -Part 1 - return "Cargo clippy $cargoClippyVersion" -} - -function Get-CbindgenVersion { - $cbindgenVersion = $(cbindgen --version) | Take-OutputPart -Part 1 - return "Cbindgen $cbindgenVersion" -} - -function Get-RustupVersion { - $rustupVersion = $(rustup --version) | Take-OutputPart -Part 1 - return "Rustup $rustupVersion" -} - -function Get-RustdocVersion { - $rustdocVersion = $(rustdoc --version) | Take-OutputPart -Part 1 - return "Rustdoc $rustdocVersion" -} - -function Get-RustfmtVersion { - $rustfmtVersion = $(rustfmt --version) | Take-OutputPart -Part 1 | Take-OutputPart -Part 0 -Delimiter "-" - return "Rustfmt $rustfmtVersion" -} - function Get-AzModuleVersions { $azModuleVersions = Get-ChildItem /usr/share | Where-Object { $_ -match "az_\d+" } | Foreach-Object { $_.Name.Split("_")[1] diff --git a/images/linux/scripts/SoftwareReport/SoftwareReport.Generator.ps1 b/images/linux/scripts/SoftwareReport/SoftwareReport.Generator.ps1 index 1cd951f3a..e0acc6bde 100644 --- a/images/linux/scripts/SoftwareReport/SoftwareReport.Generator.ps1 +++ b/images/linux/scripts/SoftwareReport/SoftwareReport.Generator.ps1 @@ -4,14 +4,15 @@ param ( ) Import-Module MarkdownPS +Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Android.psm1") -DisableNameChecking +Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Browsers.psm1") -DisableNameChecking Import-Module (Join-Path $PSScriptRoot "SoftwareReport.CachedTools.psm1") -DisableNameChecking Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Common.psm1") -DisableNameChecking -Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Helpers.psm1") -DisableNameChecking -Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Tools.psm1") -DisableNameChecking -Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Java.psm1") -DisableNameChecking Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Databases.psm1") -DisableNameChecking -Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Browsers.psm1") -DisableNameChecking -Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Android.psm1") -DisableNameChecking +Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Helpers.psm1") -DisableNameChecking +Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Java.psm1") -DisableNameChecking +Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Rust.psm1") -DisableNameChecking +Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Tools.psm1") -DisableNameChecking $markdown = "" diff --git a/images/linux/scripts/SoftwareReport/SoftwareReport.Helpers.psm1 b/images/linux/scripts/SoftwareReport/SoftwareReport.Helpers.psm1 index 4bad753bd..45ab44948 100644 --- a/images/linux/scripts/SoftwareReport/SoftwareReport.Helpers.psm1 +++ b/images/linux/scripts/SoftwareReport/SoftwareReport.Helpers.psm1 @@ -37,8 +37,7 @@ function Test-IsUbuntu20 { return (lsb_release -rs) -eq "20.04" } -function Get-ToolsetContent -{ +function Get-ToolsetContent { $toolset = Join-Path $env:INSTALLER_SCRIPT_FOLDER "toolset.json" Get-Content $toolset -Raw | ConvertFrom-Json } diff --git a/images/linux/scripts/SoftwareReport/SoftwareReport.Rust.psm1 b/images/linux/scripts/SoftwareReport/SoftwareReport.Rust.psm1 new file mode 100644 index 000000000..640ad2cf8 --- /dev/null +++ b/images/linux/scripts/SoftwareReport/SoftwareReport.Rust.psm1 @@ -0,0 +1,54 @@ +function Initialize-RustEnvironment { + ln -sf "/usr/share/rust/.rustup" $HOME/.rustup + ln -sf "/usr/share/rust/.cargo" $HOME/.cargo +} +function Get-RustVersion { + Initialize-RustEnvironment + $rustVersion = $(rustc --version) | Take-OutputPart -Part 1 + return "Rust $rustVersion" +} + +function Get-BindgenVersion { + $bindgenVersion = $(bindgen --version) | Take-OutputPart -Part 1 + return "Bindgen $bindgenVersion" +} + +function Get-CargoVersion { + $cargoVersion = $(cargo --version) | Take-OutputPart -Part 1 + return "Cargo $cargoVersion" +} + +function Get-CargoAuditVersion { + $cargoAuditVersion = $(cargo audit --version) | Take-OutputPart -Part 1 + return "Cargo audit $cargoAuditVersion" +} + +function Get-CargoOutdatedVersion { + $cargoOutdatedVersion = $(cargo outdated --version) | Take-OutputPart -Part 1 -Delimiter "v" + return "Cargo outdated $cargoOutdatedVersion" +} + +function Get-CargoClippyVersion { + $cargoClippyVersion = $(cargo-clippy --version) | Take-OutputPart -Part 1 + return "Cargo clippy $cargoClippyVersion" +} + +function Get-CbindgenVersion { + $cbindgenVersion = $(cbindgen --version) | Take-OutputPart -Part 1 + return "Cbindgen $cbindgenVersion" +} + +function Get-RustupVersion { + $rustupVersion = $(rustup --version) | Take-OutputPart -Part 1 + return "Rustup $rustupVersion" +} + +function Get-RustdocVersion { + $rustdocVersion = $(rustdoc --version) | Take-OutputPart -Part 1 + return "Rustdoc $rustdocVersion" +} + +function Get-RustfmtVersion { + $rustfmtVersion = $(rustfmt --version) | Take-OutputPart -Part 1 | Take-OutputPart -Part 0 -Delimiter "-" + return "Rustfmt $rustfmtVersion" +} \ No newline at end of file diff --git a/images/linux/scripts/SoftwareReport/SoftwareReport.Tools.psm1 b/images/linux/scripts/SoftwareReport/SoftwareReport.Tools.psm1 index 05032cfb6..a76c17f9b 100644 --- a/images/linux/scripts/SoftwareReport/SoftwareReport.Tools.psm1 +++ b/images/linux/scripts/SoftwareReport/SoftwareReport.Tools.psm1 @@ -4,7 +4,7 @@ function Get-7zipVersion { } function Get-AnsibleVersion { - $ansibleVersion = ansible --version | Select-Object -First 1 | Take-OutputPart -Part 1 + $ansibleVersion = sudo ansible --version | Select-Object -First 1 | Take-OutputPart -Part 1 return "Ansible $ansibleVersion" } @@ -19,12 +19,12 @@ function Get-AzCopy10Version { } function Get-BazelVersion { - $bazelVersion = bazel --version | Select-String "bazel" | Take-OutputPart -Part 1 + $bazelVersion = sudo bazel --version | Select-String "bazel" | Take-OutputPart -Part 1 return "Bazel $bazelVersion" } function Get-BazeliskVersion { - $bazeliskVersion = bazelisk version 2>&1 | Select-String "Bazelisk version:" | Take-OutputPart -Part 2 | Take-OutputPart -Part 0 -Delimiter "v" + $bazeliskVersion = sudo bazelisk version 2>&1 | Select-String "Bazelisk version:" | Take-OutputPart -Part 2 | Take-OutputPart -Part 0 -Delimiter "v" return "Bazelisk $bazeliskVersion" } @@ -84,7 +84,7 @@ function Get-GitFTPVersion { } function Get-GoogleCloudSDKVersion { - return "$(gcloud --version | Select-Object -First 1)" + return "$(sudo gcloud --version | Select-Object -First 1)" } function Get-HavegedVersion { @@ -93,7 +93,7 @@ function Get-HavegedVersion { } function Get-HerokuVersion { - $herokuVersion = heroku version | Take-OutputPart -Part 0 | Take-OutputPart -Part 1 -Delimiter "/" + $herokuVersion = sudo heroku version | Take-OutputPart -Part 0 | Take-OutputPart -Part 1 -Delimiter "/" return "Heroku $herokuVersion" } @@ -146,7 +146,7 @@ function Get-NewmanVersion { } function Get-NvmVersion { - $nvmVersion = bash -c "source $HOME/.nvm/nvm.sh && nvm --version" + $nvmVersion = bash -c "source /etc/skel/.nvm/nvm.sh && nvm --version" return "nvm $nvmVersion" } @@ -193,12 +193,12 @@ function Get-JqVersion { } function Get-AzureCliVersion { - $azcliVersion = az -v | Select-String "azure-cli" | Take-OutputPart -Part -1 + $azcliVersion = sudo az -v | Select-String "azure-cli" | Take-OutputPart -Part -1 return "Azure CLI (azure-cli) $azcliVersion" } function Get-AzureDevopsVersion { - $azdevopsVersion = az -v | Select-String "azure-devops" | Take-OutputPart -Part -1 + $azdevopsVersion = sudo az -v | Select-String "azure-devops" | Take-OutputPart -Part -1 return "Azure CLI (azure-devops) $azdevopsVersion" } @@ -230,7 +230,7 @@ function Get-GitHubCliVersion { } function Get-NetlifyCliVersion { - $netlifyVersion = netlify --version | Take-OutputPart -Part 0 | Take-OutputPart -Part 1 -Delimiter "/" + $netlifyVersion = sudo netlify --version | Take-OutputPart -Part 0 | Take-OutputPart -Part 1 -Delimiter "/" return "Netlify CLI $netlifyVersion" } diff --git a/images/linux/scripts/installers/azcopy.sh b/images/linux/scripts/installers/azcopy.sh index 3efe54d11..9d15d37af 100644 --- a/images/linux/scripts/installers/azcopy.sh +++ b/images/linux/scripts/installers/azcopy.sh @@ -17,6 +17,7 @@ rm azcopy.tar.gz wget -O /tmp/azcopy.tar.gz https://aka.ms/downloadazcopy-v10-linux tar zxvf /tmp/azcopy.tar.gz --strip-components=1 -C /tmp mv /tmp/azcopy /usr/local/bin/azcopy10 +chmod +x /usr/local/bin/azcopy10 # Run tests to determine that the software installed as expected echo "Testing to make sure that script performed as expected, and basic scenarios work" From ef96becdb646ab93999161d763c41c1bd475bba3 Mon Sep 17 00:00:00 2001 From: Aleksandr Chebotov Date: Mon, 14 Sep 2020 22:15:25 +0300 Subject: [PATCH 37/50] fix warnings --- .../SoftwareReport/SoftwareReport.Common.psm1 | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/images/linux/scripts/SoftwareReport/SoftwareReport.Common.psm1 b/images/linux/scripts/SoftwareReport/SoftwareReport.Common.psm1 index 64c828424..14c6db9c0 100644 --- a/images/linux/scripts/SoftwareReport/SoftwareReport.Common.psm1 +++ b/images/linux/scripts/SoftwareReport/SoftwareReport.Common.psm1 @@ -5,7 +5,7 @@ function Get-OSName { } function Get-CPPVersions { - $cppVersions = & apt list --installed | Where-Object { $_ -match "g\+\+-\d+"} | ForEach-Object { + $cppVersions = apt list --installed 2>&1 | Where-Object { $_ -match "g\+\+-\d+"} | ForEach-Object { $_ -match "now (?\d+\.\d+\.\d+)-" | Out-Null $Matches.version } @@ -13,7 +13,7 @@ function Get-CPPVersions { } function Get-FortranVersions { - $fortranVersions = & apt list --installed | Where-Object { $_ -match "^gfortran-\d+"} | ForEach-Object { + $fortranVersions = apt list --installed 2>&1 | Where-Object { $_ -match "^gfortran-\d+"} | ForEach-Object { $_ -match "now (?\d+\.\d+\.\d+)-" | Out-Null $Matches.version } @@ -22,7 +22,7 @@ function Get-FortranVersions { function Get-ClangVersions { $clangVersions = @() - $clangVersions = & apt list --installed | Where-Object { $_ -match "^clang-\d+"} | ForEach-Object { + $clangVersions = apt list --installed 2>&1 | Where-Object { $_ -match "^clang-\d+"} | ForEach-Object { $clangCommand = ($_ -Split "/")[0] Invoke-Expression "$clangCommand --version" | Where-Object { $_ -match "clang version" } | ForEach-Object { $_ -match "clang version (?\d+\.\d+\.\d+)-" | Out-Null @@ -40,7 +40,7 @@ function Get-ErlangVersion { } function Get-MonoVersion { - $monoVersion = $(mono --version) | Out-String | Take-OutputPart -Part 4 + $monoVersion = mono --version | Out-String | Take-OutputPart -Part 4 return "Mono $monoVersion" } @@ -62,16 +62,16 @@ function Get-Python3Version { } function Get-PowershellVersion { - $(pwsh --version) + return $(pwsh --version) } function Get-RubyVersion { - $rubyVersion = $(ruby --version) | Out-String | Take-OutputPart -Part 1 + $rubyVersion = ruby --version | Out-String | Take-OutputPart -Part 1 return "Ruby $rubyVersion" } function Get-SwiftVersion { - $swiftVersion = $(swift --version) | Out-String | Take-OutputPart -Part 2 + $swiftVersion = swift --version | Out-String | Take-OutputPart -Part 2 return "Swift $swiftVersion" } @@ -88,13 +88,13 @@ function Get-HomebrewVersion { } function Get-GemVersion { - $(gem --version) -match "(?\d+\.\d+\.\d+)" | Out-Null + $(gem --version 2>&1) -match "(?\d+\.\d+\.\d+)" | Out-Null $gemVersion = $Matches.version return "Gem $gemVersion" } function Get-MinicondaVersion { - $condaVersion = $(conda --version) + $condaVersion = conda --version return "Mini$condaVersion" } @@ -105,12 +105,12 @@ function Get-HelmVersion { } function Get-NpmVersion { - $npmVersion = $(npm --version) + $npmVersion = npm --version return "Npm $npmVersion" } function Get-YarnVersion { - $yarnVersion = $(yarn --version) + $yarnVersion = yarn --version return "Yarn $yarnVersion" } @@ -136,33 +136,33 @@ function Get-VcpkgVersion { } function Get-AntVersion { - $result = $(ant -version) | Out-String + $result = ant -version | Out-String $result -match "version (?\d+\.\d+\.\d+)" | Out-Null $antVersion = $Matches.version return "Ant $antVersion" } function Get-GradleVersion { - $result = $(gradle -v) | Out-String + $result = gradle -v | Out-String $result -match "Gradle (?\d+\.\d+\.\d+)" | Out-Null $gradleVersion = $Matches.version return "Gradle $gradleVersion" } function Get-MavenVersion { - $result = $(mvn -version) | Out-String + $result = mvn -version | Out-String $result -match "Apache Maven (?\d+\.\d+\.\d+)" | Out-Null $mavenVersion = $Matches.version return "Maven $mavenVersion" } function Get-SbtVersion { - $result = $(sbt -version) | Out-String + $result = sbt -version 2>&1 | Out-String $result -match "sbt script version: (?\d+\.\d+\.\d+)" | Out-Null $sbtVersion = $Matches.version return "Sbt $sbtVersion" } function Get-PHPVersions { - return $(apt list --installed) | Where-Object { $_ -match "^php\d+\.\d+/"} | ForEach-Object { + return $(apt list --installed 2>&1) | Where-Object { $_ -match "^php\d+\.\d+/"} | ForEach-Object { $_ -match "now (?\d+\.\d+\.\d+)-" | Out-Null $Matches.version } From 5b009f290af6e135c838bc109a742d2649a5d2d6 Mon Sep 17 00:00:00 2001 From: Aleksandr Chebotov Date: Mon, 14 Sep 2020 22:22:58 +0300 Subject: [PATCH 38/50] julia remove trailing line --- images/linux/scripts/SoftwareReport/SoftwareReport.Common.psm1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/images/linux/scripts/SoftwareReport/SoftwareReport.Common.psm1 b/images/linux/scripts/SoftwareReport/SoftwareReport.Common.psm1 index 14c6db9c0..f36ab2b20 100644 --- a/images/linux/scripts/SoftwareReport/SoftwareReport.Common.psm1 +++ b/images/linux/scripts/SoftwareReport/SoftwareReport.Common.psm1 @@ -76,7 +76,7 @@ function Get-SwiftVersion { } function Get-JuliaVersion { - $juliaVersion = $(julia --version) | Out-String | Take-OutputPart -Part 2 + $juliaVersion = julia --version | Take-OutputPart -Part 2 return "Julia $juliaVersion" } From 9afcb1503a1d367b713aafd3146c945d34fe70d7 Mon Sep 17 00:00:00 2001 From: Maxim Lobanov Date: Tue, 15 Sep 2020 08:36:03 +0300 Subject: [PATCH 39/50] fresh update from internal repository --- images/macos/provision/core/haskell.sh | 2 +- images/macos/provision/core/openssl.sh | 13 +++++++++---- .../software-report/SoftwareReport.Generator.ps1 | 2 +- images/macos/templates/macOS-10.13.json | 4 ++-- images/macos/toolsets/Toolset.Tests.ps1 | 2 +- images/macos/toolsets/toolset-10.15.json | 4 ++-- images/macos/toolsets/toolset-11.0.json | 12 ++++++------ 7 files changed, 22 insertions(+), 17 deletions(-) diff --git a/images/macos/provision/core/haskell.sh b/images/macos/provision/core/haskell.sh index 1c272b435..33fa38dbb 100644 --- a/images/macos/provision/core/haskell.sh +++ b/images/macos/provision/core/haskell.sh @@ -4,7 +4,7 @@ curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh export PATH="$HOME/.ghcup/bin:$PATH" echo 'export PATH="$PATH:$HOME/.ghcup/bin"' >> "$HOME/.bashrc" -availableVersions=$(ghcup list | grep "ghc " | awk '{print $3}') +availableVersions=$(ghcup list | grep -v "prerelease" | grep "ghc " | awk '{print $3}') minorMajorVersions=$(echo "$availableVersions" | cut -d"." -f 1,2 | uniq | tail -n3) for majorMinorVersion in $minorMajorVersions; do fullVersion=$(echo "$availableVersions" | grep "$majorMinorVersion." | tail -n1) diff --git a/images/macos/provision/core/openssl.sh b/images/macos/provision/core/openssl.sh index 7a0f3844c..3b66441c4 100755 --- a/images/macos/provision/core/openssl.sh +++ b/images/macos/provision/core/openssl.sh @@ -9,13 +9,18 @@ echo Installing OpenSSL... # Install OpenSSL 1.0.2t # https://www.openssl.org/policies/releasestrat.html - Version 1.0.2 will be supported until 2019-12-31 (LTS) # To preserve backward compatibility with ruby-toolcache -brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/8b9d6d688f483a0f33fcfc93d433de501b9c3513/Formula/openssl.rb +/usr/local/bin/brew tap-new local/openssl +FORMULA_PATH=$(/usr/local/bin/brew extract openssl local/openssl | grep "Homebrew/Library/Taps") +/usr/local/bin/brew install $FORMULA_PATH # Set OpenSSL 1.0.2t as default -ln -sf /usr/local/Cellar/openssl/1.*/bin/openssl /usr/local/bin/openssl +ln -sf /usr/local/Cellar/openssl@1.0.2t /usr/local/Cellar/openssl +ln -sf /usr/local/Cellar/openssl/1.0.2t/bin/openssl /usr/local/bin/openssl +rm /usr/local/opt/openssl +ln -sf ../Cellar/openssl/1.0.2t /usr/local/opt/openssl # Resolve dot net core openssl dependency issue for agent # https://github.com/microsoft/azure-pipelines-agent/blob/master/docs/start/envosx.md mkdir -p /usr/local/lib/ -ln -s /usr/local/opt/openssl*/lib/libcrypto.1.0.*.dylib /usr/local/lib/ -ln -s /usr/local/opt/openssl*/lib/libssl.1.0.*.dylib /usr/local/lib/ \ No newline at end of file +ln -s /usr/local/opt/openssl@1.0.2t/lib/libcrypto.1.0.0.dylib /usr/local/lib/ +ln -s /usr/local/opt/openssl@1.0.2t/lib/libssl.1.0.0.dylib /usr/local/lib/ \ No newline at end of file diff --git a/images/macos/software-report/SoftwareReport.Generator.ps1 b/images/macos/software-report/SoftwareReport.Generator.ps1 index 5d2984f6d..9627e24e1 100644 --- a/images/macos/software-report/SoftwareReport.Generator.ps1 +++ b/images/macos/software-report/SoftwareReport.Generator.ps1 @@ -178,7 +178,7 @@ if ($os.IsHigherThanMojave) { $markdown += New-MDNewLine # Tools -$fastlaneVersion = Run-Command "fastlane --version" | Select-String "fastlane [0-9]" | Take-Part -Part 1 +$fastlaneVersion = Run-Command "fastlane --version" | Select-String "^fastlane [0-9]" | Take-Part -Part 1 $cmakeVersion = Run-Command "cmake --version" | Select-Object -First 1 | Take-Part -Part 2 $appcenterCLIVersion = Run-Command "appcenter --version" | Take-Part -Part 2 $azureCLIVersion = Run-Command "az -v" | Select-String "^azure-cli" | Take-Part -Part 1 diff --git a/images/macos/templates/macOS-10.13.json b/images/macos/templates/macOS-10.13.json index 74a5e61d1..2190a6b4a 100644 --- a/images/macos/templates/macOS-10.13.json +++ b/images/macos/templates/macOS-10.13.json @@ -32,8 +32,8 @@ "vm_name": "{{user `build_id`}}", "ssh_username": "{{user `vm_username`}}", "ssh_password": "{{user `vm_password`}}", - "CPUs": "4", - "RAM": "12288", + "CPUs": "10", + "RAM": "24576", "NestedHV": "true", "shutdown_timeout": "15m" } diff --git a/images/macos/toolsets/Toolset.Tests.ps1 b/images/macos/toolsets/Toolset.Tests.ps1 index 12bbee49c..8e5b69ef2 100644 --- a/images/macos/toolsets/Toolset.Tests.ps1 +++ b/images/macos/toolsets/Toolset.Tests.ps1 @@ -1,6 +1,6 @@ Import-Module "$PSScriptRoot/../helpers/Tests.Helpers.psm1" -$toolsets = Get-ChildItem -Path $PSScriptRoot -Filter "toolset_*.json" +$toolsets = Get-ChildItem -Path $PSScriptRoot -Filter "toolset-*.json" function Get-ShortVersion([System.Version] $Version) { return [System.Version]::Parse($Version).ToString(2) diff --git a/images/macos/toolsets/toolset-10.15.json b/images/macos/toolsets/toolset-10.15.json index 21eb61a0d..c825865c7 100644 --- a/images/macos/toolsets/toolset-10.15.json +++ b/images/macos/toolsets/toolset-10.15.json @@ -6,9 +6,9 @@ ] }, "xamarin": { - "vsmac": "8.7.4.38", + "vsmac": "8.7.5.19", "mono-versions": [ - "6.12.0.90", "6.10.0.106", "6.8.0.123", "6.6.0.166", "6.4.0.208" + "6.12.0.93", "6.10.0.106", "6.8.0.123", "6.6.0.166", "6.4.0.208" ], "ios-versions": [ "13.20.2.2", "13.18.2.1", "13.16.0.13", "13.14.1.39", "13.10.0.21", "13.8.3.0", "13.6.0.12", "13.4.0.2", "13.2.0.47" diff --git a/images/macos/toolsets/toolset-11.0.json b/images/macos/toolsets/toolset-11.0.json index 5a8f8ee57..bab2c6f92 100644 --- a/images/macos/toolsets/toolset-11.0.json +++ b/images/macos/toolsets/toolset-11.0.json @@ -1,14 +1,14 @@ { "xcode": { - "default": "11.6", + "default": "11.7", "versions": [ - "12_beta", "11.6" + "12_beta", "11.7" ] }, "xamarin": { - "vsmac": "8.7.1.15", + "vsmac": "8.7.5.19", "mono-versions": [ - "6.12.0.90", "6.10.0.106" + "6.12.0.93", "6.10.0.106" ], "ios-versions": [ "13.20.2.2", "13.18.2.1" @@ -17,7 +17,7 @@ "6.20.2.2", "6.18.3.2" ], "android-versions": [ - "11.0.0.3", "10.3.1.4" + "11.0.2.0", "10.3.1.4" ], "bundle-default": "latest", "bundles": [ @@ -48,7 +48,7 @@ "android-30", "android-29", "android-28", "android-27" ], "build-tools": [ - "30.0.1", "30.0.0", "29.0.3", "29.0.2", "29.0.1", "29.0.0", "28.0.3", "28.0.2", "28.0.1", "28.0.0", "27.0.3", "27.0.2", "27.0.1", "27.0.0" + "30.0.2", "30.0.1", "30.0.0", "29.0.3", "29.0.2", "29.0.1", "29.0.0", "28.0.3", "28.0.2", "28.0.1", "28.0.0", "27.0.3", "27.0.2", "27.0.1", "27.0.0" ], "extra-list": [ "android;m2repository", "google;m2repository", "google;google_play_services", "intel;Hardware_Accelerated_Execution_Manager" From 4a07ea61a8d7d558b29ad088e4621561426859b6 Mon Sep 17 00:00:00 2001 From: Aleksandr Chebotov Date: Tue, 15 Sep 2020 09:20:45 +0300 Subject: [PATCH 40/50] fix gem output --- images/linux/scripts/SoftwareReport/SoftwareReport.Common.psm1 | 3 ++- images/linux/scripts/SoftwareReport/SoftwareReport.Rust.psm1 | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/images/linux/scripts/SoftwareReport/SoftwareReport.Common.psm1 b/images/linux/scripts/SoftwareReport/SoftwareReport.Common.psm1 index f36ab2b20..64a9d1c3f 100644 --- a/images/linux/scripts/SoftwareReport/SoftwareReport.Common.psm1 +++ b/images/linux/scripts/SoftwareReport/SoftwareReport.Common.psm1 @@ -88,7 +88,8 @@ function Get-HomebrewVersion { } function Get-GemVersion { - $(gem --version 2>&1) -match "(?\d+\.\d+\.\d+)" | Out-Null + $result = Get-CommandResult "gem --version" + $result.Output -match "(?\d+\.\d+\.\d+)" | Out-Null $gemVersion = $Matches.version return "Gem $gemVersion" } diff --git a/images/linux/scripts/SoftwareReport/SoftwareReport.Rust.psm1 b/images/linux/scripts/SoftwareReport/SoftwareReport.Rust.psm1 index 640ad2cf8..e822a5c38 100644 --- a/images/linux/scripts/SoftwareReport/SoftwareReport.Rust.psm1 +++ b/images/linux/scripts/SoftwareReport/SoftwareReport.Rust.psm1 @@ -2,6 +2,7 @@ function Initialize-RustEnvironment { ln -sf "/usr/share/rust/.rustup" $HOME/.rustup ln -sf "/usr/share/rust/.cargo" $HOME/.cargo } + function Get-RustVersion { Initialize-RustEnvironment $rustVersion = $(rustc --version) | Take-OutputPart -Part 1 From e703a5e0bce9f7a402b3235fff4567ac011d9f21 Mon Sep 17 00:00:00 2001 From: Vladimir Safonkin Date: Tue, 15 Sep 2020 12:25:51 +0300 Subject: [PATCH 41/50] Add approve by Actions bot to software docs PR (#1582) * Add approve to software docs PR by Actions bot * Minor fix --- .github/workflows/create_github_release.yml | 2 +- .github/workflows/create_pull_request.yml | 2 +- .github/workflows/merge_pull_request.yml | 17 +++++++++++++++-- .github/workflows/update_github_release.yml | 2 +- 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/.github/workflows/create_github_release.yml b/.github/workflows/create_github_release.yml index 95e738155..f7ae5fccb 100644 --- a/.github/workflows/create_github_release.yml +++ b/.github/workflows/create_github_release.yml @@ -6,7 +6,7 @@ on: jobs: - build: + Create_GitHub_release: runs-on: ubuntu-latest steps: diff --git a/.github/workflows/create_pull_request.yml b/.github/workflows/create_pull_request.yml index e96085ad5..cff80e9d6 100644 --- a/.github/workflows/create_pull_request.yml +++ b/.github/workflows/create_pull_request.yml @@ -6,7 +6,7 @@ on: jobs: - build: + Create_pull_request: runs-on: ubuntu-latest steps: diff --git a/.github/workflows/merge_pull_request.yml b/.github/workflows/merge_pull_request.yml index 974082c12..c1d18cd44 100644 --- a/.github/workflows/merge_pull_request.yml +++ b/.github/workflows/merge_pull_request.yml @@ -6,7 +6,7 @@ on: jobs: - build: + Merge_pull_request: runs-on: ubuntu-latest steps: @@ -23,6 +23,18 @@ jobs: git push origin ${{ github.event.client_payload.ReleaseBranchName }}-docs sleep 30 + - name: Approve pull request by GitHub-Actions bot + uses: actions/github-script@v2 + with: + github-token: ${{secrets.GITHUB_TOKEN}} + script: | + github.pulls.createReview({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: ${{ github.event.client_payload.PullRequestNumber }}, + event: "APPROVE" + }); + - name: Merge pull request for ${{ github.event.client_payload.ReleaseBranchName }} uses: actions/github-script@v2 with: @@ -31,7 +43,8 @@ jobs: github.pulls.merge({ owner: context.repo.owner, repo: context.repo.repo, - pull_number: ${{ github.event.client_payload.PullRequestNumber }} + pull_number: ${{ github.event.client_payload.PullRequestNumber }}, + merge_method: "squash" }) - name: Delete docs branch ${{ github.event.client_payload.ReleaseBranchName }}-docs diff --git a/.github/workflows/update_github_release.yml b/.github/workflows/update_github_release.yml index e6593ae98..0ea6d3020 100644 --- a/.github/workflows/update_github_release.yml +++ b/.github/workflows/update_github_release.yml @@ -6,7 +6,7 @@ on: jobs: - build: + Update_GitHub_release: runs-on: ubuntu-latest steps: From 5bdcf8b9494ddcea25b76caeb1ab3fd2c0fca90a Mon Sep 17 00:00:00 2001 From: Dmitry Shibanov Date: Tue, 15 Sep 2020 12:33:12 +0300 Subject: [PATCH 42/50] add fix for dotnet --- images/win/scripts/Installers/Install-DotnetSDK.ps1 | 2 +- images/win/scripts/Tests/DotnetSDK.Tests.ps1 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/images/win/scripts/Installers/Install-DotnetSDK.ps1 b/images/win/scripts/Installers/Install-DotnetSDK.ps1 index 5b3cec5b4..7b91c7aca 100644 --- a/images/win/scripts/Installers/Install-DotnetSDK.ps1 +++ b/images/win/scripts/Installers/Install-DotnetSDK.ps1 @@ -62,7 +62,7 @@ function InstallAllValidSdks() # Consider all channels except preview/eol channels. # Sort the channels in ascending order - $dotnetChannels = $dotnetChannels.'releases-index' | Where-Object { (!$_."support-phase".Equals('preview') -and !$_."support-phase".Equals('eol')) } | Sort-Object { [Version] $_."channel-version" } + $dotnetChannels = $dotnetChannels.'releases-index' | Where-Object { (!$_."support-phase".Equals('preview') -and !$_."support-phase".Equals('eol') -and !$_."support-phase".Equals('rc')) } | Sort-Object { [Version] $_."channel-version" } # Download installation script. $installationName = "dotnet-install.ps1" diff --git a/images/win/scripts/Tests/DotnetSDK.Tests.ps1 b/images/win/scripts/Tests/DotnetSDK.Tests.ps1 index 1598b337c..373e1d47f 100644 --- a/images/win/scripts/Tests/DotnetSDK.Tests.ps1 +++ b/images/win/scripts/Tests/DotnetSDK.Tests.ps1 @@ -1,6 +1,6 @@ $releaseIndexUrl = "https://raw.githubusercontent.com/dotnet/core/master/release-notes/releases-index.json" $dotnetChannels = (New-Object system.net.webclient).DownloadString($releaseIndexUrl) | ConvertFrom-Json -$dotnetVersions = $dotnetChannels.'releases-index' | Where-Object { (!$_."support-phase".Equals('preview') -and !$_."support-phase".Equals('eol')) } | Select-Object -ExpandProperty "channel-version" +$dotnetVersions = $dotnetChannels.'releases-index' | Where-Object { (!$_."support-phase".Equals('preview') -and !$_."support-phase".Equals('eol') -and !$_."support-phase".Equals('rc')) } | Select-Object -ExpandProperty "channel-version" Describe "Dotnet SDK" { From 46fdad5e60e1895f97b10436f35e1ab7202d2efe Mon Sep 17 00:00:00 2001 From: Aleksandr Chebotov Date: Wed, 16 Sep 2020 10:42:16 +0300 Subject: [PATCH 43/50] fix android and docker sections --- .../SoftwareReport/SoftwareReport.Android.psm1 | 12 ++++++------ .../SoftwareReport/SoftwareReport.Generator.ps1 | 2 +- .../scripts/SoftwareReport/SoftwareReport.Tools.psm1 | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/images/linux/scripts/SoftwareReport/SoftwareReport.Android.psm1 b/images/linux/scripts/SoftwareReport/SoftwareReport.Android.psm1 index 7f34143a9..a3504171c 100644 --- a/images/linux/scripts/SoftwareReport/SoftwareReport.Android.psm1 +++ b/images/linux/scripts/SoftwareReport/SoftwareReport.Android.psm1 @@ -52,6 +52,10 @@ function Build-AndroidTable { "Package" = "Google APIs" "Version" = Get-AndroidGoogleAPIsVersions -PackageInfo $packageInfo }, + @{ + "Package" = "NDK" + "Version" = Get-AndroidPackageVersions -PackageInfo $packageInfo -MatchedString "ndk-bundle" + }, @{ "Package" = "Android Support Repository" "Version" = Get-AndroidPackageVersions -PackageInfo $packageInfo -MatchedString "Android Support Repository" @@ -71,16 +75,12 @@ function Build-AndroidTable { @{ "Package" = "CMake" "Version" = Get-AndroidPackageVersions -PackageInfo $packageInfo -MatchedString "cmake" - }, - @{ - "Package" = "NDK" - "Version" = Get-AndroidPackageVersions -PackageInfo $packageInfo -MatchedString "ndk-bundle" } ) | Where-Object { $_.Version } | ForEach-Object { [PSCustomObject] @{ "Package Name" = $_.Package "Version" = $_.Version - } + } } } @@ -109,7 +109,7 @@ function Get-AndroidPlatformVersions { $packageInfoParts = Split-TableRowByColumns $_ $revision = $packageInfoParts[1] $version = $packageInfoParts[0].split(";")[1] - return "$version, (rev $revision)" + return "$version (rev $revision)" } [array]::Reverse($versions) return ($versions -Join "
") diff --git a/images/linux/scripts/SoftwareReport/SoftwareReport.Generator.ps1 b/images/linux/scripts/SoftwareReport/SoftwareReport.Generator.ps1 index e0acc6bde..73a8d63e7 100644 --- a/images/linux/scripts/SoftwareReport/SoftwareReport.Generator.ps1 +++ b/images/linux/scripts/SoftwareReport/SoftwareReport.Generator.ps1 @@ -79,8 +79,8 @@ $toolsList = @( (Get-BazeliskVersion), (Get-CMakeVersion), (Get-CurlVersion), - (Get-DockerComposeVersion), (Get-DockerMobyVersion), + (Get-DockerComposeVersion), (Get-DockerBuildxVersion), (Get-GitVersion), (Get-GitLFSVersion), diff --git a/images/linux/scripts/SoftwareReport/SoftwareReport.Tools.psm1 b/images/linux/scripts/SoftwareReport/SoftwareReport.Tools.psm1 index a76c17f9b..dcb121f61 100644 --- a/images/linux/scripts/SoftwareReport/SoftwareReport.Tools.psm1 +++ b/images/linux/scripts/SoftwareReport/SoftwareReport.Tools.psm1 @@ -10,12 +10,12 @@ function Get-AnsibleVersion { function Get-AzCopy7Version { $azcopy7Version = azcopy --version | Take-OutputPart -Part 1 | Take-OutputPart -Part 0 -Delimiter "-" - return "AzCopy7 (available by azcopy alias) $azcopy7Version" + return "AzCopy7 $azcopy7Version (available by ``azcopy`` alias)" } function Get-AzCopy10Version { $azcopy10Version = azcopy10 --version | Take-OutputPart -Part 2 - return "AzCopy10 (available by azcopy10 alias) $azcopy10Version" + return "AzCopy10 $azcopy10Version (available by ``azcopy10`` alias)" } function Get-BazelVersion { From 2d3a3d4f3d51db151893250736dbfd6cb25a8c0c Mon Sep 17 00:00:00 2001 From: Maxim Lobanov Date: Wed, 16 Sep 2020 11:43:50 +0300 Subject: [PATCH 44/50] update documentation --- .github/pull_request_template.md | 2 ++ CONTRIBUTING.md | 3 ++- README.md | 3 ++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 54085c9b9..d0997a0c2 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -3,6 +3,8 @@ New tool, Bug fixing, or Improvement? Please include a summary of the change and which issue is fixed. Also include relevant motivation and context. **For new tools, please provide total size and installation time.** + + #### Related issue: ## Check list diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index af608840b..e35a3c829 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -51,7 +51,8 @@ Add `Invoke-PesterTests -TestFile [-TestName ]` at - Use `DocumentInstalledItem ""` helper for building documentation. ### macOS -We are in the process of preparing our macOS source to live in this repo so we can take contributions from the community. Until then, we appreciate your patience and ask you continue to make tool requests by filing issues. +MacOS source lives in this repository and available for everyone. However, MacOS image-generation CI doesn't support external contributions yet so we are not ready to accept pull-requests for now. +We are in the process of preparing MacOS CI to accept contributions. Until then, we appreciate your patience and ask you continue to make tool requests by filing issues. ## Resources diff --git a/README.md b/README.md index dc30f2668..1df8ea4ed 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,8 @@ The "ubuntu-latest" YAML workflow label still uses the Ubuntu 18.04 virtual envi ***Looking for other Linux distributions?*** We do not plan to offer other Linux distributions. We recommend using Docker if you'd like to build using other distributions with the hosted virtual environments. Alternatively, you can leverage [self-hosted runners] and fully customize your environment to your needs. -***Where is the macOS source?*** We are in the process of preparing our macOS source to live in this repo so we can take contributions from the community. Until then, we appreciate your patience and ask you continue to make tool requests by filing issues. +***How to contribute to macOS source?*** MacOS source lives in this repository and available for everyone. However, MacOS image-generation CI doesn't support external contributions yet so we are not ready to accept pull-requests for now. +We are in the process of preparing MacOS CI to accept contributions. Until then, we appreciate your patience and ask you continue to make tool requests by filing issues. ## Software Guidelines In general, these are the guidelines we consider when deciding what to pre-install: From 15b5f5fe6759e428d837399596c5966403f22cc1 Mon Sep 17 00:00:00 2001 From: Maxim Lobanov Date: Wed, 16 Sep 2020 13:25:16 +0300 Subject: [PATCH 45/50] MacOS -> macOS --- CONTRIBUTING.md | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e35a3c829..021fbc2fa 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -51,7 +51,7 @@ Add `Invoke-PesterTests -TestFile [-TestName ]` at - Use `DocumentInstalledItem ""` helper for building documentation. ### macOS -MacOS source lives in this repository and available for everyone. However, MacOS image-generation CI doesn't support external contributions yet so we are not ready to accept pull-requests for now. +macOS source lives in this repository and available for everyone. However, MacOS image-generation CI doesn't support external contributions yet so we are not ready to accept pull-requests for now. We are in the process of preparing MacOS CI to accept contributions. Until then, we appreciate your patience and ask you continue to make tool requests by filing issues. ## Resources diff --git a/README.md b/README.md index 1df8ea4ed..934fcb446 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ The "ubuntu-latest" YAML workflow label still uses the Ubuntu 18.04 virtual envi ***Looking for other Linux distributions?*** We do not plan to offer other Linux distributions. We recommend using Docker if you'd like to build using other distributions with the hosted virtual environments. Alternatively, you can leverage [self-hosted runners] and fully customize your environment to your needs. -***How to contribute to macOS source?*** MacOS source lives in this repository and available for everyone. However, MacOS image-generation CI doesn't support external contributions yet so we are not ready to accept pull-requests for now. +***How to contribute to macOS source?*** macOS source lives in this repository and available for everyone. However, MacOS image-generation CI doesn't support external contributions yet so we are not ready to accept pull-requests for now. We are in the process of preparing MacOS CI to accept contributions. Until then, we appreciate your patience and ask you continue to make tool requests by filing issues. ## Software Guidelines From 6e62e32b9713809bfa0a7f13a373d45a734ebd19 Mon Sep 17 00:00:00 2001 From: Maxim Lobanov Date: Wed, 16 Sep 2020 13:41:49 +0300 Subject: [PATCH 46/50] Update CONTRIBUTING.md --- CONTRIBUTING.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 021fbc2fa..927ae8724 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -31,7 +31,7 @@ Here are a few things you can do that will increase the likelihood of your pull ## How to add new tool ### General rules - For every new tool add validation scripts and update software report script to make sure that it is included to documentation -- If the tool is available in other platforms (MacOS, Windows, Linux), make sure you include it in as many as possible. +- If the tool is available in other platforms (macOS, Windows, Linux), make sure you include it in as many as possible. - If installing a few versions of the tool, consider putting the list of versions in the corresponding `toolset.json` file. It will help other customers to configure their builds flexibly. See [toolset-windows-2016.json](images/win/toolsets/toolset-2019.json) as example. - Use consistent naming across all files - Validation scripts should be simple and shouldn't change image content @@ -51,8 +51,8 @@ Add `Invoke-PesterTests -TestFile [-TestName ]` at - Use `DocumentInstalledItem ""` helper for building documentation. ### macOS -macOS source lives in this repository and available for everyone. However, MacOS image-generation CI doesn't support external contributions yet so we are not ready to accept pull-requests for now. -We are in the process of preparing MacOS CI to accept contributions. Until then, we appreciate your patience and ask you continue to make tool requests by filing issues. +macOS source lives in this repository and available for everyone. However, macOS image-generation CI doesn't support external contributions yet so we are not ready to accept pull-requests for now. +We are in the process of preparing macOS CI to accept contributions. Until then, we appreciate your patience and ask you continue to make tool requests by filing issues. ## Resources From 219bfe0d1f60f456e5e992d7224a34a5a4d97d3b Mon Sep 17 00:00:00 2001 From: Maxim Lobanov Date: Wed, 16 Sep 2020 16:37:30 +0300 Subject: [PATCH 47/50] fix comments --- .github/pull_request_template.md | 2 +- CONTRIBUTING.md | 2 +- README.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index d0997a0c2..d815d34fd 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -3,7 +3,7 @@ New tool, Bug fixing, or Improvement? Please include a summary of the change and which issue is fixed. Also include relevant motivation and context. **For new tools, please provide total size and installation time.** - + #### Related issue: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 927ae8724..f0d8d4ec7 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -51,7 +51,7 @@ Add `Invoke-PesterTests -TestFile [-TestName ]` at - Use `DocumentInstalledItem ""` helper for building documentation. ### macOS -macOS source lives in this repository and available for everyone. However, macOS image-generation CI doesn't support external contributions yet so we are not ready to accept pull-requests for now. +macOS source lives in this repository and available for everyone. However, macOS image-generation CI doesn't support external contributions yet so we are not able to accept pull-requests for now. We are in the process of preparing macOS CI to accept contributions. Until then, we appreciate your patience and ask you continue to make tool requests by filing issues. ## Resources diff --git a/README.md b/README.md index 934fcb446..b3c596491 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ The "ubuntu-latest" YAML workflow label still uses the Ubuntu 18.04 virtual envi ***Looking for other Linux distributions?*** We do not plan to offer other Linux distributions. We recommend using Docker if you'd like to build using other distributions with the hosted virtual environments. Alternatively, you can leverage [self-hosted runners] and fully customize your environment to your needs. -***How to contribute to macOS source?*** macOS source lives in this repository and available for everyone. However, MacOS image-generation CI doesn't support external contributions yet so we are not ready to accept pull-requests for now. +***How to contribute to macOS source?*** macOS source lives in this repository and available for everyone. However, MacOS image-generation CI doesn't support external contributions yet so we are not able to accept pull-requests for now. We are in the process of preparing MacOS CI to accept contributions. Until then, we appreciate your patience and ask you continue to make tool requests by filing issues. ## Software Guidelines From 063bc445b9275b1ab865ced0983a4b76be89b6c3 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 17 Sep 2020 11:35:15 +0300 Subject: [PATCH 48/50] Updating readme file for macos-10.15 version 20200913.1 (#1597) Co-authored-by: no-reply@microsoft.com Co-authored-by: Actions service account --- images/macos/macos-10.15-Readme.md | 78 ++++++++++++++---------------- 1 file changed, 37 insertions(+), 41 deletions(-) diff --git a/images/macos/macos-10.15-Readme.md b/images/macos/macos-10.15-Readme.md index 3c57b80b5..e103a50e3 100644 --- a/images/macos/macos-10.15-Readme.md +++ b/images/macos/macos-10.15-Readme.md @@ -1,11 +1,7 @@ -| Announcements | -|-| -| [Xcode 11.7 will be set as a default one on September, 9](https://github.com/actions/virtual-environments/issues/1537) | -*** # macOS 10.15 info - System Version: macOS 10.15.6 (19G2021) - Kernel Version: Darwin 19.6.0 -- Image Version: 20200903.1 +- Image Version: 20200913.1 ## Installed Software ### Language and Runtime @@ -16,13 +12,13 @@ - GNU Fortran (Homebrew GCC 9.3.0) 9.3.0 — available by `gfortran-9` alias - Node.js v12.18.3 - NVM 0.35.3 -- NVM - Cached node versions: v6.17.1 v8.17.0 v10.22.0 v12.18.3 v13.14.0 v14.9.0 +- NVM - Cached node versions: v6.17.1 v8.17.0 v10.22.0 v12.18.3 v13.14.0 v14.10.1 - Python 2.7.17 - Python 3.8.5 - Ruby 2.6.6p146 -- .NET SDK 2.1.300 2.1.301 2.1.302 2.1.401 2.1.402 2.1.403 2.1.500 2.1.502 2.1.503 2.1.504 2.1.505 2.1.506 2.1.507 2.1.602 2.1.603 2.1.604 2.1.607 2.1.700 2.1.701 2.1.801 2.1.802 2.1.803 2.1.804 2.1.805 2.1.806 2.1.807 2.1.808 2.1.809 3.0.100 3.0.101 3.0.102 3.0.103 3.1.100 3.1.101 3.1.200 3.1.201 3.1.300 3.1.301 3.1.302 3.1.401 +- .NET SDK 2.1.300 2.1.301 2.1.302 2.1.401 2.1.402 2.1.403 2.1.500 2.1.502 2.1.503 2.1.504 2.1.505 2.1.506 2.1.507 2.1.602 2.1.603 2.1.604 2.1.607 2.1.700 2.1.701 2.1.801 2.1.802 2.1.803 2.1.804 2.1.805 2.1.806 2.1.807 2.1.808 2.1.809 2.1.810 3.0.100 3.0.101 3.0.102 3.0.103 3.1.100 3.1.101 3.1.200 3.1.201 3.1.300 3.1.301 3.1.302 3.1.401 3.1.402 - R 4.0.2 -- Go 1.15 +- Go 1.15.2 - PHP 7.4.10 - julia 1.5.1 @@ -31,7 +27,7 @@ - Bundler version 2.1.4 - Carthage 0.35.0 - CocoaPods 1.9.3 -- Homebrew 2.4.16 +- Homebrew 2.5.0 - NPM 6.14.6 - Yarn 1.22.5 - NuGet 5.6.0.6489 @@ -39,7 +35,7 @@ - Pip 20.1.1 (python 3.8) - Miniconda 4.8.3 - RubyGems 3.1.4 -- Composer 1.10.10 +- Composer 1.10.13 ### Project Management - Apache Maven 3.6.3 @@ -50,15 +46,15 @@ - Curl 7.72.0 - Git: 2.28.0 - Git LFS: 2.12.0 -- GitHub CLI: 0.11.1 +- GitHub CLI: 0.12.0 - Hub CLI: 2.14.2 - GNU Wget 1.20.3 - Subversion (SVN) 1.14.0 - Packer 1.6.2 - GNU parallel 20200722 -- OpenSSL 1.0.2t 10 Sep 2019 `(/usr/local/opt/openssl -> /usr/local/Cellar/openssl/1.0.2t)` +- OpenSSL 1.0.2t 10 Sep 2019 `(/usr/local/opt/openssl -> /usr/local/Cellar/openssl@1.0.2t/1.0.2t)` - jq 1.6 -- gpg (GnuPG) 2.2.22 +- gpg (GnuPG) 2.2.23 - psql (PostgreSQL) 12.4 - PostgreSQL 12.4 - aria2 1.35.0 @@ -67,7 +63,7 @@ - bazel 3.5.0 - bazelisk 1.6.1 - helm v3.3.1+g249e521 -- virtualbox 6.1.12r139181 +- virtualbox 6.1.14r140239 - mongo v4.4.0 - mongod v4.4.0 - Vagrant 2.2.10 @@ -76,30 +72,30 @@ ### Tools -- Fastlane 2.157.2 +- Fastlane 2.159.0 - Cmake 3.18.2 -- App Center CLI 2.6.7 +- App Center CLI 2.7.0 - Azure CLI 2.11.1 -- AWS CLI 2.0.44 +- AWS CLI 2.0.48 - AWS SAM CLI 1.2.0 - AWS Session Manager CLI 1.1.61.0 - Aliyun CLI 3.0.56 - GHCup v0.1.10 -- GHC 9.0.0 +- GHC 8.10.2 - Cabal 3.2.0.0 - Stack 2.3.3 ### Linters - yamllint 1.24.2 -- SwiftLint 0.40.1 +- SwiftLint 0.40.2 ### Browsers - Safari 13.1.2 (15609.3.5.1.3) - SafariDriver 13.1.2 (15609.3.5.1.3) -- Google Chrome 85.0.4183.83 +- Google Chrome 85.0.4183.102 - ChromeDriver 85.0.4183.87 -- Microsoft Edge 85.0.564.44 -- MSEdgeDriver 85.0.564.44 +- Microsoft Edge 85.0.564.51 +- MSEdgeDriver 85.0.564.51 - Mozilla Firefox 80.0.1 - geckodriver 0.27.0 @@ -121,7 +117,7 @@ #### Python - 2.7.18 -- 3.5.9 +- 3.5.10 - 3.6.12 - 3.7.9 - 3.8.5 @@ -134,14 +130,14 @@ - 8.17.0 - 10.22.0 - 12.18.3 -- 14.9.0 +- 14.10.1 #### Go - 1.11.13 - 1.12.17 - 1.13.15 -- 1.14.8 -- 1.15.1 +- 1.14.9 +- 1.15.2 ### Rust Tools - Rust 1.46.0 @@ -165,10 +161,10 @@ ### Xamarin #### Visual Studio for Mac -- 8.7.4.38 +- 8.7.5.19 #### Mono -- 6.12.0.90 +- 6.12.0.93 - 6.10.0.106 - 6.8.0.123 - 6.6.0.166 @@ -207,19 +203,19 @@ - NUnit 3.6.1 ### Xcode -| Version | Build | Path | -| -------------- | -------- | ------------------------------- | -| 12.0 (beta) | 12A8189n | /Applications/Xcode_12_beta.app | -| 11.7 (default) | 11E801a | /Applications/Xcode_11.7.app | -| 11.6 | 11E708 | /Applications/Xcode_11.6.app | -| 11.5 | 11E608c | /Applications/Xcode_11.5.app | -| 11.4.1 | 11E503a | /Applications/Xcode_11.4.1.app | -| 11.4 | 11E146 | /Applications/Xcode_11.4.app | -| 11.3.1 | 11C505 | /Applications/Xcode_11.3.1.app | -| 11.2.1 | 11B500 | /Applications/Xcode_11.2.1.app | -| 11.1 | 11A1027 | /Applications/Xcode_11.1.app | -| 11.0 | 11A420a | /Applications/Xcode_11.app | -| 10.3 | 10G8 | /Applications/Xcode_10.3.app | +| Version | Build | Path | +| -------------- | -------- | ------------------------------ | +| 12.0 | 12A8189n | /Applications/Xcode_12.app | +| 11.7 (default) | 11E801a | /Applications/Xcode_11.7.app | +| 11.6 | 11E708 | /Applications/Xcode_11.6.app | +| 11.5 | 11E608c | /Applications/Xcode_11.5.app | +| 11.4.1 | 11E503a | /Applications/Xcode_11.4.1.app | +| 11.4 | 11E146 | /Applications/Xcode_11.4.app | +| 11.3.1 | 11C505 | /Applications/Xcode_11.3.1.app | +| 11.2.1 | 11B500 | /Applications/Xcode_11.2.1.app | +| 11.1 | 11A1027 | /Applications/Xcode_11.1.app | +| 11.0 | 11A420a | /Applications/Xcode_11.app | +| 10.3 | 10G8 | /Applications/Xcode_10.3.app | #### Xcode Support Tools - Nomad CLI 3.1.4 From 1abf54f6c1519fcc6cd665e58802b436421f7385 Mon Sep 17 00:00:00 2001 From: Alena Sviridenko Date: Thu, 17 Sep 2020 14:14:54 +0300 Subject: [PATCH 49/50] updated Ubuntu contribution guide (#1602) --- CONTRIBUTING.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f0d8d4ec7..cce174ef1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -38,17 +38,18 @@ Here are a few things you can do that will increase the likelihood of your pull ### Windows - Add a script that will install the tool and put the script in the `scripts/Installers` folder. -There are a bunch of helper functions that could simplify your code: `Choco-Install`, `Install-Binary`, `Install-VsixExtension`, ` Start-DownloadWithRetry`, `Test-IsWin16`, ` Test-IsWin19` (find the full list of helpers in [ImageHelpers.psm1](images/win/scripts/ImageHelpers/ImageHelpers.psm1)). +There are a bunch of helper functions that could simplify your code: `Choco-Install`, `Install-Binary`, `Install-VsixExtension`, `Start-DownloadWithRetry`, `Test-IsWin16`, `Test-IsWin19` (find the full list of helpers in [ImageHelpers.psm1](images/win/scripts/ImageHelpers/ImageHelpers.psm1)). - Add a script that will validate the tool installation and put the script in the `scripts/Tests` folder. We use [Pester v5](https://github.com/pester/pester) for validation scripts. If the tests for the tool are complex enough, create a separate `*.Tests.ps1`. Otherwise, use `Tools.Tests.ps1` for simple tests. Add `Invoke-PesterTests -TestFile [-TestName ]` at the end of the installation script to make sure that your tests will be run. - Add changes to the software report generator `images/win/scripts/SoftwareReport/SoftwareReport.Generator.ps1`. The software report generator is used to generate an image's README file, e.g. [Windows2019-Readme.md](images/win/Windows2019-Readme.md) and uses [MarkdownPS](https://github.com/Sarafian/MarkdownPS). ### Ubuntu -- Add a single script that will install, validate, and document the tool and put the script in the `script/Installers` folder. Use existing scripts such as [github-cli.sh](images/linux/scripts/installers/github-cli.sh) as a starting point. +- Add script that will install and validate the tool and put the script in the `scripts/installers` folder. +Use existing scripts such as [github-cli.sh](images/linux/scripts/installers/github-cli.sh) as a starting point. - Use [helpers](images/linux/scripts/helpers/install.sh) to simplify installation process. - Validation part should `exit 1` if any issue with installation. - - Use `DocumentInstalledItem ""` helper for building documentation. +- Add changes to the software report generator `images/linux/scripts/SoftwareReport/SoftwareReport.Generator.ps1`. The software report generator is used to generate an image's README file, e.g. [Ubuntu1804-Readme.md](images/linux/Ubuntu1804-README.md) and it uses [MarkdownPS](https://github.com/Sarafian/MarkdownPS). ### macOS macOS source lives in this repository and available for everyone. However, macOS image-generation CI doesn't support external contributions yet so we are not able to accept pull-requests for now. From 7b3bfbdf61e1833e3409f1b44afc3cff42c36731 Mon Sep 17 00:00:00 2001 From: Vladimir Safonkin Date: Thu, 17 Sep 2020 14:15:31 +0300 Subject: [PATCH 50/50] [Ubuntu] Remove docs logic from Ubuntu provisioner (#1603) * Remove docs logic on Ubuntu * Cleanup templates * Fix oras-cli.sh * Remove announcements.md --- images/linux/announcements.md | 0 images/linux/scripts/helpers/document.sh | 42 ------------------- images/linux/scripts/installers/7-zip.sh | 6 --- .../scripts/installers/Validate-Toolset.ps1 | 4 -- images/linux/scripts/installers/aliyun-cli.sh | 7 ---- images/linux/scripts/installers/android.sh | 32 -------------- images/linux/scripts/installers/ansible.sh | 5 --- .../linux/scripts/installers/aws-sam-cli.sh | 6 --- images/linux/scripts/installers/aws.sh | 7 ---- images/linux/scripts/installers/azcopy.sh | 9 ---- .../linux/scripts/installers/azpowershell.sh | 7 ---- images/linux/scripts/installers/azure-cli.sh | 5 --- .../scripts/installers/azure-devops-cli.sh | 5 --- images/linux/scripts/installers/basic.sh | 9 ---- images/linux/scripts/installers/bazel.sh | 9 ---- .../scripts/installers/build-essential.sh | 7 +--- images/linux/scripts/installers/clang.sh | 6 --- images/linux/scripts/installers/cmake.sh | 6 --- images/linux/scripts/installers/containers.sh | 10 ----- .../scripts/installers/docker-compose.sh | 6 --- .../linux/scripts/installers/docker-moby.sh | 16 ------- .../scripts/installers/dotnetcore-sdk.sh | 3 -- images/linux/scripts/installers/erlang.sh | 7 ---- images/linux/scripts/installers/example.sh | 6 --- images/linux/scripts/installers/firefox.sh | 13 ------ images/linux/scripts/installers/gcc.sh | 6 --- images/linux/scripts/installers/gfortran.sh | 6 --- images/linux/scripts/installers/git.sh | 10 ----- images/linux/scripts/installers/github-cli.sh | 6 --- .../linux/scripts/installers/google-chrome.sh | 9 ---- .../scripts/installers/google-cloud-sdk.sh | 6 --- images/linux/scripts/installers/haskell.sh | 7 ---- images/linux/scripts/installers/heroku.sh | 6 --- images/linux/scripts/installers/hhvm.sh | 5 --- images/linux/scripts/installers/homebrew.sh | 5 --- .../scripts/installers/hosted-tool-cache.sh | 8 ---- .../linux/scripts/installers/image-magick.sh | 6 --- images/linux/scripts/installers/java-tools.sh | 18 -------- images/linux/scripts/installers/julia.sh | 6 --- images/linux/scripts/installers/kind.sh | 6 --- .../scripts/installers/kubernetes-tools.sh | 11 ----- images/linux/scripts/installers/leiningen.sh | 6 --- images/linux/scripts/installers/mercurial.sh | 5 --- images/linux/scripts/installers/miniconda.sh | 6 --- images/linux/scripts/installers/mongodb.sh | 5 --- images/linux/scripts/installers/mono.sh | 7 ---- images/linux/scripts/installers/mysql.sh | 9 ---- images/linux/scripts/installers/netlify.sh | 6 --- images/linux/scripts/installers/nodejs.sh | 15 ------- images/linux/scripts/installers/nvm.sh | 4 -- images/linux/scripts/installers/oc.sh | 7 +--- images/linux/scripts/installers/oras-cli.sh | 6 --- images/linux/scripts/installers/packer.sh | 7 +--- images/linux/scripts/installers/phantomjs.sh | 7 ---- images/linux/scripts/installers/php.sh | 16 ------- images/linux/scripts/installers/pollinate.sh | 6 --- images/linux/scripts/installers/postgresql.sh | 4 -- .../scripts/installers/powershellcore.sh | 5 --- .../scripts/installers/preparemetadata.sh | 20 --------- images/linux/scripts/installers/pulumi.sh | 5 --- images/linux/scripts/installers/pypy.sh | 2 - images/linux/scripts/installers/python.sh | 8 ---- images/linux/scripts/installers/r.sh | 3 -- .../linux/scripts/installers/rndgenerator.sh | 6 --- images/linux/scripts/installers/ruby.sh | 7 ---- images/linux/scripts/installers/rust.sh | 14 ------- images/linux/scripts/installers/sbt.sh | 6 --- images/linux/scripts/installers/selenium.sh | 5 --- images/linux/scripts/installers/sphinx.sh | 6 --- images/linux/scripts/installers/subversion.sh | 6 --- images/linux/scripts/installers/swift.sh | 6 --- images/linux/scripts/installers/swig.sh | 6 --- images/linux/scripts/installers/terraform.sh | 6 --- images/linux/scripts/installers/vcpkg.sh | 5 --- images/linux/scripts/installers/vercel.sh | 7 ---- images/linux/ubuntu1604.json | 18 -------- images/linux/ubuntu1804.json | 18 -------- images/linux/ubuntu2004.json | 18 -------- 78 files changed, 3 insertions(+), 644 deletions(-) delete mode 100644 images/linux/announcements.md delete mode 100644 images/linux/scripts/helpers/document.sh delete mode 100644 images/linux/scripts/installers/preparemetadata.sh diff --git a/images/linux/announcements.md b/images/linux/announcements.md deleted file mode 100644 index e69de29bb..000000000 diff --git a/images/linux/scripts/helpers/document.sh b/images/linux/scripts/helpers/document.sh deleted file mode 100644 index 0e1793a44..000000000 --- a/images/linux/scripts/helpers/document.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash -################################################################################ -## File: document.sh -## Desc: Helper functions for writing information to the metadata document -################################################################################ - -function WriteItem { - if [ -z "$METADATA_FILE" ]; then - echo "METADATA_FILE environment variable must be set to output to Metadata Document!" - return 1; - else - echo -e "$1" | sudo tee -a "$METADATA_FILE" - fi -} - -function AddTitle { - WriteItem "# $1" -} - -function AddSubTitle { - WriteItem "## $1" -} - -function DocumentInstalledItem { - WriteItem "- $1" -} - -function DocumentInstalledItemIndent { - WriteItem " - $1" -} - -function AddBlockquote { - WriteItem "> $1" -} - -function StartCode { - WriteItem '```' -} - -function EndCode { - WriteItem '```' -} diff --git a/images/linux/scripts/installers/7-zip.sh b/images/linux/scripts/installers/7-zip.sh index 1baa00261..4b753de53 100644 --- a/images/linux/scripts/installers/7-zip.sh +++ b/images/linux/scripts/installers/7-zip.sh @@ -4,8 +4,6 @@ ## Desc: Installs 7-zip ################################################################################ -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh # Install 7-Zip apt-get update -y @@ -17,7 +15,3 @@ if ! command -v 7z; then echo "7-Zip was not installed" exit 1 fi - -# Document what was added to the image -echo "Lastly, documenting what we added to the metadata file" -DocumentInstalledItem "7-Zip $(7z i | head --lines=2 | cut -d ' ' -f 3 | tr -d '\n')" diff --git a/images/linux/scripts/installers/Validate-Toolset.ps1 b/images/linux/scripts/installers/Validate-Toolset.ps1 index b5eb9a0a5..2af4fcf42 100644 --- a/images/linux/scripts/installers/Validate-Toolset.ps1 +++ b/images/linux/scripts/installers/Validate-Toolset.ps1 @@ -50,7 +50,6 @@ $toolset = Get-Content -Path "$env:INSTALLER_SCRIPT_FOLDER/toolset.json" -Raw $tools = ConvertFrom-Json -InputObject $toolset | Select-Object -ExpandProperty toolcache foreach($tool in $tools) { - Invoke-Expression "bash -c `"source $env:HELPER_SCRIPTS/document.sh; DocumentInstalledItem '$($tool.name):'`"" $toolPath = Join-Path $env:AGENT_TOOLSDIRECTORY $tool.name # Get executables for current tool @@ -85,8 +84,5 @@ foreach($tool in $tools) { $pypyVersion = & "$foundVersionPath/bin/python" -c "import sys;print(sys.version.split('\n')[1])" $foundVersionName = "{0} {1}" -f $foundVersionName, $pypyVersion } - - # Add tool version to documentation - Invoke-Expression "bash -c `"source $env:HELPER_SCRIPTS/document.sh; DocumentInstalledItemIndent '$($tool.name) $foundVersionName'`"" } } \ No newline at end of file diff --git a/images/linux/scripts/installers/aliyun-cli.sh b/images/linux/scripts/installers/aliyun-cli.sh index ed826c90e..af45bd07c 100644 --- a/images/linux/scripts/installers/aliyun-cli.sh +++ b/images/linux/scripts/installers/aliyun-cli.sh @@ -4,8 +4,6 @@ ## Desc: Installs Alibaba Cloud CLI ################################################################################ -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh # Install Alibaba Cloud CLI URL=$(curl -s https://api.github.com/repos/aliyun/aliyun-cli/releases/latest | jq -r '.assets[].browser_download_url | select(contains("aliyun-cli-linux"))') @@ -19,8 +17,3 @@ if ! command -v aliyun ; then echo "aliyun was not installed" exit 1 fi - -# Document what was added to the image -aliyun_version="$(aliyun version)" -echo "Lastly, documenting what we added to the metadata file" -DocumentInstalledItem "Alibaba Cloud CLI ($aliyun_version)" \ No newline at end of file diff --git a/images/linux/scripts/installers/android.sh b/images/linux/scripts/installers/android.sh index ed06f51ac..81f28ff7a 100644 --- a/images/linux/scripts/installers/android.sh +++ b/images/linux/scripts/installers/android.sh @@ -7,7 +7,6 @@ set -e # Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh source $HELPER_SCRIPTS/os.sh # Set env variable for SDK Root (https://developer.android.com/studio/command-line/variables) @@ -62,34 +61,3 @@ buildtools_versions_list=$(echo "$buildtools"|awk -F';' '{print $2}') # Add required permissions chmod -R a+rwx ${ANDROID_SDK_ROOT} - -echo "Lastly, document what was added to the metadata file" -DocumentInstalledItem "Google Repository $(cat ${ANDROID_SDK_ROOT}/extras/google/m2repository/source.properties 2>&1 | grep Pkg.Revision | cut -d '=' -f 2)" -DocumentInstalledItem "Google Play services $(cat ${ANDROID_SDK_ROOT}/extras/google/google_play_services/source.properties 2>&1 | grep Pkg.Revision | cut -d '=' -f 2)" - -for version in $google_api_versions_list; do - DocumentInstalledItem "Google APIs $version" -done - -DocumentInstalledItem "CMake $(ls ${ANDROID_SDK_ROOT}/cmake 2>&1)" - -for version in $constraint_layout_versions_list; do - DocumentInstalledItem "Android ConstraintLayout $version" -done - -for version in $constraint_layout_solver_versions_list; do - DocumentInstalledItem "Android ConstraintLayout Solver $version" -done - -DocumentInstalledItem "Android SDK Platform-Tools $(cat ${ANDROID_SDK_ROOT}/platform-tools/source.properties 2>&1 | grep Pkg.Revision | cut -d '=' -f 2)" -for version in $platform_versions_list; do - DocumentInstalledItem "Android SDK Platform $version" -done - -DocumentInstalledItem "Android SDK Patch Applier v4" - -for version in $buildtools_versions_list; do - DocumentInstalledItem "Android SDK Build-Tools $version" -done - -DocumentInstalledItem "Android NDK $(cat ${ANDROID_SDK_ROOT}/ndk-bundle/source.properties 2>&1 | grep Pkg.Revision | cut -d ' ' -f 3)" diff --git a/images/linux/scripts/installers/ansible.sh b/images/linux/scripts/installers/ansible.sh index fcf039308..9f41af7cb 100644 --- a/images/linux/scripts/installers/ansible.sh +++ b/images/linux/scripts/installers/ansible.sh @@ -5,7 +5,6 @@ ################################################################################ # Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh source $HELPER_SCRIPTS/os.sh # ppa:ansible/ansible doesn't contain packages for Ubuntu20.04 @@ -23,7 +22,3 @@ if ! command -v ansible; then echo "Ansible was not installed or found on PATH" exit 1 fi - -# Document what was added to the image -echo "Lastly, documenting what we added to the metadata file" -DocumentInstalledItem "Ansible ($(ansible --version |& head -n 1))" diff --git a/images/linux/scripts/installers/aws-sam-cli.sh b/images/linux/scripts/installers/aws-sam-cli.sh index 97ceb2135..ac56144b3 100644 --- a/images/linux/scripts/installers/aws-sam-cli.sh +++ b/images/linux/scripts/installers/aws-sam-cli.sh @@ -5,8 +5,6 @@ ## Requires Python >=3.6, must be run as non-root user after toolset installation ################################################################################ -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh # Download latest aws sam cli sources TarballUrl=$(curl -s https://api.github.com/repos/aws/aws-sam-cli/releases/latest | jq -r '.tarball_url') @@ -31,7 +29,3 @@ if ! sam --version; then echo "AWS SAM CLI was not installed" exit 1 fi - -# Document what was added to the image -echo "Lastly, documenting what we added to the metadata file" -DocumentInstalledItem "AWS $(sam --version)" \ No newline at end of file diff --git a/images/linux/scripts/installers/aws.sh b/images/linux/scripts/installers/aws.sh index edf9b1a5c..b2ab32fa1 100644 --- a/images/linux/scripts/installers/aws.sh +++ b/images/linux/scripts/installers/aws.sh @@ -4,8 +4,6 @@ ## Desc: Installs the AWS CLI ################################################################################ -# Source the helpers -source $HELPER_SCRIPTS/document.sh source $HELPER_SCRIPTS/os.sh # Install the AWS CLI v1 on Ubuntu16 and Ubuntu18, and AWS CLI v2 on Ubuntu20 @@ -41,8 +39,3 @@ if ! [[ $sessionPlugin == *"was installed successfully"* ]] then exit 1 fi - -# Document the installed version -echo "Document the installed version" -DocumentInstalledItem "AWS CLI ($(aws --version 2>&1))" -DocumentInstalledItem "AWS CLI Session manager plugin ($(session-manager-plugin --version 2>&1))" diff --git a/images/linux/scripts/installers/azcopy.sh b/images/linux/scripts/installers/azcopy.sh index 9d15d37af..9b57d2680 100644 --- a/images/linux/scripts/installers/azcopy.sh +++ b/images/linux/scripts/installers/azcopy.sh @@ -4,8 +4,6 @@ ## Desc: Installs AzCopy ################################################################################ -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh # Install AzCopy7 wget -O azcopy.tar.gz https://aka.ms/downloadazcopylinux64 @@ -30,10 +28,3 @@ if ! command -v azcopy10; then echo "azcopy10 was not installed" exit 1 fi - -# Document what was added to the image -azcopy7Version=$(azcopy --version | awk '{print $2}' | cut -d '-' -f 1) -azcopy10Version=$(azcopy10 --version | awk '{print $3}') -echo "Lastly, documenting what we added to the metadata file" -DocumentInstalledItem "AzCopy7 (available by azcopy alias) $azcopy7Version" -DocumentInstalledItem "AzCopy10 (available by azcopy10 alias) $azcopy10Version" diff --git a/images/linux/scripts/installers/azpowershell.sh b/images/linux/scripts/installers/azpowershell.sh index 2b7d703df..a4a159865 100644 --- a/images/linux/scripts/installers/azpowershell.sh +++ b/images/linux/scripts/installers/azpowershell.sh @@ -5,7 +5,6 @@ ################################################################################ # Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh source $HELPER_SCRIPTS/os.sh # List of versions @@ -36,9 +35,3 @@ for version in ${versions[@]}; do exit 1 fi done - -# Document what was added to the image -echo "Lastly, documenting what we added to the metadata file" -for version in ${versions[@]}; do - DocumentInstalledItem "Az Module ($version)" -done diff --git a/images/linux/scripts/installers/azure-cli.sh b/images/linux/scripts/installers/azure-cli.sh index 713d23151..a33ee2f64 100644 --- a/images/linux/scripts/installers/azure-cli.sh +++ b/images/linux/scripts/installers/azure-cli.sh @@ -4,8 +4,6 @@ ## Desc: Installed Azure CLI (az) ################################################################################ -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh # Install Azure CLI (instructions taken from https://docs.microsoft.com/en-us/cli/azure/install-azure-cli) curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash @@ -16,6 +14,3 @@ if ! command -v az; then echo "azure-cli was not installed" exit 1 fi - -# Document what was added to the image -DocumentInstalledItem "Azure CLI ($(az -v | head -n 1))" diff --git a/images/linux/scripts/installers/azure-devops-cli.sh b/images/linux/scripts/installers/azure-devops-cli.sh index e709243d6..d39761be6 100644 --- a/images/linux/scripts/installers/azure-devops-cli.sh +++ b/images/linux/scripts/installers/azure-devops-cli.sh @@ -4,8 +4,6 @@ ## Desc: Installed Azure DevOps CLI (az devops) ################################################################################ -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh # AZURE_EXTENSION_DIR shell variable defines where modules are installed # https://docs.microsoft.com/en-us/cli/azure/azure-cli-extensions-overview @@ -23,6 +21,3 @@ else echo "azure DevOps Cli extension was not installed" exit 1 fi - -# Document what was added to the image -DocumentInstalledItem "Azure CLI ($(az -v | grep azure-devops))" diff --git a/images/linux/scripts/installers/basic.sh b/images/linux/scripts/installers/basic.sh index 0772cf4ed..b8f3e10f6 100644 --- a/images/linux/scripts/installers/basic.sh +++ b/images/linux/scripts/installers/basic.sh @@ -5,8 +5,6 @@ ################################################################################ set -e -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh toolset="$INSTALLER_SCRIPT_FOLDER/toolset.json" common_packages=$(jq -r ".apt.common_packages[]" $toolset) @@ -24,10 +22,3 @@ for cmd in $cmd_packages; do exit 1 fi done - -# Document what was added to the image -echo "Lastly, documenting what we added to the metadata file" -DocumentInstalledItem "Basic packages:" -for package in $common_packages $cmd_packages; do - DocumentInstalledItemIndent $package -done diff --git a/images/linux/scripts/installers/bazel.sh b/images/linux/scripts/installers/bazel.sh index d058d5764..2735df10c 100644 --- a/images/linux/scripts/installers/bazel.sh +++ b/images/linux/scripts/installers/bazel.sh @@ -4,8 +4,6 @@ ## Desc: Installs Bazel and Bazelisk (A user-friendly launcher for 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 - @@ -27,10 +25,3 @@ if ! command -v bazelisk; then echo "Bazelisk was not installed" exit 1 fi - -# Document what was added to the image -bazelisk_version="$(bazelisk version 2>null | grep "Bazelisk version:" | cut -d "v" -f 3)" - -echo "Lastly, documenting what we added to the metadata file" -DocumentInstalledItem "Bazel ($(bazel --version))" -DocumentInstalledItem "Bazelisk ($bazelisk_version)" diff --git a/images/linux/scripts/installers/build-essential.sh b/images/linux/scripts/installers/build-essential.sh index 34c2ac040..af711a1e9 100644 --- a/images/linux/scripts/installers/build-essential.sh +++ b/images/linux/scripts/installers/build-essential.sh @@ -4,8 +4,7 @@ ## Desc: Installs build-essential package ################################################################################ -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh + source $HELPER_SCRIPTS/install.sh PACKAGE=build-essential @@ -18,7 +17,3 @@ if ! IsPackageInstalled $PACKAGE; then else echo "$PACKAGE is already installed" fi - -# Document what was added to the image -echo "Lastly, documenting what we added to the metadata file" -DocumentInstalledItem "$PACKAGE" diff --git a/images/linux/scripts/installers/clang.sh b/images/linux/scripts/installers/clang.sh index eb508493b..54e6a94f4 100644 --- a/images/linux/scripts/installers/clang.sh +++ b/images/linux/scripts/installers/clang.sh @@ -4,8 +4,6 @@ ## Desc: Installs Clang compiler (versions: 6, 8 and 9) ################################################################################ -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh function InstallClang { version=$1 @@ -26,10 +24,6 @@ function InstallClang { exit 1 fi done - - # Document what was added to the image - echo "Documenting clang-$version..." - DocumentInstalledItem "Clang $version ($(clang-$version --version | head -n 1 | cut -d ' ' -f 3 | cut -d '-' -f 1))" } # Download script for automatic installation diff --git a/images/linux/scripts/installers/cmake.sh b/images/linux/scripts/installers/cmake.sh index 0fd839a50..2dbf4cf54 100644 --- a/images/linux/scripts/installers/cmake.sh +++ b/images/linux/scripts/installers/cmake.sh @@ -4,8 +4,6 @@ ## Desc: Installs CMake ################################################################################ -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh # Test to see if the software in question is already installed, if not install it echo "Checking to see if the installer script has already been run" @@ -24,7 +22,3 @@ if ! command -v cmake; then echo "cmake was not installed" exit 1 fi - -# Document what was added to the image -echo "Lastly, documenting what we added to the metadata file" -DocumentInstalledItem "CMake ($(cmake --version | head -n 1))" diff --git a/images/linux/scripts/installers/containers.sh b/images/linux/scripts/installers/containers.sh index 77e542286..a44d73fd7 100644 --- a/images/linux/scripts/installers/containers.sh +++ b/images/linux/scripts/installers/containers.sh @@ -4,7 +4,6 @@ ## Desc: Installs container tools: podman, buildah and skopeo onto the image ################################################################################ -source $HELPER_SCRIPTS/document.sh source /etc/os-release sh -c "echo 'deb http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/x${NAME}_${VERSION_ID}/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list" @@ -14,12 +13,3 @@ apt-get update -qq apt-get -qq -y install podman buildah skopeo mkdir -p /etc/containers echo -e "[registries.search]\nregistries = ['docker.io', 'quay.io']" | tee /etc/containers/registries.conf - -## Add version information to the metadata file -echo "Documenting container tools version" -PODMAN_VERSION="$(podman --version | cut -d " " -f 3)" -BUILDAH_VERSION="$(buildah --version | cut -d " " -f 3)" -SKOPEO_VERSION="$(skopeo --version | cut -d " " -f 3)" -DocumentInstalledItem "Podman ($PODMAN_VERSION)" -DocumentInstalledItem "Buildah ($BUILDAH_VERSION)" -DocumentInstalledItem "Skopeo ($SKOPEO_VERSION)" diff --git a/images/linux/scripts/installers/docker-compose.sh b/images/linux/scripts/installers/docker-compose.sh index 76a5df7b9..d2698d5c0 100644 --- a/images/linux/scripts/installers/docker-compose.sh +++ b/images/linux/scripts/installers/docker-compose.sh @@ -4,7 +4,6 @@ ## Desc: Installs Docker Compose ################################################################################ -source $HELPER_SCRIPTS/document.sh URL=$(curl -s https://api.github.com/repos/docker/compose/releases/latest | jq -r '.assets[].browser_download_url | select(contains("docker-compose-Linux-x86_64"))' | head -1) @@ -18,8 +17,3 @@ if ! command -v docker-compose; then echo "docker-compose was not installed" exit 1 fi - -## Add version information to the metadata file -echo "Documenting Docker Compose version" -docker_compose_version=$(docker-compose -v) -DocumentInstalledItem "Docker Compose (${docker_compose_version})" diff --git a/images/linux/scripts/installers/docker-moby.sh b/images/linux/scripts/installers/docker-moby.sh index 6ce336718..49ef6a563 100644 --- a/images/linux/scripts/installers/docker-moby.sh +++ b/images/linux/scripts/installers/docker-moby.sh @@ -6,7 +6,6 @@ set -e # Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh source $HELPER_SCRIPTS/install.sh source $HELPER_SCRIPTS/os.sh @@ -54,18 +53,3 @@ images=$(jq -r '.docker.images[]' $toolset) for image in $images; do docker pull "$image" done - -# Add version information to the metadata file -echo "Documenting Docker version" -docker_version=$(docker -v) -DocumentInstalledItem "Docker-Moby ($docker_version)" - -echo "Documenting Docker-buildx version" -DOCKER_BUILDX_VERSION=$(docker buildx version | cut -d ' ' -f2) -DocumentInstalledItem "Docker-Buildx ($DOCKER_BUILDX_VERSION)" - -# Add container information to the metadata file -DocumentInstalledItem "Cached container images" -while read -r line; do - DocumentInstalledItemIndent "$line" -done <<< "$(docker images --digests --format '{{.Repository}}:{{.Tag}} (Digest: {{.Digest}})')" diff --git a/images/linux/scripts/installers/dotnetcore-sdk.sh b/images/linux/scripts/installers/dotnetcore-sdk.sh index e510f34c3..ee0a95b89 100644 --- a/images/linux/scripts/installers/dotnetcore-sdk.sh +++ b/images/linux/scripts/installers/dotnetcore-sdk.sh @@ -5,7 +5,6 @@ ################################################################################ source $HELPER_SCRIPTS/etc-environment.sh -source $HELPER_SCRIPTS/document.sh source $HELPER_SCRIPTS/install.sh source $HELPER_SCRIPTS/os.sh @@ -84,7 +83,6 @@ for tarball in *.tar.gz; do done rm urls -DocumentInstalledItem ".NET Core SDK:" # Smoke test each SDK for sdk in $sortedSdks; do mksamples "$sdk" "console" @@ -93,7 +91,6 @@ for sdk in $sortedSdks; do mksamples "$sdk" "web" mksamples "$sdk" "mvc" mksamples "$sdk" "webapi" - DocumentInstalledItemIndent "$sdk" done # NuGetFallbackFolder at /usr/share/dotnet/sdk/NuGetFallbackFolder is warmed up by smoke test diff --git a/images/linux/scripts/installers/erlang.sh b/images/linux/scripts/installers/erlang.sh index 31a3a3061..aa94e3a2b 100644 --- a/images/linux/scripts/installers/erlang.sh +++ b/images/linux/scripts/installers/erlang.sh @@ -4,8 +4,6 @@ ## Desc: Installs erlang ################################################################################ -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh source_list=/etc/apt/sources.list.d/eslerlang.list @@ -29,10 +27,5 @@ for cmd in erl erlc rebar3; do fi done -# Document what was added to the image -echo "Lastly, documenting what we added to the metadata file" -erlang_version="$(erl -version 2>&1 | tr -d '\n' | tr -d '\r')" -DocumentInstalledItem "Erlang ($erlang_version)" - # Clean up source list rm $source_list diff --git a/images/linux/scripts/installers/example.sh b/images/linux/scripts/installers/example.sh index d0f3c5c3d..895de5d35 100644 --- a/images/linux/scripts/installers/example.sh +++ b/images/linux/scripts/installers/example.sh @@ -5,8 +5,6 @@ ## installer to the image ################################################################################ -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh # Test to see if the software in question is already installed, if not install it echo "Checking to see if the installer script has already been run" @@ -24,7 +22,3 @@ if [ -z $EXAMPLE_VAR ]; then else echo "EXAMPLE_VAR was set properly" fi - -# Document what was added to the image -echo "Lastly, documenting what we added to the metadata file" -DocumentInstalledItem "Example Var ($EXAMPLE_VAR)" diff --git a/images/linux/scripts/installers/firefox.sh b/images/linux/scripts/installers/firefox.sh index e6f44cbf2..3287bf168 100644 --- a/images/linux/scripts/installers/firefox.sh +++ b/images/linux/scripts/installers/firefox.sh @@ -4,8 +4,6 @@ ## Desc: Installs Firefox ################################################################################ -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh # Install Firefox apt-get install -y firefox @@ -20,13 +18,6 @@ fi # Default firefox local is en_GB echo 'pref("intl.locale.requested","en_US");' >> "/usr/lib/firefox/browser/defaults/preferences/syspref.js" -# Document what was added to the image -echo "Lastly, documenting what we added to the metadata file" -# Resolves: Running Firefox as root in a regular user's session is not supported. -# ($HOME is /home/packer which is owned by packer.) -HOME=/root -DocumentInstalledItem "Firefox ($(firefox --version))" - # Download and unpack latest release of geckodriver URL=$(curl -s https://api.github.com/repos/mozilla/geckodriver/releases/latest | jq -r '.assets[].browser_download_url | select(test("linux64.tar.gz$"))') echo "Downloading geckodriver $URL" @@ -50,7 +41,3 @@ if ! command -v geckodriver; then echo "geckodriver was not installed" exit 1 fi - -echo "Lastly, documenting what we added to the metadata file" -ver=`geckodriver --version | head -1 |awk '{print $2}'` -DocumentInstalledItem "Geckodriver (${ver}); Gecko Driver is available via GECKOWEBDRIVER environment variable" diff --git a/images/linux/scripts/installers/gcc.sh b/images/linux/scripts/installers/gcc.sh index 86575568c..7b1bd56ea 100644 --- a/images/linux/scripts/installers/gcc.sh +++ b/images/linux/scripts/installers/gcc.sh @@ -4,8 +4,6 @@ ## Desc: Installs GNU C++ ################################################################################ -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh function InstallGcc { version=$1 @@ -19,10 +17,6 @@ function InstallGcc { echo "$version was not installed" exit 1 fi - - # Document what was added to the image - echo "Documenting $version..." - DocumentInstalledItem "GNU C++ $($version --version | head -n 1 | cut -d ' ' -f 4)" } # Install GNU C++ compiler diff --git a/images/linux/scripts/installers/gfortran.sh b/images/linux/scripts/installers/gfortran.sh index 1e392839d..c37fccf27 100644 --- a/images/linux/scripts/installers/gfortran.sh +++ b/images/linux/scripts/installers/gfortran.sh @@ -4,8 +4,6 @@ ## Desc: Installs GNU Fortran ################################################################################ -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh function InstallFortran { version=$1 @@ -19,10 +17,6 @@ function InstallFortran { echo "$version was not installed" exit 1 fi - - # Document what was added to the image - echo "Documenting $version..." - DocumentInstalledItem "GNU Fortran $($version --version | head -n 1 | cut -d ' ' -f 5)" } # Install GNU Fortran compiler diff --git a/images/linux/scripts/installers/git.sh b/images/linux/scripts/installers/git.sh index ae497458d..331e5f813 100644 --- a/images/linux/scripts/installers/git.sh +++ b/images/linux/scripts/installers/git.sh @@ -6,7 +6,6 @@ set -e # Source the helpers for use with the script -source "$HELPER_SCRIPTS"/document.sh source "$HELPER_SCRIPTS"/install.sh ## Install git @@ -39,14 +38,6 @@ if ! command -v git-ftp; then exit 1 fi -# Document what was added to the image -echo "Lastly, document the installed versions" -# git version 2.20.1 -DocumentInstalledItem "Git ($(git --version 2>&1 | cut -d ' ' -f 3))" -# git-lfs/2.6.1 (GitHub; linux amd64; go 1.11.1) -DocumentInstalledItem "Git Large File Storage (LFS) ($(git-lfs --version 2>&1 | cut -d ' ' -f 1 | cut -d '/' -f 2))" -DocumentInstalledItem "Git-ftp ($(git-ftp --version | cut -d ' ' -f 3))" - #Install hub tmp_hub="/tmp/hub" mkdir -p "$tmp_hub" @@ -57,7 +48,6 @@ mv "$tmp_hub"/bin/hub /usr/local/bin if command -v hub; then echo "hub CLI was installed successfully" - DocumentInstalledItem "Hub CLI ($(hub --version | grep "hub version" | cut -d ' ' -f 3))" else echo "[!] Hub CLI was not installed" exit 1 diff --git a/images/linux/scripts/installers/github-cli.sh b/images/linux/scripts/installers/github-cli.sh index 5cc430948..c9bec1fc6 100644 --- a/images/linux/scripts/installers/github-cli.sh +++ b/images/linux/scripts/installers/github-cli.sh @@ -5,8 +5,6 @@ ## Must be run as non-root user after homebrew ################################################################################ -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh # Install GitHub CLI url=$(curl -s https://api.github.com/repos/cli/cli/releases/latest | jq -r '.assets[].browser_download_url|select(contains("linux") and contains("amd64") and contains(".deb"))') @@ -20,7 +18,3 @@ if ! gh --version; then echo "GitHub CLI was not installed" exit 1 fi - -# Document what was added to the image -echo "Lastly, documenting what we added to the metadata file" -DocumentInstalledItem "GitHub CLI $(gh --version|awk 'FNR==1 {print $3}')" diff --git a/images/linux/scripts/installers/google-chrome.sh b/images/linux/scripts/installers/google-chrome.sh index 892380ce7..a6ace2f38 100644 --- a/images/linux/scripts/installers/google-chrome.sh +++ b/images/linux/scripts/installers/google-chrome.sh @@ -4,8 +4,6 @@ ## Desc: Installs google-chrome and chromedriver ################################################################################ -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh LSB_RELEASE=$(lsb_release -rs) @@ -22,10 +20,6 @@ if ! command -v google-chrome; then exit 1 fi -# Document what was added to the image -echo "Lastly, documenting what we added to the metadata file" -DocumentInstalledItem "Google Chrome ($(google-chrome --version))" - CHROME_VERSION=$(google-chrome --product-version) CHROME_VERSION=${CHROME_VERSION%.*} @@ -54,6 +48,3 @@ if ! command -v chromedriver; then echo "chromedriver was not installed" exit 1 fi - -echo "Lastly, documenting what we added to the metadata file" -DocumentInstalledItem "$(chromedriver --version); Chrome Driver is available via CHROMEWEBDRIVER environment variable" diff --git a/images/linux/scripts/installers/google-cloud-sdk.sh b/images/linux/scripts/installers/google-cloud-sdk.sh index 4293a85a4..147d8d4fb 100644 --- a/images/linux/scripts/installers/google-cloud-sdk.sh +++ b/images/linux/scripts/installers/google-cloud-sdk.sh @@ -4,8 +4,6 @@ ## Desc: Installs the Google Cloud SDK ################################################################################ -# Source the helpers -source $HELPER_SCRIPTS/document.sh # Install the Google Cloud SDK echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] http://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list @@ -19,7 +17,3 @@ if ! command -v gcloud; then echo "gcloud was not installed" exit 1 fi - -# Document the installed version -echo "Document the installed version" -DocumentInstalledItem "Google Cloud SDK ($(gcloud --version | head -n 1 | cut -d ' ' -f 4))" diff --git a/images/linux/scripts/installers/haskell.sh b/images/linux/scripts/installers/haskell.sh index 242a0f32c..b8bfa5efe 100644 --- a/images/linux/scripts/installers/haskell.sh +++ b/images/linux/scripts/installers/haskell.sh @@ -6,7 +6,6 @@ # Source the helpers for use with the script source $HELPER_SCRIPTS/etc-environment.sh -source $HELPER_SCRIPTS/document.sh # Install Herbert V. Riedel's PPA for managing multiple version of ghc on ubuntu. # https://launchpad.net/~hvr/+archive/ubuntu/ghc @@ -58,9 +57,3 @@ fi # Create symlink for ghc and cabal in /usr/bin ln -s "/opt/ghc/$defaultGHCVersion/bin/ghc" "/usr/bin/ghc" ln -s "/opt/cabal/$cabalVersion/bin/cabal" "/usr/bin/cabal" - -# Document what was added to the image -echo "Lastly, documenting what we added to the metadata file" -DocumentInstalledItem "Haskell Cabal ($(cabal --version))" -DocumentInstalledItem "GHC ($(ghc --version))" -DocumentInstalledItem "Haskell Stack ($(stack --version))" diff --git a/images/linux/scripts/installers/heroku.sh b/images/linux/scripts/installers/heroku.sh index ff39be66c..c4c0e588c 100644 --- a/images/linux/scripts/installers/heroku.sh +++ b/images/linux/scripts/installers/heroku.sh @@ -4,8 +4,6 @@ ## Desc: Installs Heroku CLI ################################################################################ -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh # Install Heroku CLI curl https://cli-assets.heroku.com/install-ubuntu.sh | sh @@ -15,7 +13,3 @@ echo "Testing to make sure that script performed as expected, and basic scenario if ! command -v heroku; then exit 1 fi - -# Document what was added to the image -echo "Lastly, documenting what we added to the metadata file" -DocumentInstalledItem "Heroku ($(heroku version))" diff --git a/images/linux/scripts/installers/hhvm.sh b/images/linux/scripts/installers/hhvm.sh index e5f9079bc..3010db873 100644 --- a/images/linux/scripts/installers/hhvm.sh +++ b/images/linux/scripts/installers/hhvm.sh @@ -5,7 +5,6 @@ ################################################################################ # Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh source $HELPER_SCRIPTS/install.sh hhvm_package=hhvm @@ -31,7 +30,3 @@ fi if ! command -v hhvm; then exit 1 fi - -# Document what was added to the image -echo "Lastly, documenting what we added to the metadata file" -DocumentInstalledItem "HHVM ($(hhvm --version | head -n 1))" diff --git a/images/linux/scripts/installers/homebrew.sh b/images/linux/scripts/installers/homebrew.sh index 0a739e274..370d9d09d 100644 --- a/images/linux/scripts/installers/homebrew.sh +++ b/images/linux/scripts/installers/homebrew.sh @@ -6,7 +6,6 @@ ################################################################################ # Source the helpers -source $HELPER_SCRIPTS/document.sh source $HELPER_SCRIPTS/etc-environment.sh # Install the Homebrew on Linux @@ -31,7 +30,3 @@ if ! command -v brew; then echo "brew was not installed" exit 1 fi - -# Document the installed version -echo "Document the installed version" -DocumentInstalledItem "Homebrew on Linux ($(brew -v 2>&1))" diff --git a/images/linux/scripts/installers/hosted-tool-cache.sh b/images/linux/scripts/installers/hosted-tool-cache.sh index ef1553f2e..d40a4922a 100644 --- a/images/linux/scripts/installers/hosted-tool-cache.sh +++ b/images/linux/scripts/installers/hosted-tool-cache.sh @@ -4,8 +4,6 @@ ## Desc: Downloads and installs hosted tools cache ################################################################################ -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh # Fail out if any setups fail set -e @@ -43,9 +41,3 @@ for PACKAGE_NAME in ${PACKAGE_LIST[@]}; do done; popd - -DocumentInstalledItem "Ruby:" -rubys=$(ls $AGENT_TOOLSDIRECTORY/Ruby) -for ruby in $rubys; do - DocumentInstalledItemIndent "Ruby $ruby" -done; diff --git a/images/linux/scripts/installers/image-magick.sh b/images/linux/scripts/installers/image-magick.sh index 39925fdfe..e01c933a7 100644 --- a/images/linux/scripts/installers/image-magick.sh +++ b/images/linux/scripts/installers/image-magick.sh @@ -4,8 +4,6 @@ ## Desc: Installs ImageMagick ################################################################################ -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh # Install ImageMagick apt-get install -y --no-install-recommends --fix-missing \ @@ -13,7 +11,3 @@ apt-get install -y --no-install-recommends --fix-missing \ libmagickcore-dev \ libmagickwand-dev \ libmagic-dev - -# Document what was added to the image -echo "Lastly, documenting what we added to the metadata file" -DocumentInstalledItem "ImageMagick" diff --git a/images/linux/scripts/installers/java-tools.sh b/images/linux/scripts/installers/java-tools.sh index 7ec94b732..46aa8b285 100644 --- a/images/linux/scripts/installers/java-tools.sh +++ b/images/linux/scripts/installers/java-tools.sh @@ -4,8 +4,6 @@ ## Desc: Installs Java and related tooling (Ant, Gradle, Maven) ################################################################################ -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh source $HELPER_SCRIPTS/os.sh set -e @@ -103,19 +101,3 @@ javaVersion=$(java -version |& head -n 1 | cut -d\" -f 2) javaTool "Java" $javaVersion javacVersion=$(javac -version |& cut -d" " -f2) javaTool "Javac" $javacVersion - -# Document what was added to the image -echo "Lastly, documenting what we added to the metadata file" -if isUbuntu16 || isUbuntu18 ; then -DocumentInstalledItem "Azul Zulu OpenJDK:" -DocumentInstalledItemIndent "7 ($(/usr/lib/jvm/zulu-7-azure-amd64/bin/java -showversion |& head -n 1))" -fi -DocumentInstalledItem "Adopt OpenJDK:" -DocumentInstalledItemIndent "8 ($(/usr/lib/jvm/adoptopenjdk-8-hotspot-amd64/bin/java -showversion |& head -n 1)) $defaultLabel8" -DocumentInstalledItemIndent "11 ($(/usr/lib/jvm/adoptopenjdk-11-hotspot-amd64/bin/java -showversion |& head -n 1)) $defaultLabel11" -if isUbuntu16 || isUbuntu18 ; then -DocumentInstalledItemIndent "12 ($(/usr/lib/jvm/adoptopenjdk-12-hotspot-amd64/bin/java -showversion |& head -n 1))" -fi -DocumentInstalledItem "Ant ($(ant -version))" -DocumentInstalledItem "Gradle ${gradleVersion}" -DocumentInstalledItem "Maven ($(mvn -version | head -n 1))" diff --git a/images/linux/scripts/installers/julia.sh b/images/linux/scripts/installers/julia.sh index a576a5405..079890a19 100644 --- a/images/linux/scripts/installers/julia.sh +++ b/images/linux/scripts/installers/julia.sh @@ -4,8 +4,6 @@ ## Desc: Installs Julia, and adds Julia to the path ################################################################################ -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh # This function fetches the latest Julia release from the GitHub API # Based on https://gist.github.com/lukechilds/a83e1d7127b78fef38c2914c4ececc3c @@ -54,10 +52,6 @@ function InstallJulia () { echo "Julia was not installed correctly" exit 1 fi - - # Document what was added to the image - echo "Lastly, documenting what we added to the metadata file" - DocumentInstalledItem "Julia ($(julia --version))" } InstallJulia "$(GetLatestJuliaRelease)" true diff --git a/images/linux/scripts/installers/kind.sh b/images/linux/scripts/installers/kind.sh index 4fc7c0d42..3a312a2e3 100644 --- a/images/linux/scripts/installers/kind.sh +++ b/images/linux/scripts/installers/kind.sh @@ -4,8 +4,6 @@ ## Desc: Installs kind ################################################################################ -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh # Install KIND URL=$(curl -s https://api.github.com/repos/kubernetes-sigs/kind/releases/latest | jq -r '.assets[].browser_download_url | select(contains("kind-linux-amd64"))') @@ -18,7 +16,3 @@ if ! command -v kind; then echo "Kind was not installed or found on PATH" exit 1 fi - -# Document what was added to the image -echo "Lastly, documenting what we added to the metadata file" -DocumentInstalledItem "Kind ($(kind version))" diff --git a/images/linux/scripts/installers/kubernetes-tools.sh b/images/linux/scripts/installers/kubernetes-tools.sh index f86f8abaa..a25cb0f26 100644 --- a/images/linux/scripts/installers/kubernetes-tools.sh +++ b/images/linux/scripts/installers/kubernetes-tools.sh @@ -4,8 +4,6 @@ ## Desc: Installs kubectl, helm, kustomize ################################################################################ -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh ## Install kubectl curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - @@ -52,12 +50,3 @@ if ! command -v kustomize; then echo "kustomize was not installed" exit 1 fi - -# Document what was added to the image -echo "Lastly, documenting what we added to the metadata file" -DocumentInstalledItem "kubectl ($(kubectl version --client --short |& head -n 1))" -DocumentInstalledItem "helm ($(helm version --short |& head -n 1))" -# minikube version output already has word minikube in it. example minikube version: v1.9.2 -DocumentInstalledItem "$(minikube version --short)" -# kustomize version output has "{} in it". example {kustomize/v3.8.1 2020-07-16T00:58:46Z } -DocumentInstalledItem "kustomize ($(kustomize version --short))" diff --git a/images/linux/scripts/installers/leiningen.sh b/images/linux/scripts/installers/leiningen.sh index 318f65ebc..56079a34d 100644 --- a/images/linux/scripts/installers/leiningen.sh +++ b/images/linux/scripts/installers/leiningen.sh @@ -4,8 +4,6 @@ ## Desc: Installs Leiningen ################################################################################ -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh set -e @@ -29,7 +27,3 @@ if ! command -v lein; then else lein new app testapp && rm -rf testapp fi - -# Document what was added to the image -echo "Lastly, documenting what we added to the metadata file" -DocumentInstalledItem "Leiningen ($(lein -v))" diff --git a/images/linux/scripts/installers/mercurial.sh b/images/linux/scripts/installers/mercurial.sh index af40bf817..ad972d74f 100644 --- a/images/linux/scripts/installers/mercurial.sh +++ b/images/linux/scripts/installers/mercurial.sh @@ -5,7 +5,6 @@ ################################################################################ # Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh source $HELPER_SCRIPTS/os.sh if isUbuntu16 ; then @@ -22,7 +21,3 @@ echo "Testing to make sure that script performed as expected, and basic scenario if ! command -v hg; then exit 1 fi - -# Document what was added to the image -echo "Lastly, documenting what we added to the metadata file" -DocumentInstalledItem "Mercurial ($(hg --version | head -n 1))" diff --git a/images/linux/scripts/installers/miniconda.sh b/images/linux/scripts/installers/miniconda.sh index 8ec72635d..29eebd0ca 100644 --- a/images/linux/scripts/installers/miniconda.sh +++ b/images/linux/scripts/installers/miniconda.sh @@ -4,8 +4,6 @@ ## Desc: Installs miniconda ################################################################################ -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh # Install Miniconda curl -sL https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -o miniconda.sh \ @@ -17,7 +15,3 @@ CONDA=/usr/share/miniconda echo "CONDA=$CONDA" | tee -a /etc/environment ln -s $CONDA/bin/conda /usr/bin/conda - -# Document what was added to the image -echo "Lastly, documenting what we added to the metadata file" -DocumentInstalledItem "Miniconda ($($CONDA/bin/conda --version))" diff --git a/images/linux/scripts/installers/mongodb.sh b/images/linux/scripts/installers/mongodb.sh index 54aaa4075..2d012c61f 100644 --- a/images/linux/scripts/installers/mongodb.sh +++ b/images/linux/scripts/installers/mongodb.sh @@ -6,7 +6,6 @@ # Source the helpers source $HELPER_SCRIPTS/os.sh -source $HELPER_SCRIPTS/document.sh # Install Mongo DB wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add - @@ -21,7 +20,3 @@ if ! command -v mongod; then echo "mongodb was not installed" exit 1 fi - -# Document the installed version -echo "Document the installed version" -DocumentInstalledItem "MongoDB on Linux $(mongod --version | awk 'NR==1{print $3}')" diff --git a/images/linux/scripts/installers/mono.sh b/images/linux/scripts/installers/mono.sh index e0f84a11a..9e4968f36 100644 --- a/images/linux/scripts/installers/mono.sh +++ b/images/linux/scripts/installers/mono.sh @@ -4,8 +4,6 @@ ## Desc: Installs Mono ################################################################################ -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh LSB_CODENAME=$(lsb_release -cs) @@ -27,8 +25,3 @@ if ! command -v nuget; then echo "nuget was not installed" exit 1 fi - -# Document what was added to the image -echo "Lastly, documenting what we added to the metadata file" -DocumentInstalledItem "Mono ($(mono --version | head -n 1))" -DocumentInstalledItem "NuGet ($(nuget | tail -n +1 | head -n 1))" # Pipe to tail before piping to head because NuGet prints an ugly error if you close its stream before it's done writing. diff --git a/images/linux/scripts/installers/mysql.sh b/images/linux/scripts/installers/mysql.sh index a2869adb2..24cb5cf26 100644 --- a/images/linux/scripts/installers/mysql.sh +++ b/images/linux/scripts/installers/mysql.sh @@ -4,8 +4,6 @@ ## Desc: Installs MySQL Client ################################################################################ -## Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh export ACCEPT_EULA=Y @@ -51,13 +49,6 @@ mysql -vvv -e 'CREATE DATABASE smoke_test' -uroot -proot mysql -vvv -e 'DROP DATABASE smoke_test' -uroot -proot set +e -# Document what was added to the image -echo "Lastly, documenting what we added to the metadata file" -DocumentInstalledItem "MySQL ($(mysql --version))" -DocumentInstalledItem "MySQL Server (user:root password:root)" -DocumentInstalledItem "MS SQL Server Client Tools" -DocumentInstalledItem "MySQL service is disabled by default. Use the following command as a part of your job to start the service: 'sudo systemctl start mysql.service'" - # Disable mysql.service systemctl is-active --quiet mysql.service && systemctl stop mysql.service systemctl disable mysql.service diff --git a/images/linux/scripts/installers/netlify.sh b/images/linux/scripts/installers/netlify.sh index 48afc4826..b737d4759 100644 --- a/images/linux/scripts/installers/netlify.sh +++ b/images/linux/scripts/installers/netlify.sh @@ -4,8 +4,6 @@ ## Desc: Installs the Netlify CLI ################################################################################ -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh # Install the Netlify CLI npm i -g netlify-cli @@ -16,7 +14,3 @@ if ! command -v netlify; then echo "Netlify CLI was not installed" exit 1 fi - -# Document the installed version -echo "Document the installed version" -DocumentInstalledItem "Netlify CLI ($(netlify --version))" diff --git a/images/linux/scripts/installers/nodejs.sh b/images/linux/scripts/installers/nodejs.sh index 073061ed5..378236a8b 100644 --- a/images/linux/scripts/installers/nodejs.sh +++ b/images/linux/scripts/installers/nodejs.sh @@ -4,8 +4,6 @@ ## Desc: Installs Node.js LTS and related tooling (Gulp, Grunt) ################################################################################ -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh # Install LTS Node.js and related build tools curl -sL https://raw.githubusercontent.com/mklement0/n-install/stable/bin/n-install | bash -s -- -ny - @@ -31,16 +29,3 @@ for cmd in node grunt gulp webpack parcel yarn newman; do exit 1 fi done - -# Document what was added to the image -echo "Lastly, documenting what we added to the metadata file" -DocumentInstalledItem "Node.js ($(node --version))" -DocumentInstalledItem "Grunt ($(grunt --version))" -DocumentInstalledItem "Gulp ($(gulp --version))" -DocumentInstalledItem "n ($(n --version))" -DocumentInstalledItem "Parcel ($(parcel --version))" -DocumentInstalledItem "TypeScript ($(tsc --version))" -DocumentInstalledItem "Webpack ($(webpack --version))" -DocumentInstalledItem "Webpack CLI ($(webpack-cli --version))" -DocumentInstalledItem "Yarn ($(yarn --version))" -DocumentInstalledItem "Newman ($(newman --version))" diff --git a/images/linux/scripts/installers/nvm.sh b/images/linux/scripts/installers/nvm.sh index 817693076..74fed1f2a 100644 --- a/images/linux/scripts/installers/nvm.sh +++ b/images/linux/scripts/installers/nvm.sh @@ -4,8 +4,6 @@ ## Desc: Installs Nvm ################################################################################ -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh export NVM_DIR="/etc/skel/.nvm" mkdir $NVM_DIR @@ -21,5 +19,3 @@ fi # set system node.js as default one nvm alias default system - -DocumentInstalledItem "nvm ($(nvm --version))" \ No newline at end of file diff --git a/images/linux/scripts/installers/oc.sh b/images/linux/scripts/installers/oc.sh index 31892f105..88894e3f5 100644 --- a/images/linux/scripts/installers/oc.sh +++ b/images/linux/scripts/installers/oc.sh @@ -4,8 +4,7 @@ ## Desc: Installs the OC CLI ################################################################################ -# Source the helpers -source $HELPER_SCRIPTS/document.sh + # Install the oc CLI curl "https://mirror.openshift.com/pub/openshift-v4/clients/oc/latest/linux/oc.tar.gz" > oc.tar.gz tar xvzf oc.tar.gz @@ -18,7 +17,3 @@ if ! command -v oc; then echo "oc was not installed" exit 1 fi - -# Document the installed version -echo "Document the installed version" -DocumentInstalledItem "oc CLI $(oc version)" diff --git a/images/linux/scripts/installers/oras-cli.sh b/images/linux/scripts/installers/oras-cli.sh index c4546ccbf..e615d25de 100644 --- a/images/linux/scripts/installers/oras-cli.sh +++ b/images/linux/scripts/installers/oras-cli.sh @@ -4,8 +4,6 @@ ## Desc: Installs ORAS CLI ################################################################################ -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh source $HELPER_SCRIPTS/install.sh # Determine latest ORAS CLI version @@ -24,7 +22,3 @@ if ! oras version; then echo "ORAS CLI was not installed" exit 1 fi - -# Document what was added to the image -echo "Lastly, documenting what we added to the metadata file" -DocumentInstalledItem "ORAS CLI $(oras version | awk 'NR==1{print $2}')" \ No newline at end of file diff --git a/images/linux/scripts/installers/packer.sh b/images/linux/scripts/installers/packer.sh index d44dd9c02..25897a780 100644 --- a/images/linux/scripts/installers/packer.sh +++ b/images/linux/scripts/installers/packer.sh @@ -3,8 +3,7 @@ ## File: packer.sh ## Desc: Installs packer ################################################################################ -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh + # Install Packer PACKER_VERSION=$(curl -s https://checkpoint-api.hashicorp.com/v1/check/packer | jq -r .current_version) @@ -18,7 +17,3 @@ if ! command -v packer; then echo "Packer was not installed or found on PATH" exit 1 fi - -# Document what was added to the image -echo "Lastly, documenting what we added to the metadata file" -DocumentInstalledItem "Packer ($(packer --version))" diff --git a/images/linux/scripts/installers/phantomjs.sh b/images/linux/scripts/installers/phantomjs.sh index 9f333350c..093056db2 100644 --- a/images/linux/scripts/installers/phantomjs.sh +++ b/images/linux/scripts/installers/phantomjs.sh @@ -6,9 +6,6 @@ set -e -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh - # Install PhantomJS apt-get install -y chrpath libssl-dev libxft-dev libfreetype6 libfreetype6-dev libfontconfig1 libfontconfig1-dev PHANTOM_JS=phantomjs-2.1.1-linux-x86_64 @@ -23,7 +20,3 @@ if ! command -v phantomjs; then echo "phantomjs was not installed" exit 1 fi - -# Document what was added to the image -echo "Lastly, documenting what we added to the metadata file" -DocumentInstalledItem "PhantomJS ($(phantomjs --version))" diff --git a/images/linux/scripts/installers/php.sh b/images/linux/scripts/installers/php.sh index 3725f6ac5..35afa4a4f 100644 --- a/images/linux/scripts/installers/php.sh +++ b/images/linux/scripts/installers/php.sh @@ -6,7 +6,6 @@ # Source the helpers for use with the script source $HELPER_SCRIPTS/etc-environment.sh -source $HELPER_SCRIPTS/document.sh source $HELPER_SCRIPTS/os.sh set -e @@ -127,24 +126,9 @@ for cmd in php $php_versions composer phpunit; do fi done -# Document what was added to the image -echo "Lastly, documenting what we added to the metadata file" - -for version in $php_versions; do - DocumentInstalledItem "PHP $version ($(php$version --version | head -n 1))" -done - # ubuntu 20.04 libzip-dev is libzip5 based and is not compatible libzip-dev of ppa:ondrej/php # see https://github.com/actions/virtual-environments/issues/1084 if isUbuntu20 ; then rm /etc/apt/sources.list.d/ondrej-ubuntu-php-focal.list apt-get update - AddBlockquote "To use ppa:ondrej/php APT repository On Ubuntu 20.04 it is necessary to add it to the APT sources" - StartCode - WriteItem "apt-add-repository ppa:ondrej/php -y" - WriteItem "apt-get update" - EndCode fi - -DocumentInstalledItem "Composer ($(composer --version))" -DocumentInstalledItem "PHPUnit ($(phpunit --version))" diff --git a/images/linux/scripts/installers/pollinate.sh b/images/linux/scripts/installers/pollinate.sh index 97d0d23ab..bdb2ce36c 100644 --- a/images/linux/scripts/installers/pollinate.sh +++ b/images/linux/scripts/installers/pollinate.sh @@ -4,8 +4,6 @@ ## Desc: Installs Pollinate ################################################################################ -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh # Install Pollinate apt-get install -y --no-install-recommends pollinate @@ -16,7 +14,3 @@ if ! command -v pollinate; then echo "pollinate was not installed" exit 1 fi - -# Document what was added to the image -echo "Lastly, documenting what we added to the metadata file" -DocumentInstalledItem "Pollinate" diff --git a/images/linux/scripts/installers/postgresql.sh b/images/linux/scripts/installers/postgresql.sh index 7c1c89cc0..ae5ffbb25 100644 --- a/images/linux/scripts/installers/postgresql.sh +++ b/images/linux/scripts/installers/postgresql.sh @@ -4,8 +4,6 @@ ## Desc: Installs Postgresql ################################################################################ -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh #Preparing repo for PostgreSQL 12. wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - @@ -25,8 +23,6 @@ apt-get install libpq-dev # connection timeout - 2 pg_isready -DocumentInstalledItem "$(psql -V 2>&1 | cut -d ' ' -f 1,2,3)" - # Disable postgresql.service systemctl is-active --quiet postgresql.service && systemctl stop postgresql.service systemctl disable postgresql.service \ No newline at end of file diff --git a/images/linux/scripts/installers/powershellcore.sh b/images/linux/scripts/installers/powershellcore.sh index abd5d751d..e0c19ba7c 100644 --- a/images/linux/scripts/installers/powershellcore.sh +++ b/images/linux/scripts/installers/powershellcore.sh @@ -5,7 +5,6 @@ ################################################################################ # Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh source $HELPER_SCRIPTS/os.sh # Install Powershell @@ -27,7 +26,3 @@ if ! pwsh -c 'Write-Host Hello world'; then echo "pwsh failed to run" exit 1 fi - -# Document what was added to the image -echo "Lastly, documenting what we added to the metadata file" -DocumentInstalledItem "Powershell ($(pwsh --version))" diff --git a/images/linux/scripts/installers/preparemetadata.sh b/images/linux/scripts/installers/preparemetadata.sh deleted file mode 100644 index 9e8aef1e1..000000000 --- a/images/linux/scripts/installers/preparemetadata.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -################################################################################ -## File: preparemetadata.sh -## Desc: This script adds a image title information to the metadata -## document -################################################################################ - -source $HELPER_SCRIPTS/document.sh - -WriteItem "" - -if [ -n "$ANNOUNCEMENTS" ]; then - WriteItem "$ANNOUNCEMENTS" - WriteItem "***" -fi - - -AddTitle "$(lsb_release -ds)" -WriteItem "The following software is installed on machines with the $IMAGE_VERSION update." -WriteItem "***" diff --git a/images/linux/scripts/installers/pulumi.sh b/images/linux/scripts/installers/pulumi.sh index e041c2b7c..bfdad2d13 100644 --- a/images/linux/scripts/installers/pulumi.sh +++ b/images/linux/scripts/installers/pulumi.sh @@ -5,7 +5,6 @@ ################################################################################ # Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh source $HELPER_SCRIPTS/install.sh # Install Pulumi @@ -20,7 +19,3 @@ if ! command -v pulumi ; then echo "Pulumi was not installed" exit 1 fi - -# Document what was added to the image -echo "Lastly, documenting what we added to the metadata file" -DocumentInstalledItem "Pulumi $(pulumi version)" diff --git a/images/linux/scripts/installers/pypy.sh b/images/linux/scripts/installers/pypy.sh index b859eb4e1..cc707a3e4 100644 --- a/images/linux/scripts/installers/pypy.sh +++ b/images/linux/scripts/installers/pypy.sh @@ -4,8 +4,6 @@ ## Desc: Installs PyPy ################################################################################ -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh source $HELPER_SCRIPTS/install.sh # This function installs PyPy using the specified arguments: diff --git a/images/linux/scripts/installers/python.sh b/images/linux/scripts/installers/python.sh index 7081c5e7d..3f6361e16 100644 --- a/images/linux/scripts/installers/python.sh +++ b/images/linux/scripts/installers/python.sh @@ -5,7 +5,6 @@ ################################################################################ # Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh source $HELPER_SCRIPTS/os.sh # Install Python, Python 3, pip, pip3 @@ -28,10 +27,3 @@ for cmd in python pip python3 pip3; do exit 1 fi done - -# Document what was added to the image -echo "Lastly, documenting what we added to the metadata file" -DocumentInstalledItem "Python ($(python --version 2>&1))" -DocumentInstalledItem "pip ($(pip --version))" -DocumentInstalledItem "Python3 ($(python3 --version))" -DocumentInstalledItem "pip3 ($(pip3 --version))" \ No newline at end of file diff --git a/images/linux/scripts/installers/r.sh b/images/linux/scripts/installers/r.sh index 4eaa14160..cca86e1bb 100644 --- a/images/linux/scripts/installers/r.sh +++ b/images/linux/scripts/installers/r.sh @@ -1,7 +1,6 @@ #!/bin/bash # Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh source $HELPER_SCRIPTS/os.sh # install R @@ -13,5 +12,3 @@ sudo add-apt-repository "deb https://cloud.r-project.org/bin/linux/ubuntu $osLab sudo apt update sudo apt install r-base version=$(R --version | grep "R version" | cut -d " " -f 3) - -DocumentInstalledItem "R $version" diff --git a/images/linux/scripts/installers/rndgenerator.sh b/images/linux/scripts/installers/rndgenerator.sh index c25759893..cdb78edf1 100644 --- a/images/linux/scripts/installers/rndgenerator.sh +++ b/images/linux/scripts/installers/rndgenerator.sh @@ -4,8 +4,6 @@ ## Desc: Install random number generator ################################################################################ -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh # Install haveged apt-get -y install haveged @@ -18,7 +16,3 @@ for cmd in haveged; do exit 1 fi done - -# Document what was added to the image -echo "Lastly, documenting what we added to the metadata file" -DocumentInstalledItem "Haveged $(dpkg-query --showformat='${Version}' --show haveged)" \ No newline at end of file diff --git a/images/linux/scripts/installers/ruby.sh b/images/linux/scripts/installers/ruby.sh index 0cbea36d1..8be6d0fa9 100644 --- a/images/linux/scripts/installers/ruby.sh +++ b/images/linux/scripts/installers/ruby.sh @@ -4,16 +4,9 @@ ## Desc: Installs Ruby requirements ################################################################################ -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh sudo apt-get install ruby-full sudo gem update --system # Install Ruby requirements apt-get install -y libz-dev openssl libssl-dev - -DocumentInstalledItem "ruby ($(ruby --version 2>&1 | cut -d ' ' -f 2))" -DocumentInstalledItem "gem ($(gem -v 2>&1 | tail -n 1))" -DocumentInstalledItem "$(openssl version)" -DocumentInstalledItem "Libssl $(dpkg -l libssl-dev | grep '^ii' | awk '{print $3}')" diff --git a/images/linux/scripts/installers/rust.sh b/images/linux/scripts/installers/rust.sh index 088cc9aa1..a211e791b 100644 --- a/images/linux/scripts/installers/rust.sh +++ b/images/linux/scripts/installers/rust.sh @@ -6,7 +6,6 @@ # Source the helpers for use with the script source $HELPER_SCRIPTS/etc-environment.sh -source $HELPER_SCRIPTS/document.sh export RUSTUP_HOME=/usr/share/rust/.rustup export CARGO_HOME=/usr/share/rust/.cargo @@ -45,16 +44,3 @@ pushd /etc/skel ln -sf $RUSTUP_HOME .rustup ln -sf $CARGO_HOME .cargo popd - -# Document what was added to the image -echo "Lastly, document what was added to the metadata file" -DocumentInstalledItem "rustup ($(rustup --version 2>&1 | cut -d ' ' -f 2))" -DocumentInstalledItem "rust ($(rustc --version 2>&1 | cut -d ' ' -f 2))" -DocumentInstalledItem "cargo ($(cargo --version 2>&1 | cut -d ' ' -f 2))" -DocumentInstalledItem "rustfmt ($(rustfmt --version 2>&1 | cut -d ' ' -f 2))" -DocumentInstalledItem "clippy ($(cargo-clippy --version 2>&1 | cut -d ' ' -f 2))" -DocumentInstalledItem "rustdoc ($(rustdoc --version 2>&1 | cut -d ' ' -f 2))" -DocumentInstalledItem "bindgen ($(bindgen --version 2>&1 | cut -d ' ' -f 2))" -DocumentInstalledItem "cbindgen ($(cbindgen --version 2>&1 | cut -d ' ' -f 2))" -DocumentInstalledItem "cargo audit ($(cargo audit --version 2>&1 | cut -d ' ' -f 2))" -DocumentInstalledItem "cargo outdated ($(cargo outdated --version 2>&1 | cut -d ' ' -f 2))" \ No newline at end of file diff --git a/images/linux/scripts/installers/sbt.sh b/images/linux/scripts/installers/sbt.sh index adc74daaf..166dc18b5 100644 --- a/images/linux/scripts/installers/sbt.sh +++ b/images/linux/scripts/installers/sbt.sh @@ -4,8 +4,6 @@ ## Desc: Installs sbt ################################################################################ -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh # Install sbt # https://www.scala-sbt.org/1.x/docs/Installing-sbt-on-Linux.html @@ -13,7 +11,3 @@ echo "deb https://dl.bintray.com/sbt/debian /" | sudo tee -a /etc/apt/sources.li curl -sL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2EE0EA64E40A89B84B2DF73499E82A75642AC823" | apt-key add apt-get -q update apt-get -y install sbt - -# Document what was added to the image -echo "Lastly, documenting what we added to the metadata file" -DocumentInstalledItem "sbt ($(sbt --script-version))" diff --git a/images/linux/scripts/installers/selenium.sh b/images/linux/scripts/installers/selenium.sh index 3cb7c315c..d9b5e2794 100644 --- a/images/linux/scripts/installers/selenium.sh +++ b/images/linux/scripts/installers/selenium.sh @@ -4,8 +4,6 @@ ## Desc: Installs selenium server ################################################################################ -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh # Determine latest selenium standalone server version SELENIUM_LATEST_VERSION_URL=https://api.github.com/repos/SeleniumHQ/selenium/releases/latest @@ -26,6 +24,3 @@ fi SELENIUM_JAR_PATH="/usr/share/java/selenium-server-standalone.jar" mv $SELENIUM_JAR_NAME $SELENIUM_JAR_PATH echo "SELENIUM_JAR_PATH=$SELENIUM_JAR_PATH" | tee -a /etc/environment - -echo "Lastly, documenting what we added to the metadata file" -DocumentInstalledItem "Selenium server standalone (available via SELENIUM_JAR_PATH environment variable)" \ No newline at end of file diff --git a/images/linux/scripts/installers/sphinx.sh b/images/linux/scripts/installers/sphinx.sh index 844d145a2..425bb7fd3 100644 --- a/images/linux/scripts/installers/sphinx.sh +++ b/images/linux/scripts/installers/sphinx.sh @@ -4,12 +4,6 @@ ## Desc: Installs Sphinx ################################################################################ -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh # Install Sphinx apt-get install -y sphinxsearch - -# Document what was added to the image -echo "Lastly, documenting what we added to the metadata file" -DocumentInstalledItem "Sphinx Open Source Search Server" diff --git a/images/linux/scripts/installers/subversion.sh b/images/linux/scripts/installers/subversion.sh index 66540704c..3f51d46a0 100644 --- a/images/linux/scripts/installers/subversion.sh +++ b/images/linux/scripts/installers/subversion.sh @@ -4,8 +4,6 @@ ## Desc: Installs Subversion client ################################################################################ -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh # Install Subversion apt-get install -y --no-install-recommends subversion @@ -16,7 +14,3 @@ if ! command -v svn; then echo "Subversion (svn) was not installed" exit 1 fi - -# Document what was added to the image -echo "Lastly, documenting what we added to the metadata file" -DocumentInstalledItem "Subversion ($(svn --version | head -n 1))" diff --git a/images/linux/scripts/installers/swift.sh b/images/linux/scripts/installers/swift.sh index ca97606e9..318d3973f 100644 --- a/images/linux/scripts/installers/swift.sh +++ b/images/linux/scripts/installers/swift.sh @@ -4,8 +4,6 @@ ## Desc: Installs Swift ################################################################################ -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh # Install image_label="$(lsb_release -rs)" @@ -26,7 +24,3 @@ if ! command -v swift; then echo "Swift was not installed" exit 1 fi - -# Document what was added to the image -echo "Lastly, documenting what we added to the metadata file" -DocumentInstalledItem "$(swift --version)" \ No newline at end of file diff --git a/images/linux/scripts/installers/swig.sh b/images/linux/scripts/installers/swig.sh index 2d9164741..7972e8827 100644 --- a/images/linux/scripts/installers/swig.sh +++ b/images/linux/scripts/installers/swig.sh @@ -1,7 +1,5 @@ #!/bin/bash -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh # Install Swig sudo apt-get install -y swig @@ -12,7 +10,3 @@ if ! command -v swig; then echo "Swig was not installed" exit 1 fi - -# Document what was added to the image -echo "Lastly, documenting what we added to the metadata file" -DocumentInstalledItem "Swig $(swig -version | sed -n 2p | cut -d ' ' -f 3)" diff --git a/images/linux/scripts/installers/terraform.sh b/images/linux/scripts/installers/terraform.sh index 8cbd026a0..4c7e6e762 100644 --- a/images/linux/scripts/installers/terraform.sh +++ b/images/linux/scripts/installers/terraform.sh @@ -4,8 +4,6 @@ ## Desc: Installs terraform ################################################################################ -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh # Install Terraform TERRAFORM_VERSION=$(curl -s https://checkpoint-api.hashicorp.com/v1/check/terraform | jq -r .current_version) @@ -19,7 +17,3 @@ if ! command -v terraform; then echo "Terraform was not installed or found on PATH" exit 1 fi - -# Document what was added to the image -echo "Lastly, documenting what we added to the metadata file" -DocumentInstalledItem "Terraform ($(terraform --version))" diff --git a/images/linux/scripts/installers/vcpkg.sh b/images/linux/scripts/installers/vcpkg.sh index 69f50c5e7..ba7cd01cf 100644 --- a/images/linux/scripts/installers/vcpkg.sh +++ b/images/linux/scripts/installers/vcpkg.sh @@ -5,7 +5,6 @@ ################################################################################ # Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh source $HELPER_SCRIPTS/os.sh # Set env variable for vcpkg @@ -36,7 +35,3 @@ if ! command -v vcpkg; then echo "vcpkg was not installed" exit 1 fi - -# Document what was added to the image -echo "Lastly, documenting what we added to the metadata file" -DocumentInstalledItem "Vcpkg $(vcpkg version | head -n 1 | cut -d ' ' -f 6)" diff --git a/images/linux/scripts/installers/vercel.sh b/images/linux/scripts/installers/vercel.sh index 13fb39155..4e0d41ae6 100644 --- a/images/linux/scripts/installers/vercel.sh +++ b/images/linux/scripts/installers/vercel.sh @@ -4,9 +4,6 @@ ## Desc: Installs the Vercel CLI ################################################################################ -# Source the helpers for use with the script -source $HELPER_SCRIPTS/document.sh - # Install the Vercel CLI npm i -g vercel @@ -25,7 +22,3 @@ if ! command -v now; then echo "[Now] symlink to Vercel CLI was not created" exit 1 fi - -# Document the installed version -echo "Document the installed version" -DocumentInstalledItem "Vercel CLI ($(vercel --version))" diff --git a/images/linux/ubuntu1604.json b/images/linux/ubuntu1604.json index 27cc6b0bd..33263345a 100644 --- a/images/linux/ubuntu1604.json +++ b/images/linux/ubuntu1604.json @@ -14,7 +14,6 @@ "private_virtual_network_with_public_ip": "{{env `PRIVATE_VIRTUAL_NETWORK_WITH_PUBLIC_IP`}}", "image_folder": "/imagegeneration", "imagedata_file": "/imagegeneration/imagedata.json", - "metadata_file": "/imagegeneration/metadatafile", "installer_script_folder": "/imagegeneration/installers", "helper_script_folder": "/imagegeneration/helpers", "vm_size": "Standard_DS2_v2", @@ -103,19 +102,6 @@ "source": "{{template_dir}}/toolsets/toolset-1604.json", "destination": "{{user `installer_script_folder`}}/toolset.json" }, - { - "type": "shell", - "execute_command": "chmod +x {{ .Path }}; sudo {{ .Vars }} {{ .Path }}", - "scripts":[ - "{{template_dir}}/scripts/installers/preparemetadata.sh" - ], - "environment_vars": [ - "IMAGE_VERSION={{user `image_version`}}", - "METADATA_FILE={{user `metadata_file`}}", - "HELPER_SCRIPTS={{user `helper_script_folder`}}", - "ANNOUNCEMENTS={{user `announcements`}}" - ] - }, { "type": "shell", "scripts":[ @@ -222,7 +208,6 @@ "{{template_dir}}/scripts/installers/test-toolcache.sh" ], "environment_vars": [ - "METADATA_FILE={{user `metadata_file`}}", "HELPER_SCRIPTS={{user `helper_script_folder`}}", "INSTALLER_SCRIPT_FOLDER={{user `installer_script_folder`}}", "GITHUB_FEED_TOKEN={{user `github_feed_token`}}", @@ -238,7 +223,6 @@ "{{template_dir}}/scripts/installers/Validate-Toolset.ps1" ], "environment_vars": [ - "METADATA_FILE={{user `metadata_file`}}", "HELPER_SCRIPTS={{user `helper_script_folder`}}", "INSTALLER_SCRIPT_FOLDER={{user `installer_script_folder`}}" ], @@ -250,7 +234,6 @@ "{{template_dir}}/scripts/installers/aws-sam-cli.sh" ], "environment_vars": [ - "METADATA_FILE={{user `metadata_file`}}", "HELPER_SCRIPTS={{user `helper_script_folder`}}" ], "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" @@ -261,7 +244,6 @@ "{{template_dir}}/scripts/installers/homebrew.sh" ], "environment_vars": [ - "METADATA_FILE={{user `metadata_file`}}", "HELPER_SCRIPTS={{user `helper_script_folder`}}", "DEBIAN_FRONTEND=noninteractive" ], diff --git a/images/linux/ubuntu1804.json b/images/linux/ubuntu1804.json index 05f4a2691..1dd62bc2d 100644 --- a/images/linux/ubuntu1804.json +++ b/images/linux/ubuntu1804.json @@ -14,7 +14,6 @@ "private_virtual_network_with_public_ip": "{{env `PRIVATE_VIRTUAL_NETWORK_WITH_PUBLIC_IP`}}", "image_folder": "/imagegeneration", "imagedata_file": "/imagegeneration/imagedata.json", - "metadata_file": "/imagegeneration/metadatafile", "installer_script_folder": "/imagegeneration/installers", "helper_script_folder": "/imagegeneration/helpers", "vm_size": "Standard_DS2_v2", @@ -106,19 +105,6 @@ "source": "{{template_dir}}/toolsets/toolset-1804.json", "destination": "{{user `installer_script_folder`}}/toolset.json" }, - { - "type": "shell", - "execute_command": "chmod +x {{ .Path }}; sudo {{ .Vars }} {{ .Path }}", - "scripts":[ - "{{template_dir}}/scripts/installers/preparemetadata.sh" - ], - "environment_vars": [ - "IMAGE_VERSION={{user `image_version`}}", - "METADATA_FILE={{user `metadata_file`}}", - "HELPER_SCRIPTS={{user `helper_script_folder`}}", - "ANNOUNCEMENTS={{user `announcements`}}" - ] - }, { "type": "shell", "scripts":[ @@ -226,7 +212,6 @@ "{{template_dir}}/scripts/installers/test-toolcache.sh" ], "environment_vars": [ - "METADATA_FILE={{user `metadata_file`}}", "HELPER_SCRIPTS={{user `helper_script_folder`}}", "INSTALLER_SCRIPT_FOLDER={{user `installer_script_folder`}}", "GITHUB_FEED_TOKEN={{user `github_feed_token`}}", @@ -242,7 +227,6 @@ "{{template_dir}}/scripts/installers/Validate-Toolset.ps1" ], "environment_vars": [ - "METADATA_FILE={{user `metadata_file`}}", "HELPER_SCRIPTS={{user `helper_script_folder`}}", "INSTALLER_SCRIPT_FOLDER={{user `installer_script_folder`}}" ], @@ -254,7 +238,6 @@ "{{template_dir}}/scripts/installers/aws-sam-cli.sh" ], "environment_vars": [ - "METADATA_FILE={{user `metadata_file`}}", "HELPER_SCRIPTS={{user `helper_script_folder`}}" ], "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" @@ -265,7 +248,6 @@ "{{template_dir}}/scripts/installers/homebrew.sh" ], "environment_vars": [ - "METADATA_FILE={{user `metadata_file`}}", "HELPER_SCRIPTS={{user `helper_script_folder`}}", "DEBIAN_FRONTEND=noninteractive" ], diff --git a/images/linux/ubuntu2004.json b/images/linux/ubuntu2004.json index 4a4ff5c5f..67d6e1d6a 100644 --- a/images/linux/ubuntu2004.json +++ b/images/linux/ubuntu2004.json @@ -14,7 +14,6 @@ "private_virtual_network_with_public_ip": "{{env `PRIVATE_VIRTUAL_NETWORK_WITH_PUBLIC_IP`}}", "image_folder": "/imagegeneration", "imagedata_file": "/imagegeneration/imagedata.json", - "metadata_file": "/imagegeneration/metadatafile", "installer_script_folder": "/imagegeneration/installers", "helper_script_folder": "/imagegeneration/helpers", "vm_size": "Standard_DS2_v2", @@ -108,19 +107,6 @@ "source": "{{template_dir}}/toolsets/toolset-2004.json", "destination": "{{user `installer_script_folder`}}/toolset.json" }, - { - "type": "shell", - "execute_command": "chmod +x {{ .Path }}; sudo {{ .Vars }} {{ .Path }}", - "scripts":[ - "{{template_dir}}/scripts/installers/preparemetadata.sh" - ], - "environment_vars": [ - "IMAGE_VERSION={{user `image_version`}}", - "METADATA_FILE={{user `metadata_file`}}", - "HELPER_SCRIPTS={{user `helper_script_folder`}}", - "ANNOUNCEMENTS={{user `announcements`}}" - ] - }, { "type": "shell", "scripts":[ @@ -228,7 +214,6 @@ "{{template_dir}}/scripts/installers/test-toolcache.sh" ], "environment_vars": [ - "METADATA_FILE={{user `metadata_file`}}", "HELPER_SCRIPTS={{user `helper_script_folder`}}", "INSTALLER_SCRIPT_FOLDER={{user `installer_script_folder`}}", "GITHUB_FEED_TOKEN={{user `github_feed_token`}}", @@ -244,7 +229,6 @@ "{{template_dir}}/scripts/installers/Validate-Toolset.ps1" ], "environment_vars": [ - "METADATA_FILE={{user `metadata_file`}}", "HELPER_SCRIPTS={{user `helper_script_folder`}}", "INSTALLER_SCRIPT_FOLDER={{user `installer_script_folder`}}" ], @@ -256,7 +240,6 @@ "{{template_dir}}/scripts/installers/aws-sam-cli.sh" ], "environment_vars": [ - "METADATA_FILE={{user `metadata_file`}}", "HELPER_SCRIPTS={{user `helper_script_folder`}}" ], "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" @@ -267,7 +250,6 @@ "{{template_dir}}/scripts/installers/homebrew.sh" ], "environment_vars": [ - "METADATA_FILE={{user `metadata_file`}}", "HELPER_SCRIPTS={{user `helper_script_folder`}}", "DEBIAN_FRONTEND=noninteractive" ],