Merge pull request #10 from actions/master

Update local master
This commit is contained in:
Dibir Magomedsaygitov
2020-06-02 21:27:45 +03:00
committed by GitHub
93 changed files with 1657 additions and 1580 deletions

View File

@@ -1,4 +1,7 @@
{ {
// When enabled, will trim trailing whitespace when you save a file. // When enabled, will trim trailing whitespace when you save a file.
"files.trimTrailingWhitespace": true "files.trimTrailingWhitespace": true,
"[markdown]": {
"files.trimTrailingWhitespace": false
},
} }

View File

@@ -41,7 +41,8 @@ we pin the tool to specific version(s).
*Following Along / Change Notifications* *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). * **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. 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-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 [ubuntu-16.04]: https://github.com/actions/virtual-environments/blob/master/images/linux/Ubuntu1604-README.md

View File

@@ -0,0 +1,210 @@
<!--- DO NOT EDIT - This markdown file is autogenerated. -->
# 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))

View File

@@ -7,10 +7,10 @@
source $HELPER_SCRIPTS/apt.sh source $HELPER_SCRIPTS/apt.sh
source $HELPER_SCRIPTS/document.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 # 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 chmod +x /usr/local/bin/docker-compose
# Run tests to determine that the software installed as expected # Run tests to determine that the software installed as expected

View File

@@ -60,8 +60,7 @@ for release_url in ${release_urls[@]}; do
sdks=("${sdks[@]}" $(echo "${releases}" | jq '.releases[]' | jq '.sdks[]?' | jq '.version')) sdks=("${sdks[@]}" $(echo "${releases}" | jq '.releases[]' | jq '.sdks[]?' | jq '.version'))
done done
#temporary avoid 3.1.102 installation due to https://github.com/dotnet/aspnetcore/issues/19133 sortedSdks=$(echo ${sdks[@]} | tr ' ' '\n' | grep -v preview | grep -v rc | grep -v display | cut -d\" -f2 | sort -u -r)
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)
for sdk in $sortedSdks; do for sdk in $sortedSdks; do
url="https://dotnetcli.blob.core.windows.net/dotnet/Sdk/$sdk/dotnet-sdk-$sdk-linux-x64.tar.gz" url="https://dotnetcli.blob.core.windows.net/dotnet/Sdk/$sdk/dotnet-sdk-$sdk-linux-x64.tar.gz"

View File

@@ -7,10 +7,26 @@
# Source the helpers for use with the script # Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh 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" echo "Install libpq-dev"
apt-get install libpq-dev apt-get install libpq-dev
echo "Install Postgresql Client" #Verify that PostgreSQL is ready for accept incoming connections.
apt-get install postgresql-client # exit codes:
# ready - 0
# reject - 1
# connection timeout - 2
pg_isready
DocumentInstalledItem "$(psql -V 2>&1 | cut -d ' ' -f 1,2,3)" 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

View File

