mirror of
https://github.com/actions/runner-images-sangeeth.git
synced 2025-12-15 06:19:21 +00:00
[ubuntu] Refactor Software Report helpers (#8954)
This commit is contained in:
committed by
GitHub
parent
b0fc01efc6
commit
a9bc069a35
@@ -2,8 +2,8 @@ using module ./software-report-base/SoftwareReport.psm1
|
|||||||
using module ./software-report-base/SoftwareReport.Nodes.psm1
|
using module ./software-report-base/SoftwareReport.Nodes.psm1
|
||||||
|
|
||||||
param (
|
param (
|
||||||
[Parameter(Mandatory)][string]
|
[Parameter(Mandatory)]
|
||||||
$OutputDirectory
|
[string] $OutputDirectory
|
||||||
)
|
)
|
||||||
|
|
||||||
$global:ErrorActionPreference = "Stop"
|
$global:ErrorActionPreference = "Stop"
|
||||||
@@ -23,7 +23,7 @@ Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Tools.psm1") -DisableName
|
|||||||
Import-Module (Join-Path $PSScriptRoot "SoftwareReport.WebServers.psm1") -DisableNameChecking
|
Import-Module (Join-Path $PSScriptRoot "SoftwareReport.WebServers.psm1") -DisableNameChecking
|
||||||
|
|
||||||
# Restore file owner in user profile
|
# Restore file owner in user profile
|
||||||
Restore-UserOwner
|
sudo chown -R ${env:USER}: $env:HOME
|
||||||
|
|
||||||
# Software report
|
# Software report
|
||||||
$softwareReport = [SoftwareReport]::new("Ubuntu $(Get-OSVersionShort)")
|
$softwareReport = [SoftwareReport]::new("Ubuntu $(Get-OSVersionShort)")
|
||||||
@@ -164,7 +164,6 @@ $cliTools.AddToolVersion("OpenShift CLI", $(Get-OCCliVersion))
|
|||||||
$cliTools.AddToolVersion("ORAS CLI", $(Get-ORASCliVersion))
|
$cliTools.AddToolVersion("ORAS CLI", $(Get-ORASCliVersion))
|
||||||
$cliTools.AddToolVersion("Vercel CLI", $(Get-VerselCliversion))
|
$cliTools.AddToolVersion("Vercel CLI", $(Get-VerselCliversion))
|
||||||
|
|
||||||
|
|
||||||
$installedSoftware.AddHeader("Java").AddTable($(Get-JavaVersionsTable))
|
$installedSoftware.AddHeader("Java").AddTable($(Get-JavaVersionsTable))
|
||||||
|
|
||||||
$phpTools = $installedSoftware.AddHeader("PHP Tools")
|
$phpTools = $installedSoftware.AddHeader("PHP Tools")
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ function Get-AndroidInstalledPackages {
|
|||||||
return $androidSDKManagerList
|
return $androidSDKManagerList
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function Build-AndroidTable {
|
function Build-AndroidTable {
|
||||||
$packageInfo = Get-AndroidInstalledPackages
|
$packageInfo = Get-AndroidInstalledPackages
|
||||||
return @(
|
return @(
|
||||||
@@ -79,7 +78,7 @@ function Build-AndroidTable {
|
|||||||
) | Where-Object { $_.Version } | ForEach-Object {
|
) | Where-Object { $_.Version } | ForEach-Object {
|
||||||
[PSCustomObject] @{
|
[PSCustomObject] @{
|
||||||
"Package Name" = $_.Package
|
"Package Name" = $_.Package
|
||||||
"Version" = $_.Version
|
"Version" = $_.Version
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -92,7 +91,7 @@ function Get-AndroidPackageVersions {
|
|||||||
[object] $MatchedString
|
[object] $MatchedString
|
||||||
)
|
)
|
||||||
|
|
||||||
$versions = $packageInfo | Where-Object { $_ -Match $MatchedString } | ForEach-Object {
|
$versions = $PackageInfo | Where-Object { $_ -Match $MatchedString } | ForEach-Object {
|
||||||
$packageInfoParts = Split-TableRowByColumns $_
|
$packageInfoParts = Split-TableRowByColumns $_
|
||||||
return $packageInfoParts[1]
|
return $packageInfoParts[1]
|
||||||
}
|
}
|
||||||
@@ -105,7 +104,7 @@ function Get-AndroidPlatformVersions {
|
|||||||
[object] $PackageInfo
|
[object] $PackageInfo
|
||||||
)
|
)
|
||||||
|
|
||||||
$versions = $packageInfo | Where-Object { $_ -Match "Android SDK Platform " } | ForEach-Object {
|
$versions = $PackageInfo | Where-Object { $_ -Match "Android SDK Platform " } | ForEach-Object {
|
||||||
$packageInfoParts = Split-TableRowByColumns $_
|
$packageInfoParts = Split-TableRowByColumns $_
|
||||||
$revision = $packageInfoParts[1]
|
$revision = $packageInfoParts[1]
|
||||||
$version = $packageInfoParts[0].split(";")[1]
|
$version = $packageInfoParts[0].split(";")[1]
|
||||||
@@ -128,7 +127,7 @@ function Get-AndroidBuildToolVersions {
|
|||||||
[object] $PackageInfo
|
[object] $PackageInfo
|
||||||
)
|
)
|
||||||
|
|
||||||
$versions = $packageInfo | Where-Object { $_ -Match "Android SDK Build-Tools" } | ForEach-Object {
|
$versions = $PackageInfo | Where-Object { $_ -Match "Android SDK Build-Tools" } | ForEach-Object {
|
||||||
$packageInfoParts = Split-TableRowByColumns $_
|
$packageInfoParts = Split-TableRowByColumns $_
|
||||||
return $packageInfoParts[1]
|
return $packageInfoParts[1]
|
||||||
}
|
}
|
||||||
@@ -146,7 +145,7 @@ function Get-AndroidGoogleAPIsVersions {
|
|||||||
[object] $PackageInfo
|
[object] $PackageInfo
|
||||||
)
|
)
|
||||||
|
|
||||||
$versions = $packageInfo | Where-Object { $_ -Match "Google APIs" } | ForEach-Object {
|
$versions = $PackageInfo | Where-Object { $_ -Match "Google APIs" } | ForEach-Object {
|
||||||
$packageInfoParts = Split-TableRowByColumns $_
|
$packageInfoParts = Split-TableRowByColumns $_
|
||||||
return $packageInfoParts[0].split(";")[1]
|
return $packageInfoParts[0].split(";")[1]
|
||||||
}
|
}
|
||||||
@@ -171,7 +170,7 @@ function Build-AndroidEnvironmentTable {
|
|||||||
$shouldResolveLink = 'ANDROID_NDK', 'ANDROID_NDK_HOME', 'ANDROID_NDK_ROOT', 'ANDROID_NDK_LATEST_HOME'
|
$shouldResolveLink = 'ANDROID_NDK', 'ANDROID_NDK_HOME', 'ANDROID_NDK_ROOT', 'ANDROID_NDK_LATEST_HOME'
|
||||||
return $androidVersions | Sort-Object -Property Name | ForEach-Object {
|
return $androidVersions | Sort-Object -Property Name | ForEach-Object {
|
||||||
[PSCustomObject] @{
|
[PSCustomObject] @{
|
||||||
"Name" = $_.Name
|
"Name" = $_.Name
|
||||||
"Value" = if ($shouldResolveLink.Contains($_.Name )) { Get-PathWithLink($_.Value) } else {$_.Value}
|
"Value" = if ($shouldResolveLink.Contains($_.Name )) { Get-PathWithLink($_.Value) } else {$_.Value}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,35 +1,35 @@
|
|||||||
function Get-ChromeVersion {
|
function Get-ChromeVersion {
|
||||||
$googleChromeVersion = google-chrome --version | Take-OutputPart -Part 2
|
$googleChromeVersion = google-chrome --version | Get-StringPart -Part 2
|
||||||
return $googleChromeVersion
|
return $googleChromeVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
function Get-ChromeDriverVersion {
|
function Get-ChromeDriverVersion {
|
||||||
$chromeDriverVersion = chromedriver --version | Take-OutputPart -Part 1
|
$chromeDriverVersion = chromedriver --version | Get-StringPart -Part 1
|
||||||
return $chromeDriverVersion
|
return $chromeDriverVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
function Get-FirefoxVersion {
|
function Get-FirefoxVersion {
|
||||||
$firefoxVersion = $(firefox --version) | Take-OutputPart -Part 2
|
$firefoxVersion = $(firefox --version) | Get-StringPart -Part 2
|
||||||
return $firefoxVersion
|
return $firefoxVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
function Get-GeckodriverVersion {
|
function Get-GeckodriverVersion {
|
||||||
$geckodriverVersion = geckodriver --version | Select-Object -First 1 | Take-OutputPart -Part 1
|
$geckodriverVersion = geckodriver --version | Select-Object -First 1 | Get-StringPart -Part 1
|
||||||
return $geckodriverVersion
|
return $geckodriverVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
function Get-ChromiumVersion {
|
function Get-ChromiumVersion {
|
||||||
$chromiumVersion = chromium-browser --version | Take-OutputPart -Part 1
|
$chromiumVersion = chromium-browser --version | Get-StringPart -Part 1
|
||||||
return $chromiumVersion
|
return $chromiumVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
function Get-EdgeVersion {
|
function Get-EdgeVersion {
|
||||||
$edgeVersion = (microsoft-edge --version).Trim() | Take-OutputPart -Part 2
|
$edgeVersion = (microsoft-edge --version).Trim() | Get-StringPart -Part 2
|
||||||
return $edgeVersion
|
return $edgeVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
function Get-EdgeDriverVersion {
|
function Get-EdgeDriverVersion {
|
||||||
$edgeDriverVersion = msedgedriver --version | Take-OutputPart -Part 3
|
$edgeDriverVersion = msedgedriver --version | Get-StringPart -Part 3
|
||||||
return $edgeDriverVersion
|
return $edgeDriverVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -41,19 +41,19 @@ function Get-SeleniumVersion {
|
|||||||
function Build-BrowserWebdriversEnvironmentTable {
|
function Build-BrowserWebdriversEnvironmentTable {
|
||||||
return @(
|
return @(
|
||||||
[PSCustomObject] @{
|
[PSCustomObject] @{
|
||||||
"Name" = "CHROMEWEBDRIVER"
|
"Name" = "CHROMEWEBDRIVER"
|
||||||
"Value" = $env:CHROMEWEBDRIVER
|
"Value" = $env:CHROMEWEBDRIVER
|
||||||
},
|
},
|
||||||
[PSCustomObject] @{
|
[PSCustomObject] @{
|
||||||
"Name" = "EDGEWEBDRIVER"
|
"Name" = "EDGEWEBDRIVER"
|
||||||
"Value" = $env:EDGEWEBDRIVER
|
"Value" = $env:EDGEWEBDRIVER
|
||||||
},
|
},
|
||||||
[PSCustomObject] @{
|
[PSCustomObject] @{
|
||||||
"Name" = "GECKOWEBDRIVER"
|
"Name" = "GECKOWEBDRIVER"
|
||||||
"Value" = $env:GECKOWEBDRIVER
|
"Value" = $env:GECKOWEBDRIVER
|
||||||
},
|
},
|
||||||
[PSCustomObject] @{
|
[PSCustomObject] @{
|
||||||
"Name" = "SELENIUM_JAR_PATH"
|
"Name" = "SELENIUM_JAR_PATH"
|
||||||
"Value" = $env:SELENIUM_JAR_PATH
|
"Value" = $env:SELENIUM_JAR_PATH
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,18 +1,18 @@
|
|||||||
function Get-ToolcacheRubyVersions {
|
function Get-ToolcacheRubyVersions {
|
||||||
$toolcachePath = Join-Path $env:AGENT_TOOLSDIRECTORY "Ruby"
|
$toolcachePath = Join-Path $env:AGENT_TOOLSDIRECTORY "Ruby"
|
||||||
return Get-ChildItem $toolcachePath -Name | Sort-Object { [Version]$_ }
|
return Get-ChildItem $toolcachePath -Name | Sort-Object { [Version] $_ }
|
||||||
}
|
}
|
||||||
|
|
||||||
function Get-ToolcachePythonVersions {
|
function Get-ToolcachePythonVersions {
|
||||||
$toolcachePath = Join-Path $env:AGENT_TOOLSDIRECTORY "Python"
|
$toolcachePath = Join-Path $env:AGENT_TOOLSDIRECTORY "Python"
|
||||||
return Get-ChildItem $toolcachePath -Name | Sort-Object { [Version]$_ }
|
return Get-ChildItem $toolcachePath -Name | Sort-Object { [Version] $_ }
|
||||||
}
|
}
|
||||||
|
|
||||||
function Get-ToolcachePyPyVersions {
|
function Get-ToolcachePyPyVersions {
|
||||||
$toolcachePath = Join-Path $env:AGENT_TOOLSDIRECTORY "PyPy"
|
$toolcachePath = Join-Path $env:AGENT_TOOLSDIRECTORY "PyPy"
|
||||||
Get-ChildItem -Path $toolcachePath -Name | Sort-Object { [Version] $_ } | ForEach-Object {
|
Get-ChildItem -Path $toolcachePath -Name | Sort-Object { [Version] $_ } | ForEach-Object {
|
||||||
$pypyRootPath = Join-Path $toolcachePath $_ "x64"
|
$pypyRootPath = Join-Path $toolcachePath $_ "x64"
|
||||||
[string]$pypyVersionOutput = & "$pypyRootPath/bin/python" -c "import sys;print(sys.version)"
|
[string] $pypyVersionOutput = & "$pypyRootPath/bin/python" -c "import sys;print(sys.version)"
|
||||||
$pypyVersionOutput -match "^([\d\.]+) \(.+\) \[PyPy ([\d\.]+\S*) .+]$" | Out-Null
|
$pypyVersionOutput -match "^([\d\.]+) \(.+\) \[PyPy ([\d\.]+\S*) .+]$" | Out-Null
|
||||||
return "{0} [PyPy {1}]" -f $Matches[1], $Matches[2]
|
return "{0} [PyPy {1}]" -f $Matches[1], $Matches[2]
|
||||||
}
|
}
|
||||||
@@ -20,10 +20,10 @@ function Get-ToolcachePyPyVersions {
|
|||||||
|
|
||||||
function Get-ToolcacheNodeVersions {
|
function Get-ToolcacheNodeVersions {
|
||||||
$toolcachePath = Join-Path $env:AGENT_TOOLSDIRECTORY "node"
|
$toolcachePath = Join-Path $env:AGENT_TOOLSDIRECTORY "node"
|
||||||
return Get-ChildItem $toolcachePath -Name | Sort-Object { [Version]$_ }
|
return Get-ChildItem $toolcachePath -Name | Sort-Object { [Version] $_ }
|
||||||
}
|
}
|
||||||
|
|
||||||
function Get-ToolcacheGoVersions {
|
function Get-ToolcacheGoVersions {
|
||||||
$toolcachePath = Join-Path $env:AGENT_TOOLSDIRECTORY "go"
|
$toolcachePath = Join-Path $env:AGENT_TOOLSDIRECTORY "go"
|
||||||
return Get-ChildItem $toolcachePath -Name | Sort-Object { [Version]$_ }
|
return Get-ChildItem $toolcachePath -Name | Sort-Object { [Version] $_ }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,18 +10,18 @@ function Get-DashVersion {
|
|||||||
|
|
||||||
function Get-CPPVersions {
|
function Get-CPPVersions {
|
||||||
$result = Get-CommandResult "apt list --installed" -Multiline
|
$result = Get-CommandResult "apt list --installed" -Multiline
|
||||||
$cppVersions = $result.Output | Where-Object { $_ -match "g\+\+-\d+"} | ForEach-Object {
|
$cppVersions = $result.Output | Where-Object { $_ -match "g\+\+-\d+" } | ForEach-Object {
|
||||||
& $_.Split("/")[0] --version | Select-Object -First 1 | Take-OutputPart -Part 3
|
& $_.Split("/")[0] --version | Select-Object -First 1 | Get-StringPart -Part 3
|
||||||
} | Sort-Object {[Version]$_}
|
} | Sort-Object {[Version] $_}
|
||||||
return $cppVersions
|
return $cppVersions
|
||||||
}
|
}
|
||||||
|
|
||||||
function Get-FortranVersions {
|
function Get-FortranVersions {
|
||||||
$result = Get-CommandResult "apt list --installed" -Multiline
|
$result = Get-CommandResult "apt list --installed" -Multiline
|
||||||
$fortranVersions = $result.Output | Where-Object { $_ -match "^gfortran-\d+"} | ForEach-Object {
|
$fortranVersions = $result.Output | Where-Object { $_ -match "^gfortran-\d+" } | ForEach-Object {
|
||||||
$_ -match "now (?<version>\d+\.\d+\.\d+)-" | Out-Null
|
$_ -match "now (?<version>\d+\.\d+\.\d+)-" | Out-Null
|
||||||
$Matches.version
|
$Matches.version
|
||||||
} | Sort-Object {[Version]$_}
|
} | Sort-Object {[Version] $_}
|
||||||
return $fortranVersions
|
return $fortranVersions
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -34,20 +34,21 @@ function Get-ClangToolVersions {
|
|||||||
)
|
)
|
||||||
|
|
||||||
$result = Get-CommandResult "apt list --installed" -Multiline
|
$result = Get-CommandResult "apt list --installed" -Multiline
|
||||||
$toolVersions = $result.Output | Where-Object { $_ -match "^${ToolName}-\d+"} | ForEach-Object {
|
$toolVersions = $result.Output | Where-Object { $_ -match "^${ToolName}-\d+" } | ForEach-Object {
|
||||||
$clangCommand = ($_ -Split "/")[0]
|
$clangCommand = ($_ -Split "/")[0]
|
||||||
Invoke-Expression "$clangCommand --version" | Where-Object { $_ -match "${VersionLineMatcher}" } | ForEach-Object {
|
Invoke-Expression "$clangCommand --version" | Where-Object { $_ -match "${VersionLineMatcher}" } | ForEach-Object {
|
||||||
$_ -match "${VersionLineMatcher} (?<version>${VersionPattern}" | Out-Null
|
$_ -match "${VersionLineMatcher} (?<version>${VersionPattern}" | Out-Null
|
||||||
$Matches.version
|
$Matches.version
|
||||||
}
|
}
|
||||||
} | Sort-Object {[Version]$_}
|
} | Sort-Object {[Version] $_}
|
||||||
|
|
||||||
return $toolVersions
|
return $toolVersions
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function Get-ClangTidyVersions {
|
function Get-ClangTidyVersions {
|
||||||
return Get-ClangToolVersions -ToolName "clang-tidy" -VersionLineMatcher "LLVM version" -VersionPattern "\d+\.\d+\.\d+)"
|
$clangVersions = Get-ClangToolVersions -ToolName "clang-tidy" -VersionLineMatcher "LLVM version" -VersionPattern "\d+\.\d+\.\d+)"
|
||||||
|
return $clangVersions
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -64,7 +65,7 @@ function Get-ErlangRebar3Version {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function Get-MonoVersion {
|
function Get-MonoVersion {
|
||||||
$monoVersion = mono --version | Out-String | Take-OutputPart -Part 4
|
$monoVersion = mono --version | Out-String | Get-StringPart -Part 4
|
||||||
return $monoVersion
|
return $monoVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -75,7 +76,7 @@ function Get-MsbuildVersion {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function Get-NuGetVersion {
|
function Get-NuGetVersion {
|
||||||
$nugetVersion = nuget help | Select-Object -First 1 | Take-OutputPart -Part 2
|
$nugetVersion = nuget help | Select-Object -First 1 | Get-StringPart -Part 2
|
||||||
return $nugetVersion
|
return $nugetVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,7 +86,8 @@ function Get-NodeVersion {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function Get-OpensslVersion {
|
function Get-OpensslVersion {
|
||||||
return $(dpkg-query -W -f '${Version}' openssl)
|
$opensslVersion = $(dpkg-query -W -f '${Version}' openssl)
|
||||||
|
return $opensslVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
function Get-PerlVersion {
|
function Get-PerlVersion {
|
||||||
@@ -95,31 +97,32 @@ function Get-PerlVersion {
|
|||||||
|
|
||||||
function Get-PythonVersion {
|
function Get-PythonVersion {
|
||||||
$result = Get-CommandResult "python --version"
|
$result = Get-CommandResult "python --version"
|
||||||
$version = $result.Output | Take-OutputPart -Part 1
|
$version = $result.Output | Get-StringPart -Part 1
|
||||||
return $version
|
return $version
|
||||||
}
|
}
|
||||||
|
|
||||||
function Get-PowershellVersion {
|
function Get-PowershellVersion {
|
||||||
return $(pwsh --version) | Take-OutputPart -Part 1
|
$pwshVersion = $(pwsh --version) | Get-StringPart -Part 1
|
||||||
|
return $pwshVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
function Get-RubyVersion {
|
function Get-RubyVersion {
|
||||||
$rubyVersion = ruby --version | Out-String | Take-OutputPart -Part 1
|
$rubyVersion = ruby --version | Out-String | Get-StringPart -Part 1
|
||||||
return $rubyVersion
|
return $rubyVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
function Get-SwiftVersion {
|
function Get-SwiftVersion {
|
||||||
$swiftVersion = swift --version | Out-String | Take-OutputPart -Part 2
|
$swiftVersion = swift --version | Out-String | Get-StringPart -Part 2
|
||||||
return $swiftVersion
|
return $swiftVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
function Get-KotlinVersion {
|
function Get-KotlinVersion {
|
||||||
$kotlinVersion = kotlin -version | Out-String | Take-OutputPart -Part 2
|
$kotlinVersion = kotlin -version | Out-String | Get-StringPart -Part 2
|
||||||
return $kotlinVersion
|
return $kotlinVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
function Get-JuliaVersion {
|
function Get-JuliaVersion {
|
||||||
$juliaVersion = julia --version | Take-OutputPart -Part 2
|
$juliaVersion = julia --version | Get-StringPart -Part 2
|
||||||
return $juliaVersion
|
return $juliaVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -147,7 +150,7 @@ function Get-GemVersion {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function Get-MinicondaVersion {
|
function Get-MinicondaVersion {
|
||||||
$condaVersion = conda --version | Take-OutputPart -Part 1
|
$condaVersion = conda --version | Get-StringPart -Part 1
|
||||||
return $condaVersion
|
return $condaVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -195,7 +198,7 @@ function Get-AntVersion {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function Get-GradleVersion {
|
function Get-GradleVersion {
|
||||||
$gradleVersion = (gradle -v) -match "^Gradle \d" | Take-OutputPart -Part 1
|
$gradleVersion = (gradle -v) -match "^Gradle \d" | Get-StringPart -Part 1
|
||||||
return $gradleVersion
|
return $gradleVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -213,14 +216,14 @@ function Get-SbtVersion {
|
|||||||
|
|
||||||
function Get-PHPVersions {
|
function Get-PHPVersions {
|
||||||
$result = Get-CommandResult "apt list --installed" -Multiline
|
$result = Get-CommandResult "apt list --installed" -Multiline
|
||||||
return $result.Output | Where-Object { $_ -match "^php\d+\.\d+/"} | ForEach-Object {
|
return $result.Output | Where-Object { $_ -match "^php\d+\.\d+/" } | ForEach-Object {
|
||||||
$_ -match "now (\d+:)?(?<version>\d+\.\d+\.\d+)" | Out-Null
|
$_ -match "now (\d+:)?(?<version>\d+\.\d+\.\d+)" | Out-Null
|
||||||
$Matches.version
|
$Matches.version
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function Get-ComposerVersion {
|
function Get-ComposerVersion {
|
||||||
$composerVersion = (composer --version) -replace " version" | Take-OutputPart -Part 1
|
$composerVersion = (composer --version) -replace " version" | Get-StringPart -Part 1
|
||||||
return $composerVersion
|
return $composerVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -281,7 +284,7 @@ function Get-PowerShellModules {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function Get-DotNetCoreSdkVersions {
|
function Get-DotNetCoreSdkVersions {
|
||||||
$dotNetCoreSdkVersion = dotnet --list-sdks list | ForEach-Object { $_ | Take-OutputPart -Part 0 }
|
$dotNetCoreSdkVersion = dotnet --list-sdks list | ForEach-Object { $_ | Get-StringPart -Part 0 }
|
||||||
return $dotNetCoreSdkVersion
|
return $dotNetCoreSdkVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -307,8 +310,8 @@ function Get-CachedDockerImagesTableData {
|
|||||||
$parts = $_.Split("|")
|
$parts = $_.Split("|")
|
||||||
[PSCustomObject] @{
|
[PSCustomObject] @{
|
||||||
"Repository:Tag" = $parts[0]
|
"Repository:Tag" = $parts[0]
|
||||||
"Digest" = $parts[1]
|
"Digest" = $parts[1]
|
||||||
"Created" = $parts[2].split(' ')[0]
|
"Created" = $parts[2].split(' ')[0]
|
||||||
}
|
}
|
||||||
} | Sort-Object -Property "Repository:Tag"
|
} | Sort-Object -Property "Repository:Tag"
|
||||||
}
|
}
|
||||||
@@ -318,7 +321,7 @@ function Get-AptPackages {
|
|||||||
$output = @()
|
$output = @()
|
||||||
ForEach ($pkg in ($apt.vital_packages + $apt.common_packages + $apt.cmd_packages)) {
|
ForEach ($pkg in ($apt.vital_packages + $apt.common_packages + $apt.cmd_packages)) {
|
||||||
$version = $(dpkg-query -W -f '${Version}' $pkg)
|
$version = $(dpkg-query -W -f '${Version}' $pkg)
|
||||||
if ($Null -eq $version) {
|
if ($null -eq $version) {
|
||||||
$version = $(dpkg-query -W -f '${Version}' "$pkg*")
|
$version = $(dpkg-query -W -f '${Version}' "$pkg*")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -341,18 +344,18 @@ function Get-PipxVersion {
|
|||||||
function Build-PackageManagementEnvironmentTable {
|
function Build-PackageManagementEnvironmentTable {
|
||||||
return @(
|
return @(
|
||||||
[PSCustomObject] @{
|
[PSCustomObject] @{
|
||||||
"Name" = "CONDA"
|
"Name" = "CONDA"
|
||||||
"Value" = $env:CONDA
|
"Value" = $env:CONDA
|
||||||
},
|
},
|
||||||
[PSCustomObject] @{
|
[PSCustomObject] @{
|
||||||
"Name" = "VCPKG_INSTALLATION_ROOT"
|
"Name" = "VCPKG_INSTALLATION_ROOT"
|
||||||
"Value" = $env:VCPKG_INSTALLATION_ROOT
|
"Value" = $env:VCPKG_INSTALLATION_ROOT
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function Get-SystemdVersion {
|
function Get-SystemdVersion {
|
||||||
$matches = [regex]::Matches((systemctl --version | head -n 1), "\((.*?)\)")
|
$matchCollection = [regex]::Matches((systemctl --version | head -n 1), "\((.*?)\)")
|
||||||
$result = foreach ($match in $matches) {$match.Groups[1].Value}
|
$result = foreach ($match in $matchCollection) {$match.Groups[1].Value}
|
||||||
return $result
|
return $result
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,25 +1,25 @@
|
|||||||
function Get-PostgreSqlVersion {
|
function Get-PostgreSqlVersion {
|
||||||
$postgreSQLVersion = psql --version | Take-OutputPart -Part 2
|
$postgreSQLVersion = psql --version | Get-StringPart -Part 2
|
||||||
return $postgreSQLVersion
|
return $postgreSQLVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
function Get-MongoDbVersion {
|
function Get-MongoDbVersion {
|
||||||
$mongoDBVersion = mongod --version | Select-Object -First 1 | Take-OutputPart -Part 2 -Delimiter "v"
|
$mongoDBVersion = mongod --version | Select-Object -First 1 | Get-StringPart -Part 2 -Delimiter "v"
|
||||||
return $mongoDBVersion
|
return $mongoDBVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
function Get-SqliteVersion {
|
function Get-SqliteVersion {
|
||||||
$sqliteVersion = sqlite3 --version | Take-OutputPart -Part 0
|
$sqliteVersion = sqlite3 --version | Get-StringPart -Part 0
|
||||||
return $sqliteVersion
|
return $sqliteVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
function Get-MySQLVersion {
|
function Get-MySQLVersion {
|
||||||
$mySQLVersion = mysqld --version | Take-OutputPart -Part 2
|
$mySQLVersion = mysqld --version | Get-StringPart -Part 2
|
||||||
return $mySQLVersion
|
return $mySQLVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
function Get-SQLCmdVersion {
|
function Get-SQLCmdVersion {
|
||||||
$sqlcmdVersion = sqlcmd -? | Select-String -Pattern "Version" | Take-OutputPart -Part 1
|
$sqlcmdVersion = sqlcmd -? | Select-String -Pattern "Version" | Get-StringPart -Part 1
|
||||||
return $sqlcmdVersion
|
return $sqlcmdVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,51 +1,34 @@
|
|||||||
function Take-OutputPart {
|
function Get-StringPart {
|
||||||
param (
|
param (
|
||||||
[Parameter(ValueFromPipeline)]
|
[Parameter(ValueFromPipeline)]
|
||||||
[string] $toolOutput,
|
[string] $ToolOutput,
|
||||||
[string] $Delimiter = " ",
|
[string] $Delimiter = " ",
|
||||||
[int[]] $Part
|
[int[]] $Part
|
||||||
)
|
)
|
||||||
$parts = $toolOutput.Split($Delimiter, [System.StringSplitOptions]::RemoveEmptyEntries)
|
|
||||||
|
$parts = $ToolOutput.Split($Delimiter, [System.StringSplitOptions]::RemoveEmptyEntries)
|
||||||
$selectedParts = $parts[$Part]
|
$selectedParts = $parts[$Part]
|
||||||
return [string]::Join($Delimiter, $selectedParts)
|
return [string]::Join($Delimiter, $selectedParts)
|
||||||
}
|
}
|
||||||
|
|
||||||
function Restore-UserOwner {
|
|
||||||
sudo chown -R ${env:USER}: $env:HOME
|
|
||||||
}
|
|
||||||
|
|
||||||
function Get-LinkTarget {
|
|
||||||
param (
|
|
||||||
[string] $inputPath
|
|
||||||
)
|
|
||||||
$link = Get-Item $inputPath | Select-Object -ExpandProperty Target
|
|
||||||
if ($link) {
|
|
||||||
return " -> $link"
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
function Get-PathWithLink {
|
function Get-PathWithLink {
|
||||||
param (
|
param (
|
||||||
[string] $inputPath
|
[string] $InputPath
|
||||||
)
|
)
|
||||||
$link = Get-LinkTarget($inputPath)
|
|
||||||
return "${inputPath}${link}"
|
|
||||||
}
|
|
||||||
|
|
||||||
function Get-AptSourceRepository {
|
$link = Get-Item $InputPath | Select-Object -ExpandProperty Target
|
||||||
param([String] $PackageName)
|
if (-not [string]::IsNullOrEmpty($link)) {
|
||||||
|
return "${InputPath} -> ${link}"
|
||||||
$sourceUrl = Get-Content "$PSScriptRoot/../helpers/apt-sources.txt" | Select-String -Pattern $PackageName | Take-OutputPart -Part (1..3)
|
}
|
||||||
return $sourceUrl
|
return "${InputPath}"
|
||||||
}
|
}
|
||||||
|
|
||||||
function Get-OSVersionShort {
|
function Get-OSVersionShort {
|
||||||
$(Get-OSVersionFull) | Take-OutputPart -Delimiter '.' -Part 0,1
|
$(Get-OSVersionFull) | Get-StringPart -Delimiter '.' -Part 0,1
|
||||||
}
|
}
|
||||||
|
|
||||||
function Get-OSVersionFull {
|
function Get-OSVersionFull {
|
||||||
lsb_release -ds | Take-OutputPart -Part 1, 2
|
lsb_release -ds | Get-StringPart -Part 1, 2
|
||||||
}
|
}
|
||||||
|
|
||||||
function Get-KernelVersion {
|
function Get-KernelVersion {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
function Get-JavaVersionsTable {
|
function Get-JavaVersionsTable {
|
||||||
$javaToolcacheVersions = Get-ChildItem $env:AGENT_TOOLSDIRECTORY/Java*/* -Directory | Sort-Object { [int]$_.Name.Split(".")[0] }
|
$javaToolcacheVersions = Get-ChildItem $env:AGENT_TOOLSDIRECTORY/Java*/* -Directory | Sort-Object { [int] $_.Name.Split(".")[0] }
|
||||||
|
|
||||||
return $javaToolcacheVersions | ForEach-Object {
|
return $javaToolcacheVersions | ForEach-Object {
|
||||||
$majorVersion = $_.Name.split(".")[0]
|
$majorVersion = $_.Name.split(".")[0]
|
||||||
|
|||||||
@@ -5,51 +5,51 @@ function Initialize-RustEnvironment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function Get-RustVersion {
|
function Get-RustVersion {
|
||||||
$rustVersion = $(rustc --version) | Take-OutputPart -Part 1
|
$rustVersion = $(rustc --version) | Get-StringPart -Part 1
|
||||||
return $rustVersion
|
return $rustVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
function Get-BindgenVersion {
|
function Get-BindgenVersion {
|
||||||
$bindgenVersion = $(bindgen --version) | Take-OutputPart -Part 1
|
$bindgenVersion = $(bindgen --version) | Get-StringPart -Part 1
|
||||||
return $bindgenVersion
|
return $bindgenVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
function Get-CargoVersion {
|
function Get-CargoVersion {
|
||||||
$cargoVersion = $(cargo --version) | Take-OutputPart -Part 1
|
$cargoVersion = $(cargo --version) | Get-StringPart -Part 1
|
||||||
return $cargoVersion
|
return $cargoVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
function Get-CargoAuditVersion {
|
function Get-CargoAuditVersion {
|
||||||
$cargoAuditVersion = $(cargo-audit --version) | Take-OutputPart -Part 1
|
$cargoAuditVersion = $(cargo-audit --version) | Get-StringPart -Part 1
|
||||||
return $cargoAuditVersion
|
return $cargoAuditVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
function Get-CargoOutdatedVersion {
|
function Get-CargoOutdatedVersion {
|
||||||
$cargoOutdatedVersion = cargo outdated --version | Take-OutputPart -Part 1
|
$cargoOutdatedVersion = cargo outdated --version | Get-StringPart -Part 1
|
||||||
return $cargoOutdatedVersion
|
return $cargoOutdatedVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
function Get-CargoClippyVersion {
|
function Get-CargoClippyVersion {
|
||||||
$cargoClippyVersion = $(cargo-clippy --version) | Take-OutputPart -Part 1
|
$cargoClippyVersion = $(cargo-clippy --version) | Get-StringPart -Part 1
|
||||||
return $cargoClippyVersion
|
return $cargoClippyVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
function Get-CbindgenVersion {
|
function Get-CbindgenVersion {
|
||||||
$cbindgenVersion = $(cbindgen --version) | Take-OutputPart -Part 1
|
$cbindgenVersion = $(cbindgen --version) | Get-StringPart -Part 1
|
||||||
return $cbindgenVersion
|
return $cbindgenVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
function Get-RustupVersion {
|
function Get-RustupVersion {
|
||||||
$rustupVersion = $(rustup --version) | Take-OutputPart -Part 1
|
$rustupVersion = $(rustup --version) | Get-StringPart -Part 1
|
||||||
return $rustupVersion
|
return $rustupVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
function Get-RustdocVersion {
|
function Get-RustdocVersion {
|
||||||
$rustdocVersion = $(rustdoc --version) | Take-OutputPart -Part 1
|
$rustdocVersion = $(rustdoc --version) | Get-StringPart -Part 1
|
||||||
return $rustdocVersion
|
return $rustdocVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
function Get-RustfmtVersion {
|
function Get-RustfmtVersion {
|
||||||
$rustfmtVersion = $(rustfmt --version) | Take-OutputPart -Part 1 | Take-OutputPart -Part 0 -Delimiter "-"
|
$rustfmtVersion = $(rustfmt --version) | Get-StringPart -Part 1 | Get-StringPart -Part 0 -Delimiter "-"
|
||||||
return $rustfmtVersion
|
return $rustfmtVersion
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,18 +10,18 @@ function Get-AptFastVersion {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function Get-AzCopyVersion {
|
function Get-AzCopyVersion {
|
||||||
$azcopyVersion = azcopy --version | Take-OutputPart -Part 2
|
$azcopyVersion = azcopy --version | Get-StringPart -Part 2
|
||||||
return "$azcopyVersion - available by ``azcopy`` and ``azcopy10`` aliases"
|
return "$azcopyVersion - available by ``azcopy`` and ``azcopy10`` aliases"
|
||||||
}
|
}
|
||||||
|
|
||||||
function Get-BazelVersion {
|
function Get-BazelVersion {
|
||||||
$bazelVersion = bazel --version | Select-String "bazel" | Take-OutputPart -Part 1
|
$bazelVersion = bazel --version | Select-String "bazel" | Get-StringPart -Part 1
|
||||||
return $bazelVersion
|
return $bazelVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
function Get-BazeliskVersion {
|
function Get-BazeliskVersion {
|
||||||
$result = Get-CommandResult "bazelisk version" -Multiline
|
$result = Get-CommandResult "bazelisk version" -Multiline
|
||||||
$bazeliskVersion = $result.Output | Select-String "Bazelisk version:" | Take-OutputPart -Part 2 | Take-OutputPart -Part 0 -Delimiter "v"
|
$bazeliskVersion = $result.Output | Select-String "Bazelisk version:" | Get-StringPart -Part 2 | Get-StringPart -Part 0 -Delimiter "v"
|
||||||
return $bazeliskVersion
|
return $bazeliskVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -39,32 +39,32 @@ function Get-CodeQLBundleVersion {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function Get-PodManVersion {
|
function Get-PodManVersion {
|
||||||
$podmanVersion = podman --version | Take-OutputPart -Part 2
|
$podmanVersion = podman --version | Get-StringPart -Part 2
|
||||||
return $podmanVersion
|
return $podmanVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
function Get-BuildahVersion {
|
function Get-BuildahVersion {
|
||||||
$buildahVersion = buildah --version | Take-OutputPart -Part 2
|
$buildahVersion = buildah --version | Get-StringPart -Part 2
|
||||||
return $buildahVersion
|
return $buildahVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
function Get-SkopeoVersion {
|
function Get-SkopeoVersion {
|
||||||
$skopeoVersion = skopeo --version | Take-OutputPart -Part 2
|
$skopeoVersion = skopeo --version | Get-StringPart -Part 2
|
||||||
return $skopeoVersion
|
return $skopeoVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
function Get-CMakeVersion {
|
function Get-CMakeVersion {
|
||||||
$cmakeVersion = cmake --version | Select-Object -First 1 | Take-OutputPart -Part 2
|
$cmakeVersion = cmake --version | Select-Object -First 1 | Get-StringPart -Part 2
|
||||||
return $cmakeVersion
|
return $cmakeVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
function Get-DockerComposeV1Version {
|
function Get-DockerComposeV1Version {
|
||||||
$composeVersion = docker-compose -v | Take-OutputPart -Part 2 | Take-OutputPart -Part 0 -Delimiter ","
|
$composeVersion = docker-compose -v | Get-StringPart -Part 2 | Get-StringPart -Part 0 -Delimiter ","
|
||||||
return $composeVersion
|
return $composeVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
function Get-DockerComposeV2Version {
|
function Get-DockerComposeV2Version {
|
||||||
$composeVersion = docker compose version | Take-OutputPart -Part 3 | Take-OutputPart -Part 0 -Delimiter "v"
|
$composeVersion = docker compose version | Get-StringPart -Part 3 | Get-StringPart -Part 0 -Delimiter "v"
|
||||||
return $composeVersion
|
return $composeVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,62 +79,62 @@ function Get-DockerServerVersion {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function Get-DockerBuildxVersion {
|
function Get-DockerBuildxVersion {
|
||||||
$buildxVersion = docker buildx version | Take-OutputPart -Part 1 | Take-OutputPart -Part 0 -Delimiter "v"
|
$buildxVersion = docker buildx version | Get-StringPart -Part 1 | Get-StringPart -Part 0 -Delimiter "v"
|
||||||
return $buildxVersion
|
return $buildxVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
function Get-DockerAmazonECRCredHelperVersion {
|
function Get-DockerAmazonECRCredHelperVersion {
|
||||||
$ecrVersion = docker-credential-ecr-login -v | Select-String "Version:" | Take-OutputPart -Part 1
|
$ecrVersion = docker-credential-ecr-login -v | Select-String "Version:" | Get-StringPart -Part 1
|
||||||
return $ecrVersion
|
return $ecrVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
function Get-GitVersion {
|
function Get-GitVersion {
|
||||||
$gitVersion = git --version | Take-OutputPart -Part -1
|
$gitVersion = git --version | Get-StringPart -Part -1
|
||||||
return $gitVersion
|
return $gitVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
function Get-GitLFSVersion {
|
function Get-GitLFSVersion {
|
||||||
$result = Get-CommandResult "git-lfs --version"
|
$result = Get-CommandResult "git-lfs --version"
|
||||||
$gitlfsversion = $result.Output | Take-OutputPart -Part 0 | Take-OutputPart -Part 1 -Delimiter "/"
|
$gitlfsversion = $result.Output | Get-StringPart -Part 0 | Get-StringPart -Part 1 -Delimiter "/"
|
||||||
return $gitlfsversion
|
return $gitlfsversion
|
||||||
}
|
}
|
||||||
|
|
||||||
function Get-GitFTPVersion {
|
function Get-GitFTPVersion {
|
||||||
$gitftpVersion = git-ftp --version | Take-OutputPart -Part 2
|
$gitftpVersion = git-ftp --version | Get-StringPart -Part 2
|
||||||
return $gitftpVersion
|
return $gitftpVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
function Get-GoogleCloudCLIVersion {
|
function Get-GoogleCloudCLIVersion {
|
||||||
return (gcloud --version | Select-Object -First 1) | Take-OutputPart -Part 3
|
return (gcloud --version | Select-Object -First 1) | Get-StringPart -Part 3
|
||||||
}
|
}
|
||||||
|
|
||||||
function Get-HavegedVersion {
|
function Get-HavegedVersion {
|
||||||
$havegedVersion = dpkg-query --showformat='${Version}' --show haveged | Take-OutputPart -Part 0 -Delimiter "-"
|
$havegedVersion = dpkg-query --showformat='${Version}' --show haveged | Get-StringPart -Part 0 -Delimiter "-"
|
||||||
return $havegedVersion
|
return $havegedVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
function Get-HerokuVersion {
|
function Get-HerokuVersion {
|
||||||
$herokuVersion = heroku version | Take-OutputPart -Part 0 | Take-OutputPart -Part 1 -Delimiter "/"
|
$herokuVersion = heroku version | Get-StringPart -Part 0 | Get-StringPart -Part 1 -Delimiter "/"
|
||||||
return $herokuVersion
|
return $herokuVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
function Get-HHVMVersion {
|
function Get-HHVMVersion {
|
||||||
$hhvmVersion = hhvm --version | Select-Object -First 1 | Take-OutputPart -Part 2
|
$hhvmVersion = hhvm --version | Select-Object -First 1 | Get-StringPart -Part 2
|
||||||
return $hhvmVersion
|
return $hhvmVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
function Get-SVNVersion {
|
function Get-SVNVersion {
|
||||||
$svnVersion = svn --version | Select-Object -First 1 | Take-OutputPart -Part 2
|
$svnVersion = svn --version | Select-Object -First 1 | Get-StringPart -Part 2
|
||||||
return $svnVersion
|
return $svnVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
function Get-KustomizeVersion {
|
function Get-KustomizeVersion {
|
||||||
$kustomizeVersion = kustomize version --short | Take-OutputPart -Part 0 | Take-OutputPart -Part 1 -Delimiter "v"
|
$kustomizeVersion = kustomize version --short | Get-StringPart -Part 0 | Get-StringPart -Part 1 -Delimiter "v"
|
||||||
return $kustomizeVersion
|
return $kustomizeVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
function Get-KindVersion {
|
function Get-KindVersion {
|
||||||
$kindVersion = kind version | Take-OutputPart -Part 1 | Take-OutputPart -Part 0 -Delimiter "v"
|
$kindVersion = kind version | Get-StringPart -Part 1 | Get-StringPart -Part 0 -Delimiter "v"
|
||||||
return $kindVersion
|
return $kindVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -144,21 +144,21 @@ function Get-KubectlVersion {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function Get-MinikubeVersion {
|
function Get-MinikubeVersion {
|
||||||
$minikubeVersion = minikube version --short | Take-OutputPart -Part 0 -Delimiter "v"
|
$minikubeVersion = minikube version --short | Get-StringPart -Part 0 -Delimiter "v"
|
||||||
return $minikubeVersion
|
return $minikubeVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
function Get-HGVersion {
|
function Get-HGVersion {
|
||||||
$hgVersion = hg --version | Select-Object -First 1 | Take-OutputPart -Part -1 | Take-OutputPart -Part 0 -Delimiter ")"
|
$hgVersion = hg --version | Select-Object -First 1 | Get-StringPart -Part -1 | Get-StringPart -Part 0 -Delimiter ")"
|
||||||
return $hgVersion
|
return $hgVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
function Get-LeiningenVersion {
|
function Get-LeiningenVersion {
|
||||||
return "$(lein -v | Take-OutputPart -Part 1)"
|
return "$(lein -v | Get-StringPart -Part 1)"
|
||||||
}
|
}
|
||||||
|
|
||||||
function Get-MediainfoVersion {
|
function Get-MediainfoVersion {
|
||||||
$mediainfoVersion = (mediainfo --version | Select-Object -Index 1 | Take-OutputPart -Part 2).Replace('v', '')
|
$mediainfoVersion = (mediainfo --version | Select-Object -Index 1 | Get-StringPart -Part 2).Replace('v', '')
|
||||||
return $mediainfoVersion
|
return $mediainfoVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -187,11 +187,11 @@ function Get-PhantomJSVersion {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function Get-TerraformVersion {
|
function Get-TerraformVersion {
|
||||||
return (terraform version | Select-String "^Terraform").Line.Replace('v','') | Take-OutputPart -Part 1
|
return (terraform version | Select-String "^Terraform").Line.Replace('v','') | Get-StringPart -Part 1
|
||||||
}
|
}
|
||||||
|
|
||||||
function Get-JqVersion {
|
function Get-JqVersion {
|
||||||
$jqVersion = jq --version | Take-OutputPart -Part 1 -Delimiter "-"
|
$jqVersion = jq --version | Get-StringPart -Part 1 -Delimiter "-"
|
||||||
return $jqVersion
|
return $jqVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -211,7 +211,7 @@ function Get-AlibabaCloudCliVersion {
|
|||||||
|
|
||||||
function Get-AWSCliVersion {
|
function Get-AWSCliVersion {
|
||||||
$result = Get-CommandResult "aws --version"
|
$result = Get-CommandResult "aws --version"
|
||||||
$awsVersion = $result.Output | Take-OutputPart -Part 0 | Take-OutputPart -Part 1 -Delimiter "/"
|
$awsVersion = $result.Output | Get-StringPart -Part 0 | Get-StringPart -Part 1 -Delimiter "/"
|
||||||
return $awsVersion
|
return $awsVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -221,21 +221,21 @@ function Get-AWSCliSessionManagerPluginVersion {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function Get-AWSSAMVersion {
|
function Get-AWSSAMVersion {
|
||||||
return $(sam --version | Take-OutputPart -Part -1)
|
return $(sam --version | Get-StringPart -Part -1)
|
||||||
}
|
}
|
||||||
|
|
||||||
function Get-FastlaneVersion {
|
function Get-FastlaneVersion {
|
||||||
$fastlaneVersion = fastlane --version | Select-String "^fastlane [0-9]" | Take-OutputPart -Part 1
|
$fastlaneVersion = fastlane --version | Select-String "^fastlane [0-9]" | Get-StringPart -Part 1
|
||||||
return $fastlaneVersion
|
return $fastlaneVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
function Get-GitHubCliVersion {
|
function Get-GitHubCliVersion {
|
||||||
$ghVersion = gh --version | Select-String "gh version" | Take-OutputPart -Part 2
|
$ghVersion = gh --version | Select-String "gh version" | Get-StringPart -Part 2
|
||||||
return $ghVersion
|
return $ghVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
function Get-NetlifyCliVersion {
|
function Get-NetlifyCliVersion {
|
||||||
$netlifyVersion = netlify --version | Take-OutputPart -Part 0 | Take-OutputPart -Part 1 -Delimiter "/"
|
$netlifyVersion = netlify --version | Get-StringPart -Part 0 | Get-StringPart -Part 1 -Delimiter "/"
|
||||||
return $netlifyVersion
|
return $netlifyVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -245,7 +245,7 @@ function Get-OCCliVersion {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function Get-ORASCliVersion {
|
function Get-ORASCliVersion {
|
||||||
$orasVersion = oras version | Select-String "^Version:" | Take-OutputPart -Part 1
|
$orasVersion = oras version | Select-String "^Version:" | Get-StringPart -Part 1
|
||||||
return $orasVersion
|
return $orasVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -255,30 +255,30 @@ function Get-VerselCliversion {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function Get-PulumiVersion {
|
function Get-PulumiVersion {
|
||||||
$pulumiVersion = pulumi version | Take-OutputPart -Part 0 -Delimiter "v"
|
$pulumiVersion = pulumi version | Get-StringPart -Part 0 -Delimiter "v"
|
||||||
return $pulumiVersion
|
return $pulumiVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
function Get-RVersion {
|
function Get-RVersion {
|
||||||
$rVersion = (Get-CommandResult "R --version | grep 'R version'").Output | Take-OutputPart -Part 2
|
$rVersion = (Get-CommandResult "R --version | grep 'R version'").Output | Get-StringPart -Part 2
|
||||||
return $rVersion
|
return $rVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
function Get-SphinxVersion {
|
function Get-SphinxVersion {
|
||||||
$sphinxVersion = searchd -h | Select-Object -First 1 | Take-OutputPart -Part 1 | Take-OutputPart -Part 0 -Delimiter "-"
|
$sphinxVersion = searchd -h | Select-Object -First 1 | Get-StringPart -Part 1 | Get-StringPart -Part 0 -Delimiter "-"
|
||||||
return $sphinxVersion
|
return $sphinxVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
function Get-YamllintVersion {
|
function Get-YamllintVersion {
|
||||||
return $(yamllint --version) | Take-OutputPart -Part 1
|
return $(yamllint --version) | Get-StringPart -Part 1
|
||||||
}
|
}
|
||||||
|
|
||||||
function Get-ZstdVersion {
|
function Get-ZstdVersion {
|
||||||
$zstdVersion = zstd --version | Take-OutputPart -Part 1 -Delimiter "v" | Take-OutputPart -Part 0 -Delimiter ","
|
$zstdVersion = zstd --version | Get-StringPart -Part 1 -Delimiter "v" | Get-StringPart -Part 0 -Delimiter ","
|
||||||
return "$zstdVersion"
|
return "$zstdVersion"
|
||||||
}
|
}
|
||||||
|
|
||||||
function Get-YqVersion {
|
function Get-YqVersion {
|
||||||
$yqVersion = $(yq -V) | Take-OutputPart -Part 3
|
$yqVersion = $(yq -V) | Get-StringPart -Part 3
|
||||||
return $yqVersion.TrimStart("v").Trim()
|
return $yqVersion.TrimStart("v").Trim()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
function Get-ApacheVersion {
|
function Get-ApacheVersion {
|
||||||
$name = "apache2"
|
$name = "apache2"
|
||||||
$port = 80
|
$port = 80
|
||||||
$version = bash -c "apache2 -v | grep -Po 'Apache/(\d+.){2}\d+'" | Take-OutputPart -Part 1 -Delimiter "/"
|
$version = bash -c "apache2 -v | grep -Po 'Apache/(\d+.){2}\d+'" | Get-StringPart -Part 1 -Delimiter "/"
|
||||||
$serviceStatus = systemctl status apache2 | grep "Active:" | Take-OutputPart -Part 1
|
$serviceStatus = systemctl status apache2 | grep "Active:" | Get-StringPart -Part 1
|
||||||
$configFile = "/etc/apache2/apache2.conf"
|
$configFile = "/etc/apache2/apache2.conf"
|
||||||
return [PsCustomObject]@{
|
return [PsCustomObject]@{
|
||||||
"Name" = $name
|
"Name" = $name
|
||||||
"Version" = $version
|
"Version" = $version
|
||||||
"ConfigFile" = $configFile
|
"ConfigFile" = $configFile
|
||||||
"ServiceStatus" = $serviceStatus
|
"ServiceStatus" = $serviceStatus
|
||||||
"ListenPort" = $port
|
"ListenPort" = $port
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -17,14 +17,14 @@ function Get-NginxVersion {
|
|||||||
$name = "nginx"
|
$name = "nginx"
|
||||||
$port = 80
|
$port = 80
|
||||||
$version = (dpkg-query --showformat='${Version}' --show nginx).Split('-')[0]
|
$version = (dpkg-query --showformat='${Version}' --show nginx).Split('-')[0]
|
||||||
$serviceStatus = systemctl status nginx | grep "Active:" | Take-OutputPart -Part 1
|
$serviceStatus = systemctl status nginx | grep "Active:" | Get-StringPart -Part 1
|
||||||
$configFile = "/etc/nginx/nginx.conf"
|
$configFile = "/etc/nginx/nginx.conf"
|
||||||
return [PsCustomObject]@{
|
return [PsCustomObject]@{
|
||||||
"Name" = $name
|
"Name" = $name
|
||||||
"Version" = $version
|
"Version" = $version
|
||||||
"ConfigFile" = $configFile
|
"ConfigFile" = $configFile
|
||||||
"ServiceStatus" = $serviceStatus
|
"ServiceStatus" = $serviceStatus
|
||||||
"ListenPort" = $port
|
"ListenPort" = $port
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -35,11 +35,11 @@ function Get-Xsp4Version {
|
|||||||
$serviceStatus = systemctl show -p ActiveState --value mono-xsp4
|
$serviceStatus = systemctl show -p ActiveState --value mono-xsp4
|
||||||
$configFile = "/etc/default/mono-xsp4"
|
$configFile = "/etc/default/mono-xsp4"
|
||||||
return [PsCustomObject]@{
|
return [PsCustomObject]@{
|
||||||
"Name" = $name
|
"Name" = $name
|
||||||
"Version" = $version
|
"Version" = $version
|
||||||
"ConfigFile" = $configFile
|
"ConfigFile" = $configFile
|
||||||
"ServiceStatus" = $serviceStatus
|
"ServiceStatus" = $serviceStatus
|
||||||
"ListenPort" = $port
|
"ListenPort" = $port
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user