mirror of
https://github.com/actions/runner-images.git
synced 2025-12-14 13:17:54 +00:00
Document environment variables of linux images (#2498)
* Document environment variables of linux images * Change adnroid variables * Apply reviews * Remove some variables, fix headers * Show link targets * rename helper * remove symlinks * More links * Dynamic GO variables * Architecture for GO variables * remove GOROOT
This commit is contained in:
@@ -158,4 +158,16 @@ function Get-AndroidNDKVersions {
|
||||
$ndkFolderPath = Join-Path (Get-AndroidSDKRoot) "ndk"
|
||||
$versions = Get-ChildItem -Path $ndkFolderPath -Name
|
||||
return ($versions -Join "<br>")
|
||||
}
|
||||
}
|
||||
|
||||
function Build-AndroidEnvironmentTable {
|
||||
$androidVersions = Get-Item env:ANDROID_*
|
||||
|
||||
$shouldResolveLink = 'ANDROID_NDK_PATH', '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}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,4 +21,22 @@ function Get-GeckodriverVersion {
|
||||
function Get-ChromiumVersion {
|
||||
$chromiumVersion = chromium --version | Take-OutputPart -Part 0,1
|
||||
return $chromiumVersion
|
||||
}
|
||||
}
|
||||
|
||||
function Build-BrowserWebdriversEnvironmentTable {
|
||||
return @(
|
||||
@{
|
||||
"Name" = "CHROMEWEBDRIVER"
|
||||
"Value" = $env:CHROMEWEBDRIVER
|
||||
},
|
||||
@{
|
||||
"Name" = "GECKOWEBDRIVER"
|
||||
"Value" = $env:GECKOWEBDRIVER
|
||||
}
|
||||
) | ForEach-Object {
|
||||
[PSCustomObject] @{
|
||||
"Name" = $_.Name
|
||||
"Value" = $_.Value
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,19 @@ 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 Get-ToolcacheBoostVersions {
|
||||
$Name = "Boost"
|
||||
$toolcachePath = Join-Path $env:AGENT_TOOLSDIRECTORY "boost"
|
||||
@@ -82,4 +95,4 @@ function Build-CachedToolsSection {
|
||||
$output += New-MDList -Lines (Get-ToolcacheRubyVersions) -Style Unordered
|
||||
|
||||
return $output
|
||||
}
|
||||
}
|
||||
|
||||
@@ -306,3 +306,21 @@ function Build-GraalVMTable {
|
||||
"Environment variables" = $envVariables
|
||||
}
|
||||
}
|
||||
|
||||
function Build-PackageManagementEnvironmentTable {
|
||||
return @(
|
||||
@{
|
||||
"Name" = "CONDA"
|
||||
"Value" = $env:CONDA
|
||||
},
|
||||
@{
|
||||
"Name" = "VCPKG_INSTALLATION_ROOT"
|
||||
"Value" = $env:VCPKG_INSTALLATION_ROOT
|
||||
}
|
||||
) | ForEach-Object {
|
||||
[PSCustomObject] @{
|
||||
"Name" = $_.Name
|
||||
"Value" = $_.Value
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,6 +64,9 @@ $packageManagementList = @(
|
||||
(Get-Pip3Version),
|
||||
(Get-VcpkgVersion)
|
||||
)
|
||||
$markdown += New-MDHeader "Environment variables" -Level 4
|
||||
$markdown += Build-PackageManagementEnvironmentTable | New-MDTable
|
||||
$markdown += New-MDNewLine
|
||||
|
||||
if (-not (Test-IsUbuntu16)) {
|
||||
$packageManagementList += @(
|
||||
@@ -216,6 +219,10 @@ if (Test-IsUbuntu20) {
|
||||
}
|
||||
|
||||
$markdown += New-MDList -Style Unordered -Lines $browsersAndDriversList
|
||||
$markdown += New-MDNewLine
|
||||
$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 @(
|
||||
@@ -241,6 +248,10 @@ $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
|
||||
|
||||
@@ -253,6 +264,9 @@ $markdown += Build-WebServersSection
|
||||
$markdown += New-MDHeader "Android" -Level 3
|
||||
$markdown += Build-AndroidTable | New-MDTable
|
||||
$markdown += New-MDNewLine
|
||||
$markdown += New-MDHeader "Environment variables" -Level 4
|
||||
$markdown += Build-AndroidEnvironmentTable | New-MDTable
|
||||
$markdown += New-MDNewLine
|
||||
|
||||
$markdown += New-MDHeader "Cached Docker images" -Level 3
|
||||
$markdown += Get-CachedDockerImagesTableData | New-MDTable
|
||||
|
||||
@@ -20,4 +20,94 @@ function New-MDNewLine {
|
||||
|
||||
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 {
|
||||
param (
|
||||
[string] $inputPath
|
||||
)
|
||||
$link = Get-LinkTarget($inputPath)
|
||||
return "${inputPath}${link}"
|
||||
}
|
||||
|
||||
function Get-CachedToolInstances
|
||||
{
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Returns hastable of installed cached tools.
|
||||
|
||||
.DESCRIPTION
|
||||
Return hastable that contains versions and architectures for selected cached tool.
|
||||
|
||||
.PARAMETER Name
|
||||
Name of cached tool.
|
||||
|
||||
.PARAMETER VersionCommand
|
||||
Optional parameter. Command to return version of system default tool.
|
||||
|
||||
.EXAMPLE
|
||||
Get-CachedToolInstances -Name "Python" -VersionCommand "--version"
|
||||
|
||||
#>
|
||||
|
||||
param
|
||||
(
|
||||
[String] $Name,
|
||||
[String] $VersionCommand
|
||||
)
|
||||
|
||||
$toolInstances = @()
|
||||
$toolPath = Join-Path -Path $env:AGENT_TOOLSDIRECTORY -ChildPath $Name
|
||||
|
||||
# Get all installed versions from TOOLSDIRECTORY folder
|
||||
$versions = Get-ChildItem $toolPath | Sort-Object { [System.Version]$_.Name }
|
||||
foreach ($version in $versions)
|
||||
{
|
||||
$instanceInfo = @{}
|
||||
|
||||
# Create instance hashtable
|
||||
[string]$instanceInfo.Path = Join-Path -Path $toolPath -ChildPath $version.Name
|
||||
[string]$instanceInfo.Version = $version.Name
|
||||
|
||||
### Temporary workaround. Currently Boost instances don't have architecture subfolders.
|
||||
if ($Name -eq "Boost")
|
||||
{
|
||||
[string]$instanceInfo.Architecture = "x64, x86"
|
||||
$toolInstances += $instanceInfo
|
||||
continue
|
||||
}
|
||||
|
||||
# Get all architectures for current version
|
||||
[array]$instanceInfo.Architecture_Array = Get-ChildItem $version.FullName -Name -Directory | Where-Object { $_ -match "^x[0-9]{2}$" }
|
||||
[string]$instanceInfo.Architecture = $instanceInfo.Architecture_Array -Join ", "
|
||||
|
||||
# Add (default) postfix to version name, in case if current version is in environment path
|
||||
if (-not ([string]::IsNullOrEmpty($VersionCommand)))
|
||||
{
|
||||
$defaultVersion = $(& ($Name.ToLower()) $VersionCommand 2>&1)
|
||||
$defaultToolVersion = $defaultVersion | Select-String -Pattern "\d+\.\d+\.\d+" -AllMatches `
|
||||
| ForEach-Object { $_.Matches.Value }
|
||||
|
||||
if ([version]$version.Name -eq [version]$defaultToolVersion)
|
||||
{
|
||||
$instanceInfo.Version += " (Default)"
|
||||
}
|
||||
}
|
||||
|
||||
$toolInstances += $instanceInfo
|
||||
}
|
||||
|
||||
return $toolInstances
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user