@@ -80,6 +80,11 @@
"source": "{{ template_dir }}/scripts/ImageHelpers", "source": "{{ template_dir }}/scripts/ImageHelpers",
"destination": "{{user `helper_script_folder`}}" "destination": "{{user `helper_script_folder`}}"
}, },
{
"type": "file",
"source": "{{ template_dir }}/scripts/SoftwareReport",
"destination": "{{user `image_folder`}}"
},
{ {
"type": "windows-shell", "type": "windows-shell",
"inline": [ "inline": [
@@ -307,6 +312,12 @@
"scripts":[ "scripts":[
"{{ template_dir }}/scripts/Installers/Install-7zip.ps1" "{{ template_dir }}/scripts/Installers/Install-7zip.ps1"
] ]
},
{
"type": "powershell",
"scripts":[
"{{ template_dir }}/scripts/Installers/Install-PostgreSQL.ps1"
]
}, },
{ {
"type": "powershell", "type": "powershell",
@@ -514,6 +525,12 @@
"{{ template_dir }}/scripts/Installers/Install-MysqlCli.ps1" "{{ template_dir }}/scripts/Installers/Install-MysqlCli.ps1"
] ]
}, },
{
"type": "powershell",
"scripts":[
"{{ template_dir }}/scripts/Installers/Validate-PostgreSQL.ps1"
]
},
{ {
"type": "powershell", "type": "powershell",
"scripts":[ "scripts":[
@@ -655,6 +672,12 @@
"{{ template_dir }}/scripts/Installers/Install-Kind.ps1" "{{ template_dir }}/scripts/Installers/Install-Kind.ps1"
] ]
}, },
{
"type": "powershell",
"scripts":[
"{{ template_dir }}/scripts/Installers/Install-MongoDB.ps1"
]
},
{ {
"type": "windows-restart", "type": "windows-restart",
"restart_timeout": "30m" "restart_timeout": "30m"
@@ -978,12 +1001,24 @@
"{{ template_dir }}/scripts/Installers/Validate-Kind.ps1" "{{ template_dir }}/scripts/Installers/Validate-Kind.ps1"
] ]
}, },
{
"type": "powershell",
"scripts":[
"{{ template_dir }}/scripts/Installers/Validate-MongoDB.ps1"
]
},
{ {
"type": "powershell", "type": "powershell",
"scripts":[ "scripts":[
"{{ template_dir }}/scripts/Installers/Validate-DiskSpace.ps1" "{{ template_dir }}/scripts/Installers/Validate-DiskSpace.ps1"
] ]
}, },
{
"type": "powershell",
"inline": [
"pwsh -File '{{user `image_folder`}}\\SoftwareReport\\SoftwareReport.Generator.ps1'"
]
},
{ {
"type": "file", "type": "file",
"source": "C:\\InstalledSoftware.md", "source": "C:\\InstalledSoftware.md",

View File

@@ -80,6 +80,11 @@
"source": "{{ template_dir }}/scripts/ImageHelpers", "source": "{{ template_dir }}/scripts/ImageHelpers",
"destination": "{{user `helper_script_folder`}}" "destination": "{{user `helper_script_folder`}}"
}, },
{
"type": "file",
"source": "{{ template_dir }}/scripts/SoftwareReport",
"destination": "{{user `image_folder`}}"
},
{ {
"type": "windows-shell", "type": "windows-shell",
"inline": [ "inline": [
@@ -616,6 +621,12 @@
"{{ template_dir }}/scripts/Installers/Install-Vcpkg.ps1" "{{ template_dir }}/scripts/Installers/Install-Vcpkg.ps1"
] ]
}, },
{
"type": "powershell",
"scripts":[
"{{ template_dir }}/scripts/Installers/Install-PostgreSQL.ps1"
]
},
{ {
"type": "powershell", "type": "powershell",
"scripts":[ "scripts":[
@@ -646,6 +657,12 @@
"{{ template_dir }}/scripts/Installers/Install-RootCA.ps1" "{{ template_dir }}/scripts/Installers/Install-RootCA.ps1"
] ]
}, },
{
"type": "powershell",
"scripts":[
"{{ template_dir }}/scripts/Installers/Install-MongoDB.ps1"
]
},
{ {
"type": "windows-restart", "type": "windows-restart",
"restart_timeout": "10m" "restart_timeout": "10m"
@@ -939,6 +956,12 @@
"{{ template_dir }}/scripts/Installers/Validate-Vcpkg.ps1" "{{ template_dir }}/scripts/Installers/Validate-Vcpkg.ps1"
] ]
}, },
{
"type": "powershell",
"scripts":[
"{{ template_dir }}/scripts/Installers/Validate-PostgreSQL.ps1"
]
},
{ {
"type": "powershell", "type": "powershell",
"scripts":[ "scripts":[
@@ -957,6 +980,12 @@
"{{ template_dir }}/scripts/Installers/Validate-Kind.ps1" "{{ template_dir }}/scripts/Installers/Validate-Kind.ps1"
] ]
}, },
{
"type": "powershell",
"scripts":[
"{{ template_dir }}/scripts/Installers/Validate-MongoDB.ps1"
]
},
{ {
"type": "powershell", "type": "powershell",
"scripts":[ "scripts":[
@@ -975,6 +1004,12 @@
"{{ template_dir }}/scripts/Installers/Validate-DiskSpace.ps1" "{{ template_dir }}/scripts/Installers/Validate-DiskSpace.ps1"
] ]
}, },
{
"type": "powershell",
"inline": [
"pwsh -File '{{user `image_folder`}}\\SoftwareReport\\SoftwareReport.Generator.ps1'"
]
},
{ {
"type": "file", "type": "file",
"source": "C:\\InstalledSoftware.md", "source": "C:\\InstalledSoftware.md",

View File

@@ -3,7 +3,6 @@ param()
. $PSScriptRoot\PathHelpers.ps1 . $PSScriptRoot\PathHelpers.ps1
. $PSScriptRoot\InstallHelpers.ps1 . $PSScriptRoot\InstallHelpers.ps1
. $PSScriptRoot\MarkdownHelpers.ps1
. $PSScriptRoot\ChocoHelpers.ps1 . $PSScriptRoot\ChocoHelpers.ps1
Export-ModuleMember -Function @( Export-ModuleMember -Function @(
@@ -18,8 +17,6 @@ Export-ModuleMember -Function @(
'Get-ToolcachePackages' 'Get-ToolcachePackages'
'Get-ToolsetContent' 'Get-ToolsetContent'
'Get-ToolsByName' 'Get-ToolsByName'
'Add-ContentToMarkdown'
'Add-SoftwareDetailsToMarkdown'
'Stop-SvcWithErrHandling' 'Stop-SvcWithErrHandling'
'Set-SvcWithErrHandling' 'Set-SvcWithErrHandling'
'Start-DownloadWithRetry' 'Start-DownloadWithRetry'

View File

@@ -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
}

View File

@@ -5,27 +5,13 @@
Choco-Install -PackageName awscli Choco-Install -PackageName awscli
$env:PATH =$env:PATH + ";$Env:Programfiles\Amazon\AWSCLIV2" $env:Path = $env:Path + ";$env:ProgramFiles\Amazon\AWSCLIV2"
if (Get-Command -Name 'aws')
$command = Get-Command -Name 'aws'
if ($command)
{ {
Write-Host "awscli on path" Write-Host 'awscli on path'
} }
else else
{ {
Write-Host 'awscli is not on path' Write-Host 'awscli is not on path'
exit 1 exit 1
} }
# Adding description of the software to Markdown
$SoftwareName = "AWS CLI"
$version = (aws --version).Split(" ")[0].Replace("/"," ")
$Description = @"
_Version:_ $version<br/>
"@
Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description

View File

@@ -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"

View File

@@ -1,12 +1,14 @@
################################################################################ ################################################################################
## File: Install-Msys2.ps1 ## 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 # References
# https://github.com/msys2/MINGW-packages/blob/master/azure-pipelines.yml # https://github.com/msys2/MINGW-packages/blob/master/azure-pipelines.yml
# https://packages.msys2.org/group/ # https://packages.msys2.org/group/
$dash = "-" * 40
$origPath = $env:PATH $origPath = $env:PATH
$gitPath = "$env:ProgramFiles\Git" $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 { $msys2Uri = ((Invoke-RestMethod $msys2_release).assets | Where-Object {
$_.name -match "x86_64" -and $_.name.EndsWith("tar.xz") }).browser_download_url $_.name -match "x86_64" -and $_.name.EndsWith("tar.xz") }).browser_download_url
$msys2File = "$env:TEMP\msys2.tar.xz" # Download the latest msys2 x86_64, filename includes release date
# Download the latest msys2 x86_64
Write-Host "Starting msys2 download using $($msys2Uri.split('/')[-1])" 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" Write-Host "Finished download"
# nix style path for tar # nix style path for tar
@@ -31,7 +31,7 @@ $env:PATH = "$gitPath\usr\bin;$gitPath\mingw64\bin;$origPath"
$tar = "$gitPath\usr\bin\tar.exe" $tar = "$gitPath\usr\bin\tar.exe"
# extract tar.xz to C:\ # extract tar.xz to C:\
Write-Host "Starting msys2 extraction from $msys2FileU" Write-Host "Starting msys2 extraction"
&$tar -xJf $msys2FileU -C /c/ &$tar -xJf $msys2FileU -C /c/
Remove-Item $msys2File Remove-Item $msys2File
Write-Host "Finished extraction" Write-Host "Finished extraction"
@@ -39,55 +39,52 @@ Write-Host "Finished extraction"
# Add msys2 bin tools folders to PATH temporary # Add msys2 bin tools folders to PATH temporary
$env:PATH = "C:\msys64\mingw64\bin;C:\msys64\usr\bin;$origPath" $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" bash.exe -c "pacman-key --init 2>&1"
Write-Host "bash pacman-key --populate msys2" Write-Host "bash pacman-key --populate msys2"
bash.exe -c "pacman-key --populate msys2 2>&1" bash.exe -c "pacman-key --populate msys2 2>&1"
Write-Host "pacman -Sy --noconfirm --needed pacman" Write-Host "`n$dash pacman --noconfirm -Syyuu"
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"
pacman.exe -Syyuu --noconfirm pacman.exe -Syyuu --noconfirm
taskkill /f /fi "MODULES eq msys-2.0.dll"
Write-Host "`n$dash pacman --noconfirm -Syuu (2nd pass)"
pacman.exe -Syuu --noconfirm 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 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 pacman.exe -R --noconfirm --noprogressbar p7zip
# mingw package list # mingw package list
$tools = "___clang ___cmake ___llvm ___toolchain ___ragel" $tools = "___clang ___cmake ___llvm ___toolchain ___ragel"
# install mingw64 packages # install mingw64 packages
Write-Host "Install mingw64 packages" Write-Host "`n$dash Install mingw64 packages"
$pre = "mingw-w64-x86_64-" $pre = "mingw-w64-x86_64-"
pacman.exe -S --noconfirm --needed --noprogressbar $tools.replace('___', $pre).split(' ') pacman.exe -S --noconfirm --needed --noprogressbar $tools.replace('___', $pre).split(' ')
# install mingw32 packages # install mingw32 packages
Write-Host "Install mingw32 packages" Write-Host "`n$dash Install mingw32 packages"
$pre = "mingw-w64-i686-" $pre = "mingw-w64-i686-"
pacman.exe -S --noconfirm --needed --noprogressbar $tools.replace('___', $pre).split(' ') pacman.exe -S --noconfirm --needed --noprogressbar $tools.replace('___', $pre).split(' ')
# clean all packages to decrease image size # clean all packages to decrease image size
Write-Host "Clean packages" Write-Host "`n$dash Clean packages"
pacman.exe -Scc --noconfirm pacman.exe -Scc --noconfirm
Write-Host "Installed mingw64 packages" Write-Host "`n$dash Installed mingw64 packages"
pacman.exe -Qs --noconfirm mingw-w64-x86_64- pacman.exe -Q | grep ^mingw-w64-x86_64-
Write-Host "Installed mingw32 packages" Write-Host "`n$dash Installed mingw32 packages"
pacman.exe -Qs --noconfirm mingw-w64-i686- pacman.exe -Q | grep ^mingw-w64-i686-
Write-Host "Installed msys2 packages" Write-Host "`n$dash Installed msys2 packages"
pacman.exe -Qs --noconfirm pacman.exe -Q | grep -v ^mingw-w64-
Write-Host "MSYS2 installation completed" Write-Host "`nMSYS2 installation completed"
exit 0 exit 0

View File

@@ -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

View File

@@ -111,43 +111,3 @@ Push-Location -Path $sdk.FullName
Pop-Location 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
}

View File

@@ -5,7 +5,7 @@
if (Get-Command -Name '7z') if (Get-Command -Name '7z')
{ {
Write-Host "7zip on path" Write-Host '7zip on path'
} }
else else
{ {
@@ -13,13 +13,3 @@ else
exit 1 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<br/>
"@
Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description

View File

@@ -3,25 +3,12 @@
## Desc: Validate aws sam cli ## Desc: Validate aws sam cli
################################################################################ ################################################################################
$command = Get-Command -Name 'sam' if (Get-Command -Name 'sam')
if ($command)
{ {
Write-Host "AWS SAM CLI on path" Write-Host 'AWS SAM CLI on path'
} }
else else
{ {
Write-Host 'AWS SAM CLI is not on path' Write-Host 'AWS SAM CLI is not on path'
exit 1 exit 1
} }
# Adding description of the software to Markdown
$SoftwareName = "AWS SAM CLI"
$version = (sam --version).Split(" ")[3]
$Description = @"
_Version:_ $version<br/>
"@
Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description

View File

@@ -5,20 +5,10 @@
if (Get-Command -Name 'aliyun') if (Get-Command -Name 'aliyun')
{ {
Write-Host "Alibaba Cloud CLI on path" Write-Host 'Alibaba Cloud CLI on path'
} }
else else
{ {
Write-Host 'Alibaba Cloud CLI is not on path' Write-Host 'Alibaba Cloud CLI is not on path'
exit 1 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<br/>
"@
Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description

View File

@@ -3,7 +3,7 @@
## Desc: Validate Azure CLI ## Desc: Validate Azure CLI
################################################################################ ################################################################################
if(Get-Command -Name 'az') if (Get-Command -Name 'az')
{ {
Write-Host "Azure Cli $(az --version) on path" Write-Host "Azure Cli $(az --version) on path"
} }
@@ -13,16 +13,3 @@ else
exit 1 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

View File

@@ -33,15 +33,6 @@ if (!(Test-Path $exeFilePath))
Write-Host "$SoftwareName is not installed" Write-Host "$SoftwareName is not installed"
exit 1 exit 1
} }
else
{
$fileVersion = (Get-Item $exeFilePath).VersionInfo.FileVersion
Write-Host "$SoftwareName is successfully installed: $fileVersion"
$Description = @" $fileVersion = (Get-Item $exeFilePath).VersionInfo.FileVersion
_Version:_ $fileVersion<br/> Write-Host "$SoftwareName is successfully installed: $fileVersion"
_Location:_ $installDir
"@
Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description
}

View File

@@ -5,7 +5,7 @@
az devops -h az devops -h
if($LastExitCode -ne 0) if ($LastExitCode -ne 0)
{ {
Write-Error "Azure DevOps Cli extension not present" Write-Error "Azure DevOps Cli extension not present"
exit 1 exit 1
@@ -15,10 +15,3 @@ else
Write-Host "Azure DevOps Cli extension is present" 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

View File

@@ -3,47 +3,6 @@
## Desc: Validate Azure PowerShell modules ## 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 function Validate-AzureModule
{ {
param([String]$ModuleName, [String[]]$ModuleVersions) 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" $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 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

View File

@@ -5,7 +5,7 @@
if (Get-Command -Name 'bazel') if (Get-Command -Name 'bazel')
{ {
Write-Host "bazel on path" Write-Host 'bazel on path'
} }
else else
{ {
@@ -15,7 +15,7 @@ else
if (Get-Command -Name 'bazelisk') if (Get-Command -Name 'bazelisk')
{ {
Write-Host "bazelisk on path" Write-Host 'bazelisk on path'
} }
else else
{ {
@@ -23,22 +23,4 @@ else
exit 1 exit 1
} }
# Adding description of Bazel to Markdown
$SoftwareName = "bazel"
$Description = @"
_Version:_ $(bazel --version)<br/>
"@
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<br/>
"@
Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description

View File

@@ -25,50 +25,15 @@ function Validate-BoostVersion
exit 1 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' $SoftwareName = 'Boost'
$BoostRootDirectory = Join-Path -Path $env:AGENT_TOOLSDIRECTORY -ChildPath $SoftwareName $BoostRootDirectory = Join-Path -Path $env:AGENT_TOOLSDIRECTORY -ChildPath $SoftwareName
$BoostTools = Get-ToolsByName -SoftwareName $SoftwareName $BoostTools = Get-ToolsByName -SoftwareName $SoftwareName
foreach ($BoostTool in $BoostTools) foreach ($BoostTool in $BoostTools)
{ {
$BoostToolsetName = $BoostTool.Architecture
$BoostVersionsToInstall = $BoostTool.Versions | Foreach-Object {"{0}.0" -f $_} $BoostVersionsToInstall = $BoostTool.Versions | Foreach-Object {"{0}.0" -f $_}
foreach($BoostVersion in $BoostVersionsToInstall) foreach($BoostVersion in $BoostVersionsToInstall)
{ {
Validate-BoostVersion -BoostRootPath $BoostRootDirectory -BoostRelease $BoostVersion 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()

View File

@@ -3,23 +3,12 @@
## Desc: Validate Google Chrome installation. ## 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 (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
} }
else else
{ {
Write-Host "Google Chrome is not installed." Write-Host 'Google Chrome is not installed.'
exit 1 exit 1
} }

View File

@@ -5,7 +5,7 @@
if (Get-Command -Name 'cf') if (Get-Command -Name 'cf')
{ {
Write-Host "cf on path" Write-Host 'cf on path'
} }
else else
{ {
@@ -13,16 +13,3 @@ else
exit 1 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<br/>
"@
Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description

View File

@@ -9,23 +9,8 @@ if(Get-Command -Name 'cmake')
} }
else else
{ {
Write-Host 'CMake not on path' Write-Host "CMake not on path"
exit 1 exit 1
} }
if( $( $(cmake -version) | Out-String) -match 'cmake version (?<version>.*).*' )
{
$cmakeVersion = $Matches.version.Trim()
}
# Adding description of the software to Markdown
$SoftwareName = "CMake"
$Description = @"
_Version:_ $cmakeVersion<br/>
_Environment:_
* PATH: contains location of cmake.exe
"@
Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description

View File

@@ -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' $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 Write-Host "DACFx is installed at path" (Get-Command -Name 'SqlPackage').Source
} }
else else
@@ -15,29 +14,11 @@ else
throw "DACFx is not installed!" 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 else
{ {
throw "SqlLocalDB is not installed!" 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)<br/>
* SQL Server Express LocalDB is available at $localDbPath
"@
Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description

View File

@@ -3,8 +3,7 @@
## Desc: Validate Docker. ## 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 $(docker version) on path"
Write-Host "docker-compose $(docker-compose version) on path" Write-Host "docker-compose $(docker-compose version) on path"
@@ -15,36 +14,6 @@ else
exit 1 exit 1
} }
# Adding description of the software to Markdown
$SoftwareName = "Docker"
$version = $(docker version --format '{{.Server.Version}}')
$Description = @"
_Version:_ $version<br/>
_Environment:_
* PATH: contains location of docker.exe
"@
Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description
$SoftwareName = "Docker-compose"
if( $(docker-compose --version) -match 'docker-compose version (?<version>.*), build.*' )
{
$dockerComposeVersion = $Matches.version
}
$Description = @"
_Version:_ $dockerComposeVersion<br/>
_Environment:_
* PATH: contains location of docker-compose.exe
"@
Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description
# Validate helm # Validate helm
if (Get-Command -Name 'helm') if (Get-Command -Name 'helm')
{ {
@@ -55,14 +24,3 @@ else
Write-Host 'helm is not on path' Write-Host 'helm is not on path'
exit 1 exit 1
} }
$version = $(helm version --short)
$SoftwareName = "Helm"
$Description = @"
_Version:_ $version<br/>
_Environment:_
* PATH: contains location of helm
"@
Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description

View File

@@ -3,7 +3,7 @@
## Desc: Validate dotnet ## Desc: Validate dotnet
################################################################################ ################################################################################
if(Get-Command -Name 'dotnet') if (Get-Command -Name 'dotnet')
{ {
Write-Host "dotnet $(dotnet --version) on path" Write-Host "dotnet $(dotnet --version) on path"
} }
@@ -13,34 +13,4 @@ else
exit 1 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

View File

@@ -5,24 +5,14 @@
$protocols = [Net.ServicePointManager]::SecurityProtocol $protocols = [Net.ServicePointManager]::SecurityProtocol
$protocolArr = $protocols -split ', ' $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 else
{ {
Write-Host "Tls 1.2 has not been enabled." Write-Host 'Tls 1.2 has not been enabled.'
exit 1 exit 1
} }
# Adding description of the software to Markdown
$SoftwareName = "TLS12"
$version = "1.2";
$Description = @"
_Version:_ $version<br/>
_Description:_ .NET has been configured to use TLS 1.2 by default
"@
Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description

View File

@@ -6,17 +6,7 @@
$RegistryKey = "HKLM:SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\msedge.exe" $RegistryKey = "HKLM:SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\msedge.exe"
if (Test-Path $RegistryKey) if (Test-Path $RegistryKey)
{ {
$SoftwareName = "Microsoft Edge" (Get-Item (Get-ItemProperty $RegistryKey).'(Default)').VersionInfo
$VersionInfo = (Get-Item (Get-ItemProperty $RegistryKey).'(Default)').VersionInfo
$VersionInfo
$Description = @"
_version:_
$($VersionInfo.FileVersion)
"@
Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description
exit 0
} }
else else
{ {

View File

@@ -3,23 +3,12 @@
## Desc: Validate Mozilla Firefox installation. ## 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 (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
} }
else else
{ {
Write-Host "Mozilla Firefox is not installed." Write-Host 'Mozilla Firefox is not installed.'
exit 1 exit 1
} }

View File

@@ -12,51 +12,9 @@ function Test-CommandName {
exit 1 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 'bash'
Test-CommandName -CommandName 'awk' Test-CommandName -CommandName 'awk'
Test-CommandName -CommandName 'git'
$GitDescription = @" Test-CommandName -CommandName 'git-lfs'
_Version:_ {0}<br/> Test-CommandName -CommandName 'hub'
_Environment:_
* PATH: contains location of git.exe
"@
Test-Command -CommandName 'git' -CommandDescription 'Git' -VersionCmd "git version" -regexVersion 'git version (?<version>.*).win.*' -DescriptionMarkdown $GitDescription
$GitLfsDescription = @"
_Version:_ {0}<br/>
_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\/(?<version>.*) \(Git.*' -DescriptionMarkdown $GitLfsDescription
$HubCliDescription = @"
_Version:_ {0}<br/>
_Environment:_
* PATH: contains location of hub.exe
"@
Test-Command -CommandName 'hub' -CommandDescription 'Hub CLI' -VersionCmd "hub version | Select-String 'hub version'" -regexVersion 'hub version (?<version>.*)' -DescriptionMarkdown $HubCliDescription

View File

@@ -3,25 +3,12 @@
## Desc: Validate GitHub CLI ## Desc: Validate GitHub CLI
################################################################################ ################################################################################
$command = Get-Command -Name 'gh' if (Get-Command -Name 'gh')
if ($command)
{ {
Write-Host "gh on path" Write-Host 'gh on path'
} }
else else
{ {
Write-Host 'gh is not on path' Write-Host 'gh is not on path'
exit 1 exit 1
} }
# Adding description of the software to Markdown
$SoftwareName = "GitHub CLI"
$version = (gh --version).Split()[2]
$Description = @"
_Version:_ $version<br/>
"@
Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description

View File

@@ -3,23 +3,12 @@
## Desc: Validate GitVersion ## Desc: Validate GitVersion
################################################################################ ################################################################################
$command = Get-Command -Name 'gitversion' if (Get-Command -Name 'gitversion')
if ($command)
{ {
Write-Host "gitversion on path" Write-Host 'gitversion on path'
} }
else else
{ {
Write-Host 'gitversion is not on path' Write-Host 'gitversion is not on path'
exit 1 exit 1
} }
# Adding description of the software to Markdown
$SoftwareName = "GitVersion"
$version = $command.Version.ToString()
$Description = @"
_Version:_ $version<br/>
"@
Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description

View File

@@ -25,8 +25,6 @@ function Get-GoVersion
{ {
$goFullVersion = $Matches.version $goFullVersion = $Matches.version
Write-Host "$goFullVersion has been found" Write-Host "$goFullVersion has been found"
return $goFullVersion
} }
else else
{ {
@@ -46,38 +44,7 @@ else
exit 1 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) $goVersionsToInstall = $env:GO_VERSIONS.split(", ", [System.StringSplitOptions]::RemoveEmptyEntries)
foreach($go in $goVersionsToInstall) { foreach($go in $goVersionsToInstall) {
$goVersion = Get-GoVersion -goVersion $go 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))
}
}
} }
Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description.ToString()

View File

@@ -14,8 +14,6 @@ else
exit 1 exit 1
} }
$SoftwareName = "ghc"
[String] $DefaultGhcVersion = & ghc --version
$ChocoPackagesPath = Join-Path $env:ChocolateyInstall "lib" $ChocoPackagesPath = Join-Path $env:ChocolateyInstall "lib"
[Array] $GhcVersionList = Get-ChildItem -Path $ChocoPackagesPath -Filter "ghc.*" | ForEach-Object { $_.Name.TrimStart("ghc.") } [Array] $GhcVersionList = Get-ChildItem -Path $ChocoPackagesPath -Filter "ghc.*" | ForEach-Object { $_.Name.TrimStart("ghc.") }
@@ -31,7 +29,8 @@ else
} }
# Validation each of GHC version # 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" $BinGhcPath = Join-Path $env:ChocolateyInstall "lib\ghc.$version\tools\ghc-$version\bin\ghc.exe"
if ((& $BinGhcPath --version) -match $version) 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<br/>
"@
Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description
# Cabal validation # Cabal validation
if (Get-Command -Name 'cabal') if (Get-Command -Name 'cabal')
{ {
@@ -68,11 +53,3 @@ else
Write-Host "cabal is not on path." Write-Host "cabal is not on path."
exit 1 exit 1
} }
$SoftwareName = "cabal"
$Description = @"
_Version:_ $(cabal --version)<br/>
"@
Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description

View File

@@ -5,23 +5,11 @@
if (Get-Command -Name 'iscc') if (Get-Command -Name 'iscc')
{ {
Write-Host "iscc is on PATH" Write-Host 'iscc is on PATH'
} }
else else
{ {
Write-Host "iscc is not on PATH" Write-Host 'iscc is not on PATH'
exit 1 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<br/>
"@
Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description

View File

@@ -40,7 +40,6 @@ Function Validate-JavaVersion {
Write-Host "Java $javaVersion found" Write-Host "Java $javaVersion found"
# Reset Path to the default one in case we need to check the default Java later # 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") $env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")
return $javaVersion
} }
else else
{ {
@@ -63,87 +62,7 @@ else
} }
Write-Host "Checking installed Java versions" Write-Host "Checking installed Java versions"
Validate-JavaVersion -Version "1.7"
$java7Version = Validate-JavaVersion -Version "1.7" Validate-JavaVersion -Version "1.8" -Default
$java8Version = Validate-JavaVersion -Version "1.8" -Default Validate-JavaVersion -Version "11"
$java11Version = Validate-JavaVersion -Version "11" Validate-JavaVersion -Version "13"
$java13Version = Validate-JavaVersion -Version "13"
if( $(ant -version) -match 'Apache Ant\(TM\) version (?<version>.*) compiled.*' )
{
$antVersion = $Matches.version
}
if( $( $(mvn -version) | Out-String) -match 'Apache Maven (?<version>.*) \(.*' )
{
$mvnVersion = $Matches.version
}
if( $( $(gradle -version) | Out-String) -match 'Gradle (?<version>.*)' )
{
$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<br/>
_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<br/>
_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<br/>
_Environment:_
* PATH: contains location of gradle
"@
Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description

View File

@@ -5,7 +5,7 @@
if (Get-Command -Name 'jq') if (Get-Command -Name 'jq')
{ {
Write-Host "jq on path" Write-Host 'jq on path'
} }
else else
{ {
@@ -13,11 +13,3 @@ else
exit 1 exit 1
} }
# Adding description of the software to Markdown
$SoftwareName = "jq"
$Description = @"
_Version:_ $(jq --version)<br/>
"@
Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description

View File

@@ -4,7 +4,7 @@
################################################################################ ################################################################################
# Verify that julia.exe is on the path # 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." Write-Host "$(julia --version) is on the path."
} }
@@ -14,12 +14,3 @@ else
exit 1 exit 1
} }
# Add description of the software to Markdown
$SoftwareName = "Julia (x64)"
$juliaVersion = $(julia --version).split() -match "\d+\.\d+\.\d+"
$Description = @"
_Version:_ $juliaVersion<br/>
"@
Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description

View File

@@ -3,8 +3,7 @@
## Desc: Validate Kind. ## Desc: Validate Kind.
################################################################################ ################################################################################
if (Get-Command -Name 'kind')
if((Get-Command -Name 'kind'))
{ {
Write-Host "kind $(kind version) in path" Write-Host "kind $(kind version) in path"
} }
@@ -13,16 +12,3 @@ else
Write-Host "kind is not in path" Write-Host "kind is not in path"
exit 1 exit 1
} }
# Adding description of the software to Markdown
$SoftwareName = "Kind"
$version = $(kind version)
$Description = @"
_Version:_ $version<br/>
_Environment:_
* PATH: contains location of kind.exe
"@
Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description

