Cleanup old markdown documenation approach (#979)

This commit is contained in:
Aleksandr Chebotov
2020-06-02 20:07:12 +03:00
committed by GitHub
parent 8c8f384a61
commit 43e26fa96b
72 changed files with 133 additions and 1541 deletions

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

@@ -100,7 +100,7 @@ Push-Location -Path $sdk.FullName
# Android NDK root path. # Android NDK root path.
$ndk_root = "C:\Program Files (x86)\Android\android-sdk\ndk-bundle" $ndk_root = "C:\Program Files (x86)\Android\android-sdk\ndk-bundle"
if (Test-Path $ndk_root){ if (Test-Path $ndk_root){
setx ANDROID_HOME $sdk_root /M setx ANDROID_HOME $sdk_root /M
setx ANDROID_NDK_HOME $ndk_root /M setx ANDROID_NDK_HOME $ndk_root /M
setx ANDROID_NDK_PATH $ndk_root /M setx ANDROID_NDK_PATH $ndk_root /M
@@ -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,48 +3,17 @@
## 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"
} }
else else
{ {
Write-Host "docker or docker-compose are not on path" Write-Host "docker or docker-compose are not on path"
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,20 +6,10 @@
$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
{ {
Write-Host "Microsoft Edge is not installed." Write-Host "Microsoft Edge is not installed."
exit 1 exit 1
} }

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

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

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

@@ -13,79 +13,26 @@ $EdgeDriverPath = $env:EdgeWebDriver
Write-Host "EdgeDriverPath: $EdgeDriverPath" Write-Host "EdgeDriverPath: $EdgeDriverPath"
if ( if (
($IEDriverPath -like "C:\SeleniumWebDrivers\IEDriver") -and ($IEDriverPath -like "C:\SeleniumWebDrivers\IEDriver") -and
($GeckoDriverPath -like "C:\SeleniumWebDrivers\GeckoDriver") -and ($GeckoDriverPath -like "C:\SeleniumWebDrivers\GeckoDriver") -and
($ChromeDriverPath -like "C:\SeleniumWebDrivers\ChromeDriver") -and ($ChromeDriverPath -like "C:\SeleniumWebDrivers\ChromeDriver") -and
($EdgeDriverPath -like "C:\SeleniumWebDrivers\EdgeDriver") ($EdgeDriverPath -like "C:\SeleniumWebDrivers\EdgeDriver")
) )
{ {
Write-Host "IEDriver installed at "
(Get-Item "$IEDriverPath\IEDriverServer.exe").VersionInfo
Write-Host "IEDriver installed at " Write-Host "Gecko Driver installed at "
(Get-Item "$IEDriverPath\IEDriverServer.exe").VersionInfo (Get-Item "$GeckoDriverPath\geckodriver.exe").VersionInfo
Write-Host "Chrome Driver installed at "
(Get-Item "$ChromeDriverPath\chromedriver.exe").VersionInfo
Write-Host "Gecko Driver installed at " Write-Host "Edge Driver installed at "
(Get-Item "$GeckoDriverPath\geckodriver.exe").VersionInfo (Get-Item "$EdgeDriverPath\msedgedriver.exe").VersionInfo
Write-Host "Chrome Driver installed at "
(Get-Item "$ChromeDriverPath\chromedriver.exe").VersionInfo
Write-Host "Edge Driver installed at "
(Get-Item "$EdgeDriverPath\msedgedriver.exe").VersionInfo
$versionFileName = "versioninfo.txt";
$chromedriverversion = Get-Content -Path "$ChromeDriverPath\$versionFileName"
$geckodriverversion = Get-Content -Path "$GeckoDriverPath\$versionFileName"
$iedriverversion = Get-Content -Path "$IEDriverPath\$versionFileName"
$edgedriverversion = Get-Content -Path "$EdgeDriverPath\$versionFileName"
# Adding description of the software to Markdown
$SoftwareName = "Selenium Web Drivers"
$Description = @"
#### Chrome Driver
_version:_
$chromedriverversion
_Environment:_
* ChromeWebDriver: location of chromedriver.exe
#### Gecko Driver
_version:_
$geckodriverversion
_Environment:_
* GeckoWebDriver: location of geckodriver.exe
#### IE Driver
_version:_
$iedriverversion
_Environment:_
* IEWebDriver: location of IEDriverServer.exe
#### Microsoft Edge Driver
_version:_
$edgedriverversion
_Environment:_
* EdgeWebDriver: location of msedgedriver.exe
"@
Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description
exit 0
} }
else else
{ {
Write-Host "Selenium Web Drivers are not installed." Write-Host "Selenium Web Drivers are not installed."
exit 1 exit 1
} }

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,43 +3,35 @@
## 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."
} }
else else
{ {
Write-Host "Failed to locate WinAppDriver directory. Exiting." Write-Host "Failed to locate WinAppDriver directory. Exiting."
exit 1 exit 1
} }
#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."
} }
else else
{ {
Write-Host "Developer Mode was not successfully provisioned." Write-Host "Developer Mode was not successfully provisioned."
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