diff --git a/.vscode/settings.json b/.vscode/settings.json index 470eddc0..791873be 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,4 +1,7 @@ { // When enabled, will trim trailing whitespace when you save a file. - "files.trimTrailingWhitespace": true + "files.trimTrailingWhitespace": true, + "[markdown]": { + "files.trimTrailingWhitespace": false + }, } diff --git a/README.md b/README.md index 69b0c920..b3cb7d45 100644 --- a/README.md +++ b/README.md @@ -40,8 +40,9 @@ we pin the tool to specific version(s). *Following Along / Change Notifications* -* **High Impact Changes** (ex. breaking changes, new or deprecated environments) will be posted to the GitHub Changelog on our [blog](https://github.blog/changelog/) and on [twitter](https://twitter.com/GHchangelog). -* **Regular Weekly Rhythm** can be followed by watching [Releases](https://github.com/actions/virtual-environments/releases) to see when we generate candidate environments or deploy new ones. You can also track upcoming changes on the [virtual environment project](https://github.com/actions/virtual-environments/projects/1) to see which issues are under development. +* **High Impact Changes** (ex. breaking changes, new or deprecated environments) will be posted to the GitHub Changelog on our [blog](https://github.blog/changelog/) and on [twitter](https://twitter.com/GHchangelog). +Low Impact changes will be pinned in this repository and marked with the [Announcement](https://github.com/actions/virtual-environments/labels/Announcement) label. +* **Regular Weekly Rhythm** can be followed by watching [Releases](https://github.com/actions/virtual-environments/releases) to see when we generate candidate environments or deploy new ones. You can also track upcoming changes using the [awaiting-deployment](https://github.com/actions/virtual-environments/labels/awaiting-deployment) label. [ubuntu-18.04]: https://github.com/actions/virtual-environments/blob/master/images/linux/Ubuntu1804-README.md [ubuntu-16.04]: https://github.com/actions/virtual-environments/blob/master/images/linux/Ubuntu1604-README.md diff --git a/images/linux/Ubuntu2004-README.md b/images/linux/Ubuntu2004-README.md new file mode 100644 index 00000000..9c3d1255 --- /dev/null +++ b/images/linux/Ubuntu2004-README.md @@ -0,0 +1,210 @@ + +# Ubuntu 20.04 LTS +The following software is installed on machines with the 20200531.1 update. +*** +- Homebrew on Linux (Homebrew 2.3.0 +Homebrew/linuxbrew-core (git revision 3d1df; last commit 2020-05-30)) +- 7-Zip 16.02 +- Ansible (ansible 2.9.6) +- AzCopy7 (available by azcopy alias) 7.3.0 +- AzCopy10 (available by azcopy10 alias) 10.4.3 +- Azure CLI (azure-cli 2.6.0) +- Azure CLI (azure-devops 0.18.0) +- Basic CLI: + - curl + - dnsutils + - file + - ftp + - iproute2 + - iputils-ping + - jq + - libcurl4 + - libgbm-dev + - libicu55 + - libunwind8 + - locales + - netcat + - openssh-client + - parallel + - rsync + - shellcheck + - sudo + - telnet + - time + - tzdata + - unzip + - upx + - wget + - zip + - zstd + - gnupg2 + - lib32z1 +- Alibaba Cloud CLI (3.0.45) +- AWS CLI (aws-cli/1.18.69 Python/2.7.18rc1 Linux/5.4.0-1012-azure botocore/1.16.19) +- build-essential +- Clang 6.0 (6.0.1) +- Clang 8 (8.0.1) +- Clang 9 (9.0.1) +- Swift version 5.2.4 (swift-5.2.4-RELEASE) +Target: x86_64-unknown-linux-gnu +- CMake (cmake version 3.17.0) +- Podman (podman --version) +Buildah (buildah --version) +Skopeo (skopeo --version) +- Docker Compose (docker-compose version 1.25.4, build 8d51620a) +- .NET Core SDK: + - 3.1.300 + - 3.1.202 + - 3.1.201 + - 3.1.200 + - 3.1.104 + - 3.1.103 + - 3.1.101 + - 3.1.100 + - 2.1.806 + - 2.1.805 + - 2.1.804 + - 2.1.803 + - 2.1.802 + - 2.1.801 + - 2.1.701 + - 2.1.700 + - 2.1.611 + - 2.1.610 + - 2.1.609 + - 2.1.608 + - 2.1.607 + - 2.1.606 + - 2.1.605 + - 2.1.604 + - 2.1.603 + - 2.1.602 + - 2.1.514 + - 2.1.513 + - 2.1.512 + - 2.1.511 + - 2.1.510 + - 2.1.509 + - 2.1.508 + - 2.1.507 + - 2.1.506 + - 2.1.505 + - 2.1.504 + - 2.1.503 + - 2.1.502 + - 2.1.500 + - 2.1.403 + - 2.1.402 + - 2.1.401 + - 2.1.302 + - 2.1.301 + - 2.1.300 +- Erlang (Erlang (SMP,ASYNC_THREADS,HIPE) (BEAM) emulator version 11.0.2) +- Firefox (Mozilla Firefox 76.0.1) +- Geckodriver (0.26.0); Gecko Driver is available via GECKOWEBDRIVER environment variable +- GNU C++ 7.5.0 +- GNU C++ 8.4.0 +- GNU C++ 9.3.0 +- GNU Fortran 8.4.0 +- GNU Fortran 9.3.0 +- Git (2.26.2) +- Git Large File Storage (LFS) (2.11.0) +- Git-ftp (1.6.0) +- Hub CLI (2.14.2) +- Google Chrome (Google Chrome 83.0.4103.61 ) +- ChromeDriver 83.0.4103.39 (ccbf011cb2d2b19b506d844400483861342c20cd-refs/branch-heads/4103@{#416}); Chrome Driver is available via CHROMEWEBDRIVER environment variable +- Google Cloud SDK (294.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.6.5) +- GHC (The Glorious Glasgow Haskell Compilation System, version 8.8.3) +- GHC (The Glorious Glasgow Haskell Compilation System, version 8.10.1) +- Haskell Stack (Version 2.3.1, Git revision de2a7b694f07de7e6cf17f8c92338c16286b2878 (8103 commits) x86_64 hpack-0.33.0) +- Heroku (heroku/7.41.1 linux-x64 node-v12.16.2) +- HHVM (HipHop VM 4.59.0 (rel)) +- ImageMagick +- Azul Zulu OpenJDK: + - 8 (openjdk version "1.8.0_252") + - 11 (openjdk version "11.0.7" 2020-04-14 LTS) (default) + - 12 (openjdk version "12.0.2" 2019-07-16) +- Ant (Apache Ant(TM) version 1.10.7 compiled on October 24 2019) +- Gradle 6.4.1 +- Maven (Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)) +- Kind (kind v0.8.1 go1.14.2 linux/amd64) +- kubectl (Client Version: v1.18.3) +- helm (v3.2.1+gfe51cd1) +- minikube version: v1.11.0 +- Leiningen (Leiningen 2.9.3 on Java 1.8.0_252 OpenJDK 64-Bit Server VM) +- Mercurial (Mercurial Distributed SCM (version 5.3.1)) +- Miniconda (conda 4.8.2) +- Mono (Mono JIT compiler version 6.8.0.123 (tarball Tue May 12 15:14:32 UTC 2020)) +- MySQL (mysql Ver 8.0.20-0ubuntu0.20.04.1 for Linux on x86_64 ((Ubuntu))) +- MySQL Server (user:root password:root) +- MS SQL Server Client Tools +- 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' +- nvm (0.35.3) +- Node.js (v12.17.0) +- Grunt (grunt-cli v1.2.0) +- Gulp (CLI version: 2.2.1 +Local version: Unknown) +- n (6.5.1) +- Parcel (1.12.4) +- TypeScript (Version 3.9.3) +- Webpack (4.43.0) +- Webpack CLI (3.3.11) +- Yarn (1.22.4) +- Bazel (bazel 3.2.0) +- Bazelisk (1.4.0) +- PhantomJS (2.1.1) +- Composer (Composer version 1.10.6 2020-05-06 10:28:10) +- PHPUnit (PHPUnit 7.5.20 by Sebastian Bergmann and contributors.) +- Pollinate +- psql (PostgreSQL) 12.2 +- Powershell (PowerShell 7.0.0) +- ruby (2.7.0p0) +- gem (3.1.3) +- rustup (1.21.1) +- rust (1.43.1) +- cargo (1.43.0) +- rustfmt (1.4.12-stable) +- clippy (0.0.212) +- rustdoc (1.43.1) +- bindgen (0.54.0) +- cbindgen (0.14.2) +- Julia (julia version 1.4.2) +- 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.12.26) +- Packer (1.5.6) +- Vcpkg 2020.02.04-unknownhash +- Zeit Vercel CLI (19.0.1) +- Haveged 1.9.1-6ubuntu1 +- AWS SAM CLI, version 0.52.0 +- Go 1.14.3 (go version go1.14.3 linux/amd64) +- Google Repository 58 +- Google Play services 49 +- CMake 3.10.2.4988404 +- Android Support Repository 47.0.0 +- Android SDK Platform-Tools 30.0.1 +- Android SDK Platform 29 +- Android SDK Platform 28 +- Android SDK Platform 27 +- Android SDK Patch Applier v4 +- Android SDK Build-Tools 29.0.3 +- Android SDK Build-Tools 29.0.2 +- Android SDK Build-Tools 29.0.0 +- Android SDK Build-Tools 28.0.3 +- Android SDK Build-Tools 28.0.2 +- Android SDK Build-Tools 28.0.1 +- Android SDK Build-Tools 28.0.0 +- Android SDK Build-Tools 27.0.3 +- Android SDK Build-Tools 27.0.2 +- Android SDK Build-Tools 27.0.1 +- Android SDK Build-Tools 27.0.0 +- Android NDK 21.2.6472646 +- Az Module (4.1.0) +- Python (Python 2.7.18rc1) +- pip (pip 20.1.1 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)) diff --git a/images/linux/scripts/installers/docker-compose.sh b/images/linux/scripts/installers/docker-compose.sh index 1ba93f99..688928f0 100644 --- a/images/linux/scripts/installers/docker-compose.sh +++ b/images/linux/scripts/installers/docker-compose.sh @@ -7,10 +7,10 @@ source $HELPER_SCRIPTS/apt.sh source $HELPER_SCRIPTS/document.sh -version="1.25.4" +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) # Install latest docker-compose from releases -curl -L "https://github.com/docker/compose/releases/download/$version/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose +curl -L $URL -o /usr/local/bin/docker-compose chmod +x /usr/local/bin/docker-compose # Run tests to determine that the software installed as expected diff --git a/images/linux/scripts/installers/dotnetcore-sdk.sh b/images/linux/scripts/installers/dotnetcore-sdk.sh index ec0f0dc3..0e598d0d 100644 --- a/images/linux/scripts/installers/dotnetcore-sdk.sh +++ b/images/linux/scripts/installers/dotnetcore-sdk.sh @@ -60,8 +60,7 @@ for release_url in ${release_urls[@]}; do sdks=("${sdks[@]}" $(echo "${releases}" | jq '.releases[]' | jq '.sdks[]?' | jq '.version')) done -#temporary avoid 3.1.102 installation due to https://github.com/dotnet/aspnetcore/issues/19133 -sortedSdks=$(echo ${sdks[@]} | tr ' ' '\n' | grep -v 3.1.102 | grep -v preview | grep -v rc | grep -v display | cut -d\" -f2 | sort -u -r) +sortedSdks=$(echo ${sdks[@]} | tr ' ' '\n' | grep -v preview | grep -v rc | grep -v display | cut -d\" -f2 | sort -u -r) for sdk in $sortedSdks; do url="https://dotnetcli.blob.core.windows.net/dotnet/Sdk/$sdk/dotnet-sdk-$sdk-linux-x64.tar.gz" diff --git a/images/linux/scripts/installers/postgresql.sh b/images/linux/scripts/installers/postgresql.sh index 9f2988a8..7c1c89cc 100644 --- a/images/linux/scripts/installers/postgresql.sh +++ b/images/linux/scripts/installers/postgresql.sh @@ -7,10 +7,26 @@ # 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 - +echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" | tee /etc/apt/sources.list.d/pgdg.list + +echo "Install PostgreSQL" +apt update +apt install postgresql postgresql-client + echo "Install libpq-dev" apt-get install libpq-dev -echo "Install Postgresql Client" -apt-get install postgresql-client +#Verify that PostgreSQL is ready for accept incoming connections. +# exit codes: +# ready - 0 +# reject - 1 +# connection timeout - 2 +pg_isready -DocumentInstalledItem "$(psql -V 2>&1 | cut -d ' ' -f 1,2,3)" \ No newline at end of file +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/win/Windows2016-Azure.json b/images/win/Windows2016-Azure.json index 6afa6c44..622909b0 100644 --- a/images/win/Windows2016-Azure.json +++ b/images/win/Windows2016-Azure.json @@ -80,6 +80,11 @@ "source": "{{ template_dir }}/scripts/ImageHelpers", "destination": "{{user `helper_script_folder`}}" }, + { + "type": "file", + "source": "{{ template_dir }}/scripts/SoftwareReport", + "destination": "{{user `image_folder`}}" + }, { "type": "windows-shell", "inline": [ @@ -307,6 +312,12 @@ "scripts":[ "{{ template_dir }}/scripts/Installers/Install-7zip.ps1" ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-PostgreSQL.ps1" + ] }, { "type": "powershell", @@ -514,6 +525,12 @@ "{{ template_dir }}/scripts/Installers/Install-MysqlCli.ps1" ] }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-PostgreSQL.ps1" + ] + }, { "type": "powershell", "scripts":[ @@ -655,6 +672,12 @@ "{{ template_dir }}/scripts/Installers/Install-Kind.ps1" ] }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-MongoDB.ps1" + ] + }, { "type": "windows-restart", "restart_timeout": "30m" @@ -978,12 +1001,24 @@ "{{ template_dir }}/scripts/Installers/Validate-Kind.ps1" ] }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-MongoDB.ps1" + ] + }, { "type": "powershell", "scripts":[ "{{ template_dir }}/scripts/Installers/Validate-DiskSpace.ps1" ] }, + { + "type": "powershell", + "inline": [ + "pwsh -File '{{user `image_folder`}}\\SoftwareReport\\SoftwareReport.Generator.ps1'" + ] + }, { "type": "file", "source": "C:\\InstalledSoftware.md", diff --git a/images/win/Windows2019-Azure.json b/images/win/Windows2019-Azure.json index 9cebffb4..dc303a19 100644 --- a/images/win/Windows2019-Azure.json +++ b/images/win/Windows2019-Azure.json @@ -80,6 +80,11 @@ "source": "{{ template_dir }}/scripts/ImageHelpers", "destination": "{{user `helper_script_folder`}}" }, + { + "type": "file", + "source": "{{ template_dir }}/scripts/SoftwareReport", + "destination": "{{user `image_folder`}}" + }, { "type": "windows-shell", "inline": [ @@ -616,6 +621,12 @@ "{{ template_dir }}/scripts/Installers/Install-Vcpkg.ps1" ] }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-PostgreSQL.ps1" + ] + }, { "type": "powershell", "scripts":[ @@ -646,6 +657,12 @@ "{{ template_dir }}/scripts/Installers/Install-RootCA.ps1" ] }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-MongoDB.ps1" + ] + }, { "type": "windows-restart", "restart_timeout": "10m" @@ -939,6 +956,12 @@ "{{ template_dir }}/scripts/Installers/Validate-Vcpkg.ps1" ] }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-PostgreSQL.ps1" + ] + }, { "type": "powershell", "scripts":[ @@ -957,6 +980,12 @@ "{{ template_dir }}/scripts/Installers/Validate-Kind.ps1" ] }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-MongoDB.ps1" + ] + }, { "type": "powershell", "scripts":[ @@ -975,6 +1004,12 @@ "{{ template_dir }}/scripts/Installers/Validate-DiskSpace.ps1" ] }, + { + "type": "powershell", + "inline": [ + "pwsh -File '{{user `image_folder`}}\\SoftwareReport\\SoftwareReport.Generator.ps1'" + ] + }, { "type": "file", "source": "C:\\InstalledSoftware.md", diff --git a/images/win/scripts/ImageHelpers/ImageHelpers.psm1 b/images/win/scripts/ImageHelpers/ImageHelpers.psm1 index c2007855..c4485493 100644 --- a/images/win/scripts/ImageHelpers/ImageHelpers.psm1 +++ b/images/win/scripts/ImageHelpers/ImageHelpers.psm1 @@ -3,7 +3,6 @@ param() . $PSScriptRoot\PathHelpers.ps1 . $PSScriptRoot\InstallHelpers.ps1 -. $PSScriptRoot\MarkdownHelpers.ps1 . $PSScriptRoot\ChocoHelpers.ps1 Export-ModuleMember -Function @( @@ -18,8 +17,6 @@ Export-ModuleMember -Function @( 'Get-ToolcachePackages' 'Get-ToolsetContent' 'Get-ToolsByName' - 'Add-ContentToMarkdown' - 'Add-SoftwareDetailsToMarkdown' 'Stop-SvcWithErrHandling' 'Set-SvcWithErrHandling' 'Start-DownloadWithRetry' diff --git a/images/win/scripts/ImageHelpers/MarkdownHelpers.ps1 b/images/win/scripts/ImageHelpers/MarkdownHelpers.ps1 deleted file mode 100644 index 49becbc9..00000000 --- a/images/win/scripts/ImageHelpers/MarkdownHelpers.ps1 +++ /dev/null @@ -1,25 +0,0 @@ -function Add-ContentToMarkdown { - - param( - $Content = "" - ) - - Add-Content 'C:\InstalledSoftware.md' $Content -} - - -function Add-SoftwareDetailsToMarkdown { - [CmdletBinding()] - param( - $SoftwareName = "", - $DescriptionMarkdown = "" - ) - -$Content = @" - -## $SoftwareName - -$DescriptionMarkdown -"@ - Add-ContentToMarkdown -Content $Content -} diff --git a/images/win/scripts/Installers/Install-AWS.ps1 b/images/win/scripts/Installers/Install-AWS.ps1 index b5ad9a6d..23a5c4d4 100644 --- a/images/win/scripts/Installers/Install-AWS.ps1 +++ b/images/win/scripts/Installers/Install-AWS.ps1 @@ -5,27 +5,13 @@ Choco-Install -PackageName awscli -$env:PATH =$env:PATH + ";$Env:Programfiles\Amazon\AWSCLIV2" - -$command = Get-Command -Name 'aws' - -if ($command) +$env:Path = $env:Path + ";$env:ProgramFiles\Amazon\AWSCLIV2" +if (Get-Command -Name 'aws') { - Write-Host "awscli on path" + Write-Host 'awscli on path' } else { Write-Host 'awscli is not on path' exit 1 } - -# Adding description of the software to Markdown -$SoftwareName = "AWS CLI" - -$version = (aws --version).Split(" ")[0].Replace("/"," ") - -$Description = @" -_Version:_ $version
-"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description \ No newline at end of file diff --git a/images/win/scripts/Installers/Install-MongoDB.ps1 b/images/win/scripts/Installers/Install-MongoDB.ps1 new file mode 100644 index 00000000..d5638230 --- /dev/null +++ b/images/win/scripts/Installers/Install-MongoDB.ps1 @@ -0,0 +1,8 @@ +#################################################################################### +## File: Install-MongoDB.ps1 +## Desc: Install MongoDB +#################################################################################### + +choco install mongodb + +Add-MachinePathItem "$($env:SystemDrive)\Program Files\MongoDB\Server\4.2\bin" diff --git a/images/win/scripts/Installers/Install-Msys2.ps1 b/images/win/scripts/Installers/Install-Msys2.ps1 index 8c5f859f..511ff40e 100644 --- a/images/win/scripts/Installers/Install-Msys2.ps1 +++ b/images/win/scripts/Installers/Install-Msys2.ps1 @@ -1,12 +1,14 @@ ################################################################################ ## File: Install-Msys2.ps1 -## Desc: Install Msys2 and 64-bit gcc, cmake, & llvm (32-bit commented out) +## Desc: Install Msys2 and 64 & 32 bit gcc, cmake, & llvm ################################################################################ # References # https://github.com/msys2/MINGW-packages/blob/master/azure-pipelines.yml # https://packages.msys2.org/group/ +$dash = "-" * 40 + $origPath = $env:PATH $gitPath = "$env:ProgramFiles\Git" @@ -15,11 +17,9 @@ $msys2_release = "https://api.github.com/repos/msys2/msys2-installer/releases/la $msys2Uri = ((Invoke-RestMethod $msys2_release).assets | Where-Object { $_.name -match "x86_64" -and $_.name.EndsWith("tar.xz") }).browser_download_url -$msys2File = "$env:TEMP\msys2.tar.xz" - -# Download the latest msys2 x86_64 +# Download the latest msys2 x86_64, filename includes release date Write-Host "Starting msys2 download using $($msys2Uri.split('/')[-1])" -(New-Object System.Net.WebClient).DownloadFile($msys2Uri, $msys2File) +$msys2File = Start-DownloadWithRetry -Url $msys2Uri Write-Host "Finished download" # nix style path for tar @@ -31,7 +31,7 @@ $env:PATH = "$gitPath\usr\bin;$gitPath\mingw64\bin;$origPath" $tar = "$gitPath\usr\bin\tar.exe" # extract tar.xz to C:\ -Write-Host "Starting msys2 extraction from $msys2FileU" +Write-Host "Starting msys2 extraction" &$tar -xJf $msys2FileU -C /c/ Remove-Item $msys2File Write-Host "Finished extraction" @@ -39,55 +39,52 @@ Write-Host "Finished extraction" # Add msys2 bin tools folders to PATH temporary $env:PATH = "C:\msys64\mingw64\bin;C:\msys64\usr\bin;$origPath" -Write-Host "bash pacman-key --init" +Write-Host "`n$dash bash pacman-key --init" bash.exe -c "pacman-key --init 2>&1" Write-Host "bash pacman-key --populate msys2" bash.exe -c "pacman-key --populate msys2 2>&1" -Write-Host "pacman -Sy --noconfirm --needed pacman" -pacman -Sy --noconfirm --needed pacman -pacman -Su --noconfirm - -# Force stop gpg-agent to continue installation -Get-Process gpg-agent -ErrorAction SilentlyContinue | Stop-Process -Force - -Write-Host "pacman --noconfirm -Syyuu" +Write-Host "`n$dash pacman --noconfirm -Syyuu" pacman.exe -Syyuu --noconfirm -pacman.exe -Syuu --noconfirm +taskkill /f /fi "MODULES eq msys-2.0.dll" +Write-Host "`n$dash pacman --noconfirm -Syuu (2nd pass)" +pacman.exe -Syuu --noconfirm +taskkill /f /fi "MODULES eq msys-2.0.dll" -Write-Host "Install msys2 packages" +Write-Host "`n$dash Install msys2 packages" pacman.exe -S --noconfirm --needed --noprogressbar base-devel compression +taskkill /f /fi "MODULES eq msys-2.0.dll" -Write-Host "Remove p7zip/7z package due to conflicts" +Write-Host "`n$dash Remove p7zip/7z package due to conflicts" pacman.exe -R --noconfirm --noprogressbar p7zip # mingw package list $tools = "___clang ___cmake ___llvm ___toolchain ___ragel" # install mingw64 packages -Write-Host "Install mingw64 packages" +Write-Host "`n$dash Install mingw64 packages" $pre = "mingw-w64-x86_64-" pacman.exe -S --noconfirm --needed --noprogressbar $tools.replace('___', $pre).split(' ') # install mingw32 packages -Write-Host "Install mingw32 packages" +Write-Host "`n$dash Install mingw32 packages" $pre = "mingw-w64-i686-" pacman.exe -S --noconfirm --needed --noprogressbar $tools.replace('___', $pre).split(' ') # clean all packages to decrease image size -Write-Host "Clean packages" +Write-Host "`n$dash Clean packages" pacman.exe -Scc --noconfirm -Write-Host "Installed mingw64 packages" -pacman.exe -Qs --noconfirm mingw-w64-x86_64- +Write-Host "`n$dash Installed mingw64 packages" +pacman.exe -Q | grep ^mingw-w64-x86_64- -Write-Host "Installed mingw32 packages" -pacman.exe -Qs --noconfirm mingw-w64-i686- +Write-Host "`n$dash Installed mingw32 packages" +pacman.exe -Q | grep ^mingw-w64-i686- -Write-Host "Installed msys2 packages" -pacman.exe -Qs --noconfirm +Write-Host "`n$dash Installed msys2 packages" +pacman.exe -Q | grep -v ^mingw-w64- -Write-Host "MSYS2 installation completed" +Write-Host "`nMSYS2 installation completed" -exit 0 \ No newline at end of file +exit 0 diff --git a/images/win/scripts/Installers/Install-PostgreSQL.ps1 b/images/win/scripts/Installers/Install-PostgreSQL.ps1 new file mode 100644 index 00000000..2e6bc373 --- /dev/null +++ b/images/win/scripts/Installers/Install-PostgreSQL.ps1 @@ -0,0 +1,22 @@ +$ErrorActionPreference = "Stop" + +Import-Module -Name ImageHelpers + +#Define user and password for PostgreSQL database +$postgresusr="postgres" +$postgrespwd="root" + +#Prepare environment variable for validation +Set-SystemVariable -SystemVariable PGUSER -Value $postgresusr +Set-SystemVariable -SystemVariable PGPASSWORD -Value $postgrespwd +#Install latest PostgreSQL + +cinst postgresql --params "/Password:$postgrespwd" --params-global --debug --verbose + +#Get Path to pg_ctl.exe +$paths = (Get-CimInstance Win32_Service -Filter "Name LIKE 'postgresql-%'").PathName +#Parse output of command above to obtain pure path +$pgbin = $paths.split('"')[1].replace("\pg_ctl.exe", "") +#Added PostgreSQL bin path into PATH variable. +Add-MachinePathItem $pgbin + diff --git a/images/win/scripts/Installers/Update-AndroidSDK.ps1 b/images/win/scripts/Installers/Update-AndroidSDK.ps1 index 51b6b50c..cd7d1d0c 100644 --- a/images/win/scripts/Installers/Update-AndroidSDK.ps1 +++ b/images/win/scripts/Installers/Update-AndroidSDK.ps1 @@ -100,7 +100,7 @@ Push-Location -Path $sdk.FullName # Android NDK root path. $ndk_root = "C:\Program Files (x86)\Android\android-sdk\ndk-bundle" - if (Test-Path $ndk_root){ + if (Test-Path $ndk_root){ setx ANDROID_HOME $sdk_root /M setx ANDROID_NDK_HOME $ndk_root /M setx ANDROID_NDK_PATH $ndk_root /M @@ -111,43 +111,3 @@ Push-Location -Path $sdk.FullName Pop-Location -# Adding description of the software to Markdown -$Header = @" - -## Android SDK Build Tools - -"@ - -Add-ContentToMarkdown -Content $Header - -$BuildTools =(Get-ChildItem "C:\Program Files (x86)\Android\android-sdk\build-tools\") ` - | Where { $_.Name -match "[0-9].*" } ` - | Sort-Object -Descending ` - | % { "#### $($_.Name)`n`n_Location:_ $($_.FullName)`n" } - -Add-ContentToMarkdown -Content $BuildTools - - -# Adding description of the software to Markdown -$Header = @" - -## Android SDK Platforms - -"@ - -Add-ContentToMarkdown -Content $Header - -$SdkList =(Get-ChildItem "C:\Program Files (x86)\Android\android-sdk\platforms\") | Sort-Object -Descending | %{ $_.FullName } - -foreach($sdk in $SdkList) -{ - $sdkProps = ConvertFrom-StringData (Get-Content "$sdk\source.properties" -Raw) - - $content = @" -#### $($sdkProps.'Platform.Version') (API $($sdkProps.'AndroidVersion.ApiLevel')) - -_Location:_ $sdk - -"@ - Add-ContentToMarkdown -Content $content -} diff --git a/images/win/scripts/Installers/Validate-7zip.ps1 b/images/win/scripts/Installers/Validate-7zip.ps1 index c47c95a7..d29d394e 100644 --- a/images/win/scripts/Installers/Validate-7zip.ps1 +++ b/images/win/scripts/Installers/Validate-7zip.ps1 @@ -5,7 +5,7 @@ if (Get-Command -Name '7z') { - Write-Host "7zip on path" + Write-Host '7zip on path' } else { @@ -13,13 +13,3 @@ else exit 1 } -# Adding description of the software to Markdown -$SoftwareName = "7zip" -$(7z --help).Split([System.Environment]::NewLine)[1] -match "\d+\.\d+" -$7zipVersion = $matches[0] - -$Description = @" -_Version:_ $7zipVersion
-"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-AWS-SAM.ps1 b/images/win/scripts/Installers/Validate-AWS-SAM.ps1 index d953229d..ac18ab5d 100644 --- a/images/win/scripts/Installers/Validate-AWS-SAM.ps1 +++ b/images/win/scripts/Installers/Validate-AWS-SAM.ps1 @@ -3,25 +3,12 @@ ## Desc: Validate aws sam cli ################################################################################ -$command = Get-Command -Name 'sam' - -if ($command) +if (Get-Command -Name 'sam') { - Write-Host "AWS SAM CLI on path" + Write-Host 'AWS SAM CLI on path' } else { Write-Host 'AWS SAM CLI is not on path' exit 1 } - -# Adding description of the software to Markdown -$SoftwareName = "AWS SAM CLI" - -$version = (sam --version).Split(" ")[3] - -$Description = @" -_Version:_ $version
-"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description \ No newline at end of file diff --git a/images/win/scripts/Installers/Validate-AliyunCli.ps1 b/images/win/scripts/Installers/Validate-AliyunCli.ps1 index 2f72deca..cb3cad4d 100644 --- a/images/win/scripts/Installers/Validate-AliyunCli.ps1 +++ b/images/win/scripts/Installers/Validate-AliyunCli.ps1 @@ -5,20 +5,10 @@ if (Get-Command -Name 'aliyun') { - Write-Host "Alibaba Cloud CLI on path" + Write-Host 'Alibaba Cloud CLI on path' } else { Write-Host 'Alibaba Cloud CLI is not on path' exit 1 } - -# Adding description of the software to Markdown -$aliyun_version = ((aliyun --version | Select-String "Alibaba Cloud Command Line Interface Version ") -Split(" "))[6] - -$SoftwareName = "Alibaba Cloud CLI" -$Description = @" -_Version:_ $aliyun_version
-"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description \ No newline at end of file diff --git a/images/win/scripts/Installers/Validate-AzureCli.ps1 b/images/win/scripts/Installers/Validate-AzureCli.ps1 index 231d112d..9c801f0b 100644 --- a/images/win/scripts/Installers/Validate-AzureCli.ps1 +++ b/images/win/scripts/Installers/Validate-AzureCli.ps1 @@ -3,7 +3,7 @@ ## Desc: Validate Azure CLI ################################################################################ -if(Get-Command -Name 'az') +if (Get-Command -Name 'az') { Write-Host "Azure Cli $(az --version) on path" } @@ -13,16 +13,3 @@ else exit 1 } -$azureCliVersion = az -v | findstr azure-cli -$azureCliVersion = $azureCliVersion.trim().Substring("azure-cli".Length).trim() - -# Adding description of the software to Markdown -$SoftwareName = "Azure CLI" - -$Description = @" -_Version:_ $azureCliVersion -_Environment:_ -* PATH: contains location of az.cmd -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-AzureCosmosDbEmulator.ps1 b/images/win/scripts/Installers/Validate-AzureCosmosDbEmulator.ps1 index 4020f40e..b2d8d4a3 100644 --- a/images/win/scripts/Installers/Validate-AzureCosmosDbEmulator.ps1 +++ b/images/win/scripts/Installers/Validate-AzureCosmosDbEmulator.ps1 @@ -33,15 +33,6 @@ if (!(Test-Path $exeFilePath)) Write-Host "$SoftwareName is not installed" exit 1 } -else -{ - $fileVersion = (Get-Item $exeFilePath).VersionInfo.FileVersion - Write-Host "$SoftwareName is successfully installed: $fileVersion" - $Description = @" -_Version:_ $fileVersion
-_Location:_ $installDir -"@ - - Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description -} +$fileVersion = (Get-Item $exeFilePath).VersionInfo.FileVersion +Write-Host "$SoftwareName is successfully installed: $fileVersion" diff --git a/images/win/scripts/Installers/Validate-AzureDevOpsCli.ps1 b/images/win/scripts/Installers/Validate-AzureDevOpsCli.ps1 index 4ec5e330..17a93491 100644 --- a/images/win/scripts/Installers/Validate-AzureDevOpsCli.ps1 +++ b/images/win/scripts/Installers/Validate-AzureDevOpsCli.ps1 @@ -5,7 +5,7 @@ az devops -h -if($LastExitCode -ne 0) +if ($LastExitCode -ne 0) { Write-Error "Azure DevOps Cli extension not present" exit 1 @@ -15,10 +15,3 @@ else Write-Host "Azure DevOps Cli extension is present" } -$azDevopsVer = az -v | findstr azure-devops - -$Description = @" -_Version:_ $azDevopsVer -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName 'Azure DevOps Cli extension' -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-AzureModules.ps1 b/images/win/scripts/Installers/Validate-AzureModules.ps1 index 38c692b4..10190e0f 100644 --- a/images/win/scripts/Installers/Validate-AzureModules.ps1 +++ b/images/win/scripts/Installers/Validate-AzureModules.ps1 @@ -3,47 +3,6 @@ ## Desc: Validate Azure PowerShell modules ################################################################################ -Import-Module -Name ImageHelpers -Force - -# Adding description of the software to Markdown -function Add-ModuleDescription -{ - param($DefaultModule, [String]$ModuleName) - - # Adding description of the software to Markdown - $softwareName = "$moduleName PowerShell module" - - if ($defaultModule) - { - $description = "#### $($defaultModule.Version)`n`nThis version is installed and is available via ``Get-Module -ListAvailable``" - } - else - { - $Description = "" - } - - Add-SoftwareDetailsToMarkdown -SoftwareName $softwareName -DescriptionMarkdown $description - if($moduleName -eq 'Az') - { - $prop = @{n="Version";e={[Version]$_.Directory.Name}},@{n="Path";e={$_.FullName}} - $azureModules = Get-ChildItem C:\Modules\az_*\Az\*\Az.psd1 | Select-Object $prop - } - else - { - $azureModules = Get-Module -Name $moduleName -ListAvailable | Sort-Object Version -Unique - } - - foreach($module in $azureModules) - { - if($module.Version -ne $defaultModule.Version) - { - - $currentModule = "#### $($module.Version)`n`nThis version is saved but not installed`n_Location:_ $($module.Path)" - Add-ContentToMarkdown -Content $currentModule - } - } -} - function Validate-AzureModule { param([String]$ModuleName, [String[]]$ModuleVersions) @@ -82,15 +41,3 @@ Validate-AzureModule -ModuleName Azure -ModuleVersions $azureVersions $azVersions = "1.0.0", "1.6.0", "2.3.2", "2.6.0", "3.1.0", "3.5.0", "3.8.0" Validate-AzureModule -ModuleName Az -ModuleVersions $azVersions - -# Get default modules version -$defaultAzureRMModule = Get-Module -Name AzureRM -ListAvailable -$defaultAzureModule = Get-Module -Name Azure -ListAvailable - -# Add modules to the PSModulePath -$env:PSModulePath = $env:PSModulePath + ";C:\Modules" - -# Adding description of the software to Markdown -Add-ModuleDescription -DefaultModule $defaultAzureRMModule -ModuleName AzureRM -Add-ModuleDescription -DefaultModule $defaultAzureModule -ModuleName Azure -Add-ModuleDescription -ModuleName Az diff --git a/images/win/scripts/Installers/Validate-Bazel.ps1 b/images/win/scripts/Installers/Validate-Bazel.ps1 index 1728a9a6..20d3d768 100644 --- a/images/win/scripts/Installers/Validate-Bazel.ps1 +++ b/images/win/scripts/Installers/Validate-Bazel.ps1 @@ -5,7 +5,7 @@ if (Get-Command -Name 'bazel') { - Write-Host "bazel on path" + Write-Host 'bazel on path' } else { @@ -15,7 +15,7 @@ else if (Get-Command -Name 'bazelisk') { - Write-Host "bazelisk on path" + Write-Host 'bazelisk on path' } else { @@ -23,22 +23,4 @@ else exit 1 } -# Adding description of Bazel to Markdown -$SoftwareName = "bazel" -$Description = @" -_Version:_ $(bazel --version)
-"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description - -# Adding description of Bazelisk to Markdown -$bazelisk_version = ((bazelisk version | Select-String "Bazelisk version:") -Split(" v"))[2] - -$SoftwareName = "bazelisk" - -$Description = @" -_Version:_ $bazelisk_version
-"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-Boost.ps1 b/images/win/scripts/Installers/Validate-Boost.ps1 index 97464b77..83bf3d08 100644 --- a/images/win/scripts/Installers/Validate-Boost.ps1 +++ b/images/win/scripts/Installers/Validate-Boost.ps1 @@ -25,50 +25,15 @@ function Validate-BoostVersion exit 1 } -# Adding description of the software to Markdown -$tmplMark = @" -#### {0} [{2}] - -_Environment:_ -* {1}: root directory of the Boost version {0} installation - -"@ - -$Description = New-Object System.Text.StringBuilder $SoftwareName = 'Boost' $BoostRootDirectory = Join-Path -Path $env:AGENT_TOOLSDIRECTORY -ChildPath $SoftwareName $BoostTools = Get-ToolsByName -SoftwareName $SoftwareName foreach ($BoostTool in $BoostTools) { - $BoostToolsetName = $BoostTool.Architecture $BoostVersionsToInstall = $BoostTool.Versions | Foreach-Object {"{0}.0" -f $_} foreach($BoostVersion in $BoostVersionsToInstall) { Validate-BoostVersion -BoostRootPath $BoostRootDirectory -BoostRelease $BoostVersion - $BoostVersionTag = "BOOST_ROOT_{0}" -f $BoostVersion.Replace('.', '_') - - $null = $Description.AppendLine(($tmplMark -f $BoostVersion, $BoostVersionTag, $BoostToolsetName)) } } - -$CMakeFindBoostInfo = @" - -#### _Notes:_ - -> ``BOOST_ROOT`` is not set on images but it is required by CMake. Please make sure you set this variable -> value to either ``BOOST_ROOT_1_69_0`` or ``BOOST_ROOT_1_72_0`` depending on the Boost version you are using. - -Link: https://cmake.org/cmake/help/latest/module/FindBoost.html - -If Boost was built using the ``boost-cmake`` project or from ``Boost 1.70.0`` on it provides a package -configuration file for use with find\_package's config mode. This module looks for the package -configuration file called BoostConfig.cmake or boost-config.cmake and stores the result in CACHE entry "Boost_DIR". -If found, the package configuration file is loaded and this module returns with no further action. -See documentation of the Boost CMake package configuration for details on what it provides. - -Set ``Boost_NO_BOOST_CMAKE to ON``, to disable the search for boost-cmake. -"@ - -$null = $Description.AppendLine($CMakeFindBoostInfo) -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description.ToString() diff --git a/images/win/scripts/Installers/Validate-Chrome.ps1 b/images/win/scripts/Installers/Validate-Chrome.ps1 index e27c5c9b..0f94190b 100644 --- a/images/win/scripts/Installers/Validate-Chrome.ps1 +++ b/images/win/scripts/Installers/Validate-Chrome.ps1 @@ -3,23 +3,12 @@ ## Desc: Validate Google Chrome installation. ################################################################################ -if(Test-Path "HKLM:SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe") +if (Test-Path 'HKLM:SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe') { - (Get-Item (Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe').'(Default)').VersionInfo - - $SoftwareName = "Google Chrome" - $fileVersion = (Get-Item (Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe').'(Default)').VersionInfo.FileVersion - $Description = @" -_version:_ -$fileVersion -"@ - - Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description - - exit 0 + (Get-Item (Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe').'(Default)').VersionInfo } else { - Write-Host "Google Chrome is not installed." + Write-Host 'Google Chrome is not installed.' exit 1 } diff --git a/images/win/scripts/Installers/Validate-CloudFoundryCli.ps1 b/images/win/scripts/Installers/Validate-CloudFoundryCli.ps1 index 087ffc84..69928a46 100644 --- a/images/win/scripts/Installers/Validate-CloudFoundryCli.ps1 +++ b/images/win/scripts/Installers/Validate-CloudFoundryCli.ps1 @@ -5,7 +5,7 @@ if (Get-Command -Name 'cf') { - Write-Host "cf on path" + Write-Host 'cf on path' } else { @@ -13,16 +13,3 @@ else exit 1 } -# Adding description of the software to Markdown -$SoftwareName = "Cloud Foundry CLI" - -if( $(cf version) -match '\d+\.\d+\.\d+' ) -{ - $version = $Matches[0] -} - -$Description = @" -_Version:_ $version
-"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-Cmake.ps1 b/images/win/scripts/Installers/Validate-Cmake.ps1 index bacd0d2f..df683591 100644 --- a/images/win/scripts/Installers/Validate-Cmake.ps1 +++ b/images/win/scripts/Installers/Validate-Cmake.ps1 @@ -9,23 +9,8 @@ if(Get-Command -Name 'cmake') } else { - Write-Host 'CMake not on path' + Write-Host "CMake not on path" exit 1 } -if( $( $(cmake -version) | Out-String) -match 'cmake version (?.*).*' ) -{ - $cmakeVersion = $Matches.version.Trim() -} - -# Adding description of the software to Markdown -$SoftwareName = "CMake" - -$Description = @" -_Version:_ $cmakeVersion
-_Environment:_ -* PATH: contains location of cmake.exe -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-DACFx.ps1 b/images/win/scripts/Installers/Validate-DACFx.ps1 index c7def3ef..3dd18a1c 100644 --- a/images/win/scripts/Installers/Validate-DACFx.ps1 +++ b/images/win/scripts/Installers/Validate-DACFx.ps1 @@ -5,9 +5,8 @@ $env:PATH = $env:Path + ';C:\Program Files\Microsoft SQL Server\120\DAC\bin;C:\Program Files\Microsoft SQL Server\130\DAC\bin;C:\Program Files\Microsoft SQL Server\140\DAC\bin;C:\Program Files\Microsoft SQL Server\150\DAC\bin' -if(Get-Command -Name 'SqlPackage') +if (Get-Command -Name 'SqlPackage') { - Write-Host "DACFx is installed at path" (Get-Command -Name 'SqlPackage').Source } else @@ -15,29 +14,11 @@ else throw "DACFx is not installed!" } -if(Get-Command -Name 'SqlLocalDB') +if (Get-Command -Name 'SqlLocalDB') { - $localDbPath = (Get-Command -Name 'SqlLocalDB').Source + Write-Host "SQL Server Express LocalDB is available at " (Get-Command -Name SqlLocalDB).Source } else { throw "SqlLocalDB is not installed!" } - -function Get-DacFxVersion -{ - $regKey = "HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\Data-Tier Application Framework\CurrentVersion" - $Version = (Get-ItemProperty -Path $regKey).'(Default)' - return $Version -} - - -# Adding description of the software to Markdown -$SoftwareName = "SQL Server Data Tier Application Framework (x64)" - -$Description = @" -_Version:_ $(Get-DacFxVersion)
-* SQL Server Express LocalDB is available at $localDbPath -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-Docker.ps1 b/images/win/scripts/Installers/Validate-Docker.ps1 index 9dab4f46..e2b7571f 100644 --- a/images/win/scripts/Installers/Validate-Docker.ps1 +++ b/images/win/scripts/Installers/Validate-Docker.ps1 @@ -3,48 +3,17 @@ ## Desc: Validate Docker. ################################################################################ - -if((Get-Command -Name 'docker') -and (Get-Command -Name 'docker-compose')) +if ((Get-Command -Name 'docker') -and (Get-Command -Name 'docker-compose')) { Write-Host "docker $(docker version) on path" Write-Host "docker-compose $(docker-compose version) on path" } else { - Write-Host "docker or docker-compose are not on path" + Write-Host "docker or docker-compose are not on path" exit 1 } -# Adding description of the software to Markdown -$SoftwareName = "Docker" - -$version = $(docker version --format '{{.Server.Version}}') - -$Description = @" -_Version:_ $version
-_Environment:_ -* PATH: contains location of docker.exe -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description - - - -$SoftwareName = "Docker-compose" - -if( $(docker-compose --version) -match 'docker-compose version (?.*), build.*' ) -{ - $dockerComposeVersion = $Matches.version -} - -$Description = @" -_Version:_ $dockerComposeVersion
-_Environment:_ -* PATH: contains location of docker-compose.exe -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description - # Validate helm if (Get-Command -Name 'helm') { @@ -55,14 +24,3 @@ else Write-Host 'helm is not on path' exit 1 } - -$version = $(helm version --short) -$SoftwareName = "Helm" - -$Description = @" -_Version:_ $version
-_Environment:_ -* PATH: contains location of helm -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description \ No newline at end of file diff --git a/images/win/scripts/Installers/Validate-DotnetSDK.ps1 b/images/win/scripts/Installers/Validate-DotnetSDK.ps1 index cb5f917b..6d7c104a 100644 --- a/images/win/scripts/Installers/Validate-DotnetSDK.ps1 +++ b/images/win/scripts/Installers/Validate-DotnetSDK.ps1 @@ -3,7 +3,7 @@ ## Desc: Validate dotnet ################################################################################ -if(Get-Command -Name 'dotnet') +if (Get-Command -Name 'dotnet') { Write-Host "dotnet $(dotnet --version) on path" } @@ -13,34 +13,4 @@ else exit 1 } -# Adding description of the software to Markdown -$SoftwareName = ".NET Core" - -$Description = @" -The following runtimes and SDKs are installed: - -_Environment:_ -* PATH: contains location of dotnet.exe - -_SDK:_ -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description - -$SdkList =(Get-ChildItem "C:\Program Files\dotnet\sdk") | Where { $_.Name -match "[0-9].*" } | Sort-Object -Descending | % { "* $($_.Name) $($_.FullName)" } - -Add-ContentToMarkdown -Content $SdkList - - - -$Runtimes = @" - -_Runtime:_ -"@ - -Add-ContentToMarkdown -Content $Runtimes - -$RuntimeList =(Get-ChildItem "C:\Program Files\dotnet\shared\Microsoft.NETCore.App") | Where { $_.Name -match "[0-9].*" } | Sort-Object -Descending | % { "* $($_.Name) $($_.FullName)" } - -Add-ContentToMarkdown -Content $RuntimeList diff --git a/images/win/scripts/Installers/Validate-DotnetTLS.ps1 b/images/win/scripts/Installers/Validate-DotnetTLS.ps1 index b94be5ce..0d17c7b0 100644 --- a/images/win/scripts/Installers/Validate-DotnetTLS.ps1 +++ b/images/win/scripts/Installers/Validate-DotnetTLS.ps1 @@ -5,24 +5,14 @@ $protocols = [Net.ServicePointManager]::SecurityProtocol $protocolArr = $protocols -split ', ' -if($protocolArr.Contains('Tls12')) +if ($protocolArr.Contains('Tls12')) { - Write-Host "Tls 1.2 has been enabled." + Write-Host 'Tls 1.2 has been enabled.' } else { - Write-Host "Tls 1.2 has not been enabled." + Write-Host 'Tls 1.2 has not been enabled.' exit 1 } -# Adding description of the software to Markdown -$SoftwareName = "TLS12" -$version = "1.2"; - -$Description = @" -_Version:_ $version
-_Description:_ .NET has been configured to use TLS 1.2 by default -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-Edge.ps1 b/images/win/scripts/Installers/Validate-Edge.ps1 index 7ca51da5..2db17fb9 100644 --- a/images/win/scripts/Installers/Validate-Edge.ps1 +++ b/images/win/scripts/Installers/Validate-Edge.ps1 @@ -6,20 +6,10 @@ $RegistryKey = "HKLM:SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\msedge.exe" if (Test-Path $RegistryKey) { - $SoftwareName = "Microsoft Edge" - $VersionInfo = (Get-Item (Get-ItemProperty $RegistryKey).'(Default)').VersionInfo - $VersionInfo - $Description = @" -_version:_ -$($VersionInfo.FileVersion) -"@ - - Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description - - exit 0 + (Get-Item (Get-ItemProperty $RegistryKey).'(Default)').VersionInfo } else { - Write-Host "Microsoft Edge is not installed." - exit 1 + Write-Host "Microsoft Edge is not installed." + exit 1 } diff --git a/images/win/scripts/Installers/Validate-Firefox.ps1 b/images/win/scripts/Installers/Validate-Firefox.ps1 index f66b2c5f..1fa1852f 100644 --- a/images/win/scripts/Installers/Validate-Firefox.ps1 +++ b/images/win/scripts/Installers/Validate-Firefox.ps1 @@ -3,23 +3,12 @@ ## Desc: Validate Mozilla Firefox installation. ################################################################################ -if(Test-Path "HKLM:SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\firefox.exe") +if (Test-Path 'HKLM:SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\firefox.exe') { - (Get-Item (Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\firefox.exe').'(Default)').VersionInfo - - $fileVersion = (Get-Item (Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\firefox.exe').'(Default)').VersionInfo.FileVersion - $SoftwareName = "Mozilla Firefox" - $Description = @" -_version:_ -$fileVersion -"@ - - Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description - - exit 0 + (Get-Item (Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\firefox.exe').'(Default)').VersionInfo } else { - Write-Host "Mozilla Firefox is not installed." + Write-Host 'Mozilla Firefox is not installed.' exit 1 } diff --git a/images/win/scripts/Installers/Validate-Git.ps1 b/images/win/scripts/Installers/Validate-Git.ps1 index 1927a6ad..c74239a5 100644 --- a/images/win/scripts/Installers/Validate-Git.ps1 +++ b/images/win/scripts/Installers/Validate-Git.ps1 @@ -12,51 +12,9 @@ function Test-CommandName { exit 1 } } -function Test-Command { - param( - [parameter(Mandatory)][string] $CommandName, - [parameter(Mandatory)][string] $CommandDescription, - [parameter(Mandatory)][string] $VersionCmd, - [parameter(Mandatory)][string] $regexVersion, - [parameter(Mandatory)][string] $DescriptionMarkdown - ) - Test-CommandName -CommandName $CommandName - - $strVersion = Invoke-Expression $VersionCmd - Write-Host "$strVersion on path" - if($strVersion -match $regexVersion) { - $Version = $Matches.version - } - else { - Write-Host "[!] $CommandName version detection failed" - exit 1 - } - # Adding description of the software to Markdown - $DescriptionMarkdown = $DescriptionMarkdown -f $Version - Add-SoftwareDetailsToMarkdown -SoftwareName $CommandDescription -DescriptionMarkdown $DescriptionMarkdown -} Test-CommandName -CommandName 'bash' Test-CommandName -CommandName 'awk' - -$GitDescription = @" -_Version:_ {0}
-_Environment:_ -* PATH: contains location of git.exe -"@ -Test-Command -CommandName 'git' -CommandDescription 'Git' -VersionCmd "git version" -regexVersion 'git version (?.*).win.*' -DescriptionMarkdown $GitDescription - -$GitLfsDescription = @" -_Version:_ {0}
-_Environment:_ -* PATH: contains location of git-lfs.exe -* GIT_LFS_PATH: location of git-lfs.exe -"@ -Test-Command -CommandName 'git-lfs' -CommandDescription 'Git Large File Storage (LFS)' -VersionCmd "git-lfs version" -regexVersion 'git-lfs\/(?.*) \(Git.*' -DescriptionMarkdown $GitLfsDescription - -$HubCliDescription = @" -_Version:_ {0}
-_Environment:_ -* PATH: contains location of hub.exe -"@ -Test-Command -CommandName 'hub' -CommandDescription 'Hub CLI' -VersionCmd "hub version | Select-String 'hub version'" -regexVersion 'hub version (?.*)' -DescriptionMarkdown $HubCliDescription \ No newline at end of file +Test-CommandName -CommandName 'git' +Test-CommandName -CommandName 'git-lfs' +Test-CommandName -CommandName 'hub' diff --git a/images/win/scripts/Installers/Validate-GitHub-CLI.ps1 b/images/win/scripts/Installers/Validate-GitHub-CLI.ps1 index fa9f2bf1..39163139 100644 --- a/images/win/scripts/Installers/Validate-GitHub-CLI.ps1 +++ b/images/win/scripts/Installers/Validate-GitHub-CLI.ps1 @@ -3,25 +3,12 @@ ## Desc: Validate GitHub CLI ################################################################################ -$command = Get-Command -Name 'gh' - -if ($command) +if (Get-Command -Name 'gh') { - Write-Host "gh on path" + Write-Host 'gh on path' } else { Write-Host 'gh is not on path' exit 1 } - -# Adding description of the software to Markdown -$SoftwareName = "GitHub CLI" - -$version = (gh --version).Split()[2] - -$Description = @" -_Version:_ $version
-"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description \ No newline at end of file diff --git a/images/win/scripts/Installers/Validate-GitVersion.ps1 b/images/win/scripts/Installers/Validate-GitVersion.ps1 index 4b580c38..b315cda5 100644 --- a/images/win/scripts/Installers/Validate-GitVersion.ps1 +++ b/images/win/scripts/Installers/Validate-GitVersion.ps1 @@ -3,23 +3,12 @@ ## Desc: Validate GitVersion ################################################################################ -$command = Get-Command -Name 'gitversion' -if ($command) +if (Get-Command -Name 'gitversion') { - Write-Host "gitversion on path" + Write-Host 'gitversion on path' } else { Write-Host 'gitversion is not on path' exit 1 } - -# Adding description of the software to Markdown -$SoftwareName = "GitVersion" -$version = $command.Version.ToString() - -$Description = @" -_Version:_ $version
-"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-Go.ps1 b/images/win/scripts/Installers/Validate-Go.ps1 index 4c88cc1d..4e8c0a1b 100644 --- a/images/win/scripts/Installers/Validate-Go.ps1 +++ b/images/win/scripts/Installers/Validate-Go.ps1 @@ -25,8 +25,6 @@ function Get-GoVersion { $goFullVersion = $Matches.version Write-Host "$goFullVersion has been found" - - return $goFullVersion } else { @@ -46,38 +44,7 @@ else exit 1 } -# Add details of available versions in Markdown -$tmplMark = @" -#### {0} - -_Environment:_ -* {1}: root directory of the Go {0} installation - -"@ - -$tmplMarkRoot = @" -#### {0} - -_Environment:_ -* PATH: contains the location of go.exe version {0} -* GOROOT: root directory of the Go {0} installation -* {1}: root directory of the Go {0} installation -"@ - -$SoftwareName = "Go (x64)" -$Description = New-Object System.Text.StringBuilder $goVersionsToInstall = $env:GO_VERSIONS.split(", ", [System.StringSplitOptions]::RemoveEmptyEntries) - foreach($go in $goVersionsToInstall) { - $goVersion = Get-GoVersion -goVersion $go - $goVersionTag = "GOROOT_{0}_{1}_X64" -f $go.split(".") - if ($goVersion -eq $go) { - if($go -eq $env:GO_DEFAULT) { - $null = $Description.AppendLine(($tmplMarkRoot -f $goVersion, $goVersionTag)) - } else { - $null = $Description.AppendLine(($tmplMark -f $goVersion, $goVersionTag)) - } - } + Get-GoVersion -goVersion $go } - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description.ToString() diff --git a/images/win/scripts/Installers/Validate-Haskell.ps1 b/images/win/scripts/Installers/Validate-Haskell.ps1 index 6d47daad..f64c7536 100644 --- a/images/win/scripts/Installers/Validate-Haskell.ps1 +++ b/images/win/scripts/Installers/Validate-Haskell.ps1 @@ -14,8 +14,6 @@ else exit 1 } -$SoftwareName = "ghc" -[String] $DefaultGhcVersion = & ghc --version $ChocoPackagesPath = Join-Path $env:ChocolateyInstall "lib" [Array] $GhcVersionList = Get-ChildItem -Path $ChocoPackagesPath -Filter "ghc.*" | ForEach-Object { $_.Name.TrimStart("ghc.") } @@ -31,7 +29,8 @@ else } # Validation each of GHC version -ForEach ($version in $GhcVersionList) { +foreach ($version in $GhcVersionList) +{ $BinGhcPath = Join-Path $env:ChocolateyInstall "lib\ghc.$version\tools\ghc-$version\bin\ghc.exe" if ((& $BinGhcPath --version) -match $version) { @@ -44,20 +43,6 @@ ForEach ($version in $GhcVersionList) { } } - -$GhcVersionsDescription = $GhcVersionList | ForEach-Object { - $DefaultPostfix = if ($DefaultGhcVersion -match $_) { " (default)" } else { "" } - "ghc $_ $DefaultPostfix `n" -} - -$Description = @" -_Version:_ -$GhcVersionsDescription
-"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description - - # Cabal validation if (Get-Command -Name 'cabal') { @@ -68,11 +53,3 @@ else Write-Host "cabal is not on path." exit 1 } - -$SoftwareName = "cabal" - -$Description = @" -_Version:_ $(cabal --version)
-"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description \ No newline at end of file diff --git a/images/win/scripts/Installers/Validate-InnoSetup.ps1 b/images/win/scripts/Installers/Validate-InnoSetup.ps1 index 30f28ede..21c55119 100644 --- a/images/win/scripts/Installers/Validate-InnoSetup.ps1 +++ b/images/win/scripts/Installers/Validate-InnoSetup.ps1 @@ -5,23 +5,11 @@ if (Get-Command -Name 'iscc') { - Write-Host "iscc is on PATH" + Write-Host 'iscc is on PATH' } else { - Write-Host "iscc is not on PATH" + Write-Host 'iscc is not on PATH' exit 1 } -# Adding description of the software to Markdown -$SoftwareName = "Inno Setup" - -$ChocoList = $(choco list --local-only innosetup) | Select-String -Pattern "InnoSetup" -$ChocoList -Match "\d+\.\d+\.\d+" -$Version = $Matches[0] - -$Description = @" -_Version:_ $Version
-"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-JavaTools.ps1 b/images/win/scripts/Installers/Validate-JavaTools.ps1 index 7530bf89..67d1af23 100644 --- a/images/win/scripts/Installers/Validate-JavaTools.ps1 +++ b/images/win/scripts/Installers/Validate-JavaTools.ps1 @@ -40,7 +40,6 @@ Function Validate-JavaVersion { Write-Host "Java $javaVersion found" # Reset Path to the default one in case we need to check the default Java later $env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User") - return $javaVersion } else { @@ -63,87 +62,7 @@ else } Write-Host "Checking installed Java versions" - -$java7Version = Validate-JavaVersion -Version "1.7" -$java8Version = Validate-JavaVersion -Version "1.8" -Default -$java11Version = Validate-JavaVersion -Version "11" -$java13Version = Validate-JavaVersion -Version "13" - -if( $(ant -version) -match 'Apache Ant\(TM\) version (?.*) compiled.*' ) -{ - $antVersion = $Matches.version -} - -if( $( $(mvn -version) | Out-String) -match 'Apache Maven (?.*) \(.*' ) -{ - $mvnVersion = $Matches.version -} - -if( $( $(gradle -version) | Out-String) -match 'Gradle (?.*)' ) -{ - $gradleVersion = $Matches.version.Trim() -} - -# Adding description of the software to Markdown -$SoftwareName = "Java Development Kit" - -$Description = @" -#### $java8Version (default) - -_Environment:_ -* JAVA_HOME: location of JDK -* PATH: contains bin folder of JDK - -#### $java7Version - -_Location:_ $env:JAVA_HOME_7_X64 - -#### $java11Version - -_Location:_ $env:JAVA_HOME_11_X64 - -#### $java13Version - -_Location:_ $env:JAVA_HOME_13_X64 -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description - - -# Adding description of the software to Markdown -$SoftwareName = "Ant" - -$Description = @" -_Version:_ $antVersion
-_Environment:_ -* PATH: contains location of ant.cmd -* ANT_HOME: location of ant.cmd -* COBERTURA_HOME: location of cobertura-2.1.1.jar -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description - - -# Adding description of the software to Markdown -$SoftwareName = "Maven" - -$Description = @" -_Version:_ $mvnVersion
-_Environment:_ -* PATH: contains location of mvn.bat -* M2_HOME: Maven installation root -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description - - -# Adding description of the software to Markdown -$SoftwareName = "Gradle" - -$Description = @" -_Version:_ $gradleVersion
-_Environment:_ -* PATH: contains location of gradle -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description +Validate-JavaVersion -Version "1.7" +Validate-JavaVersion -Version "1.8" -Default +Validate-JavaVersion -Version "11" +Validate-JavaVersion -Version "13" diff --git a/images/win/scripts/Installers/Validate-Jq.ps1 b/images/win/scripts/Installers/Validate-Jq.ps1 index b61ddae8..67b4275f 100644 --- a/images/win/scripts/Installers/Validate-Jq.ps1 +++ b/images/win/scripts/Installers/Validate-Jq.ps1 @@ -5,7 +5,7 @@ if (Get-Command -Name 'jq') { - Write-Host "jq on path" + Write-Host 'jq on path' } else { @@ -13,11 +13,3 @@ else exit 1 } -# Adding description of the software to Markdown -$SoftwareName = "jq" - -$Description = @" -_Version:_ $(jq --version)
-"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-Julia.ps1 b/images/win/scripts/Installers/Validate-Julia.ps1 index 41f9310a..94d02cfc 100644 --- a/images/win/scripts/Installers/Validate-Julia.ps1 +++ b/images/win/scripts/Installers/Validate-Julia.ps1 @@ -4,7 +4,7 @@ ################################################################################ # Verify that julia.exe is on the path -if((Get-Command -Name 'julia') -and (Test-Path -Path 'C:\Julia')) +if ((Get-Command -Name 'julia') -and (Test-Path -Path 'C:\Julia')) { Write-Host "$(julia --version) is on the path." } @@ -14,12 +14,3 @@ else exit 1 } -# Add description of the software to Markdown -$SoftwareName = "Julia (x64)" -$juliaVersion = $(julia --version).split() -match "\d+\.\d+\.\d+" - -$Description = @" -_Version:_ $juliaVersion
-"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-Kind.ps1 b/images/win/scripts/Installers/Validate-Kind.ps1 index 9dd12861..9147f462 100644 --- a/images/win/scripts/Installers/Validate-Kind.ps1 +++ b/images/win/scripts/Installers/Validate-Kind.ps1 @@ -3,8 +3,7 @@ ## Desc: Validate Kind. ################################################################################ - -if((Get-Command -Name 'kind')) +if (Get-Command -Name 'kind') { Write-Host "kind $(kind version) in path" } @@ -13,16 +12,3 @@ else Write-Host "kind is not in path" exit 1 } - -# Adding description of the software to Markdown -$SoftwareName = "Kind" - -$version = $(kind version) - -$Description = @" -_Version:_ $version
-_Environment:_ -* PATH: contains location of kind.exe -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-KubernetesCli.ps1 b/images/win/scripts/Installers/Validate-KubernetesCli.ps1 index 5b3d768b..a51cbac6 100644 --- a/images/win/scripts/Installers/Validate-KubernetesCli.ps1 +++ b/images/win/scripts/Installers/Validate-KubernetesCli.ps1 @@ -3,8 +3,7 @@ ## Desc: Validate KubernetesCli. ################################################################################ - -if((Get-Command -Name 'kubectl')) +if (Get-Command -Name 'kubectl') { Write-Host "kubectl $(kubectl version --client=true --short=true) in path" } @@ -14,20 +13,7 @@ else exit 1 } -# Adding description of the software to Markdown -$SoftwareName = "Kubectl" - -$version = $(kubectl version --client=true --short=true) - -$Description = @" -_Version:_ $version
-_Environment:_ -* PATH: contains location of kubectl.exe -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description - -if((Get-Command -Name 'minikube')) +if (Get-Command -Name 'minikube') { Write-Host "minikube $(minikube version --short) in path" } @@ -37,15 +23,3 @@ else exit 1 } -# Adding description of the software to Markdown -$SoftwareName = "minikube" - -$version = $(minikube version --short=true) - -$Description = @" -_Version:_ $version
-_Environment:_ -* PATH: contains location of minikube.exe -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-Mercurial.ps1 b/images/win/scripts/Installers/Validate-Mercurial.ps1 index 74299f06..d42189b8 100644 --- a/images/win/scripts/Installers/Validate-Mercurial.ps1 +++ b/images/win/scripts/Installers/Validate-Mercurial.ps1 @@ -5,21 +5,10 @@ if (Get-Command -Name 'hg') { - Write-Host "Mercurial on path" + Write-Host 'Mercurial on path' } else { Write-Host 'Mercurial is not on path' exit 1 } - -# Adding description of the software to Markdown -$SoftwareName = "Mercurial" -$(hg --version).Split([System.Environment]::NewLine)[0] -match "\d+\.\d+" -$MercurialVersion = $matches[0] - -$Description = @" -_Version:_ $MercurialVersion
-"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-Mingw64.ps1 b/images/win/scripts/Installers/Validate-Mingw64.ps1 index 080a9797..eb097ae7 100644 --- a/images/win/scripts/Installers/Validate-Mingw64.ps1 +++ b/images/win/scripts/Installers/Validate-Mingw64.ps1 @@ -35,23 +35,3 @@ else Write-Host "make is not on PATH" exit 1 } - -# Adding description of the software to Markdown - -# `gcc --version` gives output like: -# gcc.exe (x86_64-posix-seh-rev0, Built by Mingw-w64 project) 5.3.0 -# Copyright (C) 2015 Free Software Foundation, Inc. -# This is free software; see the source for copying conditions. There is NO -# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -$SoftwareName = "Mingw-w64" -$(gcc --version).Split([System.Environment]::NewLine)[0] -match "\d\.\d\.\d$" -$mingw64Version = $matches[0] - -$Description = @" -_Version:_ $mingw64Version
-_Environment:_ -* PATH: contains location of the Mingw-w64 'bin' directory -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-Miniconda.ps1 b/images/win/scripts/Installers/Validate-Miniconda.ps1 index ca48b40f..0c83f36f 100644 --- a/images/win/scripts/Installers/Validate-Miniconda.ps1 +++ b/images/win/scripts/Installers/Validate-Miniconda.ps1 @@ -25,12 +25,3 @@ else exit 1 } -$softwareName = "Miniconda" -$description = @" -_Version:_ $(& "$env:CONDA\Scripts\conda.exe" --version)
-_Environment:_ -* CONDA: contains location of the root of the Miniconda installation -"@ - -# Adding description of the software to Markdown -Add-SoftwareDetailsToMarkdown -SoftwareName $softwareName -DescriptionMarkdown $description diff --git a/images/win/scripts/Installers/Validate-MongoDB.ps1 b/images/win/scripts/Installers/Validate-MongoDB.ps1 new file mode 100644 index 00000000..e0580b54 --- /dev/null +++ b/images/win/scripts/Installers/Validate-MongoDB.ps1 @@ -0,0 +1,38 @@ +################################################################################ +## File: Validate-MongoDB.ps1 +## Desc: Validate MongoDB +################################################################################ + +$command = Get-Command -Name 'mongod' +if($command) +{ + Write-Host "mongod is on path" +} +else +{ + Write-Host 'mongod not on path' + exit 1 +} + +$command = Get-Command -Name 'mongo' +if($command) +{ + Write-Host "mongo is on path" +} +else +{ + Write-Host 'mongo not on path' + exit 1 +} + +# Adding description of the software to Markdown +$SoftwareName = "MongoDB" +$version = $command.Version.ToString(); + +$Description = @" +_Version:_ $version
+_Environment:_ +* PATH: contains location of mongo.exe and mongod.exe +"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-Msys2.ps1 b/images/win/scripts/Installers/Validate-Msys2.ps1 index d1749c5d..efb4160c 100644 --- a/images/win/scripts/Installers/Validate-Msys2.ps1 +++ b/images/win/scripts/Installers/Validate-Msys2.ps1 @@ -41,35 +41,3 @@ $installedMinGWTools | ForEach-Object { } } -# Adding description of the software to Markdown - -function Get-ToolVersion { - param( - [string] $ToolPath, - [int] $VersionLineNumber - ) - - $toolRawVersion = Invoke-Expression "$ToolPath --version" - $toolRawVersion.Split([System.Environment]::NewLine)[$VersionLineNumber] -match "\d+\.\d+(\.\d+)?" | Out-Null - $toolVersion = $matches[0] - return $toolVersion -} - -$SoftwareName = "MSYS2" -$pacmanVersion = Get-ToolVersion -ToolPath "$msys2BinDir/pacman" -VersionLineNumber 1 -$bashVersion = Get-ToolVersion -ToolPath "$msys2BinDir/bash" -VersionLineNumber 0 -$gccVersion = Get-ToolVersion -ToolPath "$msys2mingwDir/gcc" -VersionLineNumber 0 -$tarVersion = Get-ToolVersion -ToolPath "$msys2BinDir/tar" -VersionLineNumber 0 - -$Description = @" -> _Note:_ MSYS2 is pre-installed on image but not added to PATH. - -_Tool versions_ -_pacman:_ $pacmanVersion
-_bash:_ $bashVersion
-_gcc:_ $gccVersion
-_tar:_ $tarVersion
-MSYS2 location: C:\msys64 -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-MysqlCli.ps1 b/images/win/scripts/Installers/Validate-MysqlCli.ps1 index f056bee8..a88bbfd2 100644 --- a/images/win/scripts/Installers/Validate-MysqlCli.ps1 +++ b/images/win/scripts/Installers/Validate-MysqlCli.ps1 @@ -3,10 +3,9 @@ ## Desc: Validate Mysql Cli ################################################################################ -$command = Get-Command -Name 'mysql' -if($command) +if (Get-Command -Name 'mysql') { - Write-Host "Mysql is on path" + Write-Host 'Mysql is on path' } else { @@ -14,14 +13,3 @@ else exit 1 } -# Adding description of the software to Markdown -$SoftwareName = "Mysql" -$version = $command.Version.ToString(); - -$Description = @" -_Version:_ $version
-_Environment:_ -* PATH: contains location of mysql.exe -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-NET472.ps1 b/images/win/scripts/Installers/Validate-NET472.ps1 index fb791a4a..0299304f 100644 --- a/images/win/scripts/Installers/Validate-NET472.ps1 +++ b/images/win/scripts/Installers/Validate-NET472.ps1 @@ -3,25 +3,15 @@ ## Desc: Validate .NET 4.7.2 ################################################################################ -Import-Module -Name ImageHelpers -Force - # For reference, visit https://docs.microsoft.com/en-us/dotnet/framework/migration-guide/how-to-determine-which-versions-are-installed#ps_a -if(Get-ChildItem "HKLM:SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\" | Get-ItemPropertyValue -Name Release | ForEach-Object { $_ -ge 461814 }) +if (Get-ChildItem "HKLM:SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\" | Get-ItemPropertyValue -Name Release | ForEach-Object { $_ -ge 461814 }) { $version = Get-ChildItem "HKLM:SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\" | Get-ItemPropertyValue -Name Version - Write-Host "Installed .Net version " $version + Write-Host "Installed .Net version $version" } -else { +else +{ Write-Host ".Net 472 not found" exit 1 } - -# Adding description of the software to Markdown -$SoftwareName = ".NET 4.7.2" - -$Description = @" -_Version:_ $version -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-NET48.ps1 b/images/win/scripts/Installers/Validate-NET48.ps1 index a0b43c1c..1c1c974a 100644 --- a/images/win/scripts/Installers/Validate-NET48.ps1 +++ b/images/win/scripts/Installers/Validate-NET48.ps1 @@ -3,26 +3,14 @@ ## Desc: Validate .NET 4.8 ################################################################################ -Import-Module -Name ImageHelpers -Force - # For reference, visit https://docs.microsoft.com/en-us/dotnet/framework/migration-guide/how-to-determine-which-versions-are-installed#ps_a -if(Get-ChildItem "HKLM:SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\" | Get-ItemPropertyValue -Name Release | ForEach-Object { $_ -ge 528049 }) +if (Get-ChildItem "HKLM:SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\" | Get-ItemPropertyValue -Name Release | ForEach-Object { $_ -ge 528049 }) { $version = Get-ChildItem "HKLM:SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\" | Get-ItemPropertyValue -Name Version - Write-Host "Installed .Net version " $version + Write-Host "Installed .Net version $version" } -else { +else +{ Write-Host ".Net 48 not found" exit 1 } - - -# Adding description of the software to Markdown -$SoftwareName = ".NET 4.8" - -$Description = @" -_Version:_ $version -_Path:_ ${Env:ProgramFiles(x86)}\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-NSIS.ps1 b/images/win/scripts/Installers/Validate-NSIS.ps1 index 276eb139..04b54dcc 100644 --- a/images/win/scripts/Installers/Validate-NSIS.ps1 +++ b/images/win/scripts/Installers/Validate-NSIS.ps1 @@ -5,7 +5,7 @@ $SoftwareName = 'Nullsoft Install System (NSIS)' -if (Get-Command -Name makensis) +if (Get-Command -Name 'makensis') { Write-Host "$SoftwareName is installed" } @@ -15,17 +15,3 @@ else exit 1 } -# Adding description of the software to Markdown -$ChocoList = $(choco list --local-only nsis) | Select-String -Pattern "nsis" | Select-Object -First 1 - -if ($ChocoList -Match "\d+\.\d+") -{ - $Version = $Matches[0] -} - - -$Description = @" -_Version:_ $Version
-"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-NodeLts.ps1 b/images/win/scripts/Installers/Validate-NodeLts.ps1 index 7d42a040..201a86b3 100644 --- a/images/win/scripts/Installers/Validate-NodeLts.ps1 +++ b/images/win/scripts/Installers/Validate-NodeLts.ps1 @@ -3,7 +3,7 @@ ## Desc: Validate nodejs-lts and other common node tools. ################################################################################ -if((Get-Command -Name 'node') -and (Get-Command -Name 'npm')) +if ((Get-Command -Name 'node') -and (Get-Command -Name 'npm')) { Write-Host "Node $(node --version) on path" Write-Host "Npm $(npm -version) on path" @@ -14,7 +14,7 @@ else exit 1 } -if((Get-Command -Name 'gulp') -and (Get-Command -Name 'grunt') -and (Get-Command -Name 'cordova') -and (Get-Command -Name 'yarn')) +if ((Get-Command -Name 'gulp') -and (Get-Command -Name 'grunt') -and (Get-Command -Name 'cordova') -and (Get-Command -Name 'yarn')) { Write-Host "Gulp $(gulp -version) on path" Write-Host "Grunt $(grunt -version) on path" @@ -26,7 +26,7 @@ else exit 1 } -if(Get-Command -Name 'lerna') +if (Get-Command -Name 'lerna') { Write-Host "lerna $(lerna --version) on path" } @@ -35,43 +35,3 @@ else Write-Host "lerna is not on path" exit 1 } - - - -if( $(node --version) -match 'v(?.*)' ) -{ - $nodeVersion = $Matches.version - $nodeArch = $(node -e "console.log(process.arch)") -} - -$npmVersion = $(npm -version) - -# Adding description of the software to Markdown -$SoftwareName = "Node.js" -$GulpInfo = "Gulp $(gulp -version)" -$GruntInfo = "Grunt $(grunt -version)" -$YarnInfo = "Yarn $(yarn -version)" - -$Description = @" -_Version:_ $nodeVersion
-_Architecture:_ $nodeArch
-_Environment:_ -* PATH: contains location of node.exe
-* $GulpInfo
-* $GruntInfo
-* $YarnInfo
- -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description - -# Adding description of the software to Markdown -$SoftwareName = "npm" - -$Description = @" -_Version:_ $npmVersion
-_Environment:_ -* PATH: contains location of npm.cmd -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-OpenSSL.ps1 b/images/win/scripts/Installers/Validate-OpenSSL.ps1 index 12791491..6ec079be 100644 --- a/images/win/scripts/Installers/Validate-OpenSSL.ps1 +++ b/images/win/scripts/Installers/Validate-OpenSSL.ps1 @@ -5,7 +5,7 @@ if (Get-Command -Name 'openssl') { - Write-Host "openssl on path" + Write-Host 'openssl on path' } else { @@ -13,17 +13,3 @@ else exit 1 } -# Adding description of the software to Markdown -$SoftwareName = "OpenSSL" - -$versions = Get-Command openssl -All -foreach ($version in $versions) -{ - $command = "& `"$($version.Source)`" version" - if ( $(Invoke-Expression -Command $command) -match '\d+\.\d+\.\d+\w?' ) - { - $Description += "_Version:_ $($Matches[0]) at $($version.Source)
" - } -} - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-PHP.ps1 b/images/win/scripts/Installers/Validate-PHP.ps1 index f2f26a52..0c50e7e2 100644 --- a/images/win/scripts/Installers/Validate-PHP.ps1 +++ b/images/win/scripts/Installers/Validate-PHP.ps1 @@ -15,7 +15,8 @@ function Get-PHPVersion if($($(php --version)| Out-String) -match 'PHP (?.*) (.*cli).*') { $phpVersion = $Matches.version - return $phpVersion + Write-Host "PHP version at $phpRootPath is $phpVersion" + exit 0 } Write-Host "Unable to determine PHP version at " + $phpRootPath @@ -44,32 +45,5 @@ else exit 1 } -# Get the composer version. -$composerVersion = $(composer --version) - -# Add composer version details in Markdown -$SoftwareName = "Composer" -$Description = @" -#### $composerVersion - -_Environment:_ -* PATH: contains the location of composer.exe version $composerVersion -* PHPROOT: root directory of the Composer $composerVersion installation -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description - # Get available versions of PHP -$phpVersionOnPath = Get-PHPVersion -phpRootPath "C:\tools\php72" - -# Add details of available versions in Markdown -$SoftwareName = "PHP (x64)" -$Description = @" -#### $phpVersionOnPath - -_Environment:_ -* PATH: contains the location of php.exe version $phpVersionOnPath -* PHPROOT: root directory of the PHP $phpVersionOnPath installation -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description +Get-PHPVersion -phpRootPath "C:\tools\php72" diff --git a/images/win/scripts/Installers/Validate-Packer.ps1 b/images/win/scripts/Installers/Validate-Packer.ps1 index 85473557..c1333d1e 100644 --- a/images/win/scripts/Installers/Validate-Packer.ps1 +++ b/images/win/scripts/Installers/Validate-Packer.ps1 @@ -5,7 +5,7 @@ if (Get-Command -Name 'packer') { - Write-Host "Packer is on path" + Write-Host 'Packer is on path' } else { @@ -13,12 +13,3 @@ else exit 1 } -# Adding description of the software to Markdown -$SoftwareName = "Packer" -$PackerVersion = packer --version - -$Description = @" -_Version:_ $PackerVersion
-"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-Perl.ps1 b/images/win/scripts/Installers/Validate-Perl.ps1 index 6c0abc26..09ada6ab 100644 --- a/images/win/scripts/Installers/Validate-Perl.ps1 +++ b/images/win/scripts/Installers/Validate-Perl.ps1 @@ -5,7 +5,7 @@ if (Get-Command -Name 'perl') { - Write-Host "perl on path" + Write-Host 'perl on path' } else { @@ -13,11 +13,3 @@ else exit 1 } -# Adding description of the software to Markdown -$SoftwareName = "Perl" - -$Description = @" -_Version:_ $(perl -e 'print $^V')
-"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-PostgreSQL.ps1 b/images/win/scripts/Installers/Validate-PostgreSQL.ps1 new file mode 100644 index 00000000..bfd2f0f0 --- /dev/null +++ b/images/win/scripts/Installers/Validate-PostgreSQL.ps1 @@ -0,0 +1,35 @@ +$PGUSER="postgres" +function Validate-PostgreSQL { + $pgready = Start-Process -FilePath pg_isready -Wait -PassThru + $exitCode = $pgready.ExitCode + if ($exitCode -eq 0) + { + Write-Host -Object "PostgreSQL has been successfully installed." + } + else + { + Write-Host -Object "PostgreSQL is not ready. Exitcode: $exitCode" + exit $exitCode + } +} + +$paths = (Get-CimInstance Win32_Service -Filter "Name LIKE 'postgresql-%'").PathName +$pgservice = (Get-CimInstance Win32_Service -Filter "Name LIKE 'postgresql-%'").Name +$pgroot = $paths.split('"')[1].replace("\bin\pg_ctl.exe", "") +$psqlVersion = pg_config --version | Out-String +Validate-PostgreSQL + +# Adding description of the software to Markdown +$SoftwareName = "PostgreSQL" +$Description = @" +_Version:_ $psqlVersion
+_Default Path:_ $pgroot
+_User:_ $env:PGUSER
+_Password:_ $env:PGPASSWORD +"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description + +#Stop and disable PostgreSQL service +Stop-Service -Name $pgservice +Set-Service $pgservice -StartupType Disabled diff --git a/images/win/scripts/Installers/Validate-PowershellCore.ps1 b/images/win/scripts/Installers/Validate-PowershellCore.ps1 index 1501ba87..b21a4064 100644 --- a/images/win/scripts/Installers/Validate-PowershellCore.ps1 +++ b/images/win/scripts/Installers/Validate-PowershellCore.ps1 @@ -5,24 +5,11 @@ if (Get-Command -Name 'pwsh') { - Write-Host "pwsh is on PATH" + Write-Host 'pwsh is on PATH' } else { - Write-Host "pwsh is not on PATH" + Write-Host 'pwsh is not on PATH' exit 1 } -# Adding description of the software to Markdown -$SoftwareName = "Powershell Core" - -if(($(pwsh --version) | Out-String) -match 'PowerShell (?.*)') -{ - $PowershellVersion = $Matches.version -} - -$Description = @" -_Version:_ $PowershellVersion
-"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-Rust.ps1 b/images/win/scripts/Installers/Validate-Rust.ps1 index d23d91d8..116f33cf 100644 --- a/images/win/scripts/Installers/Validate-Rust.ps1 +++ b/images/win/scripts/Installers/Validate-Rust.ps1 @@ -17,18 +17,3 @@ else Write-Host "rustc is not on the path" exit 1 } - -$RustPath = Split-Path (Get-Command -Name 'rustc').Path -$RustcVersion -Match "\d+\.\d+\.\d+" | Out-Null -$Version = $Matches[0] - -# Adding description of the software to Markdown -$SoftwareName = "Rust (64-bit)" -$Description = @" -#### $Version -_Environment:_ -* _Location:_ $RustPath -* PATH: contains the location of rustc.exe -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-SQLExpress.ps1 b/images/win/scripts/Installers/Validate-SQLExpress.ps1 index 2cb7f4f3..c1f32eca 100644 --- a/images/win/scripts/Installers/Validate-SQLExpress.ps1 +++ b/images/win/scripts/Installers/Validate-SQLExpress.ps1 @@ -25,8 +25,6 @@ function Test-SqlConnection { $sqlConnection = New-Object System.Data.SqlClient.SqlConnection $connectionString $sqlConnection.Open() Write-Host -Object "Connection to SQL Express was successful." - return $sqlConnection.ServerVersion - } catch { Write-Host -Object "Connection to SQL Express cannot be established." exit 1 @@ -36,17 +34,7 @@ function Test-SqlConnection { $sqlConnection.Close() } } + $instanceName = "$env:computername\$sqlInstance" -$version = Test-SqlConnection -ServerName $instanceName -IntegratedSecurity "false" -UserName $sqlUser -Password $sqlPassword +Test-SqlConnection -ServerName $instanceName -IntegratedSecurity "false" -UserName $sqlUser -Password $sqlPassword -# Adding description of the software to Markdown -$SoftwareName = "Microsoft SQL Express" -$Description = @" -_Version:_ $version
-_InstanceName:_ $sqlInstance
-_Username:_ $sqlUser
-_Password:_ $sqlPassword
-_Default Path:_ C:\Program Files (x86)\Microsoft SQL Server -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-SQLPowerShellTools.ps1 b/images/win/scripts/Installers/Validate-SQLPowerShellTools.ps1 index 5af77da6..26dfeddc 100644 --- a/images/win/scripts/Installers/Validate-SQLPowerShellTools.ps1 +++ b/images/win/scripts/Installers/Validate-SQLPowerShellTools.ps1 @@ -4,34 +4,7 @@ $modules = Get-Module -Name SQLPS -ListAvailable Write-Host "The SQLPS Modules present are:" $modules | Select-Object Name,Version,Path | Format-Table -if ($modules) { - $sqlPSVersion = $modules.Version -} - # Validate the SQLserver PS module installation $modules = Get-Module -Name SQLServer -ListAvailable Write-Host "The SQLServer Modules present are:" $modules | Select-Object Name,Version,Path | Format-Table - -if ($modules) { - $sqlServerPSModuleVersion = $modules.Version -} - - -# Adding description of the software to Markdown -$SoftwareName = "SQLPS" - -$Description = @" -_Version:_ $sqlPSVersion -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description - -# Adding description of the software to Markdown -$SoftwareName = "SQLServer PS" - -$Description = @" -_Version:_ $sqlServerPSModuleVersion -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-Sbt.ps1 b/images/win/scripts/Installers/Validate-Sbt.ps1 index bea29c8b..16944722 100644 --- a/images/win/scripts/Installers/Validate-Sbt.ps1 +++ b/images/win/scripts/Installers/Validate-Sbt.ps1 @@ -3,15 +3,13 @@ ## Desc: Validate sbt for Windows ################################################################################ -if((Get-Command -Name 'sbt')) +if (Get-Command -Name 'sbt') { - Write-Host "sbt is on the path" + Write-Host 'sbt is on the path' } else { - Write-Host "sbt is not on path." + Write-Host 'sbt is not on path.' exit 1 } -# This works around issue where sbt --script-version does some copies and breaks the build -Add-SoftwareDetailsToMarkdown -SoftwareName "sbt" -DescriptionMarkdown "" diff --git a/images/win/scripts/Installers/Validate-SeleniumWebDrivers.ps1 b/images/win/scripts/Installers/Validate-SeleniumWebDrivers.ps1 index dd74b95e..7dd9529f 100644 --- a/images/win/scripts/Installers/Validate-SeleniumWebDrivers.ps1 +++ b/images/win/scripts/Installers/Validate-SeleniumWebDrivers.ps1 @@ -13,79 +13,26 @@ $EdgeDriverPath = $env:EdgeWebDriver Write-Host "EdgeDriverPath: $EdgeDriverPath" if ( - ($IEDriverPath -like "C:\SeleniumWebDrivers\IEDriver") -and - ($GeckoDriverPath -like "C:\SeleniumWebDrivers\GeckoDriver") -and - ($ChromeDriverPath -like "C:\SeleniumWebDrivers\ChromeDriver") -and - ($EdgeDriverPath -like "C:\SeleniumWebDrivers\EdgeDriver") + ($IEDriverPath -like "C:\SeleniumWebDrivers\IEDriver") -and + ($GeckoDriverPath -like "C:\SeleniumWebDrivers\GeckoDriver") -and + ($ChromeDriverPath -like "C:\SeleniumWebDrivers\ChromeDriver") -and + ($EdgeDriverPath -like "C:\SeleniumWebDrivers\EdgeDriver") ) { + Write-Host "IEDriver installed at " + (Get-Item "$IEDriverPath\IEDriverServer.exe").VersionInfo - Write-Host "IEDriver installed at " - (Get-Item "$IEDriverPath\IEDriverServer.exe").VersionInfo + Write-Host "Gecko Driver installed at " + (Get-Item "$GeckoDriverPath\geckodriver.exe").VersionInfo + Write-Host "Chrome Driver installed at " + (Get-Item "$ChromeDriverPath\chromedriver.exe").VersionInfo - Write-Host "Gecko Driver installed at " - (Get-Item "$GeckoDriverPath\geckodriver.exe").VersionInfo - - - Write-Host "Chrome Driver installed at " - (Get-Item "$ChromeDriverPath\chromedriver.exe").VersionInfo - - - Write-Host "Edge Driver installed at " - (Get-Item "$EdgeDriverPath\msedgedriver.exe").VersionInfo - - $versionFileName = "versioninfo.txt"; - $chromedriverversion = Get-Content -Path "$ChromeDriverPath\$versionFileName" - $geckodriverversion = Get-Content -Path "$GeckoDriverPath\$versionFileName" - $iedriverversion = Get-Content -Path "$IEDriverPath\$versionFileName" - $edgedriverversion = Get-Content -Path "$EdgeDriverPath\$versionFileName" - - # Adding description of the software to Markdown - $SoftwareName = "Selenium Web Drivers" - - $Description = @" - -#### Chrome Driver - -_version:_ -$chromedriverversion - -_Environment:_ -* ChromeWebDriver: location of chromedriver.exe - -#### Gecko Driver - -_version:_ -$geckodriverversion - -_Environment:_ -* GeckoWebDriver: location of geckodriver.exe - -#### IE Driver - -_version:_ -$iedriverversion - -_Environment:_ -* IEWebDriver: location of IEDriverServer.exe - -#### Microsoft Edge Driver - -_version:_ -$edgedriverversion - -_Environment:_ -* EdgeWebDriver: location of msedgedriver.exe - -"@ - - Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description - - exit 0 + Write-Host "Edge Driver installed at " + (Get-Item "$EdgeDriverPath\msedgedriver.exe").VersionInfo } else { - Write-Host "Selenium Web Drivers are not installed." + Write-Host "Selenium Web Drivers are not installed." exit 1 } diff --git a/images/win/scripts/Installers/Validate-ServiceFabricSDK.ps1 b/images/win/scripts/Installers/Validate-ServiceFabricSDK.ps1 index d2d69f1b..7984335e 100644 --- a/images/win/scripts/Installers/Validate-ServiceFabricSDK.ps1 +++ b/images/win/scripts/Installers/Validate-ServiceFabricSDK.ps1 @@ -5,40 +5,13 @@ $modules = Get-Module -Name ServiceFabric -ListAvailable -if(($modules | Measure-Object).Count -gt 0) +if (($modules | Measure-Object).Count -gt 0) { $modules } -else { +else +{ Write-Host "ServiceFabric Module is not present, it might not be installed" throw "ServiceFabric Module is not present, it might not be installed" } - -function Get-ServiceFabricSDKVersion -{ - $regKey = "HKLM:\Software\Microsoft\Service Fabric SDK" - $installedApplications = Get-ItemProperty -Path $regKey - $Version = (Get-ItemProperty -Path $regKey).FabricSDKVersion - return $Version -} - - -function Get-ServiceFabricVersion -{ - $regKey = "HKLM:\Software\Microsoft\Service Fabric" - $installedApplications = Get-ItemProperty -Path $regKey - $Version = (Get-ItemProperty -Path $regKey).FabricVersion - return $Version -} - - -# Adding description of the software to Markdown -$SoftwareName = "Azure Service Fabric" - -$Description = @" -_SDK Version:_ $(Get-ServiceFabricSDKVersion)
-_Runtime Version:_ $(Get-ServiceFabricVersion) -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-Stack.ps1 b/images/win/scripts/Installers/Validate-Stack.ps1 index d24d8954..e52b54b2 100644 --- a/images/win/scripts/Installers/Validate-Stack.ps1 +++ b/images/win/scripts/Installers/Validate-Stack.ps1 @@ -5,23 +5,11 @@ if (Get-Command -Name 'stack') { - Write-Host "stack is on the path" + Write-Host 'stack is on the path' } else { - Write-Host "stack is not on path." + Write-Host 'stack is not on path.' exit 1 } -$StackVersion = stack --version --quiet - -# Adding description of the software to Markdown -$SoftwareName = "Stack" - -$Description = @" -_Version:_ $StackVersion
-_Environment:_ -* PATH: contains location of stack.exe -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-Svn.ps1 b/images/win/scripts/Installers/Validate-Svn.ps1 index 2009807e..775190b0 100644 --- a/images/win/scripts/Installers/Validate-Svn.ps1 +++ b/images/win/scripts/Installers/Validate-Svn.ps1 @@ -3,7 +3,7 @@ ## Desc: Validate Subversion ################################################################################ -if(Get-Command -Name 'svn') +if (Get-Command -Name 'svn') { Write-Host "Subversion $(svn --version --quiet) is on the path." } @@ -12,17 +12,3 @@ else Write-Host "Subversion is not on the path." exit 1 } - - -$svnVersion = $(svn --version --quiet) - -# Adding description of the software to Markdown -$SoftwareName = "Subversion" - -$Description = @" -_Version:_ $svnVersion
-_Environment:_ -* PATH: contains location of svn.exe -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-ToolCache.ps1 b/images/win/scripts/Installers/Validate-ToolCache.ps1 index f2e900ae..a44b75a4 100644 --- a/images/win/scripts/Installers/Validate-ToolCache.ps1 +++ b/images/win/scripts/Installers/Validate-ToolCache.ps1 @@ -83,40 +83,6 @@ function Get-SystemDefaultRuby { exit 1 } - - $rubyVersionOnPath = "Ruby $($Matches.version)" - $description = GetDefaultToolDescription -SoftwareVersion $rubyVersionOnPath -SoftwareLocation $rubyBinOnPath - - $gemVersion = & gem -v - $description += "* Gem Version: $gemVersion
" - - return $description -} - -function GetDefaultToolDescription { - param ( - [Parameter(Mandatory = $True)] - [string]$SoftwareVersion, - [Parameter(Mandatory = $True)] - [string]$SoftwareLocation - ) - - $description = "
__System default version:__ $SoftwareVersion
" - $description += "_Environment:_
" - $description += "* Location: $SoftwareLocation
" - $description += "* PATH: contains the location of $SoftwareVersion
" - - return $description -} - -function GetMarkdownDescription { - param ( - [Parameter(Mandatory = $True)] - [string]$SoftwareVersion, - [Parameter(Mandatory = $True)] - [string]$SoftwareArchitecture - ) - return "_Version:_ $SoftwareVersion ($SoftwareArchitecture)
" } function ToolcacheTest { @@ -142,7 +108,6 @@ function ToolcacheTest { exit 1 } - $markdownDescription = "" $tools = GetToolsByName -SoftwareName $SoftwareName foreach($tool in $tools) { @@ -165,16 +130,12 @@ function ToolcacheTest { $path = "$softwarePath\$foundVersion\$requiredArchitecture" RunTestsByPath -ExecTests $ExecTests -Path $path -SoftwareName $SoftwareName -SoftwareVersion $foundVersion -SoftwareArchitecture $requiredArchitecture - - $markdownDescription += GetMarkdownDescription -SoftwareVersion $foundVersion -SoftwareArchitecture $requiredArchitecture } } if ($SoftwareName -contains "Ruby") { - $markdownDescription += Get-SystemDefaultRuby + Get-SystemDefaultRuby } - - Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $markdownDescription } # Ruby test diff --git a/images/win/scripts/Installers/Validate-Toolset.ps1 b/images/win/scripts/Installers/Validate-Toolset.ps1 index 048256c3..c5460053 100644 --- a/images/win/scripts/Installers/Validate-Toolset.ps1 +++ b/images/win/scripts/Installers/Validate-Toolset.ps1 @@ -34,7 +34,6 @@ function Validate-SystemDefaultTool { # Check if tool on path if (Get-Command -Name $binName) { $versionOnPath = $(& $binName --version 2>&1) | Select-String -Pattern ".*(\d+\.\d+\.\d+)" - $versionBinPath = Split-Path -Path (Get-Command -Name $binName).Path # Check if version is correct if ($versionOnPath.matches.Groups[1].Value -notlike $ExpectedVersion) { @@ -47,20 +46,10 @@ function Validate-SystemDefaultTool { Write-Host "$ToolName is not on path" exit 1 } - - # Add default version description to markdown - $description = "
__System default version:__ $versionOnPath
" - $description += "_Environment:_
" - $description += "* Location: $versionBinPath
" - $description += "* PATH: contains the location of $versionOnPath
" - - return $description } $ErrorActionPreference = "Stop" -Import-Module -Name ImageHelpers -Force - # Define executables for cached tools $toolsExecutables = @{ Python = @("python.exe", "Scripts\pip.exe") @@ -72,8 +61,6 @@ $toolsExecutables = @{ $tools = Get-ToolsetContent | Select-Object -ExpandProperty toolcache foreach($tool in $tools) { - $markdownDescription = "" - $toolPath = Join-Path $env:AGENT_TOOLSDIRECTORY $tool.name # Get executables for current tool $toolExecs = $toolsExecutables[$tool.name] @@ -105,22 +92,10 @@ foreach($tool in $tools) { Write-Host "Run validation test for $($tool.name)($($tool.arch)) $($foundVersion.name) executables..." Run-ExecutableTests -Executables $toolExecs -ToolPath $foundVersionArchPath - - $foundVersionName = $foundVersion.name - if ($tool.name -eq 'PyPy') - { - $pypyVersion = & "$foundVersionArchPath\python.exe" -c "import sys;print(sys.version.split('\n')[1])" - $foundVersionName = "{0} {1}" -f $foundVersionName, $pypyVersion - } - # Add to tool version to markdown - $markdownDescription += "_Version:_ $foundVersionName
" } - # Create markdown description for system default tool if (-not ([string]::IsNullOrEmpty($tool.default))) { Write-Host "Validate system default $($tool.name)($($tool.arch)) $($tool.default)..." - $markdownDescription += Validate-SystemDefaultTool -ToolName $tool.name -ExpectedVersion $tool.default + Validate-SystemDefaultTool -ToolName $tool.name -ExpectedVersion $tool.default } - - Add-SoftwareDetailsToMarkdown -SoftwareName "$($tool.name) ($($tool.arch))" -DescriptionMarkdown $markdownDescription } \ No newline at end of file diff --git a/images/win/scripts/Installers/Validate-TypeScript.ps1 b/images/win/scripts/Installers/Validate-TypeScript.ps1 index 94efab7a..b498eceb 100644 --- a/images/win/scripts/Installers/Validate-TypeScript.ps1 +++ b/images/win/scripts/Installers/Validate-TypeScript.ps1 @@ -3,7 +3,7 @@ ## Desc: Validate Typescript Installation ################################################################################ -if(Get-Command -Name 'tsc') +if (Get-Command -Name 'tsc') { Write-Host "TypeScript $(tsc --version) is on the path." } @@ -12,15 +12,3 @@ else Write-Host "TypeScript is not on the path." exit 1 } - - -$typescriptVersion = $(tsc --version) - -# Adding description of the software to Markdown -$SoftwareName = "TypeScript" - -$Description = @" -_Version:_ $typescriptVersion
-"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-VSWhere.ps1 b/images/win/scripts/Installers/Validate-VSWhere.ps1 index c44ba7d4..850b5f26 100644 --- a/images/win/scripts/Installers/Validate-VSWhere.ps1 +++ b/images/win/scripts/Installers/Validate-VSWhere.ps1 @@ -3,7 +3,7 @@ ## Desc: Validate vswhere ################################################################################ -if(Get-Command -Name 'vswhere') +if (Get-Command -Name 'vswhere') { Write-Host "vswhere $(vswhere) on path" } @@ -12,14 +12,3 @@ else Write-Host "vswhere is not on path" exit 1 } - -# Adding description of the software to Markdown -$SoftwareName = "VSWhere" -$VswhereVersion = (Get-Command -Name vswhere).FileVersionInfo.ProductVersion - -$Description = @" -_Version_: $VswhereVersion
-* PATH: contains location of vswhere.exe -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description \ No newline at end of file diff --git a/images/win/scripts/Installers/Validate-Vcpkg.ps1 b/images/win/scripts/Installers/Validate-Vcpkg.ps1 index 49c6fc04..e10927f1 100644 --- a/images/win/scripts/Installers/Validate-Vcpkg.ps1 +++ b/images/win/scripts/Installers/Validate-Vcpkg.ps1 @@ -16,31 +16,12 @@ else if ($env:VCPKG_INSTALLATION_ROOT) { - Write-Host "The VCPKG_INSTALLATION_ROOT environment variable is set" + Write-Host 'The VCPKG_INSTALLATION_ROOT environment variable is set' Write-Host $env:VCPKG_INSTALLATION_ROOT } else { - Write-Host "The VCPKG_INSTALLATION_ROOT environment variable is not set" + Write-Host 'The VCPKG_INSTALLATION_ROOT environment variable is not set' exit 1 } -# Adding description of the software to Markdown - -# `vcpkg version` gives output like: -# Vcpkg package management program version 2018.11.23-nohash -# -# See LICENSE.txt for license information. - -$SoftwareName = 'Vcpkg' -$(vcpkg version).Split([System.Environment]::NewLine)[0] -match "\d+.\d+.\d+.*" -$VcpkgVersion = $Matches[0] - -$Description = @" -_Version:_ $VcpkgVersion
-_Environment:_ -* PATH: contains location of the vcpkg directory -* VCPKG_INSTALLATION_ROOT: root directory of the vcpkg installation -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-WDK.ps1 b/images/win/scripts/Installers/Validate-WDK.ps1 index 564a0ab2..dfb98249 100644 --- a/images/win/scripts/Installers/Validate-WDK.ps1 +++ b/images/win/scripts/Installers/Validate-WDK.ps1 @@ -3,8 +3,6 @@ ## Desc: Validate the installation of the Windows Driver Kit ################################################################################ -Import-Module -Name ImageHelpers -Force - function Get-WDKVersion { $WDKVersion = (Get-CimInstance -ClassName Win32_Product -Filter "Name = 'Windows Driver Kit'").Version @@ -14,19 +12,8 @@ function Get-WDKVersion Write-Host "WDK was not found" exit 1 } - - return $WDKVersion } -$WDKVersion = Get-WDKVersion -$WDKPackageVersion = Get-VSExtensionVersion -packageName "Microsoft.Windows.DriverKit" +Get-WDKVersion +$null = Get-VSExtensionVersion -packageName "Microsoft.Windows.DriverKit" -# Adding description of the software to Markdown -$SoftwareName = "Windows Driver Kit" - -$Description = @" -_WDK Version:_ $WDKVersion
-_WDK Visual Studio Extension Version:_ $WDKPackageVersion
-"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-WinAppDriver.ps1 b/images/win/scripts/Installers/Validate-WinAppDriver.ps1 index f92b37c4..ee1a6fc5 100644 --- a/images/win/scripts/Installers/Validate-WinAppDriver.ps1 +++ b/images/win/scripts/Installers/Validate-WinAppDriver.ps1 @@ -3,43 +3,35 @@ ## Desc: Validate WinAppDriver installation ################################################################################ -$wad = "Windows Application Driver"; -if (${Env:ProgramFiles(x86)}) +$wad = "Windows Application Driver" +if (${env:ProgramFiles(x86)}) { - $wadPath = "${Env:ProgramFiles(x86)}\$wad" + $wadPath = "${env:ProgramFiles(x86)}\$wad" } else { - $wadPath = "${Env:ProgramFiles}\$wad" + $wadPath = "${env:ProgramFiles}\$wad" } -if(Test-Path $wadPath -PathType Any) +if (Test-Path $wadPath -PathType Any) { - Write-Host "WinAppDriver directory found." + Write-Host "WinAppDriver directory found." } else { - Write-Host "Failed to locate WinAppDriver directory. Exiting." - exit 1 + Write-Host "Failed to locate WinAppDriver directory. Exiting." + exit 1 } #Validate if Developer Mode is enabled $path = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock"; -if((Get-ItemProperty -Path $path | Select-Object -ExpandProperty "AllowDevelopmentWithoutDevLicense") -eq 1) +if ((Get-ItemProperty -Path $path | Select-Object -ExpandProperty "AllowDevelopmentWithoutDevLicense") -eq 1) { - Write-Host "Developer Mode is successfully provisioned." + Write-Host "Developer Mode is successfully provisioned." } else { - Write-Host "Developer Mode was not successfully provisioned." - exit 1 + Write-Host "Developer Mode was not successfully provisioned." + exit 1 } -# Adding description of the software to Markdown -$SoftwareName = "WinAppDriver" -$version = [System.Diagnostics.FileVersionInfo]::GetVersionInfo("C:\Program Files (x86)\Windows Application Driver\WinAppDriver.exe").FileVersion -$Description = @" -_Version:_ $version
-"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-Wix.ps1 b/images/win/scripts/Installers/Validate-Wix.ps1 index d755939d..184a1bd7 100644 --- a/images/win/scripts/Installers/Validate-Wix.ps1 +++ b/images/win/scripts/Installers/Validate-Wix.ps1 @@ -14,7 +14,7 @@ function Get-WixVersion { $WixToolSetVersion = Get-WixVersion -if($WixToolSetVersion) { +if ($WixToolSetVersion) { Write-Host "Wix Toolset version" $WixPackage.version "installed" } else { @@ -22,25 +22,12 @@ else { exit 1 } -if(Test-IsWin19) +if (Test-IsWin19) { - $WixPackageVersion = Get-VSExtensionVersion -packageName "WixToolset.VisualStudioExtension.Dev16" - $VSver = "2019" + $null = Get-VSExtensionVersion -packageName "WixToolset.VisualStudioExtension.Dev16" } else { - $WixPackageVersion = Get-VSExtensionVersion -packageName "WixToolset.VisualStudioExtension.Dev15" - $VSver = "2017" + $null = Get-VSExtensionVersion -packageName "WixToolset.VisualStudioExtension.Dev15" } -# Adding description of the software to Markdown -$SoftwareName = "WIX Tools" - -$Description = @" -_Toolset Version:_ $WixToolSetVersion
-_WIX Toolset Studio $VSver Extension Version:_ $WixPackageVersion
-_Environment:_ -* WIX: Installation root of WIX -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-Zstd.ps1 b/images/win/scripts/Installers/Validate-Zstd.ps1 index afb6a030..d637b096 100644 --- a/images/win/scripts/Installers/Validate-Zstd.ps1 +++ b/images/win/scripts/Installers/Validate-Zstd.ps1 @@ -5,7 +5,7 @@ if (Get-Command -Name 'zstd') { - Write-Host "zstd on path" + Write-Host 'zstd on path' } else { @@ -13,12 +13,3 @@ else exit 1 } -# Adding description of the software to Markdown -$SoftwareName = "zstd" -$zstdVersion = $(zstd --version).Split(' ')[6].Split(',')[0].Substring(1) - -$Description = @" -_Version:_ $zstdVersion
-"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Windows2016/Initialize-VM.ps1 b/images/win/scripts/Installers/Windows2016/Initialize-VM.ps1 index 202c9b48..794c1b0f 100644 --- a/images/win/scripts/Installers/Windows2016/Initialize-VM.ps1 +++ b/images/win/scripts/Installers/Windows2016/Initialize-VM.ps1 @@ -125,48 +125,14 @@ Choco-Install -PackageName webpicmd # Install vcredist140 Choco-Install -PackageName vcredist140 - # Expand disk size of OS drive - New-Item -Path d:\ -Name cmds.txt -ItemType File -Force - Add-Content -Path d:\cmds.txt "SELECT VOLUME=C`r`nEXTEND" $expandResult = (diskpart /s 'd:\cmds.txt') - Write-Host $expandResult Write-Host "Disk sizes after expansion" - wmic logicaldisk get size,freespace,caption -# Adding description of the software to Markdown - -$Content = @" - -# Windows Server 2016 - -The following software is installed on machines with the $env:ImageVersion update. - -Components marked with **\*** have been upgraded since the previous version of the image. - -"@ - -Add-ContentToMarkdown -Content $Content - - -$SoftwareName = "Chocolatey" - -if( $( $(choco version) | Out-String) -match 'Chocolatey v(?.*).*' ) -{ - $chocoVersion = $Matches.version.Trim() -} - -$Description = @" -_Version:_ $chocoVersion
-_Environment:_ -* PATH: contains location for choco.exe -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Windows2016/Install-VS2017.ps1 b/images/win/scripts/Installers/Windows2016/Install-VS2017.ps1 index 45fae7cd..448cbfdc 100644 --- a/images/win/scripts/Installers/Windows2016/Install-VS2017.ps1 +++ b/images/win/scripts/Installers/Windows2016/Install-VS2017.ps1 @@ -106,41 +106,3 @@ Write-Host "Visual Studio version ${version} installed" # Updating content of MachineState.json file to disable autoupdate of VSIX extensions $newContent = '{"Extensions":[{"Key":"1e906ff5-9da8-4091-a299-5c253c55fdc9","Value":{"ShouldAutoUpdate":false}},{"Key":"Microsoft.VisualStudio.Web.AzureFunctions","Value":{"ShouldAutoUpdate":false}}],"ShouldAutoUpdate":false,"ShouldCheckForUpdates":false}' Set-Content -Path "$VSInstallRoot\Common7\IDE\Extensions\MachineState.json" -Value $newContent - -# Adding description of the software to Markdown - -$SoftwareName = "Visual Studio 2017 $ReleaseInPath" - -$Description = @" -_Version:_ $version
-_Location:_ $VSInstallRoot - -The following workloads including required and recommended components are installed with Visual Studio 2017: - -* Universal Windows Platform development -* .NET desktop development -* Desktop development with C++ -* ASP.NET and web development -* Azure development -* Node.js development -* Data storage and processing -* Data science and analytical applications * -* Game development with Unity * -* Linux development with C++ * -* Game development with C++ * -* Mobile development with C++ * -* Office/SharePoint development -* Mobile development with .NET -* .NET Core cross-platform development -* Visual Studio extension development * -* Python development * -* Mobile development with JavaScript * - -In addition the following optional components are installed: - -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description - -# Adding explicitly added Workloads details to markdown by parsing $Workloads -Add-ContentToMarkdown -Content $($WorkLoads.Split('--') | % { if( ($_.Split(" "))[0] -like "add") { "* " +($_.Split(" "))[1] } } ) \ No newline at end of file diff --git a/images/win/scripts/Installers/Windows2016/Update-DockerImages.ps1 b/images/win/scripts/Installers/Windows2016/Update-DockerImages.ps1 index d396d018..bd032ea3 100644 --- a/images/win/scripts/Installers/Windows2016/Update-DockerImages.ps1 +++ b/images/win/scripts/Installers/Windows2016/Update-DockerImages.ps1 @@ -11,7 +11,7 @@ function DockerPull { docker pull $image if (!$?) { - echo "Docker pull failed with a non-zero exit code" + Write-Host "Docker pull failed with a non-zero exit code" exit 1 } } @@ -22,14 +22,3 @@ DockerPull microsoft/aspnetcore-build:1.0-2.0 DockerPull mcr.microsoft.com/dotnet/framework/aspnet:4.8-windowsservercore-ltsc2016 DockerPull mcr.microsoft.com/dotnet/framework/runtime:4.8-windowsservercore-ltsc2016 -# Adding description of the software to Markdown - -$SoftwareName = "Docker images" - -$Description = @" -The following container images have been cached: -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description - -Add-ContentToMarkdown -Content $(docker images --digests --format "* {{.Repository}}:{{.Tag}} (Digest: {{.Digest}})") diff --git a/images/win/scripts/Installers/Windows2016/Validate-SSDT.ps1 b/images/win/scripts/Installers/Windows2016/Validate-SSDT.ps1 index 40444ee1..e7112db0 100644 --- a/images/win/scripts/Installers/Windows2016/Validate-SSDT.ps1 +++ b/images/win/scripts/Installers/Windows2016/Validate-SSDT.ps1 @@ -3,22 +3,5 @@ ## Desc: Validate SQL Server Data Tools for Windows ################################################################################ -Import-Module -Name ImageHelpers -Force +$null = Get-VSExtensionVersion -packageName "SSDT" -$SSDTPackageVersion = Get-VSExtensionVersion -packageName "SSDT" - -# Adding description of the software to Markdown -$SoftwareName = "SQL Server Data Tools for VS 2017" - -$Description = @" -_Version:_ $SSDTPackageVersion
- -The following components are installed: - -* SQL Server Data Tools -* SQL Server Analysis Services Designer -* SQL Server Integration Services Designer -* SQL Server Reporting Services Designers -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Windows2019/Initialize-VM.ps1 b/images/win/scripts/Installers/Windows2019/Initialize-VM.ps1 index 12feeabe..99c238e8 100644 --- a/images/win/scripts/Installers/Windows2019/Initialize-VM.ps1 +++ b/images/win/scripts/Installers/Windows2019/Initialize-VM.ps1 @@ -120,46 +120,12 @@ Remove-Item -Path $env:ChocolateyInstall\bin\cpack.exe -Force Choco-Install -PackageName webpicmd # Expand disk size of OS drive - New-Item -Path d:\ -Name cmds.txt -ItemType File -Force - Add-Content -Path d:\cmds.txt "SELECT VOLUME=C`r`nEXTEND" $expandResult = (diskpart /s 'd:\cmds.txt') - Write-Host $expandResult Write-Host "Disk sizes after expansion" - wmic logicaldisk get size,freespace,caption - -# Adding description of the software to Markdown - -$Content = @" - -# Windows Server 2019 - -The following software is installed on machines with the $env:ImageVersion update. - -Components marked with **\*** have been upgraded since the previous version of the image. - -"@ - -Add-ContentToMarkdown -Content $Content - - -$SoftwareName = "Chocolatey" - -if( $( $(choco version) | Out-String) -match 'Chocolatey v(?.*).*' ) -{ - $chocoVersion = $Matches.version.Trim() -} - -$Description = @" -_Version:_ $chocoVersion
-_Environment:_ -* PATH: contains location for choco.exe -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Windows2019/Install-VS2019.ps1 b/images/win/scripts/Installers/Windows2019/Install-VS2019.ps1 index e1a9c4d0..8b335c8b 100644 --- a/images/win/scripts/Installers/Windows2019/Install-VS2019.ps1 +++ b/images/win/scripts/Installers/Windows2019/Install-VS2019.ps1 @@ -135,28 +135,3 @@ $sdkFileName = "sdksetup14393.exe" $argumentList = ("/q", "/norestart", "/ceip off", "/features OptionId.WindowsSoftwareDevelopmentKit") Install-Binary -Url $sdkUrl -Name $sdkFileName -ArgumentList $argumentList - -# Adding description of the software to Markdown - -$SoftwareName = "Visual Studio 2019 Enterprise" - -$Description = @" -_Version:_ $version
-_Location:_ $VSInstallRoot - -The following workloads and components are installed with Visual Studio 2019: -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description - -# Adding explicitly added Workloads details to markdown by parsing $Workloads -Add-ContentToMarkdown -Content $($WorkLoads.Split('--') | % { if( ($_.Split(" "))[0] -like "add") { "* " +($_.Split(" "))[1] } } ) - -# Adding additional SDKs to markdown -$SDKDescription = @" - -Additional Windows 10 SDKs: -* Windows 10 SDK version 10.0.14393.795 -"@ - -Add-ContentToMarkdown -Content $SDKDescription diff --git a/images/win/scripts/Installers/Windows2019/Update-DockerImages.ps1 b/images/win/scripts/Installers/Windows2019/Update-DockerImages.ps1 index 2e15f85e..bc50a9bc 100644 --- a/images/win/scripts/Installers/Windows2019/Update-DockerImages.ps1 +++ b/images/win/scripts/Installers/Windows2019/Update-DockerImages.ps1 @@ -11,7 +11,7 @@ function DockerPull { docker pull $image if (!$?) { - echo "Docker pull failed with a non-zero exit code" + Write-Host "Docker pull failed with a non-zero exit code" exit 1 } } @@ -22,15 +22,3 @@ DockerPull microsoft/aspnetcore-build:1.0-2.0 DockerPull mcr.microsoft.com/dotnet/framework/aspnet:4.8-windowsservercore-ltsc2019 DockerPull mcr.microsoft.com/dotnet/framework/runtime:4.8-windowsservercore-ltsc2019 - -# Adding description of the software to Markdown - -$SoftwareName = "Docker images" - -$Description = @" -The following container images have been cached: -"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description - -Add-ContentToMarkdown -Content $(docker images --digests --format "* {{.Repository}}:{{.Tag}} (Digest: {{.Digest}})") diff --git a/images/win/scripts/Installers/Windows2019/Validate-SSDTExtensions.ps1 b/images/win/scripts/Installers/Windows2019/Validate-SSDTExtensions.ps1 index 731c10ed..4cf24bed 100644 --- a/images/win/scripts/Installers/Windows2019/Validate-SSDTExtensions.ps1 +++ b/images/win/scripts/Installers/Windows2019/Validate-SSDTExtensions.ps1 @@ -3,20 +3,7 @@ ## Desc: Validate SQL Server Data Tools Visual Studio extensions ################################################################################ -Import-Module -Name ImageHelpers -Force - #These extensions don't have any proper name in the state.packages.json file, only id is available, which can be found on extension marketplace download page -$AnalysisPackageVersion = Get-VSExtensionVersion -packageName "04a86fc2-dbd5-4222-848e-911638e487fe" -$IntegrationPackageVersion = Get-VSExtensionVersion -packageName "851E7A09-7B2B-4F06-A15D-BABFCB26B970" -$ReportingPackageVersion = Get-VSExtensionVersion -packageName "717ad572-c4b7-435c-c166-c2969777f718" - -# Adding description of the software to Markdown -$SoftwareName = "Microsoft SSDT Visual Studio 2019 Extensions" - -$Description = @" -_Microsoft Analysis Services Projects Version:_ $AnalysisPackageVersion
-_SQL Server Integration Services Projects Version:_ $IntegrationPackageVersion
-_Microsoft Reporting Services Projects Version:_ $ReportingPackageVersion
-"@ - -Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description +$null = Get-VSExtensionVersion -packageName "04a86fc2-dbd5-4222-848e-911638e487fe" +$null = Get-VSExtensionVersion -packageName "851E7A09-7B2B-4F06-A15D-BABFCB26B970" +$null = Get-VSExtensionVersion -packageName "717ad572-c4b7-435c-c166-c2969777f718" diff --git a/images/win/scripts/SoftwareReport/SoftwareReport.Android.psm1 b/images/win/scripts/SoftwareReport/SoftwareReport.Android.psm1 new file mode 100644 index 00000000..60d7c185 --- /dev/null +++ b/images/win/scripts/SoftwareReport/SoftwareReport.Android.psm1 @@ -0,0 +1,109 @@ +function Get-AndroidComponentLocation { + param( + [string] $ComponentName + ) + $path = Join-Path $env:ANDROID_HOME $ComponentName + return "Location $path" +} + +function Split-AndroidSDKOutputRow { + param( + [string] $Row + ) + return $Row.Split("|").Trim() +} + +function Create-AndroidTableObject { + param( + [string] $PackageName, + [string] $Description + ) + return [PSCustomObject] @{ + "Package Name" = $PackageName + "Description" = $Description + } +} + +function Get-AndroidSDKManagerPath { + return Join-Path $env:ANDROID_HOME "tools" "bin" "sdkmanager.bat" +} + +function Get-AndroidInstalledPackages { + $androidSDKManagerPath = Get-AndroidSDKManagerPath + $androidSDKManagerList = & $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-AndroidSDKOutputRow $_ + $packageName = $packageInfoParts[0] + $packageDescription = $packageInfoParts[2] + ", Revision " + $packageInfoParts[1] + Create-AndroidTableObject -PackageName $packageName -Description $packageDescription + } +} + +function Build-AndroidSDKPlatformTable { + param ( + [Parameter(Mandatory)] + [object] $packageInfo + ) + + return $packageInfo | ForEach-Object { + $packageInfoParts = Split-AndroidSDKOutputRow $_ + $packageName = $packageInfoParts[0].split(";")[1] + $packageDescription = $packageInfoParts[2] + ", Revision " + $packageInfoParts[1] + return Create-AndroidTableObject -PackageName $packageName -Description $packageDescription + } +} + +function Build-AndroidSDKBuildToolsTable { + param ( + [Parameter(Mandatory)] + [object] $packageInfo + ) + + return $packageInfo | ForEach-Object { + $packageInfoParts = Split-AndroidSDKOutputRow $_ + $packageName = $packageInfoParts[0].replace(";", "-") + $packageDescription = "Android SDK Build-Tools, Revision " + $packageInfoParts[1] + return Create-AndroidTableObject -PackageName $packageName -Description $packageDescription + } +} + +function Build-AndroidExtraPackagesTable { + param ( + [Parameter(Mandatory)][AllowEmptyString()] + [string[]] $installedPackages + ) + + $extraPackages = @( + "Android Support Repository", + "Google Play services", + "Google Repository", + "ndk-bundle" + ) + + return $extraPackages | ForEach-Object { + $packageId = $_ + $packageInfo = $installedPackages | Where-Object { $_ -Like "*${packageId}*" } | Select-Object -First 1 + $packageInfoParts = Split-AndroidSDKOutputRow $packageInfo + return [PSCustomObject] @{ + "Package Name" = $packageInfoParts[2] + "Version" = $packageInfoParts[1] + } + } +} \ No newline at end of file diff --git a/images/win/scripts/SoftwareReport/SoftwareReport.Browsers.psm1 b/images/win/scripts/SoftwareReport/SoftwareReport.Browsers.psm1 new file mode 100644 index 00000000..3784b7fa --- /dev/null +++ b/images/win/scripts/SoftwareReport/SoftwareReport.Browsers.psm1 @@ -0,0 +1,55 @@ +$browsers = @{ + chrome = @{ + Name="Google Chrome"; + File="chrome.exe" + }; + edge = @{ + Name="Microsoft Edge"; + File="msedge.exe" + }; + firefox = @{ + Name="Mozilla Firefox"; + File="firefox.exe" + } +} + +$webDrivers = @{ + chrome = @{ + Name="Chrome Driver"; + Path="C:\SeleniumWebDrivers\ChromeDriver" + }; + edge = @{ + Name="Microsoft Edge Driver"; + Path="C:\SeleniumWebDrivers\EdgeDriver" + }; + firefox = @{ + Name="Gecko Driver"; + Path="C:\SeleniumWebDrivers\GeckoDriver" + }; + iexplorer = @{ + Name="IE Driver"; + Path="C:\SeleniumWebDrivers\IEDriver" + } +} + +function Get-BrowserVersion { + param( + [string] $Browser + ) + $browserName = $browsers.$Browser.Name + $browserFile = $browsers.$Browser.File + $registryKey = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\$browserFile" + $browserVersion = (Get-Item (Get-ItemProperty $registryKey)."(Default)").VersionInfo.FileVersion + return "$browserName $browserVersion" +} + +function Get-SeleniumWebDriverVersion { + param( + [string] $Driver + ) + $driverName = $webDrivers.$Driver.Name + $driverPath = $webDrivers.$Driver.Path + $versionFileName = "versioninfo.txt"; + $webDriverVersion = Get-Content -Path "$driverPath\$versionFileName" + return "$driverName $webDriverVersion" +} \ No newline at end of file diff --git a/images/win/scripts/SoftwareReport/SoftwareReport.CachedTools.psm1 b/images/win/scripts/SoftwareReport/SoftwareReport.CachedTools.psm1 new file mode 100644 index 00000000..f283d142 --- /dev/null +++ b/images/win/scripts/SoftwareReport/SoftwareReport.CachedTools.psm1 @@ -0,0 +1,117 @@ +function Get-BoostMarkdown +{ + $Name = "Boost" + $ToolInstances = Get-CachedToolInstances -Name $Name + foreach ($Instance in $ToolInstances) + { + $VersionEnvVar = $Instance.Version.replace(".", "_") + $Instance."Environment Variable" = "BOOST_ROOT_${VersionEnvVar}" + } + + $Content = $ToolInstances | New-MDTable -Columns ([ordered]@{ + Version = "left"; + Architecture = "left"; + "Environment Variable" = "left" + }) + $Content += New-MDHeader "Notes:" -Level 5 + $Content += @' +``` +1. Environment variable "BOOST_ROOT" is not set by default. + Please make sure you set this variable value to proper value + from table above depending on the Boost version you are using. +2. If Boost was built using the boost-cmake project or from Boost 1.70.0 + on it provides a package configuration file for use with find_package's config mode. + This module looks for the package configuration file called BoostConfig.cmake or boost-config.cmake + and stores the result in CACHE entry "Boost_DIR". If found, the package configuration file + is loaded and this module returns with no further action. + See documentation of the Boost CMake package configuration for details on what it provides. + Set Boost_NO_BOOST_CMAKE to ON, to disable the search for boost-cmake. + Link: https://cmake.org/cmake/help/latest/module/FindBoost.html +``` +'@ + + return Build-MarkdownElement -Head $Name -Content $Content +} + +function Get-GoMarkdown +{ + $Name = "Go" + $ToolInstances = Get-CachedToolInstances -Name $Name -VersionCommand "version" + foreach ($Instance in $ToolInstances) + { + $Version = [System.Version]($Instance.Version -Split(" "))[0] + $Instance."Environment Variable" = "GOROOT_$($Version.major)_$($Version.minor)_X64" + } + + $Content = $ToolInstances | New-MDTable -Columns ([ordered]@{ + Version = "left"; + Architecture = "left"; + "Environment Variable" = "left" + }) + + return Build-MarkdownElement -Head $Name -Content $Content +} + +function Get-NodeMarkdown +{ + $Name = "Node" + $ToolInstances = Get-CachedToolInstances -Name $Name + $Content = $ToolInstances | New-MDTable -Columns ([ordered]@{Version = "left"; Architecture = "left"}) + + return Build-MarkdownElement -Head $Name -Content $Content +} + +function Get-PythonMarkdown +{ + $Name = "Python" + $ToolInstances = Get-CachedToolInstances -Name $Name -VersionCommand "--version" + $Content = $ToolInstances | New-MDTable -Columns ([ordered]@{Version = "left"; Architecture = "left"}) + + return Build-MarkdownElement -Head $Name -Content $Content +} + +function Get-RubyMarkdown +{ + $Name = "Ruby" + $ToolInstances = Get-CachedToolInstances -Name $Name -VersionCommand "--version" + $Content = $ToolInstances | New-MDTable -Columns ([ordered]@{Version = "left"; Architecture = "left"}) + + return Build-MarkdownElement -Head $Name -Content $Content +} + +function Get-PyPyMarkdown +{ + $Name = "PyPy" + $ToolInstances = Get-CachedToolInstances -Name $Name + foreach ($Instance in $ToolInstances) + { + $Instance."PyPy Version" = @() + $Instance."Python Version" = $Instance.Version + foreach ($Arch in $Instance.Architecture_Array) + { + $pythonExePath = Join-Path $Instance.Path $Arch | Join-Path -ChildPath "python.exe" + $Instance."PyPy Version" += (& $pythonExePath -c "import sys;print(sys.version.split('\n')[1])").Trim("[]") + } + } + + $Content = $ToolInstances | New-MDTable -Columns ([ordered]@{ + "Python Version" = "left"; + Architecture = "left"; + "PyPy Version" = "left" + }) + + return Build-MarkdownElement -Head $Name -Content $Content +} + +function Build-CachedToolsMarkdown +{ + $markdown = "" + $markdown += Get-BoostMarkdown + $markdown += Get-GoMarkdown + $markdown += Get-NodeMarkdown + $markdown += Get-PythonMarkdown + $markdown += Get-RubyMarkdown + $markdown += Get-PyPyMarkdown + + return $markdown +} \ No newline at end of file diff --git a/images/win/scripts/SoftwareReport/SoftwareReport.Common.psm1 b/images/win/scripts/SoftwareReport/SoftwareReport.Common.psm1 new file mode 100644 index 00000000..95b73a2f --- /dev/null +++ b/images/win/scripts/SoftwareReport/SoftwareReport.Common.psm1 @@ -0,0 +1,233 @@ +function Get-OSName { + return (Get-CimInstance -ClassName Win32_OperatingSystem).Caption +} + +function Get-OSVersion { + $systemInfo = Get-CimInstance -ClassName Win32_OperatingSystem + $OSVersion = $systemInfo.Version + $OSBuild = $systemInfo.BuildNumber + return "OS Version: $OSVersion Build $OSBuild" +} + +function Get-JavaVersionsList { + param( + [string] $DefaultVersion + ) + + $postfix = "" + $javaDir = Join-Path $env:PROGRAMFILES "Java" + return Get-ChildItem $javaDir | ForEach-Object { + $javaBinPath = Join-Path $_ "bin" + $rawVersion = & cmd /c "`"$javaBinPath\java.exe`" -version 2>&1" | Out-String + $rawVersion -match 'openjdk version "(?.+)"' | Out-Null + $version = $Matches.Version + if ($version -match $DefaultVersion) { + $postfix = "(default)" + } else { + $postfix = "" + } + return "Java $version $postfix" + } | Sort-Object { + $version = ($_.Split(" ")[1]).Split("_")[0] + return [System.Version]$version + } +} + +function Get-RustVersion { + $rustVersion = [regex]::matches($(rustc --version), "\d+\.\d+\.\d+").Value + return "Rust ${rustVersion}" +} + +function Get-PythonVersion { + return & python --version +} + +function Get-PowershellCoreVersion { + return & pwsh --version +} + +function Get-RubyVersion { + $rubyVersion = $(ruby --version).split(" ")[1] + return "Ruby $rubyVersion" +} + +function Get-GoVersion { + $(go version) -match "go(?\d+\.\d+\.\d+)" | Out-Null + $goVersion = $Matches.Version + return "Go $goVersion" +} + +function Get-PHPVersion { + ($(php --version) | Out-String) -match "PHP (?\d+\.\d+\.\d+)" | Out-Null + $phpVersion = $Matches.Version + return "PHP $phpVersion" +} + +function Get-JuliaVersion { + $juliaVersion = [regex]::matches($(julia --version), "\d+\.\d+\.\d+").Value + return "Julia $juliaVersion" +} + +function Get-PerlVersion { + ($(perl --version) | Out-String) -match "\(v(?\d+\.\d+\.\d+)\)" | Out-Null + $perlVersion = $Matches.Version + return "Perl $perlVersion" +} + +function Get-NodeVersion { + $nodeVersion = $(node --version).split("v")[1] + return "Node $nodeVersion" +} + +function Get-ChocoVersion { + ($(choco version) | Out-String) -match "v(?\d+\.\d+\.\d+)" | Out-Null + $chocoVersion = $Matches.Version + return "Chocolatey $chocoVersion" +} + +function Get-VcpkgVersion { + ($(vcpkg version) | Out-String) -match "version (?\d+\.\d+\.\d+)" | Out-Null + $vcpkgVersion = $Matches.Version + return "Vcpkg $vcpkgVersion" +} + +function Get-NPMVersion { + return "NPM $(npm -version)" +} + +function Get-YarnVersion { + return "Yarn $(yarn -version)" +} + +function Get-RubyGemsVersion { + return "RubyGems $(gem --version)" +} + +function Get-HelmVersion { + ($(helm version --short) | Out-String) -match "v(?\d+\.\d+\.\d+)" | Out-Null + $helmVersion = $Matches.Version + return "Helm $helmVersion" +} + +function Get-PipVersion { + ($(pip --version) | Out-String) -match "(?pip [\d\.]+) .+ (?\(python [\d\.]+\))" | Out-Null + $pipVersion = $Matches.Version + $pythonVersion = $Matches.Python + return "$pipVersion $pythonVersion" +} + +function Get-CondaVersion { + $condaVersion = & "$env:CONDA\Scripts\conda.exe" --version + return "Mini$condaVersion" +} + +function Get-ComposerVersion { + ($(composer --version)) -match "Composer version (?\d+\.\d+\.\d+)" | Out-Null + $composerVersion = $Matches.Version + return "Composer $composerVersion" +} + +function Get-AntVersion { + ($(ant -version) | Out-String) -match "version (?\d+\.\d+\.\d+)" | Out-Null + $antVersion = $Matches.Version + return "Ant $antVersion" +} + +function Get-MavenVersion { + ($(mvn -version) | Out-String) -match "Apache Maven (?\d+\.\d+\.\d+)" | Out-Null + $mavenVersion = $Matches.Version + return "Maven $mavenVersion" +} + +function Get-GradleVersion { + ($(gradle -version) | Out-String) -match "Gradle (?\d+\.\d+)" | Out-Null + $gradleVersion = $Matches.Version + return "Gradle $gradleVersion" +} + +function Get-DotnetSdks { + $sdksRawList = dotnet --list-sdks + $sdkVersions = ($sdksRawList | Foreach-Object {$_.Split()[0]}) -join ' ' + $sdkPath = $sdksRawList[0].Split(' ', 2)[1] -replace '\[|]' + [PSCustomObject]@{ + Versions = $sdkVersions + Path = $sdkPath + } +} + +function Get-DotnetRuntimes { + $runtimesRawList = dotnet --list-runtimes + $runtimesRawList | Group-Object {$_.Split()[0]} | ForEach-Object { + $runtimeName = $_.Name + $runtimeVersions = ($_.Group | Foreach-Object {$_.split()[1]}) -join ' ' + $runtimePath = $_.Group[0].Split(' ', 3)[2] -replace '\[|]' + [PSCustomObject]@{ + "Runtime" = $runtimeName + "Versions" = $runtimeVersions + "Path" = $runtimePath + } + } +} + +function Get-DotnetFrameworkTools { + $path = "${env:ProgramFiles(x86)}\Microsoft SDKs\Windows\*\*\NETFX*" + $frameworkVersions = @() + Get-ChildItem -Path $path -Directory | ForEach-Object { + $frameworkVersions += ($_.Name -Split(" "))[1] + $frameworkPath = $_.Fullname -Replace " \d+\.\d+(\.\d+)?", " " + } + [PSCustomObject]@{ + Versions = $frameworkVersions -Join " " + Path = $frameworkPath + } +} + +function Get-PowerShellAzureModules { + # Module names + $names = @{ + 'az' = 'Az' + 'azurerm' = 'AzureRM' + 'azure' = 'Azure' + } + + # Get default module version + $defaults = @{ + 'azurerm' = (Get-Module -Name AzureRM -ListAvailable).Version + 'azure' = (Get-Module -Name Azure -ListAvailable).Version + } + + $modulesPath = "C:\Modules" + $modules = Get-ChildItem -Path $modulesPath | Sort-Object Name | Group-Object {$_.Name.Split('_')[0]} + $modules | ForEach-Object { + $group = $_.group | Sort-Object {[Version]$_.Name.Split('_')[1]} + $moduleName = $names[$_.Name] + $moduleVersions = $group | ForEach-Object {$_.Name.Split('_')[1]} + $moduleVersions = $moduleVersions -join '
' + $modulePath = (($group.FullName).Split("_"))[0] + '_\' + + # set default version + $defaultVersion = $defaults[$_.Name] + if ($defaultVersion) { + $moduleVersions = $moduleVersions.Replace($defaultVersion, "$defaultVersion [Installed]") + } + + [PSCustomObject]@{ + Module = $moduleName + Version = $moduleVersions + Path = $modulePath + } + } +} + +function Get-CachedDockerImages { + return (docker images --digests --format "* {{.Repository}}:{{.Tag}}").Split("*") | Where-Object { $_ } +} + +function Get-PacmanVersion { + $msys2BinDir = "C:\msys64\usr\bin" + $pacmanPath = Join-Path $msys2BinDir "pacman.exe" + $rawVersion = & $pacmanPath --version + $rawVersion.Split([System.Environment]::NewLine)[1] -match "\d+\.\d+(\.\d+)?" | Out-Null + $pacmanVersion = $matches[0] + return "- Pacman $pacmanVersion" +} diff --git a/images/win/scripts/SoftwareReport/SoftwareReport.Generator.ps1 b/images/win/scripts/SoftwareReport/SoftwareReport.Generator.ps1 new file mode 100644 index 00000000..a7617a4c --- /dev/null +++ b/images/win/scripts/SoftwareReport/SoftwareReport.Generator.ps1 @@ -0,0 +1,201 @@ +# Install MarkdownPS module for software report generation +Install-Module MarkdownPS -Force -Scope AllUsers + +Import-Module MarkdownPS +Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Helpers.psm1") -DisableNameChecking +Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Common.psm1") -DisableNameChecking +Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Tools.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.VisualStudio.psm1") -DisableNameChecking +Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Android.psm1") -DisableNameChecking + +$markdown = "" + +$OSName = Get-OSName +$markdown += New-MDHeader "$OSName" -Level 1 + +$OSVersion = Get-OSVersion +$markdown += New-MDList -Style Unordered -Lines @( + "$OSVersion" + "Image Version: $env:ImageVersion" +) + +$markdown += New-MDHeader "Installed Software" -Level 2 +$markdown += New-MDHeader "Language and Runtime" -Level 3 + +$markdown += New-MDList -Lines (Get-JavaVersionsList -DefaultVersion "1.8.0") -Style Unordered -NoNewLine +$markdown += New-MDList -Style Unordered -Lines @( + (Get-RustVersion), + (Get-PythonVersion), + (Get-RubyVersion), + (Get-GoVersion), + (Get-PHPVersion), + (Get-JuliaVersion), + (Get-PerlVersion), + (Get-PowershellCoreVersion), + (Get-NodeVersion) +) + +$markdown += New-MDHeader "Package Management" -Level 3 +$markdown += New-MDList -Style Unordered -Lines @( + (Get-ChocoVersion), + (Get-VcpkgVersion), + (Get-NPMVersion), + (Get-YarnVersion), + (Get-PipVersion), + (Get-CondaVersion) + (Get-RubyGemsVersion), + (Get-HelmVersion), + (Get-ComposerVersion) +) + +$markdown += New-MDHeader "Project Management" -Level 3 +$markdown += New-MDList -Style Unordered -Lines @( + (Get-AntVersion), + (Get-MavenVersion), + (Get-GradleVersion) +) + +$markdown += New-MDHeader "Tools" -Level 3 +$markdown += New-MDList -Style Unordered -Lines @( + (Get-AzCosmosDBEmulatorVersion), + (Get-BazelVersion), + (Get-BazeliskVersion), + (Get-CMakeVersion), + (Get-DockerVersion), + (Get-DockerComposeVersion), + (Get-GitVersion), + (Get-GitLFSVersion), + (Get-InnoSetupVersion), + (Get-JQVersion), + (Get-KubectlVersion), + (Get-KindVersion), + (Get-MinGWVersion), + (Get-MySQLVersion), + (Get-MercurialVersion), + (Get-NSISVersion), + (Get-OpenSSLVersion), + (Get-PackerVersion), + (Get-SQLPSVersion), + (Get-SQLServerPSVersion), + (Get-SVNVersion), + (Get-GHCVersion), + (Get-CabalVersion), + (Get-StackVersion), + (Get-WinAppDriver), + (Get-ZstdVersion), + (Get-VSWhereVersion), + (Get-7zipVersion) +) + +$markdown += New-MDHeader "CLI Tools" -Level 3 +$markdown += New-MDList -Style Unordered -Lines @( + (Get-AzureCLIVersion), + (Get-AzureDevopsExtVersion), + (Get-AWSCLIVersion), + (Get-AWSSAMVersion), + (Get-AlibabaCLIVersion), + (Get-CloudFoundryVersion), + (Get-HubVersion) +) + +$markdown += New-MDHeader "Browsers and webdrivers" -Level 3 +$markdown += New-MDList -Style Unordered -Lines @( + (Get-BrowserVersion -Browser "chrome"), + (Get-SeleniumWebDriverVersion -Driver "chrome"), + (Get-BrowserVersion -Browser "edge"), + (Get-SeleniumWebDriverVersion -Driver "edge"), + (Get-BrowserVersion -Browser "firefox"), + (Get-SeleniumWebDriverVersion -Driver "firefox"), + (Get-SeleniumWebDriverVersion -Driver "iexplorer") +) + +$markdown += New-MDHeader "MSYS2" -Level 3 +$markdown += Get-PacmanVersion +$markdown += New-MDNewLine +$markdown += @' +``` +Location: C:\msys64 + +Note: MSYS2 is pre-installed on image but not added to PATH. +``` +'@ +$markdown += New-MDNewLine + +$markdown += New-MDHeader "Cached Tools" -Level 3 +$markdown += (Build-CachedToolsMarkdown) +$markdown += New-MDNewLine + +$vs = Get-VisualStudioVersion +$markdown += New-MDHeader "$($vs.Name)" -Level 3 +$markdown += $vs | New-MDTable +$markdown += New-MDNewLine + +$markdown += New-MDHeader "Workloads, components and extensions:" -Level 4 +$markdown += New-MDNewLine +$markdown += ((Get-VisualStudioComponents) + (Get-VisualStudioExtenions)) | New-MDTable +$markdown += New-MDNewLine + +$markdown += New-MDHeader ".NET Core SDK" -Level 3 +$sdk = Get-DotnetSdks +$markdown += "``Location $($sdk.Path)``" +$markdown += New-MDNewLine +$markdown += New-MDList -Lines $sdk.Versions -Style Unordered + +$markdown += New-MDHeader ".NET Core Runtime" -Level 3 +Get-DotnetRuntimes | Foreach-Object { + $path = $_.Path + $versions = $_.Versions + $markdown += "``Location $path``" + $markdown += New-MDNewLine + $markdown += New-MDList -Lines $versions -Style Unordered +} + +$markdown += New-MDHeader ".NET Framework" -Level 3 +$frameworks = Get-DotnetFrameworkTools +$markdown += "``Location $($frameworks.Path)``" +$markdown += New-MDNewLine +$markdown += New-MDList -Lines $frameworks.Versions -Style Unordered + +$markdown += New-MDHeader "Azure Powershell Modules" -Level 3 +$markdown += Get-PowerShellAzureModules | New-MDTable +$markdown += @' +``` +Azure PowerShell module 2.1.0 and AzureRM PowerShell module 2.1.0 are installed +and are available via 'Get-Module -ListAvailable'. +All other versions are saved but not installed. +``` +'@ +$markdown += New-MDNewLine + +# Android section +$androidInstalledPackages = Get-AndroidInstalledPackages + +$markdown += New-MDHeader "Android SDK Tools" -Level 3 +$androidSDKTools = $androidInstalledPackages | Where-Object { $_ -Match "Android SDK Tools" -or $_ -Match "Android SDK Platform-Tools" } +$markdown += Build-AndroidSDKToolsTable $androidSDKTools | New-MDTable +$markdown += New-MDNewLine + +$markdown += New-MDHeader "Android SDK Platforms" -Level 3 +$androidSDKPlatforms = $androidInstalledPackages | Where-Object { $_ -Match "Android SDK Platform " } +$markdown += New-MDInlineCode -Text (Get-AndroidComponentLocation -ComponentName "platforms") +$markdown += New-MDNewLine +$markdown += Build-AndroidSDKPlatformTable $androidSDKPlatforms | New-MDTable +$markdown += New-MDNewLine + +$markdown += New-MDHeader "Android SDK Build-Tools" -Level 3 +$androidSDKBuildTools = $androidInstalledPackages | Where-Object { $_ -Match "Android SDK Build-Tools" } +$markdown += New-MDInlineCode -Text (Get-AndroidComponentLocation -ComponentName "build-tools") +$markdown += New-MDNewLine +$markdown += Build-AndroidSDKBuildtoolsTable $androidSDKBuildTools | New-MDTable +$markdown += New-MDNewLine + +$markdown += New-MDHeader "Android Extra Packages" -Level 3 +$markdown += Build-AndroidExtraPackagesTable $androidInstalledPackages | New-MDTable +$markdown += New-MDNewLine + +$markdown += New-MDHeader "Cached Docker images" -Level 3 +$markdown += New-MDList -Style Unordered -Lines @(Get-CachedDockerImages) + +$markdown | Out-File -FilePath "C:\InstalledSoftware.md" \ No newline at end of file diff --git a/images/win/scripts/SoftwareReport/SoftwareReport.Helpers.psm1 b/images/win/scripts/SoftwareReport/SoftwareReport.Helpers.psm1 new file mode 100644 index 00000000..11c0f5c5 --- /dev/null +++ b/images/win/scripts/SoftwareReport/SoftwareReport.Helpers.psm1 @@ -0,0 +1,105 @@ +function Build-MarkdownElement +{ + <# + .SYNOPSIS + Build markdown element for cached tool. + + .DESCRIPTION + Build markdown element that contains name of tool, set of versions and additional notes. + + .PARAMETER Head + Header of cached tool markdown element + + .PARAMETER Content + Array of lines that contains required information about installed tool instances. + #> + + param + ( + [String] $Head, + [Object[]] $Content + ) + + $markdown = New-MDHeader $Head -Level 4 + $markdown += New-MDParagraph -Lines $Content + + return $markdown +} + +function Get-CachedToolInstances +{ + <# + .SYNOPSIS + Returns hastable of installed cached tools. + + .DESCRIPTION + Return hastable that contains versions and architectures for selected cached tool. + + .PARAMETER Name + Name of cached tool. + + .PARAMETER VersionCommand + Optional parameter. Command to return version of system default tool. + + .EXAMPLE + Get-CachedToolInstances -Name "Python" -VersionCommand "--version" + + #> + + param + ( + [String] $Name, + [String] $VersionCommand + ) + + $toolInstances = @() + $toolPath = Join-Path -Path $env:AGENT_TOOLSDIRECTORY -ChildPath $Name + + # Get all installed versions from TOOLSDIRECTORY folder + $versions = Get-ChildItem $toolPath | Sort-Object { [System.Version]$_.Name } + foreach ($version in $versions) + { + $instanceInfo = @{} + + # Create instance hashtable + [string]$instanceInfo.Path = Join-Path -Path $toolPath -ChildPath $version.Name + [string]$instanceInfo.Version = $version.Name + + ### Temporary workaround. Currently Boost instances don't have architecture subfolders. + if ($Name -eq "Boost") + { + [string]$instanceInfo.Architecture = "x64, x86" + $toolInstances += $instanceInfo + continue + } + + # Get all architectures for current version + [array]$instanceInfo.Architecture_Array = Get-ChildItem $version.FullName -Name -Directory | Where-Object { $_ -match "^x[0-9]{2}$" } + [string]$instanceInfo.Architecture = $instanceInfo.Architecture_Array -Join ", " + + # Add (default) postfix to version name, in case if current version is in environment path + if (-not ([string]::IsNullOrEmpty($VersionCommand))) + { + $defaultVersion = $(& ($Name.ToLower()) $VersionCommand 2>&1) + $defaultToolVersion = $defaultVersion | Select-String -Pattern "\d+\.\d+\.\d+" -AllMatches ` + | ForEach-Object { $_.Matches.Value } + + if ([version]$version.Name -eq [version]$defaultToolVersion) + { + $instanceInfo.Version += " (Default)" + } + } + + $toolInstances += $instanceInfo + } + + return $toolInstances +} + +function New-MDNewLine { + param ( + [int] $Count = 1 + ) + $newLineSymbol = [System.Environment]::NewLine + return $newLineSymbol * $Count +} \ No newline at end of file diff --git a/images/win/scripts/SoftwareReport/SoftwareReport.Tools.psm1 b/images/win/scripts/SoftwareReport/SoftwareReport.Tools.psm1 new file mode 100644 index 00000000..510269c2 --- /dev/null +++ b/images/win/scripts/SoftwareReport/SoftwareReport.Tools.psm1 @@ -0,0 +1,201 @@ +function Get-AzCosmosDBEmulatorVersion { + $regKey = gci HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\* | gp | ? { $_.DisplayName -eq 'Azure Cosmos DB Emulator' } + $installDir = $regKey.InstallLocation + $exeFilePath = Join-Path $installDir 'CosmosDB.Emulator.exe' + $version = (Get-Item $exeFilePath).VersionInfo.FileVersion + return "Azure CosmosDb Emulator $version" +} + +function Get-BazelVersion { + ((cmd /c "bazel --version 2>&1") | Out-String) -match "bazel (?\d+\.\d+\.\d+)" | Out-Null + $bazelVersion = $Matches.Version + return "Bazel $bazelVersion" +} + +function Get-BazeliskVersion { + ((cmd /c "bazelisk version 2>&1") | Out-String) -match "Bazelisk version: v(?\d+\.\d+\.\d+)" | Out-Null + $bazeliskVersion = $Matches.Version + return "Bazelisk $bazeliskVersion" +} + +function Get-CMakeVersion { + ($(cmake -version) | Out-String) -match "cmake version (?\d+\.\d+\.\d+)" | Out-Null + $cmakeVersion = $Matches.Version + return "CMake $cmakeVersion" +} + +function Get-DockerVersion { + $dockerVersion = $(docker version --format "{{.Server.Version}}") + return "Docker $dockerVersion" +} + +function Get-DockerComposeVersion { + $(docker-compose --version) -match "docker-compose version (?\d+\.\d+\.\d+)" | Out-Null + $dockerComposeVersion = $Matches.Version + return "Docker-compose $dockerComposeVersion" +} + +function Get-GitVersion { + $(git version) -match "git version (?\d+\.\d+\.\d+)" | Out-Null + $gitVersion = $Matches.Version + return "Git $gitVersion" +} + +function Get-GitLFSVersion { + $(git-lfs version) -match "git-lfs\/(?\d+\.\d+\.\d+)" | Out-Null + $gitLfsVersion = $Matches.Version + return "Git LFS $gitLfsVersion" +} + +function Get-InnoSetupVersion { + return $(choco list --local-only innosetup) | Select-String -Pattern "InnoSetup" +} + +function Get-JQVersion { + $jqVersion = ($(jq --version) -Split "jq-")[1] + return "jq $jqVersion" +} + +function Get-KubectlVersion { + $(kubectl version --client=true --short=true) -match "Client Version: v(?.+)" | Out-Null + $kubectlVersion = $Matches.Version + return "Kubectl $kubectlVersion" +} + +function Get-KindVersion { + $(kind version) -match "kind v(?\d+\.\d+\.\d+)" | Out-Null + $kindVersion = $Matches.Version + return "Kind $kindVersion" +} + +function Get-MinGWVersion { + (gcc --version | Select-String -Pattern "MinGW-W64 project") -match "(?\d+\.\d+\.\d+)" | Out-Null + $mingwVersion = $Matches.Version + return "Mingw-w64 $mingwVersion" +} + +function Get-MySQLVersion { + $mysqlCommand = Get-Command -Name "mysql" + $mysqlVersion = $mysqlCommand.Version.ToString() + return "MySQL $mysqlVersion" +} + +function Get-MercurialVersion { + ($(hg --version) | Out-String) -match "version (?\d+\.\d+\.?\d*)" | Out-Null + $mercurialVersion = $Matches.Version + return "Mercurial $mercurialVersion" +} + +function Get-NSISVersion { + $(choco list --local-only nsis | Out-String) -match "nsis (?\d+\.\d+\.?\d*\.?\d*)" | Out-Null + $nsisVersion = $Matches.Version + return "NSIS $nsisVersion" +} + +function Get-OpenSSLVersion { + $(openssl version) -match "OpenSSL (?\d+\.\d+\.\d+\w?) " | Out-Null + $opensslVersion = $Matches.Version + return "OpenSSL $opensslVersion" +} + +function Get-PackerVersion { + return "Packer $(packer --version)" +} + +function Get-SQLPSVersion { + $module = Get-Module -Name SQLPS -ListAvailable + $version = $module.Version + return "SQLPS $version" +} + +function Get-SQLServerPSVersion { + $module = Get-Module -Name SQLServer -ListAvailable + $version = $module.Version + return "SQLServer PS $version" +} + +function Get-SVNVersion { + $svnVersion = $(svn --version --quiet) + return "Subversion (SVN) $svnVersion" +} + +function Get-VSWhereVersion { + ($(Get-Command -Name vswhere).FileVersionInfo.ProductVersion) -match "(?\d+\.\d+\.\d+)" | Out-Null + $vswhereVersion = $Matches.Version + return "VSWhere $vswhereVersion" +} + +function Get-WinAppDriver { + $winAppDriverVersion = [System.Diagnostics.FileVersionInfo]::GetVersionInfo("C:\Program Files (x86)\Windows Application Driver\WinAppDriver.exe").FileVersion + return "WinAppDriver $winAppDriverVersion" +} + +function Get-ZstdVersion { + $(zstd --version) -match "v(?\d+\.\d+\.\d+)" | Out-Null + $zstdVersion = $Matches.Version + return "zstd $zstdVersion" +} + +function Get-AzureCLIVersion { + $azureCLIVersion = $(az version) | ConvertFrom-Json | Foreach{ $_."azure-cli" } + return "Azure CLI $azureCLIVersion" +} + +function Get-AzureDevopsExtVersion { + $azureDevExtVersion = (az version | ConvertFrom-Json | Foreach{ $_."extensions" })."azure-devops" + return "Azure DevOps CLI extension $azureDevExtVersion" +} + +function Get-AWSCLIVersion { + $(aws --version) -match "aws-cli\/(?\d+\.\d+\.\d+)" | Out-Null + $awscliVersion = $Matches.Version + return "AWS CLI $awscliVersion" +} + +function Get-AWSSAMVersion { + $(sam --version) -match "version (?\d+\.\d+\.\d+)" | Out-Null + $awssamVersion = $Matches.Version + return "AWS SAM CLI $awssamVersion" +} + +function Get-AlibabaCLIVersion { + $(aliyun --version | Select-String "Alibaba Cloud Command Line Interface") -match "(?\d+\.\d+\.\d+)" | Out-Null + $alicliVersion = $Matches.Version + return "Alibaba CLI $alicliVersion" +} + +function Get-CloudFoundryVersion { + $(cf version) -match "(?\d+\.\d+\.\d+)" | Out-Null + $cfVersion = $Matches.Version + return "Cloud Foundry CLI $cfVersion" +} + +function Get-HubVersion { + ($(hub version) | Select-String -Pattern "hub version") -match "hub version (?\d+\.\d+\.\d+)" | Out-Null + $hubVersion = $Matches.Version + return "Hub CLI $hubVersion" +} + +function Get-7zipVersion { + (7z | Out-String) -match "7-Zip (?\d+\.\d+\.?\d*)" | Out-Null + $version = $Matches.Version + return "7zip $version" +} + +function Get-GHCVersion { + ((ghc --version) | Out-String) -match "version (?\d+\.\d+\.\d+)" | Out-Null + $ghcVersion = $Matches.Version + return "ghc $ghcVersion" +} + +function Get-CabalVersion { + ((cabal --version) | Out-String) -match "version (?\d+\.\d+\.\d+\.\d+)" | Out-Null + $cabalVersion = $Matches.Version + return "Cabal $cabalVersion" +} + +function Get-StackVersion { + ((stack --version --quiet) | Out-String) -match "Version (?\d+\.\d+\.\d+)," | Out-Null + $stackVersion = $Matches.Version + return "Stack $stackVersion" +} \ No newline at end of file diff --git a/images/win/scripts/SoftwareReport/SoftwareReport.VisualStudio.psm1 b/images/win/scripts/SoftwareReport/SoftwareReport.VisualStudio.psm1 new file mode 100644 index 00000000..56290247 --- /dev/null +++ b/images/win/scripts/SoftwareReport/SoftwareReport.VisualStudio.psm1 @@ -0,0 +1,65 @@ +function Get-VisualStudioPackages +{ + $packagePath = "$env:ProgramData\Microsoft\VisualStudio\Packages\_Instances\*\state.packages.json" + $instanceFolders = Get-ChildItem -Path $packagePath + (Get-Content -Path $instanceFolders | ConvertFrom-Json).packages +} + +function Get-VisualStudioVersion { + $vsVersion = vswhere -format json | ConvertFrom-Json + [PSCustomObject]@{ + Name = $vsVersion.displayName + Version = $vsVersion.installationVersion + Path = $vsVersion.installationPath + } +} + +function Get-VisualStudioComponents { + $vsPackages = Get-VisualStudioPackages | Where-Object type -in 'Component', 'Workload' + $vsPackages | 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-WixVersion { + $regKey = "HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*" + $installedApplications = Get-ItemProperty -Path $regKey + ($installedApplications | Where-Object { $_.DisplayName -match "wix" } | Select-Object -First 1).DisplayVersion +} + +function Get-WDKVersion { + $regKey = "HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*" + $installedApplications = Get-ItemProperty -Path $regKey + ($installedApplications | Where-Object { $_.DisplayName -eq 'Windows Driver Kit' } | Select-Object -First 1).DisplayVersion +} + +function Get-VisualStudioExtenions { + # Wix + $vs = (Get-VisualStudioVersion).Name.Split()[-1] + $wixPackageVersion = (Get-VisualStudioPackages | Where-Object {$_.id -match 'WixToolset.VisualStudioExtension.Dev' -and $_.type -eq 'vsix'}).Version + $wixExtensionVersion = Get-WixVersion + + # WDK + $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' + + $integrationPackageName = ($vs -match "2019") ? '851E7A09-7B2B-4F06-A15D-BABFCB26B970' : 'D1B09713-C12E-43CC-9EF4-6562298285AB' + $integrationPackageVersion = Get-VSExtensionVersion -packageName $integrationPackageName + + $extensions = @( + @{Package = 'SSDT Microsoft Analysis Services Projects'; Version = $analysisPackageVersion} + @{Package = 'SSDT SQL Server Integration Services Projects'; Version = $integrationPackageVersion} + @{Package = 'SSDT Microsoft Reporting Services Projects'; Version = $reportingPackageVersion} + @{Package = 'Windows Driver Kit'; Version = $wixPackageVersion} + @{Package = 'Windows Driver Kit Visual Studio Extension'; Version = $wdkExtensionVersion} + @{Package = 'WIX Toolset'; Version = $wixPackageVersion} + @{Package = "WIX Toolset Studio $vs Extension"; Version = $wixExtensionVersion} + ) + + $extensions | Foreach-Object { + [PSCustomObject]$_ + } | Select-Object Package, Version +} \ No newline at end of file