[Windows] Update documentation generation to use shared software report module (#6834)

This commit is contained in:
bogdan-damian-bgd
2022-12-30 10:24:22 +01:00
committed by GitHub
parent f7f519dcc4
commit 447c8387a2
10 changed files with 349 additions and 535 deletions

View File

@@ -32,6 +32,19 @@ $webDrivers = @{
} }
} }
function Build-BrowserSection {
return @(
$(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"),
$(Get-SeleniumVersion)
)
}
function Get-BrowserVersion { function Get-BrowserVersion {
param( param(
[string] $Browser [string] $Browser
@@ -40,7 +53,7 @@ function Get-BrowserVersion {
$browserFile = $browsers.$Browser.File $browserFile = $browsers.$Browser.File
$registryKey = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\$browserFile" $registryKey = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\$browserFile"
$browserVersion = (Get-Item (Get-ItemProperty $registryKey)."(Default)").VersionInfo.FileVersion $browserVersion = (Get-Item (Get-ItemProperty $registryKey)."(Default)").VersionInfo.FileVersion
return "$browserName $browserVersion" return [ToolVersionNode]::new($browserName, $browserVersion)
} }
function Get-SeleniumWebDriverVersion { function Get-SeleniumWebDriverVersion {
@@ -51,13 +64,13 @@ function Get-SeleniumWebDriverVersion {
$driverPath = $webDrivers.$Driver.Path $driverPath = $webDrivers.$Driver.Path
$versionFileName = "versioninfo.txt"; $versionFileName = "versioninfo.txt";
$webDriverVersion = Get-Content -Path "$driverPath\$versionFileName" $webDriverVersion = Get-Content -Path "$driverPath\$versionFileName"
return "$driverName $webDriverVersion" return [ToolVersionNode]::new($driverName, $webDriverVersion)
} }
function Get-SeleniumVersion { function Get-SeleniumVersion {
$seleniumBinaryName = (Get-ToolsetContent).selenium.binary_name $seleniumBinaryName = (Get-ToolsetContent).selenium.binary_name
$fullSeleniumVersion = (Get-ChildItem "C:\selenium\${seleniumBinaryName}-*").Name -replace "${seleniumBinaryName}-" $fullSeleniumVersion = (Get-ChildItem "C:\selenium\${seleniumBinaryName}-*").Name -replace "${seleniumBinaryName}-"
return "Selenium server $fullSeleniumVersion" return [ToolVersionNode]::new("Selenium server", $fullSeleniumVersion)
} }
function Build-BrowserWebdriversEnvironmentTable { function Build-BrowserWebdriversEnvironmentTable {

View File

@@ -30,22 +30,11 @@ function Get-ToolcachePyPyVersions {
function Build-CachedToolsSection function Build-CachedToolsSection
{ {
$output = "" return @(
[ToolVersionsListNode]::new("Go", $(Get-ToolcacheGoVersions), '^\d+\.\d+', 'List'),
$output += New-MDHeader "Go" -Level 4 [ToolVersionsListNode]::new("Node.js", $(Get-ToolcacheNodeVersions), '^\d+', 'List'),
$output += New-MDList -Lines (Get-ToolcacheGoVersions) -Style Unordered [ToolVersionsListNode]::new("Python", $(Get-ToolcachePythonVersions), '^\d+\.\d+', 'List'),
[ToolVersionsListNode]::new("PyPy", $(Get-ToolcachePyPyVersions), '^\d+\.\d+', 'List'),
$output += New-MDHeader "Node.js" -Level 4 [ToolVersionsListNode]::new("Ruby", $(Get-ToolcacheRubyVersions), '^\d+\.\d+', 'List')
$output += New-MDList -Lines (Get-ToolcacheNodeVersions) -Style Unordered )
$output += New-MDHeader "Python" -Level 4
$output += New-MDList -Lines (Get-ToolcachePythonVersions) -Style Unordered
$output += New-MDHeader "PyPy" -Level 4
$output += New-MDList -Lines (Get-ToolcachePyPyVersions) -Style Unordered
$output += New-MDHeader "Ruby" -Level 4
$output += New-MDList -Lines (Get-ToolcacheRubyVersions) -Style Unordered
return $output
} }

View File

@@ -11,16 +11,22 @@ function Get-OSName {
function Get-OSVersion { function Get-OSVersion {
$OSVersion = (Get-CimInstance -ClassName Win32_OperatingSystem).Version $OSVersion = (Get-CimInstance -ClassName Win32_OperatingSystem).Version
$OSBuild = (Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion' UBR).UBR $OSBuild = (Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion' UBR).UBR
return "OS Version: $OSVersion Build $OSBuild" return "$OSVersion Build $OSBuild"
}
function Build-OSInfoSection {
$osInfoNode = [HeaderNode]::new($(Get-OSName))
$osInfoNode.AddToolVersion("OS Version:", $(Get-OSVersion))
$osInfoNode.AddToolVersion("Image Version:", $env:IMAGE_VERSION)
return $osInfoNode
} }
function Get-BashVersion { function Get-BashVersion {
$version = bash --% -c 'echo ${BASH_VERSION}' $version = bash --% -c 'echo ${BASH_VERSION}'
return "Bash $version" return $version
} }
function Get-RustVersion { function Get-RustVersion {
Initialize-RustEnvironment
$rustVersion = [regex]::matches($(rustc --version), "\d+\.\d+\.\d+").Value $rustVersion = [regex]::matches($(rustc --version), "\d+\.\d+\.\d+").Value
return $rustVersion return $rustVersion
} }
@@ -52,145 +58,144 @@ function Get-RustClippyVersion {
} }
function Get-BindgenVersion { function Get-BindgenVersion {
return bindgen --version return ((bindgen --version) -replace "^bindgen").Trim()
} }
function Get-CbindgenVersion { function Get-CbindgenVersion {
return cbindgen --version return ((cbindgen --version) -replace "^cbindgen").Trim()
} }
function Get-CargoAuditVersion { function Get-CargoAuditVersion {
return cargo-audit --version return ((cargo-audit --version) -replace "^cargo-audit").Trim()
} }
function Get-CargoOutdatedVersion { function Get-CargoOutdatedVersion {
return cargo outdated --version return ((cargo outdated --version) -replace "^cargo-outdated").Trim()
} }
function Get-PythonVersion { function Get-PythonVersion {
return & python --version return ((python --version) -replace "^Python").Trim()
} }
function Get-PowershellCoreVersion { function Get-PowershellCoreVersion {
return & pwsh --version return ((pwsh --version) -replace "^PowerShell").Trim()
} }
function Get-RubyVersion { function Get-RubyVersion {
$rubyVersion = $(ruby --version).split(" ")[1] $rubyVersion = $(ruby --version).split(" ")[1]
return "Ruby $rubyVersion" return $rubyVersion
} }
function Get-GoVersion { function Get-GoVersion {
$(go version) -match "go(?<version>\d+\.\d+\.\d+)" | Out-Null $(go version) -match "go(?<version>\d+\.\d+\.\d+)" | Out-Null
$goVersion = $Matches.Version $goVersion = $Matches.Version
return "Go $goVersion" return $goVersion
} }
function Get-KotlinVersion { function Get-KotlinVersion {
$kotlinVersion = $((cmd /c "kotlinc -version 2>&1") | Out-String).split(" ")[2] $kotlinVersion = $((cmd /c "kotlinc -version 2>&1") | Out-String).split(" ")[2]
return "Kotlin $kotlinVersion" return $kotlinVersion
} }
function Get-PHPVersion { function Get-PHPVersion {
($(php --version) | Out-String) -match "PHP (?<version>\d+\.\d+\.\d+)" | Out-Null ($(php --version) | Out-String) -match "PHP (?<version>\d+\.\d+\.\d+)" | Out-Null
$phpVersion = $Matches.Version $phpVersion = $Matches.Version
return "PHP $phpVersion" return $phpVersion
} }
function Get-JuliaVersion { function Get-JuliaVersion {
$juliaVersion = [regex]::matches($(julia --version), "\d+\.\d+\.\d+").Value $juliaVersion = [regex]::matches($(julia --version), "\d+\.\d+\.\d+").Value
return "Julia $juliaVersion" return $juliaVersion
} }
function Get-LLVMVersion { function Get-LLVMVersion {
$llvmVersion = [regex]::matches($(clang --version), "\d+\.\d+\.\d+").Value $llvmVersion = [regex]::matches($(clang --version), "\d+\.\d+\.\d+").Value
return "LLVM $llvmVersion" return $llvmVersion
} }
function Get-PerlVersion { function Get-PerlVersion {
($(perl --version) | Out-String) -match "\(v(?<version>\d+\.\d+\.\d+)\)" | Out-Null ($(perl --version) | Out-String) -match "\(v(?<version>\d+\.\d+\.\d+)\)" | Out-Null
$perlVersion = $Matches.Version $perlVersion = $Matches.Version
return "Perl $perlVersion" return $perlVersion
} }
function Get-NodeVersion { function Get-NodeVersion {
$nodeVersion = $(node --version).split("v")[1] $nodeVersion = $(node --version).split("v")[1]
return "Node $nodeVersion" return $nodeVersion
} }
function Get-ChocoVersion { function Get-ChocoVersion {
return "Chocolatey $(choco --version)" return $(choco --version)
} }
function Get-VcpkgVersion { function Get-VcpkgVersion {
$commitId = git -C "C:\vcpkg" rev-parse --short HEAD $commitId = git -C "C:\vcpkg" rev-parse --short HEAD
return "Vcpkg (build from commit $commitId)" return "(build from commit $commitId)"
} }
function Get-NPMVersion { function Get-NPMVersion {
return "NPM $(npm -version)" return $(npm -version)
} }
function Get-YarnVersion { function Get-YarnVersion {
return "Yarn $(yarn -version)" return $(yarn -version)
} }
function Get-RubyGemsVersion { function Get-RubyGemsVersion {
return "RubyGems $(gem --version)" return $(gem --version)
} }
function Get-HelmVersion { function Get-HelmVersion {
($(helm version --short) | Out-String) -match "v(?<version>\d+\.\d+\.\d+)" | Out-Null ($(helm version --short) | Out-String) -match "v(?<version>\d+\.\d+\.\d+)" | Out-Null
$helmVersion = $Matches.Version $helmVersion = $Matches.Version
return "Helm $helmVersion" return $helmVersion
} }
function Get-PipVersion { function Get-PipVersion {
($(pip --version) | Out-String) -match "(?<version>pip [\d\.]+) .+ (?<python>\(python [\d\.]+\))" | Out-Null ($(pip --version) | Out-String) -match "(?<version>pip [\d\.]+) .+ (?<python>\(python [\d\.]+\))" | Out-Null
$pipVersion = $Matches.Version $pipVersion = $Matches.Version
$pythonVersion = $Matches.Python $pythonVersion = $Matches.Python
return "$pipVersion $pythonVersion" return ("$pipVersion $pythonVersion" -replace "^pip").Trim()
} }
function Get-CondaVersion { function Get-CondaVersion {
$condaVersion = & "$env:CONDA\Scripts\conda.exe" --version $condaVersion = ((& "$env:CONDA\Scripts\conda.exe" --version) -replace "^conda").Trim()
return "Mini$condaVersion (pre-installed on the image but not added to PATH)" return "$condaVersion (pre-installed on the image but not added to PATH)"
} }
function Get-ComposerVersion { function Get-ComposerVersion {
composer --version | Take-Part -Part 0,2 composer --version | Take-Part -Part 2
} }
function Get-NugetVersion { function Get-NugetVersion {
(nuget help) -match "NuGet Version" -replace "Version: " return (((nuget help) -match "NuGet Version") -replace "NuGet Version:").Trim()
} }
function Get-AntVersion { function Get-AntVersion {
($(ant -version) | Out-String) -match "version (?<version>\d+\.\d+\.\d+)" | Out-Null ($(ant -version) | Out-String) -match "version (?<version>\d+\.\d+\.\d+)" | Out-Null
$antVersion = $Matches.Version $antVersion = $Matches.Version
return "Ant $antVersion" return $antVersion
} }
function Get-MavenVersion { function Get-MavenVersion {
($(mvn -version) | Out-String) -match "Apache Maven (?<version>\d+\.\d+\.\d+)" | Out-Null ($(mvn -version) | Out-String) -match "Apache Maven (?<version>\d+\.\d+\.\d+)" | Out-Null
$mavenVersion = $Matches.Version $mavenVersion = $Matches.Version
return "Maven $mavenVersion" return $mavenVersion
} }
function Get-GradleVersion { function Get-GradleVersion {
($(gradle -version) | Out-String) -match "Gradle (?<version>\d+\.\d+)" | Out-Null ($(gradle -version) | Out-String) -match "Gradle (?<version>\d+\.\d+)" | Out-Null
$gradleVersion = $Matches.Version $gradleVersion = $Matches.Version
return "Gradle $gradleVersion" return $gradleVersion
} }
function Get-SbtVersion { function Get-SbtVersion {
$sbtVersion = (sbt -version) -match "sbt script version:" -replace "script version: " return ((sbt -version) -match "sbt script version:" -replace "sbt script version:").Trim()
return "$sbtVersion"
} }
function Get-DotnetSdks { function Get-DotnetSdks {
$sdksRawList = dotnet --list-sdks $sdksRawList = dotnet --list-sdks
$sdkVersions = ($sdksRawList | Foreach-Object {$_.Split()[0]}) -join ', ' $sdkVersions = $sdksRawList | Foreach-Object {$_.Split()[0]}
$sdkPath = $sdksRawList[0].Split(' ', 2)[1] -replace '\[|]' $sdkPath = $sdksRawList[0].Split(' ', 2)[1] -replace '\[|]'
[PSCustomObject]@{ [PSCustomObject]@{
Versions = $sdkVersions Versions = $sdkVersions
@@ -205,7 +210,8 @@ function Get-DotnetTools {
$toolsList = @() $toolsList = @()
foreach ($dotnetTool in $dotnetTools) { foreach ($dotnetTool in $dotnetTools) {
$toolsList += $dotnetTool.name + " " + (Invoke-Expression $dotnetTool.getversion) $version = Invoke-Expression $dotnetTool.getversion
$toolsList += [ToolVersionNode]::new($dotnetTool.name, $version)
} }
return $toolsList return $toolsList
} }
@@ -214,7 +220,7 @@ function Get-DotnetRuntimes {
$runtimesRawList = dotnet --list-runtimes $runtimesRawList = dotnet --list-runtimes
$runtimesRawList | Group-Object {$_.Split()[0]} | ForEach-Object { $runtimesRawList | Group-Object {$_.Split()[0]} | ForEach-Object {
$runtimeName = $_.Name $runtimeName = $_.Name
$runtimeVersions = ($_.Group | Foreach-Object {$_.split()[1]}) -join ', ' $runtimeVersions = $_.Group | Foreach-Object {$_.split()[1]}
$runtimePath = $_.Group[0].Split(' ', 3)[2] -replace '\[|]' $runtimePath = $_.Group[0].Split(' ', 3)[2] -replace '\[|]'
[PSCustomObject]@{ [PSCustomObject]@{
"Runtime" = $runtimeName "Runtime" = $runtimeName
@@ -226,8 +232,7 @@ function Get-DotnetRuntimes {
function Get-DotnetFrameworkVersions { function Get-DotnetFrameworkVersions {
$path = "${env:ProgramFiles(x86)}\Microsoft SDKs\Windows\*\*\NETFX * Tools" $path = "${env:ProgramFiles(x86)}\Microsoft SDKs\Windows\*\*\NETFX * Tools"
$versions = Get-ChildItem -Path $path -Directory | ForEach-Object { $_.Name | Take-Part -Part 1 } return Get-ChildItem -Path $path -Directory | ForEach-Object { $_.Name | Take-Part -Part 1 }
$versions -join ', '
} }
function Get-PowerShellAzureModules { function Get-PowerShellAzureModules {
@@ -236,32 +241,32 @@ function Get-PowerShellAzureModules {
[Array] $azInstalledModules = Get-ChildItem -Path "C:\Modules\az_*" -Directory | ForEach-Object { $_.Name.Split("_")[1] } [Array] $azInstalledModules = Get-ChildItem -Path "C:\Modules\az_*" -Directory | ForEach-Object { $_.Name.Split("_")[1] }
if ($azInstalledModules.Count -gt 0) { if ($azInstalledModules.Count -gt 0) {
$result += "Az: $($azInstalledModules -join ', ')" $result += [ToolVersionsListNode]::new("Az", $($azInstalledModules), '^\d+\.\d+', "Inline")
} }
[Array] $azureInstalledModules = Get-ChildItem -Path "C:\Modules\azure_*" -Directory | ForEach-Object { $_.Name.Split("_")[1] } | ForEach-Object { if ($_ -eq $defaultAzureModuleVersion) { "$($_) (Default)" } else { $_ } } [Array] $azureInstalledModules = Get-ChildItem -Path "C:\Modules\azure_*" -Directory | ForEach-Object { $_.Name.Split("_")[1] } | ForEach-Object { if ($_ -eq $defaultAzureModuleVersion) { "$($_) (Default)" } else { $_ } }
if ($azureInstalledModules.Count -gt 0) { if ($azureInstalledModules.Count -gt 0) {
$result += "Azure: $($azureInstalledModules -join ', ')" $result += [ToolVersionsListNode]::new("Azure", $($azureInstalledModules), '^\d+\.\d+', "Inline")
} }
[Array] $azurermInstalledModules = Get-ChildItem -Path "C:\Modules\azurerm_*" -Directory | ForEach-Object { $_.Name.Split("_")[1] } | ForEach-Object { if ($_ -eq $defaultAzureModuleVersion) { "$($_) (Default)" } else { $_ } } [Array] $azurermInstalledModules = Get-ChildItem -Path "C:\Modules\azurerm_*" -Directory | ForEach-Object { $_.Name.Split("_")[1] } | ForEach-Object { if ($_ -eq $defaultAzureModuleVersion) { "$($_) (Default)" } else { $_ } }
if ($azurermInstalledModules.Count -gt 0) { if ($azurermInstalledModules.Count -gt 0) {
$result += "AzureRM: $($azurermInstalledModules -join ', ')" $result += [ToolVersionsListNode]::new("AzureRM", $($azurermInstalledModules), '^\d+\.\d+', "Inline")
} }
[Array] $azCachedModules = Get-ChildItem -Path "C:\Modules\az_*.zip" -File | ForEach-Object { $_.Name.Split("_")[1] } [Array] $azCachedModules = Get-ChildItem -Path "C:\Modules\az_*.zip" -File | ForEach-Object { $_.Name.Split("_")[1] }
if ($azCachedModules.Count -gt 0) { if ($azCachedModules.Count -gt 0) {
$result += "Az (Cached): $($azCachedModules -join ', ')" $result += [ToolVersionsListNode]::new("Az (Cached)", $($azCachedModules), '^\d+\.\d+', "Inline")
} }
[Array] $azureCachedModules = Get-ChildItem -Path "C:\Modules\azure_*.zip" -File | ForEach-Object { $_.Name.Split("_")[1] } [Array] $azureCachedModules = Get-ChildItem -Path "C:\Modules\azure_*.zip" -File | ForEach-Object { $_.Name.Split("_")[1] }
if ($azureCachedModules.Count -gt 0) { if ($azureCachedModules.Count -gt 0) {
$result += "Azure (Cached): $($azureCachedModules -join ', ')" $result += [ToolVersionsListNode]::new("Azure (Cached)", $($azureCachedModules), '^\d+\.\d+', "Inline")
} }
[Array] $azurermCachedModules = Get-ChildItem -Path "C:\Modules\azurerm_*.zip" -File | ForEach-Object { $_.Name.Split("_")[1] } [Array] $azurermCachedModules = Get-ChildItem -Path "C:\Modules\azurerm_*.zip" -File | ForEach-Object { $_.Name.Split("_")[1] }
if ($azurermCachedModules.Count -gt 0) { if ($azurermCachedModules.Count -gt 0) {
$result += "AzureRM: $($azurermCachedModules -join ', ')" $result += [ToolVersionsListNode]::new("AzureRM (Cached)", $($azurermCachedModules), '^\d+\.\d+', "Inline")
} }
return $result return $result
@@ -275,7 +280,7 @@ function Get-PowerShellModules {
$result += (Get-ToolsetContent).powershellModules.name | Sort-Object | ForEach-Object { $result += (Get-ToolsetContent).powershellModules.name | Sort-Object | ForEach-Object {
$moduleName = $_ $moduleName = $_
$moduleVersions = Get-Module -Name $moduleName -ListAvailable | Select-Object -ExpandProperty Version | Sort-Object -Unique $moduleVersions = Get-Module -Name $moduleName -ListAvailable | Select-Object -ExpandProperty Version | Sort-Object -Unique
return "$($moduleName): $($moduleVersions -join ', ')" return [ToolVersionsListNode]::new($moduleName, $moduleVersions, '^\d+', "Inline")
} }
return $result return $result
@@ -302,14 +307,13 @@ function Get-CachedDockerImagesTableData {
} }
function Get-ShellTarget { function Get-ShellTarget {
$shells = Get-ChildItem C:\shells -File | Select-Object Name, @{n="Target";e={ return Get-ChildItem C:\shells -File | Select-Object Name, @{n="Target";e={
if ($_.Name -eq "msys2bash.cmd") { if ($_.Name -eq "msys2bash.cmd") {
"C:\msys64\usr\bin\bash.exe" "C:\msys64\usr\bin\bash.exe"
} else { } else {
@($_.Target)[0] @($_.Target)[0]
} }
}} | Sort-Object Name }} | Sort-Object Name
$shells | New-MDTable -Columns ([ordered]@{Name = "left"; Target = "left";})
} }
function Get-PacmanVersion { function Get-PacmanVersion {
@@ -318,21 +322,21 @@ function Get-PacmanVersion {
$rawVersion = & $pacmanPath --version $rawVersion = & $pacmanPath --version
$rawVersion.Split([System.Environment]::NewLine)[1] -match "\d+\.\d+(\.\d+)?" | Out-Null $rawVersion.Split([System.Environment]::NewLine)[1] -match "\d+\.\d+(\.\d+)?" | Out-Null
$pacmanVersion = $matches[0] $pacmanVersion = $matches[0]
return "Pacman $pacmanVersion" return $pacmanVersion
} }
function Get-YAMLLintVersion { function Get-YAMLLintVersion {
yamllint --version return ((yamllint --version) -replace "^yamllint").Trim()
} }
function Get-BizTalkVersion { function Get-BizTalkVersion {
$bizTalkReg = Get-ItemProperty "HKLM:\SOFTWARE\WOW6432Node\Microsoft\BizTalk Server\3.0" $bizTalkReg = Get-ItemProperty "HKLM:\SOFTWARE\WOW6432Node\Microsoft\BizTalk Server\3.0"
return "$($bizTalkReg.ProductName) $($bizTalkReg.ProductVersion)" return [ToolVersionNode]::new($bizTalkReg.ProductName, $bizTalkReg.ProductVersion)
} }
function Get-PipxVersion { function Get-PipxVersion {
$pipxVersion = pipx --version $pipxVersion = pipx --version
return "Pipx $pipxVersion" return $pipxVersion
} }
function Build-PackageManagementEnvironmentTable { function Build-PackageManagementEnvironmentTable {

View File

@@ -1,13 +1,12 @@
function Get-PostgreSQLMarkdown function Get-PostgreSQLTable
{ {
$name = "PostgreSQL"
$pgService = Get-CimInstance Win32_Service -Filter "Name LIKE 'postgresql-%'" $pgService = Get-CimInstance Win32_Service -Filter "Name LIKE 'postgresql-%'"
$pgPath = $pgService.PathName $pgPath = $pgService.PathName
$pgRoot = $pgPath.split('"')[1].replace("\bin\pg_ctl.exe", "") $pgRoot = $pgPath.split('"')[1].replace("\bin\pg_ctl.exe", "")
$env:Path += ";${env:PGBIN}" $env:Path += ";${env:PGBIN}"
$pgVersion = (postgres --version).split()[2].Trim() $pgVersion = (postgres --version).split()[2].Trim()
$content = @( return @(
[PSCustomObject]@{ Property = "ServiceName"; Value = $pgService.Name }, [PSCustomObject]@{ Property = "ServiceName"; Value = $pgService.Name },
[PSCustomObject]@{ Property = "Version"; Value = $pgVersion }, [PSCustomObject]@{ Property = "Version"; Value = $pgVersion },
[PSCustomObject]@{ Property = "ServiceStatus"; Value = $pgService.State }, [PSCustomObject]@{ Property = "ServiceStatus"; Value = $pgService.State },
@@ -16,29 +15,18 @@ function Get-PostgreSQLMarkdown
[PSCustomObject]@{ Property = "Path"; Value = $pgRoot }, [PSCustomObject]@{ Property = "Path"; Value = $pgRoot },
[PSCustomObject]@{ Property = "UserName"; Value = $env:PGUSER }, [PSCustomObject]@{ Property = "UserName"; Value = $env:PGUSER },
[PSCustomObject]@{ Property = "Password"; Value = $env:PGPASSWORD } [PSCustomObject]@{ Property = "Password"; Value = $env:PGPASSWORD }
) | New-MDTable )
Build-MarkdownElement -Head $name -Content $content
} }
function Get-MongoDBMarkdown function Get-MongoDBTable
{ {
$name = "MongoDB" $name = "MongoDB"
$mongoService = Get-Service -Name $name $mongoService = Get-Service -Name $name
$mongoVersion = (Get-Command -Name 'mongo').Version.ToString() $mongoVersion = (Get-Command -Name 'mongo').Version.ToString()
$content = [PSCustomObject]@{ return [PSCustomObject]@{
Version = $mongoVersion Version = $mongoVersion
ServiceName = $name ServiceName = $name
ServiceStatus = $mongoService.Status ServiceStatus = $mongoService.Status
ServiceStartType = $mongoService.StartType ServiceStartType = $mongoService.StartType
} | New-MDTable }
Build-MarkdownElement -Head $name -Content $content
} }
function Build-DatabasesMarkdown
{
$markdown = ""
$markdown += Get-PostgreSQLMarkdown
$markdown += Get-MongoDBMarkdown
$markdown
}

View File

@@ -1,9 +1,11 @@
using module ./software-report-base/SoftwareReport.psm1
using module ./software-report-base/SoftwareReport.Nodes.psm1
$global:ErrorActionPreference = "Stop" $global:ErrorActionPreference = "Stop"
$global:ProgressPreference = "SilentlyContinue" $global:ProgressPreference = "SilentlyContinue"
$ErrorView = "NormalView" $ErrorView = "NormalView"
Set-StrictMode -Version Latest Set-StrictMode -Version Latest
Import-Module MarkdownPS
Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Android.psm1") -DisableNameChecking Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Android.psm1") -DisableNameChecking
Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Browsers.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.CachedTools.psm1") -DisableNameChecking
@@ -15,279 +17,222 @@ Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Java.psm1") -DisableNameC
Import-Module (Join-Path $PSScriptRoot "SoftwareReport.WebServers.psm1") -DisableNameChecking Import-Module (Join-Path $PSScriptRoot "SoftwareReport.WebServers.psm1") -DisableNameChecking
Import-Module (Join-Path $PSScriptRoot "SoftwareReport.VisualStudio.psm1") -DisableNameChecking Import-Module (Join-Path $PSScriptRoot "SoftwareReport.VisualStudio.psm1") -DisableNameChecking
$markdown = "" # Software report
$softwareReport = [SoftwareReport]::new($(Build-OSInfoSection))
$optionalFeatures = $softwareReport.Root.AddHeader("Windows features")
$optionalFeatures.AddToolVersion("Windows Subsystem for Linux (WSLv1):", "Enabled")
$installedSoftware = $softwareReport.Root.AddHeader("Installed Software")
$OSName = Get-OSName # Language and Runtime
$markdown += New-MDHeader "$OSName" -Level 1 $languageAndRuntime = $installedSoftware.AddHeader("Language and Runtime")
$languageAndRuntime.AddToolVersion("Bash", $(Get-BashVersion))
$languageAndRuntime.AddToolVersion("Go", $(Get-GoVersion))
$languageAndRuntime.AddToolVersion("Julia", $(Get-JuliaVersion))
$languageAndRuntime.AddToolVersion("Kotlin", $(Get-KotlinVersion))
$languageAndRuntime.AddToolVersion("LLVM", $(Get-LLVMVersion))
$languageAndRuntime.AddToolVersion("Node", $(Get-NodeVersion))
$languageAndRuntime.AddToolVersion("Perl", $(Get-PerlVersion))
$languageAndRuntime.AddToolVersion("PHP", $(Get-PHPVersion))
$languageAndRuntime.AddToolVersion("Python", $(Get-PythonVersion))
$languageAndRuntime.AddToolVersion("Ruby", $(Get-RubyVersion))
$OSVersion = Get-OSVersion # Package Management
$markdown += New-MDList -Style Unordered -Lines @( $packageManagement = $installedSoftware.AddHeader("Package Management")
"$OSVersion" $packageManagement.AddToolVersion("Chocolatey", $(Get-ChocoVersion))
"Image Version: $env:IMAGE_VERSION" $packageManagement.AddToolVersion("Composer", $(Get-ComposerVersion))
) $packageManagement.AddToolVersion("Helm", $(Get-HelmVersion))
$packageManagement.AddToolVersion("Miniconda", $(Get-CondaVersion))
$packageManagement.AddToolVersion("NPM", $(Get-NPMVersion))
$packageManagement.AddToolVersion("NuGet", $(Get-NugetVersion))
$packageManagement.AddToolVersion("pip", $(Get-PipVersion))
$packageManagement.AddToolVersion("Pipx", $(Get-PipxVersion))
$packageManagement.AddToolVersion("RubyGems", $(Get-RubyGemsVersion))
$packageManagement.AddToolVersion("Vcpkg", $(Get-VcpkgVersion))
$packageManagement.AddToolVersion("Yarn", $(Get-YarnVersion))
$markdown += New-MDHeader "Windows features" -Level 2 $packageManagement.AddHeader("Environment variables").AddTable($(Build-PackageManagementEnvironmentTable))
$markdown += New-MDList -Style Unordered -Lines @(
"Windows Subsystem for Linux (WSLv1): Enabled"
)
$markdown += New-MDHeader "Installed Software" -Level 2 # Project Management
$markdown += New-MDHeader "Language and Runtime" -Level 3 $projectManagement = $installedSoftware.AddHeader("Project Management")
$languageTools = @( $projectManagement.AddToolVersion("Ant", $(Get-AntVersion))
(Get-BashVersion), $projectManagement.AddToolVersion("Gradle", $(Get-GradleVersion))
(Get-GoVersion), $projectManagement.AddToolVersion("Maven", $(Get-MavenVersion))
(Get-JuliaVersion), $projectManagement.AddToolVersion("sbt", $(Get-SbtVersion))
(Get-LLVMVersion),
(Get-NodeVersion),
(Get-PerlVersion)
(Get-PHPVersion),
(Get-PythonVersion),
(Get-RubyVersion),
(Get-KotlinVersion)
)
$markdown += New-MDList -Style Unordered -Lines ($languageTools | Sort-Object)
$packageManagementList = @( # Tools
(Get-ChocoVersion), $tools = $installedSoftware.AddHeader("Tools")
(Get-CondaVersion), $tools.AddToolVersion("7zip", $(Get-7zipVersion))
(Get-ComposerVersion), $tools.AddToolVersion("aria2", $(Get-Aria2Version))
(Get-HelmVersion), $tools.AddToolVersion("azcopy", $(Get-AzCopyVersion))
(Get-NPMVersion), $tools.AddToolVersion("Bazel", $(Get-BazelVersion))
(Get-NugetVersion), $tools.AddToolVersion("Bazelisk", $(Get-BazeliskVersion))
(Get-PipxVersion), $tools.AddToolVersion("Bicep", $(Get-BicepVersion))
(Get-PipVersion), $tools.AddToolVersion("Cabal", $(Get-CabalVersion))
(Get-RubyGemsVersion), $tools.AddToolVersion("CMake", $(Get-CMakeVersion))
(Get-VcpkgVersion), $tools.AddToolVersion("CodeQL Action Bundle", $(Get-CodeQLBundleVersion))
(Get-YarnVersion) $tools.AddToolVersion("Docker", $(Get-DockerVersion))
) $tools.AddToolVersion("Docker Compose v1", $(Get-DockerComposeVersion))
$tools.AddToolVersion("Docker Compose v2", $(Get-DockerComposeVersionV2))
$markdown += New-MDHeader "Package Management" -Level 3 $tools.AddToolVersion("Docker-wincred", $(Get-DockerWincredVersion))
$markdown += New-MDList -Style Unordered -Lines ($packageManagementList | Sort-Object) $tools.AddToolVersion("ghc", $(Get-GHCVersion))
$tools.AddToolVersion("Git", $(Get-GitVersion))
$markdown += New-MDHeader "Environment variables" -Level 4 $tools.AddToolVersion("Git LFS", $(Get-GitLFSVersion))
$markdown += Build-PackageManagementEnvironmentTable | New-MDTable
$markdown += New-MDNewLine
$markdown += New-MDHeader "Project Management" -Level 3
$projectManagementTools = @(
(Get-AntVersion),
(Get-GradleVersion),
(Get-MavenVersion),
(Get-SbtVersion)
)
$markdown += New-MDList -Style Unordered -Lines ($projectManagementTools | Sort-Object)
$markdown += New-MDHeader "Tools" -Level 3
$toolsList = @(
(Get-7zipVersion),
(Get-Aria2Version),
(Get-AzCopyVersion),
(Get-BazelVersion),
(Get-BazeliskVersion),
(Get-BicepVersion),
(Get-CabalVersion),
(Get-CMakeVersion),
(Get-CodeQLBundleVersion),
(Get-DockerVersion),
(Get-DockerComposeVersion),
(Get-DockerComposeVersionV2),
(Get-DockerWincredVersion),
(Get-GHCVersion),
(Get-GitVersion),
(Get-GitLFSVersion),
(Get-InnoSetupVersion),
(Get-JQVersion),
(Get-KindVersion),
(Get-KubectlVersion),
(Get-MercurialVersion),
(Get-MinGWVersion),
(Get-NewmanVersion),
(Get-NSISVersion),
(Get-OpenSSLVersion),
(Get-PackerVersion),
(Get-PulumiVersion),
(Get-RVersion),
(Get-ServiceFabricSDKVersion),
(Get-StackVersion),
(Get-SVNVersion),
(Get-VSWhereVersion),
(Get-SwigVersion),
(Get-WinAppDriver),
(Get-WixVersion),
(Get-ZstdVersion),
(Get-YAMLLintVersion),
(Get-ImageMagickVersion)
)
if (Test-IsWin19) { if (Test-IsWin19) {
$toolsList += @( $tools.AddToolVersion("Google Cloud SDK", $(Get-GoogleCloudSDKVersion))
(Get-GoogleCloudSDKVersion),
(Get-ParcelVersion)
)
} }
$markdown += New-MDList -Style Unordered -Lines ($toolsList | Sort-Object) $tools.AddToolVersion("ImageMagick", $(Get-ImageMagickVersion))
$tools.AddToolVersion("InnoSetup", $(Get-InnoSetupVersion))
$markdown += New-MDHeader "CLI Tools" -Level 3 $tools.AddToolVersion("jq", $(Get-JQVersion))
$cliTools = @( $tools.AddToolVersion("Kind", $(Get-KindVersion))
(Get-AlibabaCLIVersion), $tools.AddToolVersion("Kubectl", $(Get-KubectlVersion))
(Get-AWSCLIVersion), $tools.AddToolVersion("Mercurial", $(Get-MercurialVersion))
(Get-AWSSAMVersion), $tools.AddToolVersion("Mingw-w64", $(Get-MinGWVersion))
(Get-AWSSessionManagerVersion), $tools.AddToolVersion("Newman", $(Get-NewmanVersion))
(Get-AzureCLIVersion), $tools.AddToolVersion("NSIS", $(Get-NSISVersion))
(Get-AzureDevopsExtVersion), $tools.AddToolVersion("OpenSSL", $(Get-OpenSSLVersion))
(Get-GHVersion), $tools.AddToolVersion("Packer", $(Get-PackerVersion))
(Get-HubVersion)
)
if (Test-IsWin19) { if (Test-IsWin19) {
$cliTools += @( $tools.AddToolVersion("Parcel", $(Get-ParcelVersion))
(Get-CloudFoundryVersion)
)
} }
$markdown += New-MDList -Style Unordered -Lines ($cliTools | Sort-Object) $tools.AddToolVersion("Pulumi", $(Get-PulumiVersion))
$tools.AddToolVersion("R", $(Get-RVersion))
$tools.AddToolVersion("Service Fabric SDK", $(Get-ServiceFabricSDKVersion))
$tools.AddToolVersion("Stack", $(Get-StackVersion))
$tools.AddToolVersion("Subversion (SVN)", $(Get-SVNVersion))
$tools.AddToolVersion("Swig", $(Get-SwigVersion))
$tools.AddToolVersion("VSWhere", $(Get-VSWhereVersion))
$tools.AddToolVersion("WinAppDriver", $(Get-WinAppDriver))
$tools.AddToolVersion("WiX Toolset", $(Get-WixVersion))
$tools.AddToolVersion("yamllint", $(Get-YAMLLintVersion))
$tools.AddToolVersion("zstd", $(Get-ZstdVersion))
$markdown += New-MDHeader "Rust Tools" -Level 3 # CLI Tools
$markdown += New-MDList -Style Unordered -Lines (@( $cliTools = $installedSoftware.AddHeader("CLI Tools")
"Rust $(Get-RustVersion)", $cliTools.AddToolVersion("Alibaba Cloud CLI", $(Get-AlibabaCLIVersion))
"Rustup $(Get-RustupVersion)", $cliTools.AddToolVersion("AWS CLI", $(Get-AWSCLIVersion))
"Cargo $(Get-RustCargoVersion)", $cliTools.AddToolVersion("AWS SAM CLI", $(Get-AWSSAMVersion))
"Rustdoc $(Get-RustdocVersion)" $cliTools.AddToolVersion("AWS Session Manager CLI", $(Get-AWSSessionManagerVersion))
) | Sort-Object $cliTools.AddToolVersion("Azure CLI", $(Get-AzureCLIVersion))
) $cliTools.AddToolVersion("Azure DevOps CLI extension", $(Get-AzureDevopsExtVersion))
if (Test-IsWin19) {
$cliTools.AddToolVersion("Cloud Foundry CLI", $(Get-CloudFoundryVersion))
}
$cliTools.AddToolVersion("GitHub CLI", $(Get-GHVersion))
$cliTools.AddToolVersion("Hub CLI", $(Get-HubVersion))
$markdown += New-MDHeader "Packages" -Level 4 # Rust Tools
$markdown += New-MDList -Style Unordered -Lines (@( Initialize-RustEnvironment
(Get-BindgenVersion), $rustTools = $installedSoftware.AddHeader("Rust Tools")
(Get-CargoAuditVersion), $rustTools.AddToolVersion("Cargo", $(Get-RustCargoVersion))
(Get-CargoOutdatedVersion), $rustTools.AddToolVersion("Rust", $(Get-RustVersion))
(Get-CbindgenVersion), $rustTools.AddToolVersion("Rustdoc", $(Get-RustdocVersion))
"Rustfmt $(Get-RustfmtVersion)", $rustTools.AddToolVersion("Rustup", $(Get-RustupVersion))
"Clippy $(Get-RustClippyVersion)"
) | Sort-Object
)
$markdown += New-MDHeader "Browsers and Drivers" -Level 3 $rustToolsPackages = $rustTools.AddHeader("Packages")
$markdown += New-MDList -Style Unordered -Lines @( $rustToolsPackages.AddToolVersion("bindgen", $(Get-BindgenVersion))
(Get-BrowserVersion -Browser "chrome"), $rustToolsPackages.AddToolVersion("cargo-audit", $(Get-CargoAuditVersion))
(Get-SeleniumWebDriverVersion -Driver "chrome"), $rustToolsPackages.AddToolVersion("cargo-outdated", $(Get-CargoOutdatedVersion))
(Get-BrowserVersion -Browser "edge"), $rustToolsPackages.AddToolVersion("cbindgen", $(Get-CbindgenVersion))
(Get-SeleniumWebDriverVersion -Driver "edge"), $rustToolsPackages.AddToolVersion("Clippy", $(Get-RustClippyVersion))
(Get-BrowserVersion -Browser "firefox"), $rustToolsPackages.AddToolVersion("Rustfmt", $(Get-RustfmtVersion))
(Get-SeleniumWebDriverVersion -Driver "firefox"),
(Get-SeleniumWebDriverVersion -Driver "iexplorer"),
(Get-SeleniumVersion)
)
$markdown += New-MDHeader "Environment variables" -Level 4 # Browsers and Drivers
$markdown += Build-BrowserWebdriversEnvironmentTable | New-MDTable $browsersAndWebdrivers = $installedSoftware.AddHeader("Browsers and Drivers")
$markdown += New-MDNewLine $browsersAndWebdrivers.AddNodes($(Build-BrowserSection))
$browsersAndWebdrivers.AddHeader("Environment variables").AddTable($(Build-BrowserWebdriversEnvironmentTable))
$markdown += New-MDHeader "Java" -Level 3 # Java
$markdown += Get-JavaVersions | New-MDTable $installedSoftware.AddHeader("Java").AddTable($(Get-JavaVersions))
$markdown += New-MDNewLine
$markdown += New-MDHeader "Shells" -Level 3 # Shells
$markdown += Get-ShellTarget $installedSoftware.AddHeader("Shells").AddTable($(Get-ShellTarget))
$markdown += New-MDNewLine
$markdown += New-MDHeader "MSYS2" -Level 3 # MSYS2
$markdown += "$(Get-PacmanVersion)" | New-MDList -Style Unordered $msys2 = $installedSoftware.AddHeader("MSYS2")
$markdown += New-MDHeader "Notes:" -Level 5 $msys2.AddToolVersion("Pacman", $(Get-PacmanVersion))
$reportMsys64 = @'
``` $notes = @'
Location: C:\msys64 Location: C:\msys64
Note: MSYS2 is pre-installed on image but not added to PATH. Note: MSYS2 is pre-installed on image but not added to PATH.
```
'@ '@
$markdown += New-MDParagraph -Lines $reportMsys64 $msys2.AddHeader("Notes").AddNote($notes)
# BizTalk Server
if (Test-IsWin19) if (Test-IsWin19)
{ {
$markdown += New-MDHeader "BizTalk Server" -Level 3 $installedSoftware.AddHeader("BizTalk Server").AddNode($(Get-BizTalkVersion))
$markdown += "$(Get-BizTalkVersion)" | New-MDList -Style Unordered
} }
$markdown += New-MDHeader "Cached Tools" -Level 3 # Cached Tools
$markdown += (Build-CachedToolsSection) $installedSoftware.AddHeader("Cached Tools").AddNodes($(Build-CachedToolsSection))
$markdown += New-MDHeader "Databases" -Level 3 # Databases
$markdown += Build-DatabasesMarkdown $databases = $installedSoftware.AddHeader("Databases")
$databases.AddHeader("PostgreSQL").AddTable($(Get-PostgreSQLTable))
$databases.AddHeader("MongoDB").AddTable($(Get-MongoDBTable))
$markdown += New-MDHeader "Database tools" -Level 3 # Database tools
$databaseTools = @( $databaseTools = $installedSoftware.AddHeader("Database tools")
(Get-AzCosmosDBEmulatorVersion), $databaseTools.AddToolVersion("Azure CosmosDb Emulator", $(Get-AzCosmosDBEmulatorVersion))
(Get-DacFxVersion), $databaseTools.AddToolVersion("DacFx", $(Get-DacFxVersion))
(Get-MySQLVersion), $databaseTools.AddToolVersion("MySQL", $(Get-MySQLVersion))
(Get-SQLPSVersion), $databaseTools.AddToolVersion("SQL OLEDB Driver", $(Get-SQLOLEDBDriverVersion))
(Get-SQLOLEDBDriverVersion) $databaseTools.AddToolVersion("SQLPS", $(Get-SQLPSVersion))
)
$markdown += New-MDList -Style Unordered -Lines ($databaseTools | Sort-Object) # Web Servers
$installedSoftware.AddHeader("Web Servers").AddTable($(Build-WebServersSection))
$markdown += Build-WebServersSection # Visual Studio
$vsTable = Get-VisualStudioVersion
$visualStudio = $installedSoftware.AddHeader($vsTable.Name)
$visualStudio.AddTable($vsTable)
$vs = Get-VisualStudioVersion $workloads = $visualStudio.AddHeader("Workloads, components and extensions")
$markdown += New-MDHeader "$($vs.Name)" -Level 3 $workloads.AddTable((Get-VisualStudioComponents) + (Get-VisualStudioExtensions))
$markdown += $vs | New-MDTable
$markdown += New-MDNewLine
$markdown += New-MDHeader "Workloads, components and extensions:" -Level 4 $msVisualCpp = $visualStudio.AddHeader("Microsoft Visual C++")
$markdown += ((Get-VisualStudioComponents) + (Get-VisualStudioExtensions)) | New-MDTable $msVisualCpp.AddTable($(Get-VisualCPPComponents))
$markdown += New-MDNewLine
$markdown += New-MDHeader "Microsoft Visual C++:" -Level 4 $visualStudio.AddToolVersionsList("Installed Windows SDKs", $(Get-WindowsSDKs).Versions, '^.+')
$markdown += Get-VisualCPPComponents | New-MDTable
$markdown += New-MDNewLine
$markdown += New-MDHeader "Installed Windows SDKs" -Level 4 # .NET Core Tools
$sdk = Get-WindowsSDKs $netCoreTools = $installedSoftware.AddHeader(".NET Core Tools")
$markdown += New-MDNewLine if (Test-IsWin19) {
$markdown += New-MDList -Lines $sdk.Versions -Style Unordered # Visual Studio 2019 brings own version of .NET Core which is different from latest official version
$netCoreTools.AddToolVersionsListInline(".NET Core SDK", $(Get-DotnetSdks).Versions, '^\d+\.\d+\.\d{2}')
$markdown += New-MDHeader ".NET Core Tools" -Level 3 } else {
$dotnetSdk = Get-DotnetSdks $netCoreTools.AddToolVersionsListInline(".NET Core SDK", $(Get-DotnetSdks).Versions, '^\d+\.\d+\.\d')
$dotnetFrameworkVersions = Get-DotnetFrameworkVersions
$dotnetTools = @(
".NET Core SDK: $($dotnetSdk.Versions)",
".NET Framework: $($dotnetFrameworkVersions)"
)
$dotnetTools += Get-DotnetRuntimes | ForEach-Object {
"$($_.Runtime): $($_.Versions)"
} }
$dotnetTools += Get-DotnetTools $netCoreTools.AddToolVersionsListInline(".NET Framework", $(Get-DotnetFrameworkVersions), '^.+')
$markdown += New-MDList -Style Unordered -Lines $dotnetTools Get-DotnetRuntimes | ForEach-Object {
$netCoreTools.AddToolVersionsListInline($_.Runtime, $_.Versions, '^.+')
}
$netCoreTools.AddNodes($(Get-DotnetTools))
# PowerShell Tools # PowerShell Tools
$markdown += New-MDHeader "PowerShell Tools" -Level 3 $psTools = $installedSoftware.AddHeader("PowerShell Tools")
$markdown += New-MDList -Lines (Get-PowershellCoreVersion) -Style Unordered $psTools.AddToolVersion("PowerShell", $(Get-PowershellCoreVersion))
$markdown += New-MDHeader "Powershell Modules" -Level 4 $psModules = $psTools.AddHeader("Powershell Modules")
$markdown += New-MDList -Lines $(Get-PowerShellModules) -Style Unordered $psModules.AddNodes($(Get-PowerShellModules))
$reportAzPwsh = @'
``` $azPsNotes = @'
Azure PowerShell module 2.1.0 and AzureRM PowerShell module 2.1.0 are installed Azure PowerShell module 2.1.0 and AzureRM PowerShell module 2.1.0 are installed
and are available via 'Get-Module -ListAvailable'. and are available via 'Get-Module -ListAvailable'.
All other versions are saved but not installed. All other versions are saved but not installed.
```
'@ '@
$markdown += New-MDParagraph -Lines $reportAzPwsh $psModules.AddNote($azPsNotes)
# Android
$android = $installedSoftware.AddHeader("Android")
$android.AddTable($(Build-AndroidTable))
# Android section $android.AddHeader("Environment variables").AddTable($(Build-AndroidEnvironmentTable))
$markdown += New-MDHeader "Android" -Level 3
$markdown += Build-AndroidTable | New-MDTable
$markdown += New-MDNewLine
$markdown += New-MDHeader "Environment variables" -Level 4
$markdown += Build-AndroidEnvironmentTable | New-MDTable
$markdown += New-MDNewLine
# Docker images section # Cached Docker images
$cachedImages = Get-CachedDockerImagesTableData $installedSoftware.AddHeader("Cached Docker images").AddTable($(Get-CachedDockerImagesTableData))
if ($cachedImages) {
$markdown += New-MDHeader "Cached Docker images" -Level 3
$markdown += $cachedImages | New-MDTable
}
Test-BlankElement -Markdown $markdown # Generate reports
$markdown | Out-File -FilePath "C:\InstalledSoftware.md" $softwareReport.ToJson() | Out-File -FilePath "C:\software-report.json" -Encoding UTF8NoBOM
$softwareReport.ToMarkdown() | Out-File -FilePath "C:\software-report.md" -Encoding UTF8NoBOM

View File

@@ -1,101 +1,3 @@
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 -NoNewLine
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
# 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
}
function Get-LinkTarget { function Get-LinkTarget {
param ( param (
[string] $inputPath [string] $inputPath
@@ -115,53 +17,6 @@ function Get-PathWithLink {
return "${inputPath}${link}" return "${inputPath}${link}"
} }
function Test-BlankElement {
param(
[string] $Markdown
)
$splitByLines = $Markdown.Split("`n")
# Validate entry without version
$blankVersions = $splitByLines -match "^-" -notmatch "(OS|Image) Version|WSL|Vcpkg|Docker|\d\." | Out-String
# Validate tables with blank rows
$blankRows = ""
for($i = 0; $i -lt $splitByLines.Length; $i++) {
$addRows= $false
$table = @()
if ($splitByLines[$i].StartsWith("#") -and $splitByLines[$i+1].StartsWith("|")) {
$table += $splitByLines[$i,($i+1),($i+2)]
$i += 3
$current = $splitByLines[$i]
while ($current.StartsWith("|")) {
$isBlankRow = $current.Substring(1, $current.LastIndexOf("|") - 2).Split("|").Trim() -contains ""
if ($isBlankRow) {
$table += $current
$addRows = $true
}
$current = $splitByLines[++$i]
}
if ($addRows) {
$blankRows += $table | Out-String
}
}
}
# Display report
$isReport = $false
if ($blankVersions) {
Write-Host "Software list with blank version:`n${blankVersions}"
$isReport = $true
}
if ($blankRows) {
Write-Host "Tables with blank rows:`n${blankRows}"
$isReport = $true
}
if ($isReport) {
exit 1
}
}
function Take-Part { function Take-Part {
param ( param (
[Parameter(ValueFromPipeline)] [Parameter(ValueFromPipeline)]

View File

@@ -1,7 +1,7 @@
function Get-Aria2Version { function Get-Aria2Version {
(aria2c -v | Out-String) -match "(?<version>(\d+\.){1,}\d+)" | Out-Null (aria2c -v | Out-String) -match "(?<version>(\d+\.){1,}\d+)" | Out-Null
$aria2Version = $Matches.Version $aria2Version = $Matches.Version
return "aria2 $aria2Version" return $aria2Version
} }
function Get-AzCosmosDBEmulatorVersion { function Get-AzCosmosDBEmulatorVersion {
@@ -9,37 +9,37 @@ function Get-AzCosmosDBEmulatorVersion {
$installDir = $regKey.InstallLocation $installDir = $regKey.InstallLocation
$exeFilePath = Join-Path $installDir 'CosmosDB.Emulator.exe' $exeFilePath = Join-Path $installDir 'CosmosDB.Emulator.exe'
$version = (Get-Item $exeFilePath).VersionInfo.FileVersion $version = (Get-Item $exeFilePath).VersionInfo.FileVersion
return "Azure CosmosDb Emulator $version" return $version
} }
function Get-BazelVersion { function Get-BazelVersion {
((cmd /c "bazel --version 2>&1") | Out-String) -match "bazel (?<version>\d+\.\d+\.\d+)" | Out-Null ((cmd /c "bazel --version 2>&1") | Out-String) -match "bazel (?<version>\d+\.\d+\.\d+)" | Out-Null
$bazelVersion = $Matches.Version $bazelVersion = $Matches.Version
return "Bazel $bazelVersion" return $bazelVersion
} }
function Get-BazeliskVersion { function Get-BazeliskVersion {
((cmd /c "bazelisk version 2>&1") | Out-String) -match "Bazelisk version: v(?<version>\d+\.\d+\.\d+)" | Out-Null ((cmd /c "bazelisk version 2>&1") | Out-String) -match "Bazelisk version: v(?<version>\d+\.\d+\.\d+)" | Out-Null
$bazeliskVersion = $Matches.Version $bazeliskVersion = $Matches.Version
return "Bazelisk $bazeliskVersion" return $bazeliskVersion
} }
function Get-BicepVersion { function Get-BicepVersion {
(bicep --version | Out-String) -match "bicep cli version (?<version>\d+\.\d+\.\d+)" | Out-Null (bicep --version | Out-String) -match "bicep cli version (?<version>\d+\.\d+\.\d+)" | Out-Null
$bicepVersion = $Matches.Version $bicepVersion = $Matches.Version
return "Bicep $bicepVersion" return $bicepVersion
} }
function Get-RVersion { function Get-RVersion {
($(cmd /c "Rscript --version 2>&1") | Out-String) -match "Rscript .* version (?<version>\d+\.\d+\.\d+)" | Out-Null ($(cmd /c "Rscript --version 2>&1") | Out-String) -match "Rscript .* version (?<version>\d+\.\d+\.\d+)" | Out-Null
$rVersion = $Matches.Version $rVersion = $Matches.Version
return "R $rVersion" return $rVersion
} }
function Get-CMakeVersion { function Get-CMakeVersion {
($(cmake -version) | Out-String) -match "cmake version (?<version>\d+\.\d+\.\d+)" | Out-Null ($(cmake -version) | Out-String) -match "cmake version (?<version>\d+\.\d+\.\d+)" | Out-Null
$cmakeVersion = $Matches.Version $cmakeVersion = $Matches.Version
return "CMake $cmakeVersion" return $cmakeVersion
} }
function Get-CodeQLBundleVersion { function Get-CodeQLBundleVersion {
@@ -47,99 +47,100 @@ function Get-CodeQLBundleVersion {
$CodeQLVersionPath = Get-ChildItem $CodeQLVersionsWildcard | Select-Object -First 1 -Expand FullName $CodeQLVersionPath = Get-ChildItem $CodeQLVersionsWildcard | Select-Object -First 1 -Expand FullName
$CodeQLPath = Join-Path $CodeQLVersionPath -ChildPath "x64" | Join-Path -ChildPath "codeql" | Join-Path -ChildPath "codeql.exe" $CodeQLPath = Join-Path $CodeQLVersionPath -ChildPath "x64" | Join-Path -ChildPath "codeql" | Join-Path -ChildPath "codeql.exe"
$CodeQLVersion = & $CodeQLPath version --quiet $CodeQLVersion = & $CodeQLPath version --quiet
return "CodeQL Action Bundle $CodeQLVersion" return $CodeQLVersion
} }
function Get-DockerVersion { function Get-DockerVersion {
$dockerVersion = $(docker version --format "{{.Server.Version}}") $dockerVersion = $(docker version --format "{{.Server.Version}}")
return "Docker $dockerVersion" return $dockerVersion
} }
function Get-DockerComposeVersion { function Get-DockerComposeVersion {
$dockerComposeVersion = docker-compose version --short $dockerComposeVersion = docker-compose version --short
return "Docker Compose v1 $dockerComposeVersion" return $dockerComposeVersion
} }
function Get-DockerComposeVersionV2 { function Get-DockerComposeVersionV2 {
$dockerComposeVersion = docker compose version --short $dockerComposeVersion = docker compose version --short
return "Docker Compose v2 $dockerComposeVersion" return $dockerComposeVersion
} }
function Get-DockerWincredVersion { function Get-DockerWincredVersion {
$dockerCredVersion = docker-credential-wincred version | Take-Part -Part 2 | Take-Part -Part 0 -Delimiter "v" $dockerCredVersion = docker-credential-wincred version | Take-Part -Part 2 | Take-Part -Part 0 -Delimiter "v"
return "Docker-wincred $dockerCredVersion" return $dockerCredVersion
} }
function Get-GitVersion { function Get-GitVersion {
$gitVersion = git --version | Take-Part -Part -1 $gitVersion = git --version | Take-Part -Part -1
return "Git $gitVersion" return $gitVersion
} }
function Get-GitLFSVersion { function Get-GitLFSVersion {
$(git-lfs version) -match "git-lfs\/(?<version>\d+\.\d+\.\d+)" | Out-Null $(git-lfs version) -match "git-lfs\/(?<version>\d+\.\d+\.\d+)" | Out-Null
$gitLfsVersion = $Matches.Version $gitLfsVersion = $Matches.Version
return "Git LFS $gitLfsVersion" return $gitLfsVersion
} }
function Get-InnoSetupVersion { function Get-InnoSetupVersion {
return $(choco list --local-only innosetup) | Select-String -Pattern "InnoSetup" $innoSetupVersion = $(choco list --local-only innosetup) | Select-String -Pattern "InnoSetup"
return ($innoSetupVersion -replace "^InnoSetup").Trim()
} }
function Get-JQVersion { function Get-JQVersion {
$jqVersion = ($(jq --version) -Split "jq-")[1] $jqVersion = ($(jq --version) -Split "jq-")[1]
return "jq $jqVersion" return $jqVersion
} }
function Get-KubectlVersion { function Get-KubectlVersion {
$kubectlVersion = (kubectl version --client --output=json | ConvertFrom-Json).clientVersion.gitVersion.Replace('v','') $kubectlVersion = (kubectl version --client --output=json | ConvertFrom-Json).clientVersion.gitVersion.Replace('v','')
return "Kubectl $kubectlVersion" return $kubectlVersion
} }
function Get-KindVersion { function Get-KindVersion {
$(kind version) -match "kind v(?<version>\d+\.\d+\.\d+)" | Out-Null $(kind version) -match "kind v(?<version>\d+\.\d+\.\d+)" | Out-Null
$kindVersion = $Matches.Version $kindVersion = $Matches.Version
return "Kind $kindVersion" return $kindVersion
} }
function Get-MinGWVersion { function Get-MinGWVersion {
(gcc --version | Select-String -Pattern "MinGW-W64") -match "(?<version>\d+\.\d+\.\d+)" | Out-Null (gcc --version | Select-String -Pattern "MinGW-W64") -match "(?<version>\d+\.\d+\.\d+)" | Out-Null
$mingwVersion = $Matches.Version $mingwVersion = $Matches.Version
return "Mingw-w64 $mingwVersion" return $mingwVersion
} }
function Get-MySQLVersion { function Get-MySQLVersion {
$mysqlCommand = Get-Command -Name "mysql" $mysqlCommand = Get-Command -Name "mysql"
$mysqlVersion = $mysqlCommand.Version.ToString() $mysqlVersion = $mysqlCommand.Version.ToString()
return "MySQL $mysqlVersion" return $mysqlVersion
} }
function Get-SQLOLEDBDriverVersion { function Get-SQLOLEDBDriverVersion {
$SQLOLEDBDriverVersion = (Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSOLEDBSQL' InstalledVersion).InstalledVersion $SQLOLEDBDriverVersion = (Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSOLEDBSQL' InstalledVersion).InstalledVersion
return "SQL OLEDB Driver $SQLOLEDBDriverVersion" return $SQLOLEDBDriverVersion
} }
function Get-MercurialVersion { function Get-MercurialVersion {
($(hg --version) | Out-String) -match "version (?<version>\d+\.\d+\.?\d*)" | Out-Null ($(hg --version) | Out-String) -match "version (?<version>\d+\.\d+\.?\d*)" | Out-Null
$mercurialVersion = $Matches.Version $mercurialVersion = $Matches.Version
return "Mercurial $mercurialVersion" return $mercurialVersion
} }
function Get-NSISVersion { function Get-NSISVersion {
$nsisVersion = &"c:\Program Files (x86)\NSIS\makensis.exe" "/Version" $nsisVersion = &"c:\Program Files (x86)\NSIS\makensis.exe" "/Version"
return "NSIS $($nsisVersion.TrimStart('v'))" return $nsisVersion.TrimStart("v")
} }
function Get-OpenSSLVersion { function Get-OpenSSLVersion {
$(openssl version) -match "OpenSSL (?<version>\d+\.\d+\.\d+\w?) " | Out-Null $(openssl version) -match "OpenSSL (?<version>\d+\.\d+\.\d+\w?) " | Out-Null
$opensslVersion = $Matches.Version $opensslVersion = $Matches.Version
return "OpenSSL $opensslVersion" return $opensslVersion
} }
function Get-PackerVersion { function Get-PackerVersion {
# Packer 1.7.1 has a bug and outputs version to stderr instead of stdout https://github.com/hashicorp/packer/issues/10855 # Packer 1.7.1 has a bug and outputs version to stderr instead of stdout https://github.com/hashicorp/packer/issues/10855
($(cmd /c "packer --version 2>&1") | Out-String) -match "(?<version>(\d+.){2}\d+)" | Out-Null ($(cmd /c "packer --version 2>&1") | Out-String) -match "(?<version>(\d+.){2}\d+)" | Out-Null
$packerVersion = $Matches.Version $packerVersion = $Matches.Version
return "Packer $packerVersion" return $packerVersion
} }
function Get-ParcelVersion { function Get-ParcelVersion {
@@ -148,133 +149,133 @@ function Get-ParcelVersion {
} }
function Get-PulumiVersion { function Get-PulumiVersion {
$pulumiVersion = $(pulumi version) return (pulumi version).TrimStart("v")
return "Pulumi $($pulumiVersion.TrimStart('v'))"
} }
function Get-SQLPSVersion { function Get-SQLPSVersion {
$module = Get-Module -Name SQLPS -ListAvailable $module = Get-Module -Name SQLPS -ListAvailable
$version = $module.Version $version = $module.Version
return "SQLPS $version" return $version
} }
function Get-SVNVersion { function Get-SVNVersion {
$svnVersion = $(svn --version --quiet) $svnVersion = $(svn --version --quiet)
return "Subversion (SVN) $svnVersion" return $svnVersion
} }
function Get-VSWhereVersion { function Get-VSWhereVersion {
($(Get-Command -Name vswhere).FileVersionInfo.ProductVersion) -match "(?<version>\d+\.\d+\.\d+)" | Out-Null ($(Get-Command -Name vswhere).FileVersionInfo.ProductVersion) -match "(?<version>\d+\.\d+\.\d+)" | Out-Null
$vswhereVersion = $Matches.Version $vswhereVersion = $Matches.Version
return "VSWhere $vswhereVersion" return $vswhereVersion
} }
function Get-WinAppDriver { function Get-WinAppDriver {
$winAppDriverVersion = [System.Diagnostics.FileVersionInfo]::GetVersionInfo("C:\Program Files (x86)\Windows Application Driver\WinAppDriver.exe").FileVersion $winAppDriverVersion = [System.Diagnostics.FileVersionInfo]::GetVersionInfo("C:\Program Files (x86)\Windows Application Driver\WinAppDriver.exe").FileVersion
return "WinAppDriver $winAppDriverVersion" return $winAppDriverVersion
} }
function Get-WixVersion { function Get-WixVersion {
$regKey = "HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*" $regKey = "HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*"
$installedApplications = Get-ItemProperty -Path $regKey $installedApplications = Get-ItemProperty -Path $regKey
return ($installedApplications | Where-Object { $_.BundleCachePath -imatch ".*\\WiX\d*\.exe$" } | Select-Object -First 1).DisplayName $wixToolsetVersion = ($installedApplications | Where-Object { $_.BundleCachePath -imatch ".*\\WiX\d*\.exe$" } | Select-Object -First 1).DisplayName
return ($wixToolsetVersion -replace "^WiX Toolset v").Trim()
} }
function Get-ZstdVersion { function Get-ZstdVersion {
$(zstd --version) -match "v(?<version>\d+\.\d+\.\d+)" | Out-Null $(zstd --version) -match "v(?<version>\d+\.\d+\.\d+)" | Out-Null
$zstdVersion = $Matches.Version $zstdVersion = $Matches.Version
return "zstd $zstdVersion" return $zstdVersion
} }
function Get-AzureCLIVersion { function Get-AzureCLIVersion {
$azureCLIVersion = $(az version) | ConvertFrom-Json | Foreach{ $_."azure-cli" } $azureCLIVersion = $(az version) | ConvertFrom-Json | Foreach{ $_."azure-cli" }
return "Azure CLI $azureCLIVersion" return $azureCLIVersion
} }
function Get-AzCopyVersion { function Get-AzCopyVersion {
return ($(azcopy --version) -replace "version ") return ($(azcopy --version) -replace "^azcopy version").Trim()
} }
function Get-AzureDevopsExtVersion { function Get-AzureDevopsExtVersion {
$azureDevExtVersion = (az version | ConvertFrom-Json | ForEach-Object { $_."extensions" })."azure-devops" $azureDevExtVersion = (az version | ConvertFrom-Json | ForEach-Object { $_."extensions" })."azure-devops"
return "Azure DevOps CLI extension $azureDevExtVersion" return $azureDevExtVersion
} }
function Get-AWSCLIVersion { function Get-AWSCLIVersion {
$(aws --version) -match "aws-cli\/(?<version>\d+\.\d+\.\d+)" | Out-Null $(aws --version) -match "aws-cli\/(?<version>\d+\.\d+\.\d+)" | Out-Null
$awscliVersion = $Matches.Version $awscliVersion = $Matches.Version
return "AWS CLI $awscliVersion" return $awscliVersion
} }
function Get-AWSSAMVersion { function Get-AWSSAMVersion {
$(sam --version) -match "version (?<version>\d+\.\d+\.\d+)" | Out-Null $(sam --version) -match "version (?<version>\d+\.\d+\.\d+)" | Out-Null
$awssamVersion = $Matches.Version $awssamVersion = $Matches.Version
return "AWS SAM CLI $awssamVersion" return $awssamVersion
} }
function Get-AWSSessionManagerVersion { function Get-AWSSessionManagerVersion {
$awsSessionManagerVersion = $(session-manager-plugin --version) $awsSessionManagerVersion = $(session-manager-plugin --version)
return "AWS Session Manager CLI $awsSessionManagerVersion" return $awsSessionManagerVersion
} }
function Get-AlibabaCLIVersion { function Get-AlibabaCLIVersion {
$alicliVersion = $(aliyun version) $alicliVersion = $(aliyun version)
return "Alibaba Cloud CLI $alicliVersion" return $alicliVersion
} }
function Get-CloudFoundryVersion { function Get-CloudFoundryVersion {
$(cf version) -match "(?<version>\d+\.\d+\.\d+)" | Out-Null $(cf version) -match "(?<version>\d+\.\d+\.\d+)" | Out-Null
$cfVersion = $Matches.Version $cfVersion = $Matches.Version
return "Cloud Foundry CLI $cfVersion" return $cfVersion
} }
function Get-HubVersion { function Get-HubVersion {
($(hub version) | Select-String -Pattern "hub version") -match "hub version (?<version>\d+\.\d+\.\d+)" | Out-Null ($(hub version) | Select-String -Pattern "hub version") -match "hub version (?<version>\d+\.\d+\.\d+)" | Out-Null
$hubVersion = $Matches.Version $hubVersion = $Matches.Version
return "Hub CLI $hubVersion" return $hubVersion
} }
function Get-7zipVersion { function Get-7zipVersion {
(7z | Out-String) -match "7-Zip (?<version>\d+\.\d+\.?\d*)" | Out-Null (7z | Out-String) -match "7-Zip (?<version>\d+\.\d+\.?\d*)" | Out-Null
$version = $Matches.Version $version = $Matches.Version
return "7zip $version" return $version
} }
function Get-GHCVersion { function Get-GHCVersion {
((ghc --version) | Out-String) -match "version (?<version>\d+\.\d+\.\d+)" | Out-Null ((ghc --version) | Out-String) -match "version (?<version>\d+\.\d+\.\d+)" | Out-Null
$ghcVersion = $Matches.Version $ghcVersion = $Matches.Version
return "ghc $ghcVersion" return $ghcVersion
} }
function Get-CabalVersion { function Get-CabalVersion {
((cabal --version) | Out-String) -match "version (?<version>\d+\.\d+\.\d+\.\d+)" | Out-Null ((cabal --version) | Out-String) -match "version (?<version>\d+\.\d+\.\d+\.\d+)" | Out-Null
$cabalVersion = $Matches.Version $cabalVersion = $Matches.Version
return "Cabal $cabalVersion" return $cabalVersion
} }
function Get-StackVersion { function Get-StackVersion {
((stack --version --quiet) | Out-String) -match "Version (?<version>\d+\.\d+\.\d+)," | Out-Null ((stack --version --quiet) | Out-String) -match "Version (?<version>\d+\.\d+\.\d+)," | Out-Null
$stackVersion = $Matches.Version $stackVersion = $Matches.Version
return "Stack $stackVersion" return $stackVersion
} }
function Get-GoogleCloudSDKVersion { function Get-GoogleCloudSDKVersion {
(cmd /c "gcloud --version") -match "Google Cloud SDK" return (((cmd /c "gcloud --version") -match "Google Cloud SDK") -replace "Google Cloud SDK").Trim()
} }
function Get-ServiceFabricSDKVersion { function Get-ServiceFabricSDKVersion {
$serviceFabricSDKVersion = Get-ItemPropertyValue 'HKLM:\SOFTWARE\Microsoft\Service Fabric\' -Name FabricVersion $serviceFabricSDKVersion = Get-ItemPropertyValue 'HKLM:\SOFTWARE\Microsoft\Service Fabric\' -Name FabricVersion
return "Service Fabric SDK $serviceFabricSDKVersion" return $serviceFabricSDKVersion
} }
function Get-NewmanVersion { function Get-NewmanVersion {
return "Newman $(newman --version)" return $(newman --version)
} }
function Get-GHVersion { function Get-GHVersion {
($(gh --version) | Select-String -Pattern "gh version") -match "gh version (?<version>\d+\.\d+\.\d+)" | Out-Null ($(gh --version) | Select-String -Pattern "gh version") -match "gh version (?<version>\d+\.\d+\.\d+)" | Out-Null
$ghVersion = $Matches.Version $ghVersion = $Matches.Version
return "GitHub CLI $ghVersion" return $ghVersion
} }
function Get-VisualCPPComponents { function Get-VisualCPPComponents {
@@ -300,17 +301,17 @@ function Get-VisualCPPComponents {
function Get-DacFxVersion { function Get-DacFxVersion {
$dacfxversion = & "$env:ProgramFiles\Microsoft SQL Server\160\DAC\bin\sqlpackage.exe" /version $dacfxversion = & "$env:ProgramFiles\Microsoft SQL Server\160\DAC\bin\sqlpackage.exe" /version
return "DacFx $dacfxversion" return $dacfxversion
} }
function Get-SwigVersion { function Get-SwigVersion {
(swig -version | Out-String) -match "version (?<version>\d+\.\d+\.\d+)" | Out-Null (swig -version | Out-String) -match "version (?<version>\d+\.\d+\.\d+)" | Out-Null
$swigVersion = $Matches.Version $swigVersion = $Matches.Version
return "Swig $swigVersion" return $swigVersion
} }
function Get-ImageMagickVersion { function Get-ImageMagickVersion {
(magick -version | Select-String -Pattern "Version") -match "(?<version>\d+\.\d+\.\d+-\d+)" | Out-Null (magick -version | Select-String -Pattern "Version") -match "(?<version>\d+\.\d+\.\d+-\d+)" | Out-Null
$magickVersion = $Matches.Version $magickVersion = $Matches.Version
return "ImageMagick $magickVersion" return $magickVersion
} }

View File

@@ -18,7 +18,7 @@ function Get-NginxVersion {
return $Matches.Version return $Matches.Version
} }
function Get-ApacheMarkdown function Get-ApacheSection
{ {
$name = "Apache" $name = "Apache"
$apachePort = "80" $apachePort = "80"
@@ -35,7 +35,7 @@ function Get-ApacheMarkdown
} }
} }
function Get-NginxMarkdown function Get-NginxSection
{ {
$name = "Nginx" $name = "Nginx"
$nginxPort = "80" $nginxPort = "80"
@@ -53,13 +53,8 @@ function Get-NginxMarkdown
} }
function Build-WebServersSection { function Build-WebServersSection {
$output = "" return @(
$output += New-MDHeader "Web Servers" -Level 3 (Get-ApacheSection),
$output += @( (Get-NginxSection)
(Get-ApacheMarkdown), )
(Get-NginxMarkdown)
) | Sort-Object Name | New-MDTable
$output += New-MDNewLine
return $output
} }

View File

@@ -82,6 +82,11 @@
"source": "{{ template_dir }}/scripts/SoftwareReport", "source": "{{ template_dir }}/scripts/SoftwareReport",
"destination": "{{user `image_folder`}}" "destination": "{{user `image_folder`}}"
}, },
{
"type": "file",
"source": "{{ template_dir }}/../../helpers/software-report-base",
"destination": "{{user `image_folder`}}/SoftwareReport/"
},
{ {
"type": "file", "type": "file",
"source": "{{ template_dir }}/post-generation", "source": "{{ template_dir }}/post-generation",
@@ -299,15 +304,22 @@
{ {
"type": "powershell", "type": "powershell",
"inline": [ "inline": [
"if (-not (Test-Path C:\\InstalledSoftware.md)) { throw 'C:\\InstalledSoftware.md not found' }" "if (-not (Test-Path C:\\software-report.md)) { throw 'C:\\software-report.md not found' }",
"if (-not (Test-Path C:\\software-report.json)) { throw 'C:\\software-report.json not found' }"
] ]
}, },
{ {
"type": "file", "type": "file",
"source": "C:\\InstalledSoftware.md", "source": "C:\\software-report.md",
"destination": "{{ template_dir }}/Windows2019-Readme.md", "destination": "{{ template_dir }}/Windows2019-Readme.md",
"direction": "download" "direction": "download"
}, },
{
"type": "file",
"source": "C:\\software-report.json",
"destination": "{{ template_dir }}/software-report.json",
"direction": "download"
},
{ {
"type": "powershell", "type": "powershell",
"skip_clean": true, "skip_clean": true,

View File

@@ -82,6 +82,11 @@
"source": "{{ template_dir }}/scripts/SoftwareReport", "source": "{{ template_dir }}/scripts/SoftwareReport",
"destination": "{{user `image_folder`}}" "destination": "{{user `image_folder`}}"
}, },
{
"type": "file",
"source": "{{ template_dir }}/../../helpers/software-report-base",
"destination": "{{user `image_folder`}}/SoftwareReport/"
},
{ {
"type": "file", "type": "file",
"source": "{{ template_dir }}/post-generation", "source": "{{ template_dir }}/post-generation",
@@ -302,15 +307,22 @@
{ {
"type": "powershell", "type": "powershell",
"inline": [ "inline": [
"if (-not (Test-Path C:\\InstalledSoftware.md)) { throw 'C:\\InstalledSoftware.md not found' }" "if (-not (Test-Path C:\\software-report.md)) { throw 'C:\\software-report.md not found' }",
"if (-not (Test-Path C:\\software-report.json)) { throw 'C:\\software-report.json not found' }"
] ]
}, },
{ {
"type": "file", "type": "file",
"source": "C:\\InstalledSoftware.md", "source": "C:\\software-report.md",
"destination": "{{ template_dir }}/Windows2022-Readme.md", "destination": "{{ template_dir }}/Windows2022-Readme.md",
"direction": "download" "direction": "download"
}, },
{
"type": "file",
"source": "C:\\software-report.json",
"destination": "{{ template_dir }}/software-report.json",
"direction": "download"
},
{ {
"type": "powershell", "type": "powershell",
"skip_clean": true, "skip_clean": true,