View File

@@ -3,8 +3,7 @@
## Desc: Validate KubernetesCli. ## Desc: Validate KubernetesCli.
################################################################################ ################################################################################
if (Get-Command -Name 'kubectl')
if((Get-Command -Name 'kubectl'))
{ {
Write-Host "kubectl $(kubectl version --client=true --short=true) in path" Write-Host "kubectl $(kubectl version --client=true --short=true) in path"
} }
@@ -14,20 +13,7 @@ else
exit 1 exit 1
} }
# Adding description of the software to Markdown if (Get-Command -Name 'minikube')
$SoftwareName = "Kubectl"
$version = $(kubectl version --client=true --short=true)
$Description = @"
_Version:_ $version<br/>
_Environment:_
* PATH: contains location of kubectl.exe
"@
Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description
if((Get-Command -Name 'minikube'))
{ {
Write-Host "minikube $(minikube version --short) in path" Write-Host "minikube $(minikube version --short) in path"
} }
@@ -37,15 +23,3 @@ else
exit 1 exit 1
} }
# Adding description of the software to Markdown
$SoftwareName = "minikube"
$version = $(minikube version --short=true)
$Description = @"
_Version:_ $version<br/>
_Environment:_
* PATH: contains location of minikube.exe
"@
Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description

View File

@@ -5,21 +5,10 @@
if (Get-Command -Name 'hg') if (Get-Command -Name 'hg')
{ {
Write-Host "Mercurial on path" Write-Host 'Mercurial on path'
} }
else else
{ {
Write-Host 'Mercurial is not on path' Write-Host 'Mercurial is not on path'
exit 1 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<br/>
"@
Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description

View File

@@ -35,23 +35,3 @@ else
Write-Host "make is not on PATH" Write-Host "make is not on PATH"
exit 1 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<br/>
_Environment:_
* PATH: contains location of the Mingw-w64 'bin' directory
"@
Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description

View File

@@ -25,12 +25,3 @@ else
exit 1 exit 1
} }
$softwareName = "Miniconda"
$description = @"
_Version:_ $(& "$env:CONDA\Scripts\conda.exe" --version)<br/>
_Environment:_
* CONDA: contains location of the root of the Miniconda installation
"@
# Adding description of the software to Markdown
Add-SoftwareDetailsToMarkdown -SoftwareName $softwareName -DescriptionMarkdown $description

