feature: initial commit for all new image changes
This commit is contained in:
@@ -0,0 +1,278 @@
|
||||
using module ./software-report-base/SoftwareReport.psm1
|
||||
using module ./software-report-base/SoftwareReport.Nodes.psm1
|
||||
|
||||
param (
|
||||
[Parameter(Mandatory)]
|
||||
[string] $OutputDirectory
|
||||
)
|
||||
|
||||
$global:ErrorActionPreference = "Stop"
|
||||
$global:ErrorView = "NormalView"
|
||||
Set-StrictMode -Version Latest
|
||||
|
||||
Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Android.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.Common.psm1") -DisableNameChecking
|
||||
Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Databases.psm1") -DisableNameChecking
|
||||
Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Helpers.psm1") -DisableNameChecking
|
||||
Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1" -DisableNameChecking
|
||||
Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Java.psm1") -DisableNameChecking
|
||||
Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Rust.psm1") -DisableNameChecking
|
||||
Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Tools.psm1") -DisableNameChecking
|
||||
Import-Module (Join-Path $PSScriptRoot "SoftwareReport.WebServers.psm1") -DisableNameChecking
|
||||
|
||||
# Restore file owner in user profile
|
||||
sudo chown -R ${env:USER}: $env:HOME
|
||||
|
||||
# Software report
|
||||
$softwareReport = [SoftwareReport]::new("Ubuntu $(Get-OSVersionShort)")
|
||||
$softwareReport.Root.AddToolVersion("OS Version:", $(Get-OSVersionFull))
|
||||
$softwareReport.Root.AddToolVersion("Kernel Version:", $(Get-KernelVersion))
|
||||
$softwareReport.Root.AddToolVersion("Image Version:", $env:IMAGE_VERSION)
|
||||
$softwareReport.Root.AddToolVersion("Systemd version:", $(Get-SystemdVersion))
|
||||
|
||||
$installedSoftware = $softwareReport.Root.AddHeader("Installed Software")
|
||||
|
||||
# Language and Runtime
|
||||
$languageAndRuntime = $installedSoftware.AddHeader("Language and Runtime")
|
||||
$languageAndRuntime.AddToolVersion("Bash", $(Get-BashVersion))
|
||||
$languageAndRuntime.AddToolVersionsListInline("Clang", $(Get-ClangToolVersions -ToolName "clang"), "^\d+")
|
||||
$languageAndRuntime.AddToolVersionsListInline("Clang-format", $(Get-ClangToolVersions -ToolName "clang-format"), "^\d+")
|
||||
$languageAndRuntime.AddToolVersionsListInline("Clang-tidy", $(Get-ClangTidyVersions), "^\d+")
|
||||
$languageAndRuntime.AddToolVersion("Dash", $(Get-DashVersion))
|
||||
if (Test-IsUbuntu20) {
|
||||
$languageAndRuntime.AddToolVersion("Erlang", $(Get-ErlangVersion))
|
||||
$languageAndRuntime.AddToolVersion("Erlang rebar3", $(Get-ErlangRebar3Version))
|
||||
}
|
||||
$languageAndRuntime.AddToolVersionsListInline("GNU C++", $(Get-CPPVersions), "^\d+")
|
||||
$languageAndRuntime.AddToolVersionsListInline("GNU Fortran", $(Get-FortranVersions), "^\d+")
|
||||
$languageAndRuntime.AddToolVersion("Julia", $(Get-JuliaVersion))
|
||||
$languageAndRuntime.AddToolVersion("Kotlin", $(Get-KotlinVersion))
|
||||
if (-not $(Test-IsUbuntu24)) {
|
||||
$languageAndRuntime.AddToolVersion("Mono", $(Get-MonoVersion))
|
||||
$languageAndRuntime.AddToolVersion("MSBuild", $(Get-MsbuildVersion))
|
||||
}
|
||||
$languageAndRuntime.AddToolVersion("Node.js", $(Get-NodeVersion))
|
||||
$languageAndRuntime.AddToolVersion("Perl", $(Get-PerlVersion))
|
||||
$languageAndRuntime.AddToolVersion("Python", $(Get-PythonVersion))
|
||||
$languageAndRuntime.AddToolVersion("Ruby", $(Get-RubyVersion))
|
||||
$languageAndRuntime.AddToolVersion("Swift", $(Get-SwiftVersion))
|
||||
|
||||
|
||||
# Package Management
|
||||
$packageManagement = $installedSoftware.AddHeader("Package Management")
|
||||
$packageManagement.AddToolVersion("cpan", $(Get-CpanVersion))
|
||||
$packageManagement.AddToolVersion("Helm", $(Get-HelmVersion))
|
||||
$packageManagement.AddToolVersion("Homebrew", $(Get-HomebrewVersion))
|
||||
$packageManagement.AddToolVersion("Miniconda", $(Get-MinicondaVersion))
|
||||
$packageManagement.AddToolVersion("Npm", $(Get-NpmVersion))
|
||||
if (-not $(Test-IsUbuntu24)) {
|
||||
$packageManagement.AddToolVersion("NuGet", $(Get-NuGetVersion))
|
||||
}
|
||||
$packageManagement.AddToolVersion("Pip", $(Get-PipVersion))
|
||||
$packageManagement.AddToolVersion("Pip3", $(Get-Pip3Version))
|
||||
$packageManagement.AddToolVersion("Pipx", $(Get-PipxVersion))
|
||||
$packageManagement.AddToolVersion("RubyGems", $(Get-GemVersion))
|
||||
$packageManagement.AddToolVersion("Vcpkg", $(Get-VcpkgVersion))
|
||||
$packageManagement.AddToolVersion("Yarn", $(Get-YarnVersion))
|
||||
$packageManagement.AddHeader("Environment variables").AddTable($(Build-PackageManagementEnvironmentTable))
|
||||
$packageManagement.AddHeader("Homebrew note").AddNote(@'
|
||||
Location: /home/linuxbrew
|
||||
Note: Homebrew is pre-installed on image but not added to PATH.
|
||||
run the eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" command
|
||||
to accomplish this.
|
||||
'@)
|
||||
|
||||
# Project Management
|
||||
$projectManagement = $installedSoftware.AddHeader("Project Management")
|
||||
$projectManagement.AddToolVersion("Ant", $(Get-AntVersion))
|
||||
$projectManagement.AddToolVersion("Gradle", $(Get-GradleVersion))
|
||||
$projectManagement.AddToolVersion("Lerna", $(Get-LernaVersion))
|
||||
$projectManagement.AddToolVersion("Maven", $(Get-MavenVersion))
|
||||
if ((Test-IsUbuntu20) -or (Test-IsUbuntu22)) {
|
||||
$projectManagement.AddToolVersion("Sbt", $(Get-SbtVersion))
|
||||
}
|
||||
|
||||
# Tools
|
||||
$tools = $installedSoftware.AddHeader("Tools")
|
||||
$tools.AddToolVersion("Ansible", $(Get-AnsibleVersion))
|
||||
if ((Test-IsUbuntu20) -or (Test-IsUbuntu22)) {
|
||||
$tools.AddToolVersion("apt-fast", $(Get-AptFastVersion))
|
||||
}
|
||||
$tools.AddToolVersion("AzCopy", $(Get-AzCopyVersion))
|
||||
$tools.AddToolVersion("Bazel", $(Get-BazelVersion))
|
||||
$tools.AddToolVersion("Bazelisk", $(Get-BazeliskVersion))
|
||||
$tools.AddToolVersion("Bicep", $(Get-BicepVersion))
|
||||
$tools.AddToolVersion("Buildah", $(Get-BuildahVersion))
|
||||
$tools.AddToolVersion("CMake", $(Get-CMakeVersion))
|
||||
$tools.AddToolVersion("CodeQL Action Bundle", $(Get-CodeQLBundleVersion))
|
||||
$tools.AddToolVersion("Docker Amazon ECR Credential Helper", $(Get-DockerAmazonECRCredHelperVersion))
|
||||
$tools.AddToolVersion("Docker Compose v2", $(Get-DockerComposeV2Version))
|
||||
$tools.AddToolVersion("Docker-Buildx", $(Get-DockerBuildxVersion))
|
||||
$tools.AddToolVersion("Docker Client", $(Get-DockerClientVersion))
|
||||
$tools.AddToolVersion("Docker Server", $(Get-DockerServerVersion))
|
||||
$tools.AddToolVersion("Fastlane", $(Get-FastlaneVersion))
|
||||
$tools.AddToolVersion("Git", $(Get-GitVersion))
|
||||
$tools.AddToolVersion("Git LFS", $(Get-GitLFSVersion))
|
||||
$tools.AddToolVersion("Git-ftp", $(Get-GitFTPVersion))
|
||||
$tools.AddToolVersion("Haveged", $(Get-HavegedVersion))
|
||||
if ((Test-IsUbuntu20) -or (Test-IsUbuntu22)) {
|
||||
$tools.AddToolVersion("Heroku", $(Get-HerokuVersion))
|
||||
}
|
||||
if (Test-IsUbuntu20) {
|
||||
$tools.AddToolVersion("HHVM (HipHop VM)", $(Get-HHVMVersion))
|
||||
}
|
||||
$tools.AddToolVersion("jq", $(Get-JqVersion))
|
||||
$tools.AddToolVersion("Kind", $(Get-KindVersion))
|
||||
$tools.AddToolVersion("Kubectl", $(Get-KubectlVersion))
|
||||
$tools.AddToolVersion("Kustomize", $(Get-KustomizeVersion))
|
||||
if ((Test-IsUbuntu20) -or (Test-IsUbuntu22)) {
|
||||
$tools.AddToolVersion("Leiningen", $(Get-LeiningenVersion))
|
||||
}
|
||||
$tools.AddToolVersion("MediaInfo", $(Get-MediainfoVersion))
|
||||
$tools.AddToolVersion("Mercurial", $(Get-HGVersion))
|
||||
$tools.AddToolVersion("Minikube", $(Get-MinikubeVersion))
|
||||
$tools.AddToolVersion("n", $(Get-NVersion))
|
||||
$tools.AddToolVersion("Newman", $(Get-NewmanVersion))
|
||||
if ((Test-IsUbuntu20) -or (Test-IsUbuntu22)) {
|
||||
$tools.AddToolVersion("nvm", $(Get-NvmVersion))
|
||||
}
|
||||
$tools.AddToolVersion("OpenSSL", $(Get-OpensslVersion))
|
||||
$tools.AddToolVersion("Packer", $(Get-PackerVersion))
|
||||
$tools.AddToolVersion("Parcel", $(Get-ParcelVersion))
|
||||
if (Test-IsUbuntu20) {
|
||||
$tools.AddToolVersion("PhantomJS", $(Get-PhantomJSVersion))
|
||||
}
|
||||
$tools.AddToolVersion("Podman", $(Get-PodManVersion))
|
||||
$tools.AddToolVersion("Pulumi", $(Get-PulumiVersion))
|
||||
if ((Test-IsUbuntu20) -or (Test-IsUbuntu22)) {
|
||||
$tools.AddToolVersion("R", $(Get-RVersion))
|
||||
}
|
||||
$tools.AddToolVersion("Skopeo", $(Get-SkopeoVersion))
|
||||
$tools.AddToolVersion("Sphinx Open Source Search Server", $(Get-SphinxVersion))
|
||||
if ((Test-IsUbuntu20) -or (Test-IsUbuntu22)) {
|
||||
$tools.AddToolVersion("SVN", $(Get-SVNVersion))
|
||||
$tools.AddToolVersion("Terraform", $(Get-TerraformVersion))
|
||||
}
|
||||
$tools.AddToolVersion("yamllint", $(Get-YamllintVersion))
|
||||
$tools.AddToolVersion("yq", $(Get-YqVersion))
|
||||
$tools.AddToolVersion("zstd", $(Get-ZstdVersion))
|
||||
|
||||
# CLI Tools
|
||||
$cliTools = $installedSoftware.AddHeader("CLI Tools")
|
||||
if ((Test-IsUbuntu20) -or (Test-IsUbuntu22)) {
|
||||
$cliTools.AddToolVersion("Alibaba Cloud CLI", $(Get-AlibabaCloudCliVersion))
|
||||
}
|
||||
$cliTools.AddToolVersion("AWS CLI", $(Get-AWSCliVersion))
|
||||
$cliTools.AddToolVersion("AWS CLI Session Manager Plugin", $(Get-AWSCliSessionManagerPluginVersion))
|
||||
$cliTools.AddToolVersion("AWS SAM CLI", $(Get-AWSSAMVersion))
|
||||
$cliTools.AddToolVersion("Azure CLI", $(Get-AzureCliVersion))
|
||||
$cliTools.AddToolVersion("Azure CLI (azure-devops)", $(Get-AzureDevopsVersion))
|
||||
$cliTools.AddToolVersion("GitHub CLI", $(Get-GitHubCliVersion))
|
||||
if ((Test-IsUbuntu20) -or (Test-IsUbuntu22)) {
|
||||
$cliTools.AddToolVersion("Google Cloud CLI", $(Get-GoogleCloudCLIVersion))
|
||||
$cliTools.AddToolVersion("Netlify CLI", $(Get-NetlifyCliVersion))
|
||||
$cliTools.AddToolVersion("OpenShift CLI", $(Get-OCCliVersion))
|
||||
$cliTools.AddToolVersion("ORAS CLI", $(Get-ORASCliVersion))
|
||||
$cliTools.AddToolVersion("Vercel CLI", $(Get-VerselCliversion))
|
||||
}
|
||||
|
||||
# Java
|
||||
$installedSoftware.AddHeader("Java").AddTable($(Get-JavaVersionsTable))
|
||||
|
||||
# PHP Tools
|
||||
$phpTools = $installedSoftware.AddHeader("PHP Tools")
|
||||
$phpTools.AddToolVersionsListInline("PHP", $(Get-PHPVersions), "^\d+\.\d+")
|
||||
$phpTools.AddToolVersion("Composer", $(Get-ComposerVersion))
|
||||
$phpTools.AddToolVersion("PHPUnit", $(Get-PHPUnitVersion))
|
||||
$phpTools.AddNote("Both Xdebug and PCOV extensions are installed, but only Xdebug is enabled.")
|
||||
|
||||
# Haskell Tools
|
||||
$haskellTools = $installedSoftware.AddHeader("Haskell Tools")
|
||||
$haskellTools.AddToolVersion("Cabal", $(Get-CabalVersion))
|
||||
$haskellTools.AddToolVersion("GHC", $(Get-GHCVersion))
|
||||
$haskellTools.AddToolVersion("GHCup", $(Get-GHCupVersion))
|
||||
$haskellTools.AddToolVersion("Stack", $(Get-StackVersion))
|
||||
|
||||
# Rust Tools
|
||||
Initialize-RustEnvironment
|
||||
$rustTools = $installedSoftware.AddHeader("Rust Tools")
|
||||
$rustTools.AddToolVersion("Cargo", $(Get-CargoVersion))
|
||||
$rustTools.AddToolVersion("Rust", $(Get-RustVersion))
|
||||
$rustTools.AddToolVersion("Rustdoc", $(Get-RustdocVersion))
|
||||
$rustTools.AddToolVersion("Rustup", $(Get-RustupVersion))
|
||||
|
||||
# Packages
|
||||
$rustToolsPackages = $rustTools.AddHeader("Packages")
|
||||
if ((Test-IsUbuntu20) -or (Test-IsUbuntu22)) {
|
||||
$rustToolsPackages.AddToolVersion("Bindgen", $(Get-BindgenVersion))
|
||||
$rustToolsPackages.AddToolVersion("Cargo audit", $(Get-CargoAuditVersion))
|
||||
$rustToolsPackages.AddToolVersion("Cargo clippy", $(Get-CargoClippyVersion))
|
||||
$rustToolsPackages.AddToolVersion("Cargo outdated", $(Get-CargoOutdatedVersion))
|
||||
$rustToolsPackages.AddToolVersion("Cbindgen", $(Get-CbindgenVersion))
|
||||
}
|
||||
$rustToolsPackages.AddToolVersion("Rustfmt", $(Get-RustfmtVersion))
|
||||
|
||||
# Browsers and Drivers
|
||||
$browsersTools = $installedSoftware.AddHeader("Browsers and Drivers")
|
||||
$browsersTools.AddToolVersion("Google Chrome", $(Get-ChromeVersion))
|
||||
$browsersTools.AddToolVersion("ChromeDriver", $(Get-ChromeDriverVersion))
|
||||
$browsersTools.AddToolVersion("Chromium", $(Get-ChromiumVersion))
|
||||
$browsersTools.AddToolVersion("Microsoft Edge", $(Get-EdgeVersion))
|
||||
$browsersTools.AddToolVersion("Microsoft Edge WebDriver", $(Get-EdgeDriverVersion))
|
||||
|
||||
$browsersTools.AddToolVersion("Selenium server", $(Get-SeleniumVersion))
|
||||
$browsersTools.AddToolVersion("Mozilla Firefox", $(Get-FirefoxVersion))
|
||||
$browsersTools.AddToolVersion("Geckodriver", $(Get-GeckodriverVersion))
|
||||
|
||||
|
||||
# Environment variables
|
||||
$browsersTools.AddHeader("Environment variables").AddTable($(Build-BrowserWebdriversEnvironmentTable))
|
||||
|
||||
# .NET Tools
|
||||
$netCoreTools = $installedSoftware.AddHeader(".NET Tools")
|
||||
$netCoreTools.AddToolVersionsListInline(".NET Core SDK", $(Get-DotNetCoreSdkVersions), "^\d+\.\d+\.\d")
|
||||
$netCoreTools.AddNodes($(Get-DotnetTools))
|
||||
|
||||
# Databases
|
||||
$databasesTools = $installedSoftware.AddHeader("Databases")
|
||||
if (Test-IsUbuntu20) {
|
||||
$databasesTools.AddToolVersion("MongoDB", $(Get-MongoDbVersion))
|
||||
}
|
||||
$databasesTools.AddToolVersion("sqlite3", $(Get-SqliteVersion))
|
||||
$databasesTools.AddNode($(Build-PostgreSqlSection))
|
||||
$databasesTools.AddNode($(Build-MySQLSection))
|
||||
if (-not $(Test-IsUbuntu24)) {
|
||||
$databasesTools.AddNode($(Build-MSSQLToolsSection))
|
||||
}
|
||||
|
||||
# Cached Tools
|
||||
$cachedTools = $installedSoftware.AddHeader("Cached Tools")
|
||||
$cachedTools.AddToolVersionsList("Go", $(Get-ToolcacheGoVersions), "^\d+\.\d+")
|
||||
$cachedTools.AddToolVersionsList("Node.js", $(Get-ToolcacheNodeVersions), "^\d+")
|
||||
$cachedTools.AddToolVersionsList("Python", $(Get-ToolcachePythonVersions), "^\d+\.\d+")
|
||||
$cachedTools.AddToolVersionsList("PyPy", $(Get-ToolcachePyPyVersions), "^\d+\.\d+")
|
||||
if (-not $(Test-IsUbuntu24)) {
|
||||
$cachedTools.AddToolVersionsList("Ruby", $(Get-ToolcacheRubyVersions), "^\d+\.\d+")
|
||||
}
|
||||
|
||||
# PowerShell Tools
|
||||
$powerShellTools = $installedSoftware.AddHeader("PowerShell Tools")
|
||||
$powerShellTools.AddToolVersion("PowerShell", $(Get-PowershellVersion))
|
||||
$powerShellTools.AddHeader("PowerShell Modules").AddNodes($(Get-PowerShellModules))
|
||||
|
||||
$installedSoftware.AddHeader("Web Servers").AddTable($(Build-WebServersTable))
|
||||
|
||||
$androidTools = $installedSoftware.AddHeader("Android")
|
||||
$androidTools.AddTable($(Build-AndroidTable))
|
||||
|
||||
$androidTools.AddHeader("Environment variables").AddTable($(Build-AndroidEnvironmentTable))
|
||||
|
||||
if (-not $(Test-IsUbuntu24)) {
|
||||
$installedSoftware.AddHeader("Cached Docker images").AddTable($(Get-CachedDockerImagesTableData))
|
||||
}
|
||||
$installedSoftware.AddHeader("Installed apt packages").AddTable($(Get-AptPackages))
|
||||
|
||||
$softwareReport.ToJson() | Out-File -FilePath "${OutputDirectory}/software-report.json" -Encoding UTF8NoBOM
|
||||
$softwareReport.ToMarkdown() | Out-File -FilePath "${OutputDirectory}/software-report.md" -Encoding UTF8NoBOM
|
||||
@@ -0,0 +1,173 @@
|
||||
function Split-TableRowByColumns {
|
||||
param(
|
||||
[string] $Row
|
||||
)
|
||||
return $Row.Split("|") | ForEach-Object { $_.trim() }
|
||||
}
|
||||
|
||||
function Get-AndroidSDKRoot {
|
||||
return "/usr/local/lib/android/sdk"
|
||||
}
|
||||
|
||||
function Get-AndroidSDKManagerPath {
|
||||
$androidSDKDir = Get-AndroidSDKRoot
|
||||
return Join-Path $androidSDKDir "cmdline-tools" "latest" "bin" "sdkmanager"
|
||||
}
|
||||
|
||||
function Get-AndroidInstalledPackages {
|
||||
$androidSDKManagerPath = Get-AndroidSDKManagerPath
|
||||
$androidSDKManagerList = Invoke-Expression "$androidSDKManagerPath --list_installed --include_obsolete"
|
||||
return $androidSDKManagerList
|
||||
}
|
||||
|
||||
function Build-AndroidTable {
|
||||
$packageInfo = Get-AndroidInstalledPackages
|
||||
return @(
|
||||
@{
|
||||
"Package" = "Android Command Line Tools"
|
||||
"Version" = Get-AndroidCommandLineToolsVersion
|
||||
},
|
||||
@{
|
||||
"Package" = "Android Emulator"
|
||||
"Version" = Get-AndroidPackageVersions -PackageInfo $packageInfo -MatchedString "Android Emulator"
|
||||
},
|
||||
@{
|
||||
"Package" = "Android SDK Build-tools"
|
||||
"Version" = Get-AndroidBuildToolVersions -PackageInfo $packageInfo
|
||||
},
|
||||
@{
|
||||
"Package" = "Android SDK Platform-Tools"
|
||||
"Version" = Get-AndroidPackageVersions -PackageInfo $packageInfo -MatchedString "Android SDK Platform-Tools"
|
||||
},
|
||||
@{
|
||||
"Package" = "Android SDK Platforms"
|
||||
"Version" = Get-AndroidPlatformVersions -PackageInfo $packageInfo
|
||||
},
|
||||
@{
|
||||
"Package" = "Android Support Repository"
|
||||
"Version" = Get-AndroidPackageVersions -PackageInfo $packageInfo -MatchedString "Android Support Repository"
|
||||
},
|
||||
@{
|
||||
"Package" = "CMake"
|
||||
"Version" = Get-AndroidPackageVersions -PackageInfo $packageInfo -MatchedString "cmake"
|
||||
},
|
||||
@{
|
||||
"Package" = "Google APIs"
|
||||
"Version" = Get-AndroidGoogleAPIsVersions -PackageInfo $packageInfo
|
||||
},
|
||||
@{
|
||||
"Package" = "Google Play services"
|
||||
"Version" = Get-AndroidPackageVersions -PackageInfo $packageInfo -MatchedString "Google Play services"
|
||||
},
|
||||
@{
|
||||
"Package" = "Google Repository"
|
||||
"Version" = Get-AndroidPackageVersions -PackageInfo $packageInfo -MatchedString "Google Repository"
|
||||
},
|
||||
@{
|
||||
"Package" = "NDK"
|
||||
"Version" = Get-AndroidNDKVersions
|
||||
},
|
||||
@{
|
||||
"Package" = "SDK Patch Applier v4"
|
||||
"Version" = Get-AndroidPackageVersions -PackageInfo $packageInfo -MatchedString "SDK Patch Applier v4"
|
||||
}
|
||||
) | Where-Object { $_.Version } | ForEach-Object {
|
||||
[PSCustomObject] @{
|
||||
"Package Name" = $_.Package
|
||||
"Version" = $_.Version
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function Get-AndroidPackageVersions {
|
||||
param (
|
||||
[Parameter(Mandatory)]
|
||||
[object] $PackageInfo,
|
||||
[Parameter(Mandatory)]
|
||||
[object] $MatchedString
|
||||
)
|
||||
|
||||
$versions = $PackageInfo | Where-Object { $_ -Match $MatchedString } | ForEach-Object {
|
||||
$packageInfoParts = Split-TableRowByColumns $_
|
||||
return $packageInfoParts[1]
|
||||
}
|
||||
return ($versions -Join "<br>")
|
||||
}
|
||||
|
||||
function Get-AndroidPlatformVersions {
|
||||
param (
|
||||
[Parameter(Mandatory)]
|
||||
[object] $PackageInfo
|
||||
)
|
||||
|
||||
$versions = $PackageInfo | Where-Object { $_ -Match "Android SDK Platform " } | ForEach-Object {
|
||||
$packageInfoParts = Split-TableRowByColumns $_
|
||||
$revision = $packageInfoParts[1]
|
||||
$version = $packageInfoParts[0].split(";")[1]
|
||||
return "$version (rev $revision)"
|
||||
}
|
||||
[array]::Reverse($versions)
|
||||
return ($versions -Join "<br>")
|
||||
}
|
||||
|
||||
function Get-AndroidCommandLineToolsVersion {
|
||||
$commandLineTools = Get-AndroidSDKManagerPath
|
||||
(& $commandLineTools --version | Out-String).Trim() -match "(?<version>^(\d+\.){1,}\d+$)" | Out-Null
|
||||
$commandLineToolsVersion = $Matches.Version
|
||||
return $commandLineToolsVersion
|
||||
}
|
||||
|
||||
function Get-AndroidBuildToolVersions {
|
||||
param (
|
||||
[Parameter(Mandatory)]
|
||||
[object] $PackageInfo
|
||||
)
|
||||
|
||||
$versions = $PackageInfo | Where-Object { $_ -Match "Android SDK Build-Tools" } | ForEach-Object {
|
||||
$packageInfoParts = Split-TableRowByColumns $_
|
||||
return $packageInfoParts[1]
|
||||
}
|
||||
$groupVersions = @()
|
||||
$versions | ForEach-Object {
|
||||
$majorVersion = $_.Split(".")[0]
|
||||
$groupVersions += $versions | Where-Object { $_.StartsWith($majorVersion) } | Join-String -Separator " "
|
||||
}
|
||||
return ($groupVersions | Sort-Object -Descending -Unique | Join-String -Separator "<br>")
|
||||
}
|
||||
|
||||
function Get-AndroidGoogleAPIsVersions {
|
||||
param (
|
||||
[Parameter(Mandatory)]
|
||||
[object] $PackageInfo
|
||||
)
|
||||
|
||||
$versions = $PackageInfo | Where-Object { $_ -Match "Google APIs" } | ForEach-Object {
|
||||
$packageInfoParts = Split-TableRowByColumns $_
|
||||
return $packageInfoParts[0].split(";")[1]
|
||||
}
|
||||
return ($versions -Join "<br>")
|
||||
}
|
||||
|
||||
function Get-AndroidNDKVersions {
|
||||
$ndkFolderPath = Join-Path (Get-AndroidSDKRoot) "ndk"
|
||||
$versions = Get-ChildItem -Path $ndkFolderPath -Name
|
||||
$ndkDefaultVersion = (Get-ToolsetContent).android.ndk.default
|
||||
$ndkDefaultFullVersion = Get-ChildItem "$env:ANDROID_HOME/ndk/$ndkDefaultVersion.*" -Name | Select-Object -Last 1
|
||||
|
||||
return ($versions | ForEach-Object {
|
||||
$defaultPostfix = ( $_ -eq $ndkDefaultFullVersion ) ? " (default)" : ""
|
||||
$_ + $defaultPostfix
|
||||
} | Join-String -Separator "<br>")
|
||||
}
|
||||
|
||||
function Build-AndroidEnvironmentTable {
|
||||
$androidVersions = Get-Item env:ANDROID_*
|
||||
|
||||
$shouldResolveLink = 'ANDROID_NDK', 'ANDROID_NDK_HOME', 'ANDROID_NDK_ROOT', 'ANDROID_NDK_LATEST_HOME'
|
||||
return $androidVersions | Sort-Object -Property Name | ForEach-Object {
|
||||
[PSCustomObject] @{
|
||||
"Name" = $_.Name
|
||||
"Value" = if ($shouldResolveLink.Contains($_.Name )) { Get-PathWithLink($_.Value) } else {$_.Value}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
function Get-ChromeVersion {
|
||||
$googleChromeVersion = google-chrome --version | Get-StringPart -Part 2
|
||||
return $googleChromeVersion
|
||||
}
|
||||
|
||||
function Get-ChromeDriverVersion {
|
||||
$chromeDriverVersion = chromedriver --version | Get-StringPart -Part 1
|
||||
return $chromeDriverVersion
|
||||
}
|
||||
|
||||
function Get-FirefoxVersion {
|
||||
$firefoxVersion = $(firefox --version) | Get-StringPart -Part 2
|
||||
return $firefoxVersion
|
||||
}
|
||||
|
||||
function Get-GeckodriverVersion {
|
||||
$geckodriverVersion = geckodriver --version | Select-Object -First 1 | Get-StringPart -Part 1
|
||||
return $geckodriverVersion
|
||||
}
|
||||
|
||||
function Get-ChromiumVersion {
|
||||
$chromiumVersion = chromium-browser --version | Get-StringPart -Part 1
|
||||
return $chromiumVersion
|
||||
}
|
||||
|
||||
function Get-EdgeVersion {
|
||||
$edgeVersion = (microsoft-edge --version).Trim() | Get-StringPart -Part 2
|
||||
return $edgeVersion
|
||||
}
|
||||
|
||||
function Get-EdgeDriverVersion {
|
||||
$edgeDriverVersion = msedgedriver --version | Get-StringPart -Part 3
|
||||
return $edgeDriverVersion
|
||||
}
|
||||
|
||||
function Get-SeleniumVersion {
|
||||
$fullSeleniumVersion = (Get-ChildItem "/usr/share/java/selenium-server-*").Name -replace "selenium-server-"
|
||||
return $fullSeleniumVersion
|
||||
}
|
||||
|
||||
function Build-BrowserWebdriversEnvironmentTable {
|
||||
return @(
|
||||
[PSCustomObject] @{
|
||||
"Name" = "CHROMEWEBDRIVER"
|
||||
"Value" = $env:CHROMEWEBDRIVER
|
||||
},
|
||||
[PSCustomObject] @{
|
||||
"Name" = "EDGEWEBDRIVER"
|
||||
"Value" = $env:EDGEWEBDRIVER
|
||||
},
|
||||
[PSCustomObject] @{
|
||||
"Name" = "GECKOWEBDRIVER"
|
||||
"Value" = $env:GECKOWEBDRIVER
|
||||
},
|
||||
[PSCustomObject] @{
|
||||
"Name" = "SELENIUM_JAR_PATH"
|
||||
"Value" = $env:SELENIUM_JAR_PATH
|
||||
}
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
function Get-ToolcacheRubyVersions {
|
||||
$toolcachePath = Join-Path $env:AGENT_TOOLSDIRECTORY "Ruby"
|
||||
return Get-ChildItem $toolcachePath -Name | Sort-Object { [Version] $_ }
|
||||
}
|
||||
|
||||
function Get-ToolcachePythonVersions {
|
||||
$toolcachePath = Join-Path $env:AGENT_TOOLSDIRECTORY "Python"
|
||||
return Get-ChildItem $toolcachePath -Name | Sort-Object { [Version] $_ }
|
||||
}
|
||||
|
||||
function Get-ToolcachePyPyVersions {
|
||||
$toolcachePath = Join-Path $env:AGENT_TOOLSDIRECTORY "PyPy"
|
||||
Get-ChildItem -Path $toolcachePath -Name | Sort-Object { [Version] $_ } | ForEach-Object {
|
||||
$pypyRootPath = Join-Path $toolcachePath $_ "x64"
|
||||
[string] $pypyVersionOutput = & "$pypyRootPath/bin/python" -c "import sys;print(sys.version)"
|
||||
$pypyVersionOutput -match "^([\d\.]+) \(.+\) \[PyPy ([\d\.]+\S*) .+]$" | Out-Null
|
||||
return "{0} [PyPy {1}]" -f $Matches[1], $Matches[2]
|
||||
}
|
||||
}
|
||||
|
||||
function Get-ToolcacheNodeVersions {
|
||||
$toolcachePath = Join-Path $env:AGENT_TOOLSDIRECTORY "node"
|
||||
return Get-ChildItem $toolcachePath -Name | Sort-Object { [Version] $_ }
|
||||
}
|
||||
|
||||
function Get-ToolcacheGoVersions {
|
||||
$toolcachePath = Join-Path $env:AGENT_TOOLSDIRECTORY "go"
|
||||
return Get-ChildItem $toolcachePath -Name | Sort-Object { [Version] $_ }
|
||||
}
|
||||
@@ -0,0 +1,358 @@
|
||||
function Get-BashVersion {
|
||||
$version = bash -c 'echo ${BASH_VERSION}'
|
||||
return $version
|
||||
}
|
||||
|
||||
function Get-DashVersion {
|
||||
$version = dpkg-query -W -f '${Version}' dash
|
||||
return $version
|
||||
}
|
||||
|
||||
function Get-CPPVersions {
|
||||
$result = Get-CommandResult "apt list --installed" -Multiline
|
||||
$cppVersions = $result.Output | Where-Object { $_ -match "g\+\+-\d\d\/" } | ForEach-Object {
|
||||
& $_.Split("/")[0] --version | Select-Object -First 1 | Get-StringPart -Part 3
|
||||
} | Sort-Object {[Version] $_}
|
||||
return $cppVersions
|
||||
}
|
||||
|
||||
function Get-FortranVersions {
|
||||
$result = Get-CommandResult "apt list --installed" -Multiline
|
||||
$fortranVersions = $result.Output | Where-Object { $_ -match "^gfortran-\d\d\/" } | ForEach-Object {
|
||||
& $_.Split("/")[0] --version | Select-Object -First 1 | Get-StringPart -Part 4
|
||||
} | Sort-Object {[Version] $_}
|
||||
return $fortranVersions
|
||||
}
|
||||
|
||||
function Get-ClangToolVersions {
|
||||
param (
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string] $ToolName,
|
||||
[string] $VersionLineMatcher = "${ToolName} version",
|
||||
[string] $VersionPattern = "\d+\.\d+\.\d+)"
|
||||
)
|
||||
|
||||
$result = Get-CommandResult "apt list --installed" -Multiline
|
||||
$toolVersions = $result.Output | Where-Object { $_ -match "^${ToolName}-\d+" } | ForEach-Object {
|
||||
$clangCommand = ($_ -Split "/")[0]
|
||||
Invoke-Expression "$clangCommand --version" | Where-Object { $_ -match "${VersionLineMatcher}" } | ForEach-Object {
|
||||
$_ -match "${VersionLineMatcher} (?<version>${VersionPattern}" | Out-Null
|
||||
$Matches.version
|
||||
}
|
||||
} | Sort-Object {[Version] $_}
|
||||
|
||||
return $toolVersions
|
||||
}
|
||||
|
||||
|
||||
function Get-ClangTidyVersions {
|
||||
$clangVersions = Get-ClangToolVersions -ToolName "clang-tidy" -VersionLineMatcher "LLVM version" -VersionPattern "\d+\.\d+\.\d+)"
|
||||
return $clangVersions
|
||||
}
|
||||
|
||||
|
||||
function Get-ErlangVersion {
|
||||
$erlangVersion = (erl -eval '{ok, Version} = file:read_file(filename:join([code:root_dir(), "releases", erlang:system_info(otp_release), ''OTP_VERSION''])), io:fwrite(Version), halt().' -noshell)
|
||||
$shellVersion = (erl -eval 'erlang:display(erlang:system_info(version)), halt().' -noshell).Trim('"')
|
||||
return "$erlangVersion (Eshell $shellVersion)"
|
||||
}
|
||||
|
||||
function Get-ErlangRebar3Version {
|
||||
$result = Get-CommandResult "rebar3 --version"
|
||||
$result.Output -match "rebar (?<version>(\d+.){2}\d+)" | Out-Null
|
||||
return $Matches.version
|
||||
}
|
||||
|
||||
function Get-MonoVersion {
|
||||
$monoVersion = mono --version | Out-String | Get-StringPart -Part 4
|
||||
return $monoVersion
|
||||
}
|
||||
|
||||
function Get-MsbuildVersion {
|
||||
$msbuildVersion = msbuild -version | Select-Object -Last 1
|
||||
$monoVersion = Get-MonoVersion
|
||||
return "$msbuildVersion (Mono $monoVersion)"
|
||||
}
|
||||
|
||||
function Get-NuGetVersion {
|
||||
$nugetVersion = nuget help | Select-Object -First 1 | Get-StringPart -Part 2
|
||||
return $nugetVersion
|
||||
}
|
||||
|
||||
function Get-NodeVersion {
|
||||
$nodeVersion = $(node --version).Substring(1)
|
||||
return $nodeVersion
|
||||
}
|
||||
|
||||
function Get-OpensslVersion {
|
||||
$opensslVersion = $(dpkg-query -W -f '${Version}' openssl)
|
||||
return $opensslVersion
|
||||
}
|
||||
|
||||
function Get-PerlVersion {
|
||||
$version = $(perl -e 'print substr($^V,1)')
|
||||
return $version
|
||||
}
|
||||
|
||||
function Get-PythonVersion {
|
||||
$result = Get-CommandResult "python --version"
|
||||
$version = $result.Output | Get-StringPart -Part 1
|
||||
return $version
|
||||
}
|
||||
|
||||
function Get-PowershellVersion {
|
||||
$pwshVersion = $(pwsh --version) | Get-StringPart -Part 1
|
||||
return $pwshVersion
|
||||
}
|
||||
|
||||
function Get-RubyVersion {
|
||||
$rubyVersion = ruby --version | Out-String | Get-StringPart -Part 1
|
||||
return $rubyVersion
|
||||
}
|
||||
|
||||
function Get-SwiftVersion {
|
||||
$swiftVersion = swift --version | Out-String | Get-StringPart -Part 2
|
||||
return $swiftVersion
|
||||
}
|
||||
|
||||
function Get-KotlinVersion {
|
||||
$kotlinVersion = kotlin -version | Out-String | Get-StringPart -Part 2
|
||||
return $kotlinVersion
|
||||
}
|
||||
|
||||
function Get-JuliaVersion {
|
||||
$juliaVersion = julia --version | Get-StringPart -Part 2
|
||||
return $juliaVersion
|
||||
}
|
||||
|
||||
function Get-LernaVersion {
|
||||
$version = lerna -v
|
||||
return $version
|
||||
}
|
||||
|
||||
function Get-HomebrewVersion {
|
||||
$result = Get-CommandResult "/home/linuxbrew/.linuxbrew/bin/brew --version"
|
||||
$result.Output -match "Homebrew (?<version>\d+\.\d+\.\d+)" | Out-Null
|
||||
return $Matches.version
|
||||
}
|
||||
|
||||
function Get-CpanVersion {
|
||||
$result = Get-CommandResult "cpan --version" -ExpectedExitCode @(25, 255)
|
||||
$result.Output -match "version (?<version>\d+\.\d+) " | Out-Null
|
||||
return $Matches.version
|
||||
}
|
||||
|
||||
function Get-GemVersion {
|
||||
$result = Get-CommandResult "gem --version"
|
||||
$result.Output -match "(?<version>\d+\.\d+\.\d+)" | Out-Null
|
||||
return $Matches.version
|
||||
}
|
||||
|
||||
function Get-MinicondaVersion {
|
||||
$condaVersion = conda --version | Get-StringPart -Part 1
|
||||
return $condaVersion
|
||||
}
|
||||
|
||||
function Get-HelmVersion {
|
||||
$(helm version) -match 'Version:"v(?<version>\d+\.\d+\.\d+)"' | Out-Null
|
||||
return $Matches.version
|
||||
}
|
||||
|
||||
function Get-NpmVersion {
|
||||
$npmVersion = npm --version
|
||||
return $npmVersion
|
||||
}
|
||||
|
||||
function Get-YarnVersion {
|
||||
$yarnVersion = yarn --version
|
||||
return $yarnVersion
|
||||
}
|
||||
|
||||
function Get-ParcelVersion {
|
||||
$parcelVersion = parcel --version
|
||||
return $parcelVersion
|
||||
}
|
||||
|
||||
function Get-PipVersion {
|
||||
$pipVersion = pip --version | Get-StringPart -Part 1
|
||||
return $pipVersion
|
||||
}
|
||||
|
||||
function Get-Pip3Version {
|
||||
$pip3Version = pip3 --version | Get-StringPart -Part 1
|
||||
return $pip3Version
|
||||
}
|
||||
|
||||
function Get-VcpkgVersion {
|
||||
$commitId = git -C "/usr/local/share/vcpkg" rev-parse --short HEAD
|
||||
return "(build from commit $commitId)"
|
||||
}
|
||||
|
||||
function Get-AntVersion {
|
||||
$result = ant -version | Out-String
|
||||
$result -match "version (?<version>\d+\.\d+\.\d+)" | Out-Null
|
||||
return $Matches.version
|
||||
}
|
||||
|
||||
function Get-GradleVersion {
|
||||
$gradleVersion = (gradle -v) -match "^Gradle \d" | Get-StringPart -Part 1
|
||||
return $gradleVersion
|
||||
}
|
||||
|
||||
function Get-MavenVersion {
|
||||
$result = mvn -version | Out-String
|
||||
$result -match "Apache Maven (?<version>\d+\.\d+\.\d+)" | Out-Null
|
||||
return $Matches.version
|
||||
}
|
||||
|
||||
function Get-SbtVersion {
|
||||
$result = Get-CommandResult "sbt -version"
|
||||
$result.Output -match "sbt script version: (?<version>\d+\.\d+\.\d+)" | Out-Null
|
||||
return $Matches.version
|
||||
}
|
||||
|
||||
function Get-PHPVersions {
|
||||
$result = Get-CommandResult "apt list --installed" -Multiline
|
||||
return $result.Output | Where-Object { $_ -match "^php\d+\.\d+/" } | ForEach-Object {
|
||||
$_ -match "now (\d+:)?(?<version>\d+\.\d+\.\d+)" | Out-Null
|
||||
$Matches.version
|
||||
}
|
||||
}
|
||||
|
||||
function Get-ComposerVersion {
|
||||
$composerVersion = (composer --version) -replace " version" | Get-StringPart -Part 1
|
||||
return $composerVersion
|
||||
}
|
||||
|
||||
function Get-PHPUnitVersion {
|
||||
$(phpunit --version | Out-String) -match "PHPUnit (?<version>\d+\.\d+\.\d+)\s" | Out-Null
|
||||
return $Matches.version
|
||||
}
|
||||
|
||||
function Get-GHCVersion {
|
||||
$(ghc --version) -match "version (?<version>\d+\.\d+\.\d+)" | Out-Null
|
||||
return $Matches.version
|
||||
}
|
||||
|
||||
function Get-GHCupVersion {
|
||||
$(ghcup --version) -match "version (?<version>\d+(\.\d+){2,})" | Out-Null
|
||||
return $Matches.version
|
||||
}
|
||||
|
||||
function Get-CabalVersion {
|
||||
$(cabal --version | Out-String) -match "cabal-install version (?<version>\d+\.\d+\.\d+\.\d+)" | Out-Null
|
||||
return $Matches.version
|
||||
}
|
||||
|
||||
function Get-StackVersion {
|
||||
$(stack --version | Out-String) -match "Version (?<version>\d+\.\d+\.\d+)" | Out-Null
|
||||
return $Matches.version
|
||||
}
|
||||
|
||||
function Get-AzModuleVersions {
|
||||
$azModuleVersions = Get-ChildItem /usr/share | Where-Object { $_ -match "az_\d+" } | Foreach-Object {
|
||||
$_.Name.Split("_")[1]
|
||||
}
|
||||
|
||||
$azModuleVersions = $azModuleVersions -join " "
|
||||
return $azModuleVersions
|
||||
}
|
||||
|
||||
function Get-PowerShellModules {
|
||||
[Array] $result = @()
|
||||
|
||||
[Array] $azureInstalledModules = Get-ChildItem -Path "/usr/share/az_*" -Directory | ForEach-Object { $_.Name.Split("_")[1] }
|
||||
if ($azureInstalledModules.Count -gt 0) {
|
||||
$result += [ToolVersionsListNode]::new("Az", $azureInstalledModules, "^\d+\.\d+", "Inline")
|
||||
}
|
||||
|
||||
[Array] $azureCachedModules = Get-ChildItem /usr/share/az_*.zip -File | ForEach-Object { $_.Name.Split("_")[1] }
|
||||
if ($azureCachedModules.Count -gt 0) {
|
||||
$result += [ToolVersionsListNode]::new("Az (Cached)", $azureCachedModules, "^\d+\.\d+", "Inline")
|
||||
}
|
||||
|
||||
(Get-ToolsetContent).powershellModules.name | ForEach-Object {
|
||||
$moduleName = $_
|
||||
$moduleVersions = Get-Module -Name $moduleName -ListAvailable | Select-Object -ExpandProperty Version | Sort-Object -Unique
|
||||
$result += [ToolVersionsListNode]::new($moduleName, $moduleVersions, "^\d+", "Inline")
|
||||
}
|
||||
|
||||
return $result
|
||||
}
|
||||
|
||||
function Get-DotNetCoreSdkVersions {
|
||||
$dotNetCoreSdkVersion = dotnet --list-sdks list | ForEach-Object { $_ | Get-StringPart -Part 0 }
|
||||
return $dotNetCoreSdkVersion
|
||||
}
|
||||
|
||||
function Get-DotnetTools {
|
||||
$env:PATH = "/etc/skel/.dotnet/tools:$($env:PATH)"
|
||||
$dotnetTools = (Get-ToolsetContent).dotnet.tools
|
||||
|
||||
return $dotnetTools | ForEach-Object {
|
||||
$version = Invoke-Expression $_.getversion
|
||||
return [ToolVersionNode]::new($_.name, $version)
|
||||
}
|
||||
}
|
||||
|
||||
function Get-CachedDockerImages {
|
||||
$toolsetJson = Get-ToolsetContent
|
||||
$images = $toolsetJson.docker.images
|
||||
return $images
|
||||
}
|
||||
|
||||
function Get-CachedDockerImagesTableData {
|
||||
$allImages = sudo docker images --digests --format "*{{.Repository}}:{{.Tag}}|{{.Digest}} |{{.CreatedAt}}"
|
||||
$allImages.Split("*") | Where-Object { $_ } | ForEach-Object {
|
||||
$parts = $_.Split("|")
|
||||
[PSCustomObject] @{
|
||||
"Repository:Tag" = $parts[0]
|
||||
"Digest" = $parts[1]
|
||||
"Created" = $parts[2].split(' ')[0]
|
||||
}
|
||||
} | Sort-Object -Property "Repository:Tag"
|
||||
}
|
||||
|
||||
function Get-AptPackages {
|
||||
$apt = (Get-ToolsetContent).Apt
|
||||
$output = @()
|
||||
ForEach ($pkg in ($apt.vital_packages + $apt.common_packages + $apt.cmd_packages)) {
|
||||
$version = $(dpkg-query -W -f '${Version}' $pkg)
|
||||
if ($null -eq $version) {
|
||||
$version = $(dpkg-query -W -f '${Version}' "$pkg*")
|
||||
}
|
||||
|
||||
$version = $version -replace '~','\~'
|
||||
|
||||
$output += [PSCustomObject] @{
|
||||
Name = $pkg
|
||||
Version = $version
|
||||
}
|
||||
}
|
||||
return ($output | Sort-Object Name)
|
||||
}
|
||||
|
||||
function Get-PipxVersion {
|
||||
$result = (Get-CommandResult "pipx --version").Output
|
||||
$result -match "(?<version>\d+\.\d+\.\d+\.?\d*)" | Out-Null
|
||||
return $Matches.Version
|
||||
}
|
||||
|
||||
function Build-PackageManagementEnvironmentTable {
|
||||
return @(
|
||||
[PSCustomObject] @{
|
||||
"Name" = "CONDA"
|
||||
"Value" = $env:CONDA
|
||||
},
|
||||
[PSCustomObject] @{
|
||||
"Name" = "VCPKG_INSTALLATION_ROOT"
|
||||
"Value" = $env:VCPKG_INSTALLATION_ROOT
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
function Get-SystemdVersion {
|
||||
$matchCollection = [regex]::Matches((systemctl --version | head -n 1), "\((.*?)\)")
|
||||
$result = foreach ($match in $matchCollection) {$match.Groups[1].Value}
|
||||
return $result
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
function Get-PostgreSqlVersion {
|
||||
$postgreSQLVersion = psql --version | Get-StringPart -Part 2
|
||||
return $postgreSQLVersion
|
||||
}
|
||||
|
||||
function Get-MongoDbVersion {
|
||||
$mongoDBVersion = mongod --version | Select-Object -First 1 | Get-StringPart -Part 2 -Delimiter "v"
|
||||
return $mongoDBVersion
|
||||
}
|
||||
|
||||
function Get-SqliteVersion {
|
||||
$sqliteVersion = sqlite3 --version | Get-StringPart -Part 0
|
||||
return $sqliteVersion
|
||||
}
|
||||
|
||||
function Get-MySQLVersion {
|
||||
$mySQLVersion = mysqld --version | Get-StringPart -Part 2
|
||||
return $mySQLVersion
|
||||
}
|
||||
|
||||
function Get-SQLCmdVersion {
|
||||
$sqlcmdVersion = sqlcmd -? | Select-String -Pattern "Version" | Get-StringPart -Part 1
|
||||
return $sqlcmdVersion
|
||||
}
|
||||
|
||||
function Get-SqlPackageVersion {
|
||||
$sqlPackageVersion = sqlpackage /version
|
||||
return $sqlPackageVersion
|
||||
}
|
||||
|
||||
function Build-PostgreSqlSection {
|
||||
$node = [HeaderNode]::new("PostgreSQL")
|
||||
$node.AddToolVersion("PostgreSQL", $(Get-PostgreSqlVersion))
|
||||
$node.AddNote(@(
|
||||
"User: postgres",
|
||||
"PostgreSQL service is disabled by default.",
|
||||
"Use the following command as a part of your job to start the service: 'sudo systemctl start postgresql.service'"
|
||||
) -join "`n")
|
||||
|
||||
return $node
|
||||
}
|
||||
|
||||
function Build-MySQLSection {
|
||||
$node = [HeaderNode]::new("MySQL")
|
||||
$node.AddToolVersion("MySQL", $(Get-MySQLVersion))
|
||||
$node.AddNote(@(
|
||||
"User: root",
|
||||
"Password: root",
|
||||
"MySQL service is disabled by default.",
|
||||
"Use the following command as a part of your job to start the service: 'sudo systemctl start mysql.service'"
|
||||
) -join "`n")
|
||||
|
||||
return $node
|
||||
}
|
||||
|
||||
function Build-MSSQLToolsSection {
|
||||
$node = [HeaderNode]::new("MS SQL")
|
||||
$node.AddToolVersion("sqlcmd", $(Get-SQLCmdVersion))
|
||||
$node.AddToolVersion("SqlPackage", $(Get-SqlPackageVersion))
|
||||
return $node
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
function Get-StringPart {
|
||||
param (
|
||||
[Parameter(ValueFromPipeline)]
|
||||
[string] $ToolOutput,
|
||||
[string] $Delimiter = " ",
|
||||
[int[]] $Part
|
||||
)
|
||||
|
||||
$parts = $ToolOutput.Split($Delimiter, [System.StringSplitOptions]::RemoveEmptyEntries)
|
||||
$selectedParts = $parts[$Part]
|
||||
return [string]::Join($Delimiter, $selectedParts)
|
||||
}
|
||||
|
||||
function Get-PathWithLink {
|
||||
param (
|
||||
[string] $InputPath
|
||||
)
|
||||
|
||||
$link = Get-Item $InputPath | Select-Object -ExpandProperty Target
|
||||
if (-not [string]::IsNullOrEmpty($link)) {
|
||||
return "${InputPath} -> ${link}"
|
||||
}
|
||||
return "${InputPath}"
|
||||
}
|
||||
|
||||
function Get-OSVersionShort {
|
||||
$(Get-OSVersionFull) | Get-StringPart -Delimiter '.' -Part 0,1
|
||||
}
|
||||
|
||||
function Get-OSVersionFull {
|
||||
lsb_release -ds | Get-StringPart -Part 1, 2
|
||||
}
|
||||
|
||||
function Get-KernelVersion {
|
||||
$kernelVersion = uname -r
|
||||
return $kernelVersion
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
function Get-JavaVersionsTable {
|
||||
$javaToolcacheVersions = Get-ChildItem $env:AGENT_TOOLSDIRECTORY/Java*/* -Directory | Sort-Object { [int] $_.Name.Split(".")[0] }
|
||||
|
||||
return $javaToolcacheVersions | ForEach-Object {
|
||||
$majorVersion = $_.Name.split(".")[0]
|
||||
$fullVersion = $_.Name.Replace("-", "+")
|
||||
$defaultJavaPath = $env:JAVA_HOME
|
||||
$javaPath = Get-Item env:JAVA_HOME_${majorVersion}_X64
|
||||
|
||||
$defaultPostfix = ($javaPath.Value -eq $defaultJavaPath) ? " (default)" : ""
|
||||
|
||||
[PSCustomObject] @{
|
||||
"Version" = $fullVersion + $defaultPostfix
|
||||
"Environment Variable" = $javaPath.Name
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
function Initialize-RustEnvironment {
|
||||
$env:PATH = "/etc/skel/.cargo/bin:/etc/skel/.rustup/bin:$($env:PATH)"
|
||||
$env:RUSTUP_HOME = "/etc/skel/.rustup"
|
||||
$env:CARGO_HOME = "/etc/skel/.cargo"
|
||||
}
|
||||
|
||||
function Get-RustVersion {
|
||||
$rustVersion = $(rustc --version) | Get-StringPart -Part 1
|
||||
return $rustVersion
|
||||
}
|
||||
|
||||
function Get-BindgenVersion {
|
||||
$bindgenVersion = $(bindgen --version) | Get-StringPart -Part 1
|
||||
return $bindgenVersion
|
||||
}
|
||||
|
||||
function Get-CargoVersion {
|
||||
$cargoVersion = $(cargo --version) | Get-StringPart -Part 1
|
||||
return $cargoVersion
|
||||
}
|
||||
|
||||
function Get-CargoAuditVersion {
|
||||
$cargoAuditVersion = $(cargo-audit --version) | Get-StringPart -Part 1
|
||||
return $cargoAuditVersion
|
||||
}
|
||||
|
||||
function Get-CargoOutdatedVersion {
|
||||
$cargoOutdatedVersion = cargo outdated --version | Get-StringPart -Part 1
|
||||
return $cargoOutdatedVersion
|
||||
}
|
||||
|
||||
function Get-CargoClippyVersion {
|
||||
$cargoClippyVersion = $(cargo-clippy --version) | Get-StringPart -Part 1
|
||||
return $cargoClippyVersion
|
||||
}
|
||||
|
||||
function Get-CbindgenVersion {
|
||||
$cbindgenVersion = $(cbindgen --version) | Get-StringPart -Part 1
|
||||
return $cbindgenVersion
|
||||
}
|
||||
|
||||
function Get-RustupVersion {
|
||||
$rustupVersion = $(rustup --version) | Get-StringPart -Part 1
|
||||
return $rustupVersion
|
||||
}
|
||||
|
||||
function Get-RustdocVersion {
|
||||
$rustdocVersion = $(rustdoc --version) | Get-StringPart -Part 1
|
||||
return $rustdocVersion
|
||||
}
|
||||
|
||||
function Get-RustfmtVersion {
|
||||
$rustfmtVersion = $(rustfmt --version) | Get-StringPart -Part 1 | Get-StringPart -Part 0 -Delimiter "-"
|
||||
return $rustfmtVersion
|
||||
}
|
||||
@@ -0,0 +1,281 @@
|
||||
function Get-AnsibleVersion {
|
||||
$ansibleVersion = (ansible --version)[0] -replace "[^\d.]"
|
||||
return $ansibleVersion
|
||||
}
|
||||
|
||||
function Get-AptFastVersion {
|
||||
$versionFileContent = Get-Content (which apt-fast) -Raw
|
||||
$match = [Regex]::Match($versionFileContent, '# apt-fast v(.+)\n')
|
||||
return $match.Groups[1].Value
|
||||
}
|
||||
|
||||
function Get-AzCopyVersion {
|
||||
$azcopyVersion = [string]$(azcopy --version) | Get-StringPart -Part 2
|
||||
return "$azcopyVersion - available by ``azcopy`` and ``azcopy10`` aliases"
|
||||
}
|
||||
|
||||
function Get-BazelVersion {
|
||||
$bazelVersion = bazel --version | Select-String "bazel" | Get-StringPart -Part 1
|
||||
return $bazelVersion
|
||||
}
|
||||
|
||||
function Get-BazeliskVersion {
|
||||
$result = Get-CommandResult "bazelisk version" -Multiline
|
||||
$bazeliskVersion = $result.Output | Select-String "Bazelisk version:" | Get-StringPart -Part 2 | Get-StringPart -Part 0 -Delimiter "v"
|
||||
return $bazeliskVersion
|
||||
}
|
||||
|
||||
function Get-BicepVersion {
|
||||
(bicep --version | Out-String) -match "bicep cli version (?<version>\d+\.\d+\.\d+)" | Out-Null
|
||||
return $Matches.Version
|
||||
}
|
||||
|
||||
function Get-CodeQLBundleVersion {
|
||||
$CodeQLVersionsWildcard = Join-Path $Env:AGENT_TOOLSDIRECTORY -ChildPath "CodeQL" | Join-Path -ChildPath "*"
|
||||
$CodeQLVersionPath = Get-ChildItem $CodeQLVersionsWildcard | Select-Object -First 1 -Expand FullName
|
||||
$CodeQLPath = Join-Path $CodeQLVersionPath -ChildPath "x64" | Join-Path -ChildPath "codeql" | Join-Path -ChildPath "codeql"
|
||||
$CodeQLVersion = & $CodeQLPath version --quiet
|
||||
return $CodeQLVersion
|
||||
}
|
||||
|
||||
function Get-PodManVersion {
|
||||
$podmanVersion = podman --version | Get-StringPart -Part 2
|
||||
return $podmanVersion
|
||||
}
|
||||
|
||||
function Get-BuildahVersion {
|
||||
$buildahVersion = buildah --version | Get-StringPart -Part 2
|
||||
return $buildahVersion
|
||||
}
|
||||
|
||||
function Get-SkopeoVersion {
|
||||
$skopeoVersion = skopeo --version | Get-StringPart -Part 2
|
||||
return $skopeoVersion
|
||||
}
|
||||
|
||||
function Get-CMakeVersion {
|
||||
$cmakeVersion = cmake --version | Select-Object -First 1 | Get-StringPart -Part 2
|
||||
return $cmakeVersion
|
||||
}
|
||||
|
||||
|
||||
|
||||
function Get-DockerComposeV2Version {
|
||||
$composeVersion = docker compose version | Get-StringPart -Part 3 | Get-StringPart -Part 0 -Delimiter "v"
|
||||
return $composeVersion
|
||||
}
|
||||
|
||||
function Get-DockerClientVersion {
|
||||
$dockerClientVersion = sudo docker version --format '{{.Client.Version}}'
|
||||
return $dockerClientVersion
|
||||
}
|
||||
|
||||
function Get-DockerServerVersion {
|
||||
$dockerServerVersion = sudo docker version --format '{{.Server.Version}}'
|
||||
return $dockerServerVersion
|
||||
}
|
||||
|
||||
function Get-DockerBuildxVersion {
|
||||
$buildxVersion = docker buildx version | Get-StringPart -Part 1 | Get-StringPart -Part 0 -Delimiter "v"
|
||||
return $buildxVersion
|
||||
}
|
||||
|
||||
function Get-DockerAmazonECRCredHelperVersion {
|
||||
$ecrVersion = docker-credential-ecr-login -v | Select-String "Version:" | Get-StringPart -Part 1
|
||||
return $ecrVersion
|
||||
}
|
||||
|
||||
function Get-GitVersion {
|
||||
$gitVersion = git --version | Get-StringPart -Part -1
|
||||
return $gitVersion
|
||||
}
|
||||
|
||||
function Get-GitLFSVersion {
|
||||
$result = Get-CommandResult "git-lfs --version"
|
||||
$gitlfsversion = $result.Output | Get-StringPart -Part 0 | Get-StringPart -Part 1 -Delimiter "/"
|
||||
return $gitlfsversion
|
||||
}
|
||||
|
||||
function Get-GitFTPVersion {
|
||||
$gitftpVersion = git-ftp --version | Get-StringPart -Part 2
|
||||
return $gitftpVersion
|
||||
}
|
||||
|
||||
function Get-GoogleCloudCLIVersion {
|
||||
return (gcloud --version | Select-Object -First 1) | Get-StringPart -Part 3
|
||||
}
|
||||
|
||||
function Get-HavegedVersion {
|
||||
$havegedVersion = dpkg-query --showformat='${Version}' --show haveged | Get-StringPart -Part 0 -Delimiter "-"
|
||||
return $havegedVersion
|
||||
}
|
||||
|
||||
function Get-HerokuVersion {
|
||||
$herokuVersion = heroku version | Get-StringPart -Part 0 | Get-StringPart -Part 1 -Delimiter "/"
|
||||
return $herokuVersion
|
||||
}
|
||||
|
||||
function Get-HHVMVersion {
|
||||
$hhvmVersion = hhvm --version | Select-Object -First 1 | Get-StringPart -Part 2
|
||||
return $hhvmVersion
|
||||
}
|
||||
|
||||
function Get-SVNVersion {
|
||||
$svnVersion = svn --version | Select-Object -First 1 | Get-StringPart -Part 2
|
||||
return $svnVersion
|
||||
}
|
||||
|
||||
function Get-KustomizeVersion {
|
||||
$kustomizeVersion = kustomize version --short | Get-StringPart -Part 0 | Get-StringPart -Part 1 -Delimiter "v"
|
||||
return $kustomizeVersion
|
||||
}
|
||||
|
||||
function Get-KindVersion {
|
||||
$kindVersion = kind version | Get-StringPart -Part 1 | Get-StringPart -Part 0 -Delimiter "v"
|
||||
return $kindVersion
|
||||
}
|
||||
|
||||
function Get-KubectlVersion {
|
||||
$kubectlVersion = (kubectl version --client --output=json | ConvertFrom-Json).clientVersion.gitVersion.Replace('v','')
|
||||
return $kubectlVersion
|
||||
}
|
||||
|
||||
function Get-MinikubeVersion {
|
||||
$minikubeVersion = minikube version --short | Get-StringPart -Part 0 -Delimiter "v"
|
||||
return $minikubeVersion
|
||||
}
|
||||
|
||||
function Get-HGVersion {
|
||||
$hgVersion = hg --version | Select-Object -First 1 | Get-StringPart -Part -1 | Get-StringPart -Part 0 -Delimiter ")"
|
||||
return $hgVersion
|
||||
}
|
||||
|
||||
function Get-LeiningenVersion {
|
||||
return "$(lein -v | Get-StringPart -Part 1)"
|
||||
}
|
||||
|
||||
function Get-MediainfoVersion {
|
||||
$mediainfoVersion = (mediainfo --version | Select-Object -Index 1 | Get-StringPart -Part 2).Replace('v', '')
|
||||
return $mediainfoVersion
|
||||
}
|
||||
|
||||
function Get-NewmanVersion {
|
||||
return $(newman --version)
|
||||
}
|
||||
|
||||
function Get-NVersion {
|
||||
$nVersion = (n --version).Replace('v', '')
|
||||
return $nVersion
|
||||
}
|
||||
|
||||
function Get-NvmVersion {
|
||||
$nvmVersion = bash -c "source /etc/skel/.nvm/nvm.sh && nvm --version"
|
||||
return $nvmVersion
|
||||
}
|
||||
|
||||
function Get-PackerVersion {
|
||||
$packerVersion = (packer --version | Select-String "^Packer").Line.Replace('v','') | Get-StringPart -Part 1
|
||||
return $packerVersion
|
||||
}
|
||||
|
||||
function Get-PhantomJSVersion {
|
||||
$env:OPENSSL_CONF="/etc/ssl"; phantomjs --version
|
||||
return $(phantomjs --version)
|
||||
}
|
||||
|
||||
function Get-TerraformVersion {
|
||||
return (terraform version | Select-String "^Terraform").Line.Replace('v','') | Get-StringPart -Part 1
|
||||
}
|
||||
|
||||
function Get-JqVersion {
|
||||
$jqVersion = jq --version | Get-StringPart -Part 1 -Delimiter "-"
|
||||
return $jqVersion
|
||||
}
|
||||
|
||||
function Get-AzureCliVersion {
|
||||
$azcliVersion = (az version | ConvertFrom-Json).'azure-cli'
|
||||
return $azcliVersion
|
||||
}
|
||||
|
||||
function Get-AzureDevopsVersion {
|
||||
$azdevopsVersion = (az version | ConvertFrom-Json).extensions.'azure-devops'
|
||||
return $azdevopsVersion
|
||||
}
|
||||
|
||||
function Get-AlibabaCloudCliVersion {
|
||||
return $(aliyun version)
|
||||
}
|
||||
|
||||
function Get-AWSCliVersion {
|
||||
$result = Get-CommandResult "aws --version"
|
||||
$awsVersion = $result.Output | Get-StringPart -Part 0 | Get-StringPart -Part 1 -Delimiter "/"
|
||||
return $awsVersion
|
||||
}
|
||||
|
||||
function Get-AWSCliSessionManagerPluginVersion {
|
||||
$result = (Get-CommandResult "session-manager-plugin --version").Output
|
||||
return $result
|
||||
}
|
||||
|
||||
function Get-AWSSAMVersion {
|
||||
return $(sam --version | Get-StringPart -Part -1)
|
||||
}
|
||||
|
||||
function Get-FastlaneVersion {
|
||||
$fastlaneVersion = fastlane --version | Select-String "^fastlane [0-9]" | Get-StringPart -Part 1
|
||||
return $fastlaneVersion
|
||||
}
|
||||
|
||||
function Get-GitHubCliVersion {
|
||||
$ghVersion = gh --version | Select-String "gh version" | Get-StringPart -Part 2
|
||||
return $ghVersion
|
||||
}
|
||||
|
||||
function Get-NetlifyCliVersion {
|
||||
$netlifyVersion = netlify --version | Get-StringPart -Part 0 | Get-StringPart -Part 1 -Delimiter "/"
|
||||
return $netlifyVersion
|
||||
}
|
||||
|
||||
function Get-OCCliVersion {
|
||||
$ocVersion = oc version -o=json | jq -r '.releaseClientVersion'
|
||||
return $ocVersion
|
||||
}
|
||||
|
||||
function Get-ORASCliVersion {
|
||||
$orasVersion = oras version | Select-String "^Version:" | Get-StringPart -Part 1
|
||||
return $orasVersion
|
||||
}
|
||||
|
||||
function Get-VerselCliversion {
|
||||
$result = Get-CommandResult "vercel --version" -Multiline
|
||||
return $result.Output | Select-Object -Skip 1 -First 1
|
||||
}
|
||||
|
||||
function Get-PulumiVersion {
|
||||
$pulumiVersion = pulumi version | Get-StringPart -Part 0 -Delimiter "v"
|
||||
return $pulumiVersion
|
||||
}
|
||||
|
||||
function Get-RVersion {
|
||||
$rVersion = (Get-CommandResult "R --version | grep 'R version'").Output | Get-StringPart -Part 2
|
||||
return $rVersion
|
||||
}
|
||||
|
||||
function Get-SphinxVersion {
|
||||
$sphinxVersion = searchd -h | Select-Object -First 1 | Get-StringPart -Part 1 | Get-StringPart -Part 0 -Delimiter "-"
|
||||
return $sphinxVersion
|
||||
}
|
||||
|
||||
function Get-YamllintVersion {
|
||||
return $(yamllint --version) | Get-StringPart -Part 1
|
||||
}
|
||||
|
||||
function Get-ZstdVersion {
|
||||
$zstdVersion = zstd --version | Get-StringPart -Part 1 -Delimiter "v" | Get-StringPart -Part 0 -Delimiter ","
|
||||
return "$zstdVersion"
|
||||
}
|
||||
|
||||
function Get-YqVersion {
|
||||
$yqVersion = $(yq -V) | Get-StringPart -Part 3
|
||||
return $yqVersion.TrimStart("v").Trim()
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
function Get-ApacheVersion {
|
||||
$name = "apache2"
|
||||
$port = 80
|
||||
$version = bash -c "apache2 -v | grep -Po 'Apache/(\d+.){2}\d+'" | Get-StringPart -Part 1 -Delimiter "/"
|
||||
$serviceStatus = systemctl status apache2 | grep "Active:" | Get-StringPart -Part 1
|
||||
$configFile = "/etc/apache2/apache2.conf"
|
||||
return [PsCustomObject]@{
|
||||
"Name" = $name
|
||||
"Version" = $version
|
||||
"ConfigFile" = $configFile
|
||||
"ServiceStatus" = $serviceStatus
|
||||
"ListenPort" = $port
|
||||
}
|
||||
}
|
||||
|
||||
function Get-NginxVersion {
|
||||
$name = "nginx"
|
||||
$port = 80
|
||||
$version = (dpkg-query --showformat='${Version}' --show nginx).Split('-')[0]
|
||||
$serviceStatus = systemctl status nginx | grep "Active:" | Get-StringPart -Part 1
|
||||
$configFile = "/etc/nginx/nginx.conf"
|
||||
return [PsCustomObject]@{
|
||||
"Name" = $name
|
||||
"Version" = $version
|
||||
"ConfigFile" = $configFile
|
||||
"ServiceStatus" = $serviceStatus
|
||||
"ListenPort" = $port
|
||||
}
|
||||
}
|
||||
|
||||
function Get-Xsp4Version {
|
||||
$name = "mono-xsp4"
|
||||
$port = (grep '^port=' /etc/default/mono-xsp4).Split('=')[1]
|
||||
$version = (dpkg-query --showformat='${Version}' --show mono-xsp4).Split('-')[0]
|
||||
$serviceStatus = systemctl show -p ActiveState --value mono-xsp4
|
||||
$configFile = "/etc/default/mono-xsp4"
|
||||
return [PsCustomObject]@{
|
||||
"Name" = $name
|
||||
"Version" = $version
|
||||
"ConfigFile" = $configFile
|
||||
"ServiceStatus" = $serviceStatus
|
||||
"ListenPort" = $port
|
||||
}
|
||||
}
|
||||
|
||||
function Build-WebServersTable {
|
||||
$servers = @()
|
||||
$servers += (Get-ApacheVersion)
|
||||
if (Test-IsUbuntu20) {
|
||||
$servers += (Get-Xsp4Version)
|
||||
}
|
||||
$servers += (Get-NginxVersion)
|
||||
|
||||
return $servers
|
||||
}
|
||||
Reference in New Issue
Block a user