[Linux] Minor documentation improvements (#6749)

This commit is contained in:
Maxim Lobanov
2022-12-13 17:07:05 +01:00
committed by GitHub
parent 6033af8dd1
commit e63632f872
9 changed files with 74 additions and 129 deletions

View File

@@ -10,8 +10,7 @@ function Get-ChromeDriverVersion {
function Get-FirefoxVersion {
$firefoxVersion = firefox --version
$aptSourceRepo = Get-AptSourceRepository -PackageName "mozillateam"
return "$firefoxVersion (apt source repository: $aptSourceRepo)"
return "$firefoxVersion"
}
function Get-GeckodriverVersion {
@@ -26,8 +25,7 @@ function Get-ChromiumVersion {
function Get-EdgeVersion {
$edgeVersion = (microsoft-edge --version).trim()
$aptSourceRepo = Get-AptSourceRepository -PackageName "microsoft-edge"
return "$edgeVersion (apt source repository: $aptSourceRepo)"
return "$edgeVersion"
}
function Get-EdgeDriverVersion {

View File

@@ -28,19 +28,6 @@ function Get-ToolcacheGoVersions {
return Get-ChildItem $toolcachePath -Name | Sort-Object { [Version]$_ }
}
function Build-GoEnvironmentTable {
return Get-CachedToolInstances -Name "go" -VersionCommand "version" | ForEach-Object {
$Version = [System.Version]($_.Version -Split(" "))[0]
$Name = "GOROOT_$($Version.major)_$($Version.minor)_X64"
$Value = (Get-Item env:\$Name).Value
[PSCustomObject] @{
"Name" = $Name
"Value" = (Get-Item env:\$Name).Value
"Architecture" = $_. Architecture
}
}
}
function Build-CachedToolsSection {
$output = ""
@@ -50,12 +37,12 @@ function Build-CachedToolsSection {
$output += New-MDHeader "Node.js" -Level 4
$output += New-MDList -Lines (Get-ToolcacheNodeVersions) -Style Unordered
$output += New-MDHeader "PyPy" -Level 4
$output += New-MDList -Lines (Get-ToolcachePyPyVersions) -Style Unordered
$output += New-MDHeader "Python" -Level 4
$output += New-MDList -Lines (Get-ToolcachePythonVersions) -Style Unordered
$output += New-MDHeader "PyPy" -Level 4
$output += New-MDList -Lines (Get-ToolcachePyPyVersions) -Style Unordered
$output += New-MDHeader "Ruby" -Level 4
$output += New-MDList -Lines (Get-ToolcacheRubyVersions) -Style Unordered

View File

@@ -76,16 +76,13 @@ function Get-ErlangRebar3Version {
function Get-MonoVersion {
$monoVersion = mono --version | Out-String | Take-OutputPart -Part 4
$aptSourceRepo = Get-AptSourceRepository -PackageName "mono"
return "Mono $monoVersion (apt source repository: $aptSourceRepo)"
return "Mono $monoVersion"
}
function Get-MsbuildVersion {
$msbuildVersion = msbuild -version | Select-Object -Last 1
$result = Select-String -Path (Get-Command msbuild).Source -Pattern "msbuild"
$result -match "(?<path>\/\S*\.dll)" | Out-Null
$msbuildPath = $Matches.path
return "MSBuild $msbuildVersion (from $msbuildPath)"
$monoVersion = Get-MonoVersion
return "MSBuild $msbuildVersion ($monoVersion)"
}
function Get-NuGetVersion {
@@ -210,11 +207,8 @@ function Get-Pip3Version {
}
function Get-VcpkgVersion {
$result = Get-CommandResult "vcpkg version"
$result.Output -match "version (?<version>\d+\.\d+\.\d+)" | Out-Null
$vcpkgVersion = $Matches.version
$commitId = git -C "/usr/local/share/vcpkg" rev-parse --short HEAD
return "Vcpkg $vcpkgVersion (build from master \<$commitId>)"
return "Vcpkg (build from commit $commitId)"
}
function Get-AntVersion {
@@ -261,31 +255,14 @@ function Get-PHPUnitVersion {
return $Matches.version
}
function Build-PHPTable {
$php = @{
"Tool" = "PHP"
"Version" = "$(Get-PHPVersions -Join '<br>')"
}
$composer = @{
"Tool" = "Composer"
"Version" = Get-ComposerVersion
}
$phpunit = @{
"Tool" = "PHPUnit"
"Version" = Get-PHPUnitVersion
}
return @($php, $composer, $phpunit) | ForEach-Object {
[PSCustomObject] @{
"Tool" = $_.Tool
"Version" = $_.Version
}
}
}
function Build-PHPSection {
$output = ""
$output += New-MDHeader "PHP" -Level 3
$output += Build-PHPTable | New-MDTable
$output += New-MDHeader "PHP Tools" -Level 3
$output += New-MDList -Style Unordered -Lines @(
"PHP: $((Get-PHPVersions) -join ', ')",
"Composer $(Get-ComposerVersion)",
"PHPUnit $(Get-PHPUnitVersion)"
)
$output += New-MDCode -Lines @(
"Both Xdebug and PCOV extensions are installed, but only Xdebug is enabled."
)
@@ -327,23 +304,30 @@ function Get-AzModuleVersions {
}
function Get-PowerShellModules {
$modules = (Get-ToolsetContent).powershellModules.name
[Array] $result = @()
$psModules = Get-Module -Name $modules -ListAvailable | Sort-Object Name | Group-Object Name
$psModules | ForEach-Object {
$moduleName = $_.Name
$moduleVersions = ($_.group.Version | Sort-Object -Unique) -join '<br>'
[PSCustomObject]@{
Module = $moduleName
Version = $moduleVersions
}
[Array] $azureInstalledModules = Get-ChildItem -Path "/usr/share/az_*" -Directory | ForEach-Object { $_.Name.Split("_")[1] }
if ($azureInstalledModules.Count -gt 0) {
$result += "Az: $($azureInstalledModules -join ', ')"
}
[Array] $azureCachedModules = Get-ChildItem /usr/share/az_*.zip -File | ForEach-Object { $_.Name.Split("_")[1] }
if ($azureCachedModules.Count -gt 0) {
$result += "Az (Cached): $($azureCachedModules -join ', ')"
}
$result += (Get-ToolsetContent).powershellModules.name | ForEach-Object {
$moduleName = $_
$moduleVersions = Get-Module -Name $moduleName -ListAvailable | Select-Object -ExpandProperty Version | Sort-Object -Unique
return "$($moduleName): $($moduleVersions -join ', ')"
}
return $result
}
function Get-DotNetCoreSdkVersions {
$unsortedDotNetCoreSdkVersion = dotnet --list-sdks list | ForEach-Object { $_ | Take-OutputPart -Part 0 }
$dotNetCoreSdkVersion = $unsortedDotNetCoreSdkVersion -join " "
$dotNetCoreSdkVersion = $unsortedDotNetCoreSdkVersion -join ", "
return $dotNetCoreSdkVersion
}

View File

@@ -1,13 +1,11 @@
function Get-PostgreSqlVersion {
$postgreSQLVersion = psql --version | Take-OutputPart -Part 2
$aptSourceRepo = Get-AptSourceRepository -PackageName "postgresql"
return "PostgreSQL $postgreSQLVersion (apt source repository: $aptSourceRepo)"
return "PostgreSQL $postgreSQLVersion"
}
function Get-MongoDbVersion {
$mongoDBVersion = mongod --version | Select-Object -First 1 | Take-OutputPart -Part 2 -Delimiter "v"
$aptSourceRepo = Get-AptSourceRepository -PackageName "mongodb"
return "MongoDB $mongoDBVersion (apt source repository: $aptSourceRepo)"
return "MongoDB $mongoDBVersion"
}
function Get-SqliteVersion {
@@ -38,11 +36,12 @@ function Build-PostgreSqlSection {
$output += New-MDHeader "PostgreSQL" -Level 4
$output += New-MDList -Style Unordered -Lines @(
(Get-PostgreSqlVersion ),
"PostgreSQL Server (user:postgres)"
(Get-PostgreSqlVersion)
)
$output += New-MDCode -Lines @(
"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'"
"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'"
)
return $output
@@ -53,11 +52,13 @@ function Build-MySQLSection {
$output += New-MDHeader "MySQL" -Level 4
$output += New-MDList -Style Unordered -Lines @(
(Get-MySQLVersion ),
"MySQL Server (user:root password:root)"
(Get-MySQLVersion )
)
$output += New-MDCode -Lines @(
"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'"
"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'"
)
return $output

View File

@@ -24,13 +24,11 @@ Import-Module (Join-Path $PSScriptRoot "SoftwareReport.WebServers.psm1") -Disabl
Restore-UserOwner
$markdown = ""
$markdown += New-MDHeader "Ubuntu $(Get-OSVersionShort)" -Level 1
$OSName = Get-OSName
$markdown += New-MDHeader "$OSName" -Level 1
$kernelVersion = Get-KernelVersion
$markdown += New-MDList -Style Unordered -Lines @(
"$kernelVersion"
"OS Version: $(Get-OSVersionFull)"
"Kernel Version: $(Get-KernelVersion)"
"Image Version: $env:IMAGE_VERSION"
)
@@ -85,7 +83,11 @@ $packageManagementList = @(
$markdown += New-MDList -Style Unordered -Lines ($packageManagementList | Sort-Object)
$markdown += New-MDHeader "Notes:" -Level 5
$markdown += New-MDHeader "Environment variables" -Level 4
$markdown += Build-PackageManagementEnvironmentTable | New-MDTable
$markdown += New-MDNewLine
$markdown += New-MDHeader "Homebrew note" -Level 4
$reportHomebrew = @'
```
Location: /home/linuxbrew
@@ -96,10 +98,6 @@ to accomplish this.
'@
$markdown += New-MDParagraph -Lines $reportHomebrew
$markdown += New-MDHeader "Environment variables" -Level 4
$markdown += Build-PackageManagementEnvironmentTable | New-MDTable
$markdown += New-MDNewLine
$markdown += New-MDHeader "Project Management" -Level 3
$projectManagementList = @()
if ((Test-IsUbuntu18) -or (Test-IsUbuntu20)) {
@@ -194,7 +192,7 @@ $markdown += New-MDList -Style Unordered -Lines (@(
(Get-OCCliVersion),
(Get-ORASCliVersion),
(Get-VerselCliversion)
) | Sort-Object
)
)
$markdown += New-MDHeader "Java" -Level 3
@@ -256,14 +254,12 @@ $markdown += New-MDHeader "Environment variables" -Level 4
$markdown += Build-BrowserWebdriversEnvironmentTable | New-MDTable
$markdown += New-MDNewLine
$markdown += New-MDHeader ".NET Core SDK" -Level 3
$markdown += New-MDList -Style Unordered -Lines @(
(Get-DotNetCoreSdkVersions)
$markdown += New-MDHeader ".NET Core Tools" -Level 3
$netCoreTools = @(
".NET Core SDK: $(Get-DotNetCoreSdkVersions)"
)
$markdown += New-MDHeader ".NET tools" -Level 3
$tools = Get-DotnetTools
$markdown += New-MDList -Lines $tools -Style Unordered
$netCoreTools += Get-DotnetTools
$markdown += New-MDList -Style Unordered -Lines $netCoreTools
$markdown += New-MDHeader "Databases" -Level 3
$databaseLists = @(
@@ -285,20 +281,11 @@ $markdown += Build-MSSQLToolsSection
$markdown += New-MDHeader "Cached Tools" -Level 3
$markdown += Build-CachedToolsSection
$markdown += New-MDHeader "Environment variables" -Level 4
$markdown += Build-GoEnvironmentTable | New-MDTable
$markdown += New-MDNewLine
$markdown += New-MDHeader "PowerShell Tools" -Level 3
$markdown += New-MDList -Lines (Get-PowershellVersion) -Style Unordered
$markdown += New-MDHeader "PowerShell Modules" -Level 4
$markdown += Get-PowerShellModules | New-MDTable
$markdown += New-MDNewLine
$markdown += New-MDHeader "Az PowerShell Modules" -Level 4
$markdown += New-MDList -Style Unordered -Lines @(
(Get-AzModuleVersions)
)
$markdown += New-MDList -Lines $(Get-PowerShellModules) -Style Unordered
$markdown += Build-WebServersSection

View File

@@ -12,7 +12,7 @@ function Get-AptFastVersion {
function Get-AzCopyVersion {
$azcopyVersion = azcopy --version | Take-OutputPart -Part 2
return "AzCopy $azcopyVersion (available by ``azcopy`` and ``azcopy10`` aliases)"
return "AzCopy $azcopyVersion - available by ``azcopy`` and ``azcopy10`` aliases"
}
function Get-BazelVersion {
@@ -42,28 +42,16 @@ function Get-CodeQLBundleVersion {
function Get-PodManVersion {
$podmanVersion = podman --version | Take-OutputPart -Part 2
if ((Test-IsUbuntu18) -or (Test-IsUbuntu20)) {
$aptSourceRepo = Get-AptSourceRepository -PackageName "containers"
return "Podman $podmanVersion (apt source repository: $aptSourceRepo)"
}
return "Podman $podmanVersion"
}
function Get-BuildahVersion {
$buildahVersion = buildah --version | Take-OutputPart -Part 2
if ((Test-IsUbuntu18) -or (Test-IsUbuntu20)) {
$aptSourceRepo = Get-AptSourceRepository -PackageName "containers"
return "Buildah $buildahVersion (apt source repository: $aptSourceRepo)"
}
return "Buildah $buildahVersion"
}
function Get-SkopeoVersion {
$skopeoVersion = skopeo --version | Take-OutputPart -Part 2
if ((Test-IsUbuntu18) -or (Test-IsUbuntu20)) {
$aptSourceRepo = Get-AptSourceRepository -PackageName "containers"
return "Skopeo $skopeoVersion (apt source repository: $aptSourceRepo)"
}
return "Skopeo $skopeoVersion"
}
@@ -104,15 +92,13 @@ function Get-DockerAmazonECRCredHelperVersion {
function Get-GitVersion {
$gitVersion = git --version | Take-OutputPart -Part -1
$aptSourceRepo = Get-AptSourceRepository -PackageName "git-core"
return "Git $gitVersion (apt source repository: $aptSourceRepo)"
return "Git $gitVersion"
}
function Get-GitLFSVersion {
$result = Get-CommandResult "git-lfs --version"
$gitlfsversion = $result.Output | Take-OutputPart -Part 0 | Take-OutputPart -Part 1 -Delimiter "/"
$aptSourceRepo = Get-AptSourceRepository -PackageName "git-lfs"
return "Git LFS $gitlfsversion (apt source repository: $aptSourceRepo)"
return "Git LFS $gitlfsversion"
}
function Get-GitFTPVersion {
@@ -121,8 +107,7 @@ function Get-GitFTPVersion {
}
function Get-GoogleCloudSDKVersion {
$aptSourceRepo = Get-AptSourceRepository -PackageName "google-cloud-sdk"
return "$(gcloud --version | Select-Object -First 1) (apt source repository: $aptSourceRepo)"
return gcloud --version | Select-Object -First 1
}
function Get-HavegedVersion {
@@ -215,8 +200,7 @@ function Get-JqVersion {
function Get-AzureCliVersion {
$azcliVersion = (az version | ConvertFrom-Json).'azure-cli'
$aptSourceRepo = Get-AptSourceRepository -PackageName "azure-cli"
return "Azure CLI (azure-cli) $azcliVersion (installation method: $aptSourceRepo)"
return "Azure CLI $azcliVersion"
}
function Get-AzureDevopsVersion {
@@ -299,7 +283,7 @@ function Get-YamllintVersion {
function Get-ZstdVersion {
$zstdVersion = zstd --version | Take-OutputPart -Part 1 -Delimiter "v" | Take-OutputPart -Part 0 -Delimiter ","
return "zstd $zstdVersion (homebrew)"
return "zstd $zstdVersion (Homebrew)"
}
function Get-YqVersion {

View File

@@ -29,13 +29,17 @@ function Get-CommandResult {
}
}
function Get-OSName {
lsb_release -ds
function Get-OSVersionShort {
$(Get-OSVersionFull) | Take-OutputPart -Delimiter '.' -Part 0,1
}
function Get-OSVersionFull {
lsb_release -ds | Take-OutputPart -Part 1, 2
}
function Get-KernelVersion {
$kernelVersion = uname -r
return "Linux kernel version: $kernelVersion"
return $kernelVersion
}
function Test-IsUbuntu18 {

View File

@@ -168,7 +168,7 @@ function Build-OSInfoSection {
$kernelVersion = $parsedSystemInfo[1].Replace($fieldsToInclude[1],"").Trim()
$osInfoNode = [HeaderNode]::new("macOS $version")
$osInfoNode.AddToolNode("System Version:", $systemVersion)
$osInfoNode.AddToolNode("OS Version:", $systemVersion)
$osInfoNode.AddToolNode("Kernel Version:", $kernelVersion)
$osInfoNode.AddToolNode("Image Version:", $ImageName.Split('_')[1])
return $osInfoNode

View File

@@ -131,8 +131,8 @@ $tools.AddToolNode("App Center CLI", $(Get-AppCenterCLIVersion))
$tools.AddToolNode("AWS CLI", $(Get-AWSCLIVersion))
$tools.AddToolNode("AWS SAM CLI", $(Get-AWSSAMCLIVersion))
$tools.AddToolNode("AWS Session Manager CLI", $(Get-AWSSessionManagerCLIVersion))
$tools.AddToolNode("Azure CLI (azure-devops)", $(Get-AzureDevopsVersion))
$tools.AddToolNode("Azure CLI", $(Get-AzureCLIVersion))
$tools.AddToolNode("Azure CLI (azure-devops)", $(Get-AzureDevopsVersion))
$tools.AddToolNode("Bicep CLI", $(Get-BicepVersion))
$tools.AddToolNode("Cabal", $(Get-CabalVersion))
$tools.AddToolNode("Cmake", $(Get-CmakeVersion))