View File

@@ -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<br/>
_Environment:_
* PATH: contains location of mongo.exe and mongod.exe
"@
Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description

View File

@@ -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<br/>
_bash:_ $bashVersion<br/>
_gcc:_ $gccVersion<br/>
_tar:_ $tarVersion<br/>
MSYS2 location: C:\msys64
"@
Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description

View File

@@ -3,10 +3,9 @@
## Desc: Validate Mysql Cli ## Desc: Validate Mysql Cli
################################################################################ ################################################################################
$command = Get-Command -Name 'mysql' if (Get-Command -Name 'mysql')
if($command)
{ {
Write-Host "Mysql is on path" Write-Host 'Mysql is on path'
} }
else else
{ {
@@ -14,14 +13,3 @@ else
exit 1 exit 1
} }
# Adding description of the software to Markdown
$SoftwareName = "Mysql"
$version = $command.Version.ToString();
$Description = @"
_Version:_ $version<br/>
_Environment:_
* PATH: contains location of mysql.exe
"@
Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description

View File

@@ -3,25 +3,15 @@
## Desc: Validate .NET 4.7.2 ## 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 # 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 $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" Write-Host ".Net 472 not found"
exit 1 exit 1
} }
# Adding description of the software to Markdown
$SoftwareName = ".NET 4.7.2"
$Description = @"
_Version:_ $version
"@
Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description

View File

@@ -3,26 +3,14 @@
## Desc: Validate .NET 4.8 ## 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 # 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 $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" Write-Host ".Net 48 not found"
exit 1 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

View File

@@ -5,7 +5,7 @@
$SoftwareName = 'Nullsoft Install System (NSIS)' $SoftwareName = 'Nullsoft Install System (NSIS)'
if (Get-Command -Name makensis) if (Get-Command -Name 'makensis')
{ {
Write-Host "$SoftwareName is installed" Write-Host "$SoftwareName is installed"
} }
@@ -15,17 +15,3 @@ else
exit 1 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<br/>
"@
Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description

View File

@@ -3,7 +3,7 @@
## Desc: Validate nodejs-lts and other common node tools. ## 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 "Node $(node --version) on path"
Write-Host "Npm $(npm -version) on path" Write-Host "Npm $(npm -version) on path"
@@ -14,7 +14,7 @@ else
exit 1 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 "Gulp $(gulp -version) on path"
Write-Host "Grunt $(grunt -version) on path" Write-Host "Grunt $(grunt -version) on path"
@@ -26,7 +26,7 @@ else
exit 1 exit 1
} }
if(Get-Command -Name 'lerna') if (Get-Command -Name 'lerna')
{ {
Write-Host "lerna $(lerna --version) on path" Write-Host "lerna $(lerna --version) on path"
} }
@@ -35,43 +35,3 @@ else
Write-Host "lerna is not on path" Write-Host "lerna is not on path"
exit 1 exit 1
} }
if( $(node --version) -match 'v(?<version>.*)' )
{
$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<br/>
_Architecture:_ $nodeArch<br/>
_Environment:_
* PATH: contains location of node.exe<br/>
* $GulpInfo<br/>
* $GruntInfo<br/>
* $YarnInfo<br/>
"@
Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description
# Adding description of the software to Markdown
$SoftwareName = "npm"
$Description = @"
_Version:_ $npmVersion<br/>
_Environment:_
* PATH: contains location of npm.cmd
"@
Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description

View File

@@ -5,7 +5,7 @@
if (Get-Command -Name 'openssl') if (Get-Command -Name 'openssl')
{ {
Write-Host "openssl on path" Write-Host 'openssl on path'
} }
else else
{ {
@@ -13,17 +13,3 @@ else
exit 1 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)<br/>"
}
}
Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description

View File

@@ -15,7 +15,8 @@ function Get-PHPVersion
if($($(php --version)| Out-String) -match 'PHP (?<version>.*) (.*cli).*') if($($(php --version)| Out-String) -match 'PHP (?<version>.*) (.*cli).*')
{ {
$phpVersion = $Matches.version $phpVersion = $Matches.version
return $phpVersion Write-Host "PHP version at $phpRootPath is $phpVersion"
exit 0
} }
Write-Host "Unable to determine PHP version at " + $phpRootPath Write-Host "Unable to determine PHP version at " + $phpRootPath
@@ -44,32 +45,5 @@ else
exit 1 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 # Get available versions of PHP
$phpVersionOnPath = Get-PHPVersion -phpRootPath "C:\tools\php72" 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

View File

@@ -5,7 +5,7 @@
if (Get-Command -Name 'packer') if (Get-Command -Name 'packer')
{ {
Write-Host "Packer is on path" Write-Host 'Packer is on path'
} }
else else
{ {
@@ -13,12 +13,3 @@ else
exit 1 exit 1
} }
# Adding description of the software to Markdown
$SoftwareName = "Packer"
$PackerVersion = packer --version
$Description = @"
_Version:_ $PackerVersion<br/>
"@
Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description

View File

@@ -5,7 +5,7 @@
if (Get-Command -Name 'perl') if (Get-Command -Name 'perl')
{ {
Write-Host "perl on path" Write-Host 'perl on path'
} }
else else
{ {
@@ -13,11 +13,3 @@ else
exit 1 exit 1
} }
# Adding description of the software to Markdown
$SoftwareName = "Perl"
$Description = @"
_Version:_ $(perl -e 'print $^V')<br/>
"@
Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description

View File

@@ -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<br/>
_Default Path:_ $pgroot<br/>
_User:_ $env:PGUSER<br/>
_Password:_ $env:PGPASSWORD
"@
Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description
#Stop and disable PostgreSQL service
Stop-Service -Name $pgservice
Set-Service $pgservice -StartupType Disabled

View File

@@ -5,24 +5,11 @@
if (Get-Command -Name 'pwsh') if (Get-Command -Name 'pwsh')
{ {
Write-Host "pwsh is on PATH" Write-Host 'pwsh is on PATH'
} }
else else
{ {
Write-Host "pwsh is not on PATH" Write-Host 'pwsh is not on PATH'
exit 1 exit 1
} }
# Adding description of the software to Markdown
$SoftwareName = "Powershell Core"
if(($(pwsh --version) | Out-String) -match 'PowerShell (?<version>.*)')
{
$PowershellVersion = $Matches.version
}
$Description = @"
_Version:_ $PowershellVersion<br/>
"@
Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description

View File

@@ -17,18 +17,3 @@ else
Write-Host "rustc is not on the path" Write-Host "rustc is not on the path"
exit 1 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

View File

@@ -25,8 +25,6 @@ function Test-SqlConnection {
$sqlConnection = New-Object System.Data.SqlClient.SqlConnection $connectionString $sqlConnection = New-Object System.Data.SqlClient.SqlConnection $connectionString
$sqlConnection.Open() $sqlConnection.Open()
Write-Host -Object "Connection to SQL Express was successful." Write-Host -Object "Connection to SQL Express was successful."
return $sqlConnection.ServerVersion
} catch { } catch {
Write-Host -Object "Connection to SQL Express cannot be established." Write-Host -Object "Connection to SQL Express cannot be established."
exit 1 exit 1
@@ -36,17 +34,7 @@ function Test-SqlConnection {
$sqlConnection.Close() $sqlConnection.Close()
} }
} }
$instanceName = "$env:computername\$sqlInstance" $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<br/>
_InstanceName:_ $sqlInstance<br/>
_Username:_ $sqlUser<br/>
_Password:_ $sqlPassword<br/>
_Default Path:_ C:\Program Files (x86)\Microsoft SQL Server
"@
Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description

View File

@@ -4,34 +4,7 @@ $modules = Get-Module -Name SQLPS -ListAvailable
Write-Host "The SQLPS Modules present are:" Write-Host "The SQLPS Modules present are:"
$modules | Select-Object Name,Version,Path | Format-Table $modules | Select-Object Name,Version,Path | Format-Table
if ($modules) {
$sqlPSVersion = $modules.Version
}
# Validate the SQLserver PS module installation # Validate the SQLserver PS module installation
$modules = Get-Module -Name SQLServer -ListAvailable $modules = Get-Module -Name SQLServer -ListAvailable
Write-Host "The SQLServer Modules present are:" Write-Host "The SQLServer Modules present are:"
$modules | Select-Object Name,Version,Path | Format-Table $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

View File

@@ -3,15 +3,13 @@
## Desc: Validate sbt for Windows ## 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 else
{ {
Write-Host "sbt is not on path." Write-Host 'sbt is not on path.'
exit 1 exit 1
} }
# This works around issue where sbt --script-version does some copies and breaks the build
Add-SoftwareDetailsToMarkdown -SoftwareName "sbt" -DescriptionMarkdown ""

View File

@@ -19,70 +19,17 @@ if (
($EdgeDriverPath -like "C:\SeleniumWebDrivers\EdgeDriver") ($EdgeDriverPath -like "C:\SeleniumWebDrivers\EdgeDriver")
) )
{ {
Write-Host "IEDriver installed at " Write-Host "IEDriver installed at "
(Get-Item "$IEDriverPath\IEDriverServer.exe").VersionInfo (Get-Item "$IEDriverPath\IEDriverServer.exe").VersionInfo
Write-Host "Gecko Driver installed at " Write-Host "Gecko Driver installed at "
(Get-Item "$GeckoDriverPath\geckodriver.exe").VersionInfo (Get-Item "$GeckoDriverPath\geckodriver.exe").VersionInfo
Write-Host "Chrome Driver installed at " Write-Host "Chrome Driver installed at "
(Get-Item "$ChromeDriverPath\chromedriver.exe").VersionInfo (Get-Item "$ChromeDriverPath\chromedriver.exe").VersionInfo
Write-Host "Edge Driver installed at " Write-Host "Edge Driver installed at "
(Get-Item "$EdgeDriverPath\msedgedriver.exe").VersionInfo (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
} }
else else
{ {

View File

@@ -5,40 +5,13 @@
$modules = Get-Module -Name ServiceFabric -ListAvailable $modules = Get-Module -Name ServiceFabric -ListAvailable
if(($modules | Measure-Object).Count -gt 0) if (($modules | Measure-Object).Count -gt 0)
{ {
$modules $modules
} }
else { else
{
Write-Host "ServiceFabric Module is not present, it might not be installed" Write-Host "ServiceFabric Module is not present, it might not be installed"
throw "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)<br/>
_Runtime Version:_ $(Get-ServiceFabricVersion)
"@
Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description

View File

@@ -5,23 +5,11 @@
if (Get-Command -Name 'stack') if (Get-Command -Name 'stack')
{ {
Write-Host "stack is on the path" Write-Host 'stack is on the path'
} }
else else
{ {
Write-Host "stack is not on path." Write-Host 'stack is not on path.'
exit 1 exit 1
} }
$StackVersion = stack --version --quiet
# Adding description of the software to Markdown
$SoftwareName = "Stack"
$Description = @"
_Version:_ $StackVersion<br/>
_Environment:_
* PATH: contains location of stack.exe
"@
Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description

View File

@@ -3,7 +3,7 @@
## Desc: Validate Subversion ## Desc: Validate Subversion
################################################################################ ################################################################################
if(Get-Command -Name 'svn') if (Get-Command -Name 'svn')
{ {
Write-Host "Subversion $(svn --version --quiet) is on the path." Write-Host "Subversion $(svn --version --quiet) is on the path."
} }
@@ -12,17 +12,3 @@ else
Write-Host "Subversion is not on the path." Write-Host "Subversion is not on the path."
exit 1 exit 1
} }
$svnVersion = $(svn --version --quiet)
# Adding description of the software to Markdown
$SoftwareName = "Subversion"
$Description = @"
_Version:_ $svnVersion<br/>
_Environment:_
* PATH: contains location of svn.exe
"@
Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description

View File

@@ -83,40 +83,6 @@ function Get-SystemDefaultRuby {
exit 1 exit 1
} }
$rubyVersionOnPath = "Ruby $($Matches.version)"
$description = GetDefaultToolDescription -SoftwareVersion $rubyVersionOnPath -SoftwareLocation $rubyBinOnPath
$gemVersion = & gem -v
$description += "* Gem Version: $gemVersion<br/>"
return $description
}
function GetDefaultToolDescription {
param (
[Parameter(Mandatory = $True)]
[string]$SoftwareVersion,
[Parameter(Mandatory = $True)]
[string]$SoftwareLocation
)
$description = "<br/>__System default version:__ $SoftwareVersion<br/>"
$description += "_Environment:_<br/>"
$description += "* Location: $SoftwareLocation<br/>"
$description += "* PATH: contains the location of $SoftwareVersion<br/>"
return $description
}
function GetMarkdownDescription {
param (
[Parameter(Mandatory = $True)]
[string]$SoftwareVersion,
[Parameter(Mandatory = $True)]
[string]$SoftwareArchitecture
)
return "_Version:_ $SoftwareVersion ($SoftwareArchitecture)<br/>"
} }
function ToolcacheTest { function ToolcacheTest {
@@ -142,7 +108,6 @@ function ToolcacheTest {
exit 1 exit 1
} }
$markdownDescription = ""
$tools = GetToolsByName -SoftwareName $SoftwareName $tools = GetToolsByName -SoftwareName $SoftwareName
foreach($tool in $tools) foreach($tool in $tools)
{ {
@@ -165,16 +130,12 @@ function ToolcacheTest {
$path = "$softwarePath\$foundVersion\$requiredArchitecture" $path = "$softwarePath\$foundVersion\$requiredArchitecture"
RunTestsByPath -ExecTests $ExecTests -Path $path -SoftwareName $SoftwareName -SoftwareVersion $foundVersion -SoftwareArchitecture $requiredArchitecture RunTestsByPath -ExecTests $ExecTests -Path $path -SoftwareName $SoftwareName -SoftwareVersion $foundVersion -SoftwareArchitecture $requiredArchitecture
$markdownDescription += GetMarkdownDescription -SoftwareVersion $foundVersion -SoftwareArchitecture $requiredArchitecture
} }
} }
if ($SoftwareName -contains "Ruby") { if ($SoftwareName -contains "Ruby") {
$markdownDescription += Get-SystemDefaultRuby Get-SystemDefaultRuby
} }
Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $markdownDescription
} }
# Ruby test # Ruby test

View File

@@ -34,7 +34,6 @@ function Validate-SystemDefaultTool {
# Check if tool on path # Check if tool on path
if (Get-Command -Name $binName) { if (Get-Command -Name $binName) {
$versionOnPath = $(& $binName --version 2>&1) | Select-String -Pattern ".*(\d+\.\d+\.\d+)" $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 # Check if version is correct
if ($versionOnPath.matches.Groups[1].Value -notlike $ExpectedVersion) { if ($versionOnPath.matches.Groups[1].Value -notlike $ExpectedVersion) {
@@ -47,20 +46,10 @@ function Validate-SystemDefaultTool {
Write-Host "$ToolName is not on path" Write-Host "$ToolName is not on path"
exit 1 exit 1
} }
# Add default version description to markdown
$description = "<br/>__System default version:__ $versionOnPath<br/>"
$description += "_Environment:_<br/>"
$description += "* Location: $versionBinPath<br/>"
$description += "* PATH: contains the location of $versionOnPath<br/>"
return $description
} }
$ErrorActionPreference = "Stop" $ErrorActionPreference = "Stop"
Import-Module -Name ImageHelpers -Force
# Define executables for cached tools # Define executables for cached tools
$toolsExecutables = @{ $toolsExecutables = @{
Python = @("python.exe", "Scripts\pip.exe") Python = @("python.exe", "Scripts\pip.exe")
@@ -72,8 +61,6 @@ $toolsExecutables = @{
$tools = Get-ToolsetContent | Select-Object -ExpandProperty toolcache $tools = Get-ToolsetContent | Select-Object -ExpandProperty toolcache
foreach($tool in $tools) { foreach($tool in $tools) {
$markdownDescription = ""
$toolPath = Join-Path $env:AGENT_TOOLSDIRECTORY $tool.name $toolPath = Join-Path $env:AGENT_TOOLSDIRECTORY $tool.name
# Get executables for current tool # Get executables for current tool
$toolExecs = $toolsExecutables[$tool.name] $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..." Write-Host "Run validation test for $($tool.name)($($tool.arch)) $($foundVersion.name) executables..."
Run-ExecutableTests -Executables $toolExecs -ToolPath $foundVersionArchPath 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<br/>"
} }
# Create markdown description for system default tool
if (-not ([string]::IsNullOrEmpty($tool.default))) { if (-not ([string]::IsNullOrEmpty($tool.default))) {
Write-Host "Validate system default $($tool.name)($($tool.arch)) $($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
} }

View File

@@ -3,7 +3,7 @@
## Desc: Validate Typescript Installation ## Desc: Validate Typescript Installation
################################################################################ ################################################################################
if(Get-Command -Name 'tsc') if (Get-Command -Name 'tsc')
{ {
Write-Host "TypeScript $(tsc --version) is on the path." Write-Host "TypeScript $(tsc --version) is on the path."
} }
@@ -12,15 +12,3 @@ else
Write-Host "TypeScript is not on the path." Write-Host "TypeScript is not on the path."
exit 1 exit 1
} }
$typescriptVersion = $(tsc --version)
# Adding description of the software to Markdown
$SoftwareName = "TypeScript"
$Description = @"
_Version:_ $typescriptVersion<br/>
"@
Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description

View File

@@ -3,7 +3,7 @@
## Desc: Validate vswhere ## Desc: Validate vswhere
################################################################################ ################################################################################
if(Get-Command -Name 'vswhere') if (Get-Command -Name 'vswhere')
{ {
Write-Host "vswhere $(vswhere) on path" Write-Host "vswhere $(vswhere) on path"
} }
@@ -12,14 +12,3 @@ else
Write-Host "vswhere is not on path" Write-Host "vswhere is not on path"
exit 1 exit 1
} }
# Adding description of the software to Markdown
$SoftwareName = "VSWhere"
$VswhereVersion = (Get-Command -Name vswhere).FileVersionInfo.ProductVersion
$Description = @"
_Version_: $VswhereVersion<br/>
* PATH: contains location of vswhere.exe
"@
Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description

View File

@@ -16,31 +16,12 @@ else
if ($env:VCPKG_INSTALLATION_ROOT) 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 Write-Host $env:VCPKG_INSTALLATION_ROOT
} }
else 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 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<br/>
_Environment:_
* PATH: contains location of the vcpkg directory
* VCPKG_INSTALLATION_ROOT: root directory of the vcpkg installation
"@
Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description

View File

@@ -3,8 +3,6 @@
## Desc: Validate the installation of the Windows Driver Kit ## Desc: Validate the installation of the Windows Driver Kit
################################################################################ ################################################################################
Import-Module -Name ImageHelpers -Force
function Get-WDKVersion function Get-WDKVersion
{ {
$WDKVersion = (Get-CimInstance -ClassName Win32_Product -Filter "Name = 'Windows Driver Kit'").Version $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" Write-Host "WDK was not found"
exit 1 exit 1
} }
return $WDKVersion
} }
$WDKVersion = Get-WDKVersion Get-WDKVersion
$WDKPackageVersion = Get-VSExtensionVersion -packageName "Microsoft.Windows.DriverKit" $null = Get-VSExtensionVersion -packageName "Microsoft.Windows.DriverKit"
# Adding description of the software to Markdown
$SoftwareName = "Windows Driver Kit"
$Description = @"
_WDK Version:_ $WDKVersion<br/>
_WDK Visual Studio Extension Version:_ $WDKPackageVersion<br/>
"@
Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description

View File

@@ -3,17 +3,17 @@
## Desc: Validate WinAppDriver installation ## Desc: Validate WinAppDriver installation
################################################################################ ################################################################################
$wad = "Windows Application Driver"; $wad = "Windows Application Driver"
if (${Env:ProgramFiles(x86)}) if (${env:ProgramFiles(x86)})
{ {
$wadPath = "${Env:ProgramFiles(x86)}\$wad" $wadPath = "${env:ProgramFiles(x86)}\$wad"
} }
else 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."
} }
@@ -25,7 +25,7 @@ else
#Validate if Developer Mode is enabled #Validate if Developer Mode is enabled
$path = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock"; $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."
} }
@@ -35,11 +35,3 @@ else
exit 1 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<br/>
"@
Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description

View File

@@ -14,7 +14,7 @@ function Get-WixVersion {
$WixToolSetVersion = Get-WixVersion $WixToolSetVersion = Get-WixVersion
if($WixToolSetVersion) { if ($WixToolSetVersion) {
Write-Host "Wix Toolset version" $WixPackage.version "installed" Write-Host "Wix Toolset version" $WixPackage.version "installed"
} }
else { else {
@@ -22,25 +22,12 @@ else {
exit 1 exit 1
} }
if(Test-IsWin19) if (Test-IsWin19)
{ {
$WixPackageVersion = Get-VSExtensionVersion -packageName "WixToolset.VisualStudioExtension.Dev16" $null = Get-VSExtensionVersion -packageName "WixToolset.VisualStudioExtension.Dev16"
$VSver = "2019"
} }
else else
{ {
$WixPackageVersion = Get-VSExtensionVersion -packageName "WixToolset.VisualStudioExtension.Dev15" $null = Get-VSExtensionVersion -packageName "WixToolset.VisualStudioExtension.Dev15"
$VSver = "2017"
} }
# Adding description of the software to Markdown
$SoftwareName = "WIX Tools"
$Description = @"
_Toolset Version:_ $WixToolSetVersion<br/>
_WIX Toolset Studio $VSver Extension Version:_ $WixPackageVersion<br/>
_Environment:_
* WIX: Installation root of WIX
"@
Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description

View File

@@ -5,7 +5,7 @@
if (Get-Command -Name 'zstd') if (Get-Command -Name 'zstd')
{ {
Write-Host "zstd on path" Write-Host 'zstd on path'
} }
else else
{ {
@@ -13,12 +13,3 @@ else
exit 1 exit 1
} }
# Adding description of the software to Markdown
$SoftwareName = "zstd"
$zstdVersion = $(zstd --version).Split(' ')[6].Split(',')[0].Substring(1)
$Description = @"
_Version:_ $zstdVersion<br/>
"@
Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description

View File

@@ -125,48 +125,14 @@ Choco-Install -PackageName webpicmd
# Install vcredist140 # Install vcredist140
Choco-Install -PackageName vcredist140 Choco-Install -PackageName vcredist140
# Expand disk size of OS drive # Expand disk size of OS drive
New-Item -Path d:\ -Name cmds.txt -ItemType File -Force New-Item -Path d:\ -Name cmds.txt -ItemType File -Force
Add-Content -Path d:\cmds.txt "SELECT VOLUME=C`r`nEXTEND" Add-Content -Path d:\cmds.txt "SELECT VOLUME=C`r`nEXTEND"
$expandResult = (diskpart /s 'd:\cmds.txt') $expandResult = (diskpart /s 'd:\cmds.txt')
Write-Host $expandResult Write-Host $expandResult
Write-Host "Disk sizes after expansion" Write-Host "Disk sizes after expansion"
wmic logicaldisk get size,freespace,caption wmic logicaldisk get size,freespace,caption
# Adding description of the software to Markdown
$Content = @"
<!--- DO NOT EDIT - This markdown file is autogenerated. -->
# 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(?<version>.*).*' )
{
$chocoVersion = $Matches.version.Trim()
}
$Description = @"
_Version:_ $chocoVersion<br/>
_Environment:_
* PATH: contains location for choco.exe
"@
Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description

View File

@@ -106,41 +106,3 @@ Write-Host "Visual Studio version ${version} installed"
# Updating content of MachineState.json file to disable autoupdate of VSIX extensions # 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}' $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 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<br/>
_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] } } )

View File

@@ -11,7 +11,7 @@ function DockerPull {
docker pull $image docker pull $image
if (!$?) { if (!$?) {
echo "Docker pull failed with a non-zero exit code" Write-Host "Docker pull failed with a non-zero exit code"
exit 1 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/aspnet:4.8-windowsservercore-ltsc2016
DockerPull mcr.microsoft.com/dotnet/framework/runtime: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}})")

View File

@@ -3,22 +3,5 @@
## Desc: Validate SQL Server Data Tools for Windows ## 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<br/>
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

View File

@@ -120,46 +120,12 @@ Remove-Item -Path $env:ChocolateyInstall\bin\cpack.exe -Force
Choco-Install -PackageName webpicmd Choco-Install -PackageName webpicmd
# Expand disk size of OS drive # Expand disk size of OS drive
New-Item -Path d:\ -Name cmds.txt -ItemType File -Force New-Item -Path d:\ -Name cmds.txt -ItemType File -Force
Add-Content -Path d:\cmds.txt "SELECT VOLUME=C`r`nEXTEND" Add-Content -Path d:\cmds.txt "SELECT VOLUME=C`r`nEXTEND"
$expandResult = (diskpart /s 'd:\cmds.txt') $expandResult = (diskpart /s 'd:\cmds.txt')
Write-Host $expandResult Write-Host $expandResult
Write-Host "Disk sizes after expansion" Write-Host "Disk sizes after expansion"
wmic logicaldisk get size,freespace,caption wmic logicaldisk get size,freespace,caption
# Adding description of the software to Markdown
$Content = @"
<!--- DO NOT EDIT - This markdown file is autogenerated. -->
# 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(?<version>.*).*' )
{
$chocoVersion = $Matches.version.Trim()
}
$Description = @"
_Version:_ $chocoVersion<br/>
_Environment:_
* PATH: contains location for choco.exe
"@
Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description

View File

@@ -135,28 +135,3 @@ $sdkFileName = "sdksetup14393.exe"
$argumentList = ("/q", "/norestart", "/ceip off", "/features OptionId.WindowsSoftwareDevelopmentKit") $argumentList = ("/q", "/norestart", "/ceip off", "/features OptionId.WindowsSoftwareDevelopmentKit")
Install-Binary -Url $sdkUrl -Name $sdkFileName -ArgumentList $argumentList Install-Binary -Url $sdkUrl -Name $sdkFileName -ArgumentList $argumentList
# Adding description of the software to Markdown
$SoftwareName = "Visual Studio 2019 Enterprise"
$Description = @"
_Version:_ $version<br/>
_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

View File

@@ -11,7 +11,7 @@ function DockerPull {
docker pull $image docker pull $image
if (!$?) { if (!$?) {
echo "Docker pull failed with a non-zero exit code" Write-Host "Docker pull failed with a non-zero exit code"
exit 1 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/aspnet:4.8-windowsservercore-ltsc2019
DockerPull mcr.microsoft.com/dotnet/framework/runtime: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}})")

View File

@@ -3,20 +3,7 @@
## Desc: Validate SQL Server Data Tools Visual Studio extensions ## 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 #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" $null = Get-VSExtensionVersion -packageName "04a86fc2-dbd5-4222-848e-911638e487fe"
$IntegrationPackageVersion = Get-VSExtensionVersion -packageName "851E7A09-7B2B-4F06-A15D-BABFCB26B970" $null = Get-VSExtensionVersion -packageName "851E7A09-7B2B-4F06-A15D-BABFCB26B970"
$ReportingPackageVersion = Get-VSExtensionVersion -packageName "717ad572-c4b7-435c-c166-c2969777f718" $null = 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<br/>
_SQL Server Integration Services Projects Version:_ $IntegrationPackageVersion<br/>
_Microsoft Reporting Services Projects Version:_ $ReportingPackageVersion<br/>
"@
Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description

View File

@@ -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]
}
}
}

View File

@@ -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"
}

View File

@@ -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
}

View File

@@ -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 "(?<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(?<version>\d+\.\d+\.\d+)" | Out-Null
$goVersion = $Matches.Version
return "Go $goVersion"
}
function Get-PHPVersion {
($(php --version) | Out-String) -match "PHP (?<version>\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(?<version>\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(?<version>\d+\.\d+\.\d+)" | Out-Null
$chocoVersion = $Matches.Version
return "Chocolatey $chocoVersion"
}
function Get-VcpkgVersion {
($(vcpkg version) | Out-String) -match "version (?<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(?<version>\d+\.\d+\.\d+)" | Out-Null
$helmVersion = $Matches.Version
return "Helm $helmVersion"
}
function Get-PipVersion {
($(pip --version) | Out-String) -match "(?<version>pip [\d\.]+) .+ (?<python>\(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 (?<version>\d+\.\d+\.\d+)" | Out-Null
$composerVersion = $Matches.Version
return "Composer $composerVersion"
}
function Get-AntVersion {
($(ant -version) | Out-String) -match "version (?<version>\d+\.\d+\.\d+)" | Out-Null
$antVersion = $Matches.Version
return "Ant $antVersion"
}
function Get-MavenVersion {
($(mvn -version) | Out-String) -match "Apache Maven (?<version>\d+\.\d+\.\d+)" | Out-Null
$mavenVersion = $Matches.Version
return "Maven $mavenVersion"
}
function Get-GradleVersion {
($(gradle -version) | Out-String) -match "Gradle (?<version>\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+)?", " <version>"
}
[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 '<br>'
$modulePath = (($group.FullName).Split("_"))[0] + '_\<version\>'
# 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"
}

View File

@@ -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"

View File

@@ -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
}

View File

@@ -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 (?<version>\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(?<version>\d+\.\d+\.\d+)" | Out-Null
$bazeliskVersion = $Matches.Version
return "Bazelisk $bazeliskVersion"
}
function Get-CMakeVersion {
($(cmake -version) | Out-String) -match "cmake version (?<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 (?<version>\d+\.\d+\.\d+)" | Out-Null
$dockerComposeVersion = $Matches.Version
return "Docker-compose $dockerComposeVersion"
}
function Get-GitVersion {
$(git version) -match "git version (?<version>\d+\.\d+\.\d+)" | Out-Null
$gitVersion = $Matches.Version
return "Git $gitVersion"
}
function Get-GitLFSVersion {
$(git-lfs version) -match "git-lfs\/(?<version>\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(?<version>.+)" | Out-Null
$kubectlVersion = $Matches.Version
return "Kubectl $kubectlVersion"
}
function Get-KindVersion {
$(kind version) -match "kind v(?<version>\d+\.\d+\.\d+)" | Out-Null
$kindVersion = $Matches.Version
return "Kind $kindVersion"
}
function Get-MinGWVersion {
(gcc --version | Select-String -Pattern "MinGW-W64 project") -match "(?<version>\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 (?<version>\d+\.\d+\.?\d*)" | Out-Null
$mercurialVersion = $Matches.Version
return "Mercurial $mercurialVersion"
}
function Get-NSISVersion {
$(choco list --local-only nsis | Out-String) -match "nsis (?<version>\d+\.\d+\.?\d*\.?\d*)" | Out-Null
$nsisVersion = $Matches.Version
return "NSIS $nsisVersion"
}
function Get-OpenSSLVersion {
$(openssl version) -match "OpenSSL (?<version>\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 "(?<version>\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(?<version>\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\/(?<version>\d+\.\d+\.\d+)" | Out-Null
$awscliVersion = $Matches.Version
return "AWS CLI $awscliVersion"
}
function Get-AWSSAMVersion {
$(sam --version) -match "version (?<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 "(?<version>\d+\.\d+\.\d+)" | Out-Null
$alicliVersion = $Matches.Version
return "Alibaba CLI $alicliVersion"
}
function Get-CloudFoundryVersion {
$(cf version) -match "(?<version>\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 (?<version>\d+\.\d+\.\d+)" | Out-Null
$hubVersion = $Matches.Version
return "Hub CLI $hubVersion"
}
function Get-7zipVersion {
(7z | Out-String) -match "7-Zip (?<version>\d+\.\d+\.?\d*)" | Out-Null
$version = $Matches.Version
return "7zip $version"
}
function Get-GHCVersion {
((ghc --version) | Out-String) -match "version (?<version>\d+\.\d+\.\d+)" | Out-Null
$ghcVersion = $Matches.Version
return "ghc $ghcVersion"
}
function Get-CabalVersion {
((cabal --version) | Out-String) -match "version (?<version>\d+\.\d+\.\d+\.\d+)" | Out-Null
$cabalVersion = $Matches.Version
return "Cabal $cabalVersion"
}
function Get-StackVersion {
((stack --version --quiet) | Out-String) -match "Version (?<version>\d+\.\d+\.\d+)," | Out-Null
$stackVersion = $Matches.Version
return "Stack $stackVersion"
}

View File

@@ -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
}