Merge main into install-codeql-bundle.

This commit is contained in:
Chris Gavin
2020-09-19 13:52:56 +01:00
124 changed files with 1928 additions and 999 deletions

View File

@@ -0,0 +1,147 @@
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 "tools" "bin" "sdkmanager"
}
function Get-AndroidInstalledPackages {
$androidSDKManagerPath = Get-AndroidSDKManagerPath
$androidSDKManagerList = Invoke-Expression "$androidSDKManagerPath --list --include_obsolete"
$androidInstalledPackages = @()
foreach($packageInfo in $androidSDKManagerList) {
if($packageInfo -Match "Available Packages:") {
break
}
$androidInstalledPackages += $packageInfo
}
return $androidInstalledPackages
}
function Build-AndroidTable {
$packageInfo = Get-AndroidInstalledPackages
return @(
@{
"Package" = "Android SDK Platform-Tools"
"Version" = Get-AndroidPackageVersions -PackageInfo $packageInfo -MatchedString "Android SDK Platform-Tools"
},
@{
"Package" = "Android SDK Tools"
"Version" = Get-AndroidPackageVersions -PackageInfo $packageInfo -MatchedString "Android SDK Tools"
},
@{
"Package" = "Android SDK Platforms"
"Version" = Get-AndroidPlatformVersions -PackageInfo $packageInfo
},
@{
"Package" = "Android SDK Build-tools"
"Version" = Get-AndroidBuildToolVersions -PackageInfo $packageInfo
},
@{
"Package" = "Google APIs"
"Version" = Get-AndroidGoogleAPIsVersions -PackageInfo $packageInfo
},
@{
"Package" = "NDK"
"Version" = Get-AndroidPackageVersions -PackageInfo $packageInfo -MatchedString "ndk-bundle"
},
@{
"Package" = "Android Support Repository"
"Version" = Get-AndroidPackageVersions -PackageInfo $packageInfo -MatchedString "Android Support Repository"
},
@{
"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" = "SDK Patch Applier v4"
"Version" = Get-AndroidPackageVersions -PackageInfo $packageInfo -MatchedString "SDK Patch Applier v4"
},
@{
"Package" = "CMake"
"Version" = Get-AndroidPackageVersions -PackageInfo $packageInfo -MatchedString "cmake"
}
) | 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-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>")
}

View File

@@ -0,0 +1,19 @@
function Get-ChromeVersion {
$googleChromeVersion = google-chrome --version | Take-OutputPart -Part 2
return "Google Chrome $googleChromeVersion"
}
function Get-ChromeDriverVersion {
$chromeDriverVersion = chromedriver --version | Take-OutputPart -Part 1
return "ChromeDriver $chromeDriverVersion"
}
function Get-FirefoxVersion {
$firefoxVersion = firefox --version
return $firefoxVersion
}
function Get-GeckodriverVersion {
$geckodriverVersion = geckodriver --version | Select-Object -First 1 | Take-OutputPart -Part 1
return "Geckodriver $geckodriverVersion"
}

View File

@@ -0,0 +1,64 @@
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\.]+) .+]$" | 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]$_ }
}
function Get-ToolcacheBoostVersions {
$toolcachePath = Join-Path $env:AGENT_TOOLSDIRECTORY "boost"
if (-not (Test-Path $toolcachePath)) {
return @()
}
return Get-ChildItem $toolcachePath -Name | Sort-Object { [Version]$_ }
}
function Build-CachedToolsSection {
$output = ""
$output += New-MDHeader "Ruby" -Level 4
$output += New-MDList -Lines (Get-ToolcacheRubyVersions) -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 "Node.js" -Level 4
$output += New-MDList -Lines (Get-ToolcacheNodeVersions) -Style Unordered
$output += New-MDHeader "Go" -Level 4
$output += New-MDList -Lines (Get-ToolcacheGoVersions) -Style Unordered
$boostVersions = Get-ToolcacheBoostVersions
if ($boostVersions.Count -gt 0) {
$output += New-MDHeader "Boost" -Level 4
$output += New-MDList -Lines $boostVersions -Style Unordered
}
return $output
}

View File

@@ -0,0 +1,247 @@
Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Helpers.psm1") -DisableNameChecking
function Get-OSName {
lsb_release -ds
}
function Get-CPPVersions {
$cppVersions = apt list --installed 2>&1 | Where-Object { $_ -match "g\+\+-\d+"} | ForEach-Object {
$_ -match "now (?<version>\d+\.\d+\.\d+)-" | Out-Null
$Matches.version
}
return "GNU C++ " + ($cppVersions -Join ", ")
}
function Get-FortranVersions {
$fortranVersions = apt list --installed 2>&1 | Where-Object { $_ -match "^gfortran-\d+"} | ForEach-Object {
$_ -match "now (?<version>\d+\.\d+\.\d+)-" | Out-Null
$Matches.version
}
return "GNU Fortran " + ($fortranVersions -Join ", ")
}
function Get-ClangVersions {
$clangVersions = @()
$clangVersions = apt list --installed 2>&1 | Where-Object { $_ -match "^clang-\d+"} | ForEach-Object {
$clangCommand = ($_ -Split "/")[0]
Invoke-Expression "$clangCommand --version" | Where-Object { $_ -match "clang version" } | ForEach-Object {
$_ -match "clang version (?<version>\d+\.\d+\.\d+)-" | Out-Null
$Matches.version
}
}
return "Clang " + ($clangVersions -Join ", ")
}
function Get-ErlangVersion {
$result = Get-CommandResult "erl -version"
$result.Output -match "version (?<version>\d+\.\d+\.\d+)" | Out-Null
$version = $Matches.version
return "Erlang $version"
}
function Get-MonoVersion {
$monoVersion = mono --version | Out-String | Take-OutputPart -Part 4
return "Mono $monoVersion"
}
function Get-NodeVersion {
$nodeVersion = $(node --version).Substring(1)
return "Node $nodeVersion"
}
function Get-PythonVersion {
$result = Get-CommandResult "python --version"
$version = $result.Output | Take-OutputPart -Part 1
return "Python $version"
}
function Get-Python3Version {
$result = Get-CommandResult "python3 --version"
$version = $result.Output | Take-OutputPart -Part 1
return "Python3 $version"
}
function Get-PowershellVersion {
return $(pwsh --version)
}
function Get-RubyVersion {
$rubyVersion = ruby --version | Out-String | Take-OutputPart -Part 1
return "Ruby $rubyVersion"
}
function Get-SwiftVersion {
$swiftVersion = swift --version | Out-String | Take-OutputPart -Part 2
return "Swift $swiftVersion"
}
function Get-JuliaVersion {
$juliaVersion = julia --version | Take-OutputPart -Part 2
return "Julia $juliaVersion"
}
function Get-HomebrewVersion {
$result = Get-CommandResult "brew -v"
$result.Output -match "Homebrew (?<version>\d+\.\d+\.\d+)" | Out-Null
$version = $Matches.version
return "Homebrew $version"
}
function Get-GemVersion {
$result = Get-CommandResult "gem --version"
$result.Output -match "(?<version>\d+\.\d+\.\d+)" | Out-Null
$gemVersion = $Matches.version
return "Gem $gemVersion"
}
function Get-MinicondaVersion {
$condaVersion = conda --version
return "Mini$condaVersion"
}
function Get-HelmVersion {
$(helm version) -match 'Version:"v(?<version>\d+\.\d+\.\d+)"' | Out-Null
$helmVersion = $Matches.version
return "Helm $helmVersion"
}
function Get-NpmVersion {
$npmVersion = npm --version
return "Npm $npmVersion"
}
function Get-YarnVersion {
$yarnVersion = yarn --version
return "Yarn $yarnVersion"
}
function Get-PipVersion {
$result = Get-CommandResult "pip --version"
$result.Output -match "pip (?<version>\d+\.\d+\.\d+)" | Out-Null
$pipVersion = $Matches.version
return "Pip $pipVersion"
}
function Get-Pip3Version {
$result = Get-CommandResult "pip3 --version"
$result.Output -match "pip (?<version>\d+\.\d+\.\d+)" | Out-Null
$pipVersion = $Matches.version
return "Pip3 $pipVersion"
}
function Get-VcpkgVersion {
$result = Get-CommandResult "vcpkg version"
$result.Output -match "version (?<version>\d+\.\d+\.\d+)" | Out-Null
$vcpkgVersion = $Matches.version
return "Vcpkg $vcpkgVersion"
}
function Get-AntVersion {
$result = ant -version | Out-String
$result -match "version (?<version>\d+\.\d+\.\d+)" | Out-Null
$antVersion = $Matches.version
return "Ant $antVersion"
}
function Get-GradleVersion {
$result = gradle -v | Out-String
$result -match "Gradle (?<version>\d+\.\d+\.\d+)" | Out-Null
$gradleVersion = $Matches.version
return "Gradle $gradleVersion"
}
function Get-MavenVersion {
$result = mvn -version | Out-String
$result -match "Apache Maven (?<version>\d+\.\d+\.\d+)" | Out-Null
$mavenVersion = $Matches.version
return "Maven $mavenVersion"
}
function Get-SbtVersion {
$result = sbt -version 2>&1 | Out-String
$result -match "sbt script version: (?<version>\d+\.\d+\.\d+)" | Out-Null
$sbtVersion = $Matches.version
return "Sbt $sbtVersion"
}
function Get-PHPVersions {
return $(apt list --installed 2>&1) | Where-Object { $_ -match "^php\d+\.\d+/"} | ForEach-Object {
$_ -match "now (?<version>\d+\.\d+\.\d+)-" | Out-Null
$Matches.version
}
}
function Get-ComposerVersion {
$(composer --version) -match "Composer version (?<version>\d+\.\d+\.\d+)\s" | Out-Null
return $Matches.version
}
function Get-PHPUnitVersion {
$(phpunit --version | Out-String) -match "PHPUnit (?<version>\d+\.\d+\.\d+)\s" | Out-Null
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 Get-GHCVersion {
$(ghc --version) -match "version (?<version>\d+\.\d+\.\d+)" | Out-Null
$ghcVersion = $Matches.version
return "GHC $ghcVersion"
}
function Get-CabalVersion {
$(cabal --version | Out-String) -match "cabal-install version (?<version>\d+\.\d+\.\d+\.\d+)" | Out-Null
$cabalVersion = $Matches.version
return "Cabal $cabalVersion"
}
function Get-StackVersion {
$(stack --version | Out-String) -match "Version (?<version>\d+\.\d+\.\d+)" | Out-Null
$stackVersion = $Matches.version
return "Stack $stackVersion"
}
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-DotNetCoreSdkVersions {
$unsortedDotNetCoreSdkVersion = dotnet --list-sdks list | ForEach-Object { $_ | Take-OutputPart -Part 0 }
$dotNetCoreSdkVersion = $unsortedDotNetCoreSdkVersion -join " "
return $dotNetCoreSdkVersion
}
function Get-CachedDockerImages {
$toolsetJson = Get-ToolsetContent
$images = $toolsetJson.docker.images
return $images
}
function Get-AptPackages {
$toolsetJson = Get-ToolsetContent
$apt = $toolsetJson.apt
$pkgs = ($apt.common_packages + $apt.cmd_packages | Sort-Object) -join ", "
return $pkgs
}

View File

@@ -0,0 +1,35 @@
function Get-PostgreSqlVersion {
$postgreSQLVersion = psql --version | Take-OutputPart -Part 2
return "Postgre SQL $postgreSQLVersion"
}
function Get-MongoDbVersion {
$mongoDBVersion = mongod --version | Select-Object -First 1 | Take-OutputPart -Part 2 -Delimiter "v"
return "MongoDB $mongoDBVersion"
}
function Get-SqliteVersion {
$sqliteVersion = sqlite3 --version | Take-OutputPart -Part 0
return "sqlite3 $sqliteVersion"
}
function Get-MySQLVersion {
$mySQLVersion = mysqld --version | Take-OutputPart -Part 2 | Take-OutputPart -Part 0 -Delimiter "-"
return "MySQL $mySQLVersion"
}
function Build-MySQLSection {
$output = ""
$output += New-MDHeader "MySQL" -Level 4
$output += New-MDList -Style Unordered -Lines @(
(Get-MySQLVersion ),
"MySQL Server (user:root password:root)",
"MS SQL Server Client Tools"
)
$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'"
)
return $output
}

View File

@@ -0,0 +1,212 @@
param (
[Parameter(Mandatory)][string]
$OutputDirectory
)
Import-Module MarkdownPS
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 (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
$markdown = ""
if ($env:ANNOUNCEMENTS) {
$markdown += $env:ANNOUNCEMENTS
$markdown += New-MDNewLine
$markdown += "***"
$markdown += New-MDNewLine
}
$OSName = Get-OSName
$markdown += New-MDHeader "$OSName" -Level 1
$markdown += New-MDList -Style Unordered -Lines @(
"Image Version: $env:IMAGE_VERSION"
)
$markdown += New-MDHeader "Installed Software" -Level 2
$markdown += New-MDHeader "Language and Runtime" -Level 3
$markdown += New-MDList -Style Unordered -Lines @(
(Get-CPPVersions),
(Get-FortranVersions),
(Get-ClangVersions),
(Get-ErlangVersion),
(Get-MonoVersion),
(Get-NodeVersion),
(Get-PythonVersion),
(Get-Python3Version),
(Get-PowershellVersion),
(Get-RubyVersion),
(Get-SwiftVersion),
(Get-JuliaVersion)
)
$markdown += New-MDHeader "Package Management" -Level 3
$markdown += New-MDList -Style Unordered -Lines @(
(Get-HomebrewVersion),
(Get-GemVersion),
(Get-MinicondaVersion),
(Get-HelmVersion),
(Get-NpmVersion),
(Get-YarnVersion),
(Get-PipVersion),
(Get-Pip3Version),
(Get-VcpkgVersion)
)
$markdown += New-MDHeader "Project Management" -Level 3
$markdown += New-MDList -Style Unordered -Lines @(
(Get-AntVersion),
(Get-GradleVersion),
(Get-MavenVersion),
(Get-SbtVersion)
)
$markdown += New-MDHeader "Tools" -Level 3
$toolsList = @(
(Get-7zipVersion),
(Get-AnsibleVersion),
(Get-AzCopy7Version),
(Get-AzCopy10Version),
(Get-BazelVersion),
(Get-BazeliskVersion),
(Get-CMakeVersion),
(Get-CurlVersion),
(Get-DockerMobyVersion),
(Get-DockerComposeVersion),
(Get-DockerBuildxVersion),
(Get-GitVersion),
(Get-GitLFSVersion),
(Get-GitFTPVersion),
(Get-GoogleCloudSDKVersion),
(Get-HavegedVersion),
(Get-HerokuVersion),
(Get-HHVMVersion),
(Get-SVNVersion),
(Get-JqVersion),
(Get-KindVersion),
(Get-KubectlVersion),
(Get-KustomizeVersion),
(Get-LeiningenVersion),
(Get-M4Version),
(Get-HGVersion),
(Get-MinikubeVersion),
(Get-NewmanVersion),
(Get-NvmVersion),
(Get-PackerVersion),
(Get-PhantomJSVersion),
(Get-SwigVersion),
(Get-TerraformVersion),
(Get-UnZipVersion),
(Get-WgetVersion),
(Get-ZipVersion),
(Get-ZstdVersion)
)
if (-not (Test-IsUbuntu16)) {
$toolsList += @(
(Get-PodManVersion),
(Get-BuildahVersion),
(Get-SkopeoVersion)
)
}
$markdown += New-MDList -Style Unordered -Lines ($toolsList | Sort-Object)
$markdown += New-MDHeader "CLI Tools" -Level 3
$markdown += New-MDList -Style Unordered -Lines @(
(Get-AlibabaCloudCliVersion),
(Get-AWSCliVersion),
(Get-AWSCliSessionManagerPluginVersion),
(Get-AWSSAMVersion),
(Get-AzureCliVersion),
(Get-AzureDevopsVersion),
(Get-GitHubCliVersion),
(Get-HubCliVersion),
(Get-NetlifyCliVersion),
(Get-OCCliVersion),
(Get-ORASCliVersion),
(Get-VerselCliversion)
)
$markdown += New-MDHeader "Java" -Level 3
$markdown += Get-JavaVersions | New-MDTable
$markdown += New-MDNewLine
$markdown += New-MDHeader "PHP" -Level 3
$markdown += Build-PHPTable | New-MDTable
$markdown += New-MDNewLine
$markdown += New-MDHeader "Haskell" -Level 3
$markdown += New-MDList -Style Unordered -Lines @(
(Get-GHCVersion),
(Get-CabalVersion),
(Get-StackVersion)
)
$markdown += New-MDHeader "Rust Tools" -Level 3
$markdown += New-MDList -Style Unordered -Lines @(
(Get-RustVersion),
(Get-RustupVersion),
(Get-RustdocVersion),
(Get-CargoVersion)
)
$markdown += New-MDHeader "Packages" -Level 4
$markdown += New-MDList -Style Unordered -Lines @(
(Get-BindgenVersion),
(Get-CargoAuditVersion),
(Get-CargoOutdatedVersion),
(Get-CargoClippyVersion),
(Get-CbindgenVersion),
(Get-RustfmtVersion)
)
$markdown += New-MDHeader "Browsers and Drivers" -Level 3
$markdown += New-MDList -Style Unordered -Lines @(
(Get-ChromeVersion),
(Get-ChromeDriverVersion),
(Get-FirefoxVersion),
(Get-GeckodriverVersion)
)
$markdown += New-MDHeader ".NET Core SDK" -Level 3
$markdown += New-MDList -Style Unordered -Lines @(
(Get-DotNetCoreSdkVersions)
)
$markdown += New-MDHeader "Az Module" -Level 3
$markdown += New-MDList -Style Unordered -Lines @(
(Get-AzModuleVersions)
)
$markdown += New-MDHeader "Databases" -Level 3
$markdown += New-MDList -Style Unordered -Lines @(
(Get-PostgreSqlVersion),
(Get-MongoDbVersion),
(Get-SqliteVersion)
)
$markdown += Build-MySQLSection
$markdown += New-MDHeader "Cached Tools" -Level 3
$markdown += Build-CachedToolsSection
$markdown += New-MDHeader "Android" -Level 3
$markdown += Build-AndroidTable | New-MDTable
$markdown += New-MDNewLine
$markdown += New-MDHeader "Cached Docker images" -Level 3
$markdown += New-MDList -Style Unordered -Lines @(Get-CachedDockerImages)
$markdown += New-MDHeader "Installed apt packages" -Level 3
$markdown += New-MDList -Style Unordered -Lines @(Get-AptPackages)
$markdown | Out-File -FilePath "${OutputDirectory}/Ubuntu-Readme.md"

View File

@@ -0,0 +1,51 @@
function Get-CommandResult {
param (
[Parameter(Mandatory=$true)]
[string] $Command,
[switch] $Multiline
)
# Bash trick to suppress and show error output because some commands write to stderr (for example, "python --version")
$stdout = & bash -c "$Command 2>&1"
$exitCode = $LASTEXITCODE
return @{
Output = If ($Multiline -eq $true) { $stdout } else { [string]$stdout }
ExitCode = $exitCode
}
}
function Take-OutputPart {
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 Test-IsUbuntu16 {
return (lsb_release -rs) -eq "16.04"
}
function Test-IsUbuntu18 {
return (lsb_release -rs) -eq "18.04"
}
function Test-IsUbuntu20 {
return (lsb_release -rs) -eq "20.04"
}
function Get-ToolsetContent {
$toolset = Join-Path $env:INSTALLER_SCRIPT_FOLDER "toolset.json"
Get-Content $toolset -Raw | ConvertFrom-Json
}
function New-MDNewLine {
param (
[int] $Count = 1
)
$newLineSymbol = [System.Environment]::NewLine
return $newLineSymbol * $Count
}

View File

@@ -0,0 +1,30 @@
function Get-JavaFullVersion {
param($JavaRootPath)
$javaBinPath = Join-Path $javaRootPath "/bin/java"
$javaVersionOutput = (Get-CommandResult "$javaBinPath -version").Output
$matchResult = $javaVersionOutput | Select-String '^openjdk version \"([\d\._]+)\"'
return $matchResult.Matches.Groups[1].Value
}
function Get-JavaVersions {
$defaultJavaPath = $env:JAVA_HOME
$javaVersions = Get-Item env:JAVA_HOME_*_X64
$sortRules = @{
Expression = { [Int32]$_.Name.Split("_")[2] }
Descending = $false
}
return $javaVersions | Sort-Object $sortRules | ForEach-Object {
$javaPath = $_.Value
$version = Get-JavaFullVersion $javaPath
$vendor = $version.StartsWith("1.7") ? "Zulu" : "AdoptOpenJDK"
$defaultPostfix = ($javaPath -eq $defaultJavaPath) ? " (default)" : ""
[PSCustomObject] @{
"Version" = $version + $defaultPostfix
"Vendor" = $vendor
"Environment Variable" = $_.Name
}
}
}

View File

@@ -0,0 +1,55 @@
function Initialize-RustEnvironment {
ln -sf "/usr/share/rust/.rustup" $HOME/.rustup
ln -sf "/usr/share/rust/.cargo" $HOME/.cargo
}
function Get-RustVersion {
Initialize-RustEnvironment
$rustVersion = $(rustc --version) | Take-OutputPart -Part 1
return "Rust $rustVersion"
}
function Get-BindgenVersion {
$bindgenVersion = $(bindgen --version) | Take-OutputPart -Part 1
return "Bindgen $bindgenVersion"
}
function Get-CargoVersion {
$cargoVersion = $(cargo --version) | Take-OutputPart -Part 1
return "Cargo $cargoVersion"
}
function Get-CargoAuditVersion {
$cargoAuditVersion = $(cargo audit --version) | Take-OutputPart -Part 1
return "Cargo audit $cargoAuditVersion"
}
function Get-CargoOutdatedVersion {
$cargoOutdatedVersion = $(cargo outdated --version) | Take-OutputPart -Part 1 -Delimiter "v"
return "Cargo outdated $cargoOutdatedVersion"
}
function Get-CargoClippyVersion {
$cargoClippyVersion = $(cargo-clippy --version) | Take-OutputPart -Part 1
return "Cargo clippy $cargoClippyVersion"
}
function Get-CbindgenVersion {
$cbindgenVersion = $(cbindgen --version) | Take-OutputPart -Part 1
return "Cbindgen $cbindgenVersion"
}
function Get-RustupVersion {
$rustupVersion = $(rustup --version) | Take-OutputPart -Part 1
return "Rustup $rustupVersion"
}
function Get-RustdocVersion {
$rustdocVersion = $(rustdoc --version) | Take-OutputPart -Part 1
return "Rustdoc $rustdocVersion"
}
function Get-RustfmtVersion {
$rustfmtVersion = $(rustfmt --version) | Take-OutputPart -Part 1 | Take-OutputPart -Part 0 -Delimiter "-"
return "Rustfmt $rustfmtVersion"
}

View File

@@ -0,0 +1,249 @@
function Get-7zipVersion {
$7zVersion = 7z i | Select-String "7-Zip" | Take-OutputPart -Part 2
return "7-Zip $7zVersion"
}
function Get-AnsibleVersion {
$ansibleVersion = sudo ansible --version | Select-Object -First 1 | Take-OutputPart -Part 1
return "Ansible $ansibleVersion"
}
function Get-AzCopy7Version {
$azcopy7Version = azcopy --version | Take-OutputPart -Part 1 | Take-OutputPart -Part 0 -Delimiter "-"
return "AzCopy7 $azcopy7Version (available by ``azcopy`` alias)"
}
function Get-AzCopy10Version {
$azcopy10Version = azcopy10 --version | Take-OutputPart -Part 2
return "AzCopy10 $azcopy10Version (available by ``azcopy10`` alias)"
}
function Get-BazelVersion {
$bazelVersion = sudo bazel --version | Select-String "bazel" | Take-OutputPart -Part 1
return "Bazel $bazelVersion"
}
function Get-BazeliskVersion {
$bazeliskVersion = sudo bazelisk version 2>&1 | Select-String "Bazelisk version:" | Take-OutputPart -Part 2 | Take-OutputPart -Part 0 -Delimiter "v"
return "Bazelisk $bazeliskVersion"
}
function Get-PodManVersion {
$podmanVersion = podman --version | Take-OutputPart -Part 2
return "Podman $podmanVersion"
}
function Get-BuildahVersion {
$buildahVersion = buildah --version | Take-OutputPart -Part 2
return "Buildah $buildahVersion"
}
function Get-SkopeoVersion {
$skopeoVersion = skopeo --version | Take-OutputPart -Part 2
return "Skopeo $skopeoVersion"
}
function Get-CMakeVersion {
$cmakeVersion = cmake --version | Select-Object -First 1 | Take-OutputPart -Part 2
return "CMake $cmakeVersion"
}
function Get-CurlVersion {
$curlVersion = curl --version | Select-Object -First 1 | Take-OutputPart -Part 0,1
return $curlVersion
}
function Get-DockerComposeVersion {
$composeVersion = docker-compose -v | Take-OutputPart -Part 2 | Take-OutputPart -Part 0 -Delimiter ","
return "Docker Compose $composeVersion"
}
function Get-DockerMobyVersion {
$dockerVersion = docker -v | Take-OutputPart -Part 2 | Take-OutputPart -Part 0 -Delimiter "+"
return "Docker-Moby $dockerVersion"
}
function Get-DockerBuildxVersion {
$buildxVersion = docker buildx version | Take-OutputPart -Part 1 | Take-OutputPart -Part 0 -Delimiter "+"
return "Docker-Buildx $buildxVersion"
}
function Get-GitVersion {
$gitVersion = git --version 2>&1 | Take-OutputPart -Part 2
return "Git $gitVersion"
}
function Get-GitLFSVersion {
$gitlfsversion = git-lfs --version 2>&1 | Take-OutputPart -Part 0 | Take-OutputPart -Part 1 -Delimiter "/"
return "Git LFS $gitlfsversion"
}
function Get-GitFTPVersion {
$gitftpVersion = git-ftp --version | Take-OutputPart -Part 2
return "Git-ftp $gitftpVersion"
}
function Get-GoogleCloudSDKVersion {
return "$(sudo gcloud --version | Select-Object -First 1)"
}
function Get-HavegedVersion {
$havegedVersion = dpkg-query --showformat='${Version}' --show haveged | Take-OutputPart -Part 0 -Delimiter "-"
return "Haveged $havegedVersion"
}
function Get-HerokuVersion {
$herokuVersion = sudo heroku version | Take-OutputPart -Part 0 | Take-OutputPart -Part 1 -Delimiter "/"
return "Heroku $herokuVersion"
}
function Get-HHVMVersion {
$hhvmVersion = hhvm --version | Select-Object -First 1 | Take-OutputPart -Part 2
return "HHVM (HipHop VM) $hhvmVersion"
}
function Get-SVNVersion {
$svnVersion = svn --version | Select-Object -First 1 | Take-OutputPart -Part 2
return "SVN $svnVersion"
}
function Get-KustomizeVersion {
$kustomizeVersion = kustomize version --short | Take-OutputPart -Part 0 | Take-OutputPart -Part 1 -Delimiter "v"
return "Kustomize $kustomizeVersion"
}
function Get-KindVersion {
$kindVersion = kind version | Take-OutputPart -Part 1 | Take-OutputPart -Part 0 -Delimiter "v"
return "Kind $kindVersion"
}
function Get-KubectlVersion {
$kubectlVersion = kubectl version --client --short | Take-OutputPart -Part 2 | Take-OutputPart -Part 0 -Delimiter "v"
return "Kubectl $kubectlVersion"
}
function Get-MinikubeVersion {
$minikubeVersion = minikube version --short | Take-OutputPart -Part 2 | Take-OutputPart -Part 0 -Delimiter "v"
return "Minikube $minikubeVersion"
}
function Get-HGVersion {
$hgVersion = hg --version | Select-Object -First 1 | Take-OutputPart -Part -1 | Take-OutputPart -Part 0 -Delimiter ")"
return "Mercurial $hgVersion"
}
function Get-M4Version {
$m4Version = m4 --version | Select-Object -First 1 | Take-OutputPart -Part -1
return "m4 $m4Version"
}
function Get-LeiningenVersion {
return "$(lein -v | Take-OutputPart -Part 0,1)"
}
function Get-NewmanVersion {
return "Newman $(newman --version)"
}
function Get-NvmVersion {
$nvmVersion = bash -c "source /etc/skel/.nvm/nvm.sh && nvm --version"
return "nvm $nvmVersion"
}
function Get-PackerVersion {
return "Packer $(packer --version)"
}
function Get-PhantomJSVersion {
return "PhantomJS $(phantomjs --version)"
}
function Get-SwigVersion {
$swigVersion = swig -version | Select-String "SWIG Version" | Take-OutputPart -Part 2
return "Swig $swigVersion"
}
function Get-TerraformVersion {
return (terraform version | Select-String "^Terraform").Line.Replace('v','')
}
function Get-UnZipVersion {
$unzipVersion = unzip -v | Select-Object -First 1 | Take-OutputPart -Part 1
return "unzip $unzipVersion"
}
function Get-WgetVersion {
$wgetVersion = wget --version | Select-Object -First 1 | Take-OutputPart -Part 2
return "wget $wgetVersion"
}
function Get-ZipVersion {
$zipVersion = zip -v | Select-String "This is Zip" | Take-OutputPart -Part 3
return "zip $zipVersion"
}
function Get-ZstdVersion {
$zstdVersion = (zstd --version).Split() -match "v\d+" | ForEach-Object {$_.Replace("v","").Replace(",","")}
return "zstd $zstdVersion"
}
function Get-JqVersion {
$jqVersion = jq --version | Take-OutputPart -Part 1 -Delimiter "-"
return "jq $jqVersion"
}
function Get-AzureCliVersion {
$azcliVersion = sudo az -v | Select-String "azure-cli" | Take-OutputPart -Part -1
return "Azure CLI (azure-cli) $azcliVersion"
}
function Get-AzureDevopsVersion {
$azdevopsVersion = sudo az -v | Select-String "azure-devops" | Take-OutputPart -Part -1
return "Azure CLI (azure-devops) $azdevopsVersion"
}
function Get-AlibabaCloudCliVersion {
return "Alibaba Cloud CLI $(aliyun version)"
}
function Get-AWSCliVersion {
$awsVersion = aws --version 2>&1 | Take-OutputPart -Part 0 | Take-OutputPart -Part 1 -Delimiter "/"
return "AWS CLI $awsVersion"
}
function Get-AWSCliSessionManagerPluginVersion {
return "AWS CLI Session manager plugin $(session-manager-plugin --version 2>&1)"
}
function Get-AWSSAMVersion {
return "AWS SAM CLI $(sam --version | Take-OutputPart -Part -1)"
}
function Get-HubCliVersion {
$hubVersion = hub --version | Select-String "hub version" | Take-OutputPart -Part 2
return "Hub CLI $hubVersion"
}
function Get-GitHubCliVersion {
$ghVersion = gh --version | Select-String "gh version" | Take-OutputPart -Part 2
return "GitHub CLI $ghVersion"
}
function Get-NetlifyCliVersion {
$netlifyVersion = sudo netlify --version | Take-OutputPart -Part 0 | Take-OutputPart -Part 1 -Delimiter "/"
return "Netlify CLI $netlifyVersion"
}
function Get-OCCliVersion {
$ocVersion = oc version | Take-OutputPart -Part 2 | Take-OutputPart -Part 0 -Delimiter "-"
return "oc CLI $ocVersion"
}
function Get-ORASCliVersion {
$orasVersion = oras version | Select-String "^Version:" | Take-OutputPart -Part 1
return "ORAS CLI $orasVersion"
}
function Get-VerselCliversion {
return "$(vercel --version 2>&1 | Select-Object -First 1)"
}

View File

@@ -1,42 +0,0 @@
#!/bin/bash
################################################################################
## File: document.sh
## Desc: Helper functions for writing information to the metadata document
################################################################################
function WriteItem {
if [ -z "$METADATA_FILE" ]; then
echo "METADATA_FILE environment variable must be set to output to Metadata Document!"
return 1;
else
echo -e "$1" | sudo tee -a "$METADATA_FILE"
fi
}
function AddTitle {
WriteItem "# $1"
}
function AddSubTitle {
WriteItem "## $1"
}
function DocumentInstalledItem {
WriteItem "- $1"
}
function DocumentInstalledItemIndent {
WriteItem " - $1"
}
function AddBlockquote {
WriteItem "> $1"
}
function StartCode {
WriteItem '```'
}
function EndCode {
WriteItem '```'
}

View File

@@ -4,8 +4,6 @@
## Desc: Installs 7-zip
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
# Install 7-Zip
apt-get update -y
@@ -17,7 +15,3 @@ if ! command -v 7z; then
echo "7-Zip was not installed"
exit 1
fi
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "7-Zip $(7z i | head --lines=2 | cut -d ' ' -f 3 | tr -d '\n')"

View File

@@ -0,0 +1,31 @@
$ErrorActionPreference = "Stop"
function Get-ToolsetContent
{
$toolset = Join-Path $env:INSTALLER_SCRIPT_FOLDER "toolset.json"
Get-Content $toolset -Raw | ConvertFrom-Json
}
# Specifies the installation policy
Set-PSRepository -InstallationPolicy Trusted -Name PSGallery
# Install PowerShell modules
$modules = (Get-ToolsetContent).powershellModules
foreach($module in $modules)
{
$moduleName = $module.name
Write-Host "Installing ${moduleName} module"
if ($module.versions)
{
foreach ($version in $module.versions)
{
Write-Host " - $version"
Install-Module -Name $moduleName -RequiredVersion $version -Scope AllUsers -SkipPublisherCheck -Force
}
continue
}
Install-Module -Name $moduleName -Scope AllUsers -SkipPublisherCheck -Force
}

View File

@@ -50,7 +50,6 @@ $toolset = Get-Content -Path "$env:INSTALLER_SCRIPT_FOLDER/toolset.json" -Raw
$tools = ConvertFrom-Json -InputObject $toolset | Select-Object -ExpandProperty toolcache
foreach($tool in $tools) {
Invoke-Expression "bash -c `"source $env:HELPER_SCRIPTS/document.sh; DocumentInstalledItem '$($tool.name):'`""
$toolPath = Join-Path $env:AGENT_TOOLSDIRECTORY $tool.name
# Get executables for current tool
@@ -85,8 +84,5 @@ foreach($tool in $tools) {
$pypyVersion = & "$foundVersionPath/bin/python" -c "import sys;print(sys.version.split('\n')[1])"
$foundVersionName = "{0} {1}" -f $foundVersionName, $pypyVersion
}
# Add tool version to documentation
Invoke-Expression "bash -c `"source $env:HELPER_SCRIPTS/document.sh; DocumentInstalledItemIndent '$($tool.name) $foundVersionName'`""
}
}

View File

@@ -4,8 +4,6 @@
## Desc: Installs Alibaba Cloud CLI
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
# Install Alibaba Cloud CLI
URL=$(curl -s https://api.github.com/repos/aliyun/aliyun-cli/releases/latest | jq -r '.assets[].browser_download_url | select(contains("aliyun-cli-linux"))')
@@ -19,8 +17,3 @@ if ! command -v aliyun ; then
echo "aliyun was not installed"
exit 1
fi
# Document what was added to the image
aliyun_version="$(aliyun version)"
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "Alibaba Cloud CLI ($aliyun_version)"

View File

@@ -7,7 +7,6 @@
set -e
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
source $HELPER_SCRIPTS/os.sh
# Set env variable for SDK Root (https://developer.android.com/studio/command-line/variables)
@@ -62,34 +61,3 @@ buildtools_versions_list=$(echo "$buildtools"|awk -F';' '{print $2}')
# Add required permissions
chmod -R a+rwx ${ANDROID_SDK_ROOT}
echo "Lastly, document what was added to the metadata file"
DocumentInstalledItem "Google Repository $(cat ${ANDROID_SDK_ROOT}/extras/google/m2repository/source.properties 2>&1 | grep Pkg.Revision | cut -d '=' -f 2)"
DocumentInstalledItem "Google Play services $(cat ${ANDROID_SDK_ROOT}/extras/google/google_play_services/source.properties 2>&1 | grep Pkg.Revision | cut -d '=' -f 2)"
for version in $google_api_versions_list; do
DocumentInstalledItem "Google APIs $version"
done
DocumentInstalledItem "CMake $(ls ${ANDROID_SDK_ROOT}/cmake 2>&1)"
for version in $constraint_layout_versions_list; do
DocumentInstalledItem "Android ConstraintLayout $version"
done
for version in $constraint_layout_solver_versions_list; do
DocumentInstalledItem "Android ConstraintLayout Solver $version"
done
DocumentInstalledItem "Android SDK Platform-Tools $(cat ${ANDROID_SDK_ROOT}/platform-tools/source.properties 2>&1 | grep Pkg.Revision | cut -d '=' -f 2)"
for version in $platform_versions_list; do
DocumentInstalledItem "Android SDK Platform $version"
done
DocumentInstalledItem "Android SDK Patch Applier v4"
for version in $buildtools_versions_list; do
DocumentInstalledItem "Android SDK Build-Tools $version"
done
DocumentInstalledItem "Android NDK $(cat ${ANDROID_SDK_ROOT}/ndk-bundle/source.properties 2>&1 | grep Pkg.Revision | cut -d ' ' -f 3)"

View File

@@ -5,7 +5,6 @@
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
source $HELPER_SCRIPTS/os.sh
# ppa:ansible/ansible doesn't contain packages for Ubuntu20.04
@@ -23,7 +22,3 @@ if ! command -v ansible; then
echo "Ansible was not installed or found on PATH"
exit 1
fi
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "Ansible ($(ansible --version |& head -n 1))"

View File

@@ -5,8 +5,6 @@
## Requires Python >=3.6, must be run as non-root user after toolset installation
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
# Download latest aws sam cli sources
TarballUrl=$(curl -s https://api.github.com/repos/aws/aws-sam-cli/releases/latest | jq -r '.tarball_url')
@@ -31,7 +29,3 @@ if ! sam --version; then
echo "AWS SAM CLI was not installed"
exit 1
fi
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "AWS $(sam --version)"

View File

@@ -4,8 +4,6 @@
## Desc: Installs the AWS CLI
################################################################################
# Source the helpers
source $HELPER_SCRIPTS/document.sh
source $HELPER_SCRIPTS/os.sh
# Install the AWS CLI v1 on Ubuntu16 and Ubuntu18, and AWS CLI v2 on Ubuntu20
@@ -41,8 +39,3 @@ if ! [[ $sessionPlugin == *"was installed successfully"* ]]
then
exit 1
fi
# Document the installed version
echo "Document the installed version"
DocumentInstalledItem "AWS CLI ($(aws --version 2>&1))"
DocumentInstalledItem "AWS CLI Session manager plugin ($(session-manager-plugin --version 2>&1))"

View File

@@ -4,8 +4,6 @@
## Desc: Installs AzCopy
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
# Install AzCopy7
wget -O azcopy.tar.gz https://aka.ms/downloadazcopylinux64
@@ -17,6 +15,7 @@ rm azcopy.tar.gz
wget -O /tmp/azcopy.tar.gz https://aka.ms/downloadazcopy-v10-linux
tar zxvf /tmp/azcopy.tar.gz --strip-components=1 -C /tmp
mv /tmp/azcopy /usr/local/bin/azcopy10
chmod +x /usr/local/bin/azcopy10
# Run tests to determine that the software installed as expected
echo "Testing to make sure that script performed as expected, and basic scenarios work"
@@ -29,10 +28,3 @@ if ! command -v azcopy10; then
echo "azcopy10 was not installed"
exit 1
fi
# Document what was added to the image
azcopy7Version=$(azcopy --version | awk '{print $2}' | cut -d '-' -f 1)
azcopy10Version=$(azcopy10 --version | awk '{print $3}')
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "AzCopy7 (available by azcopy alias) $azcopy7Version"
DocumentInstalledItem "AzCopy10 (available by azcopy10 alias) $azcopy10Version"

View File

@@ -5,7 +5,6 @@
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
source $HELPER_SCRIPTS/os.sh
# List of versions
@@ -36,9 +35,3 @@ for version in ${versions[@]}; do
exit 1
fi
done
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
for version in ${versions[@]}; do
DocumentInstalledItem "Az Module ($version)"
done

View File

@@ -4,8 +4,6 @@
## Desc: Installed Azure CLI (az)
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
# Install Azure CLI (instructions taken from https://docs.microsoft.com/en-us/cli/azure/install-azure-cli)
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
@@ -16,6 +14,3 @@ if ! command -v az; then
echo "azure-cli was not installed"
exit 1
fi
# Document what was added to the image
DocumentInstalledItem "Azure CLI ($(az -v | head -n 1))"

View File

@@ -4,8 +4,6 @@
## Desc: Installed Azure DevOps CLI (az devops)
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
# AZURE_EXTENSION_DIR shell variable defines where modules are installed
# https://docs.microsoft.com/en-us/cli/azure/azure-cli-extensions-overview
@@ -23,6 +21,3 @@ else
echo "azure DevOps Cli extension was not installed"
exit 1
fi
# Document what was added to the image
DocumentInstalledItem "Azure CLI ($(az -v | grep azure-devops))"

View File

@@ -5,8 +5,6 @@
################################################################################
set -e
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
toolset="$INSTALLER_SCRIPT_FOLDER/toolset.json"
common_packages=$(jq -r ".apt.common_packages[]" $toolset)
@@ -24,10 +22,3 @@ for cmd in $cmd_packages; do
exit 1
fi
done
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "Basic packages:"
for package in $common_packages $cmd_packages; do
DocumentInstalledItemIndent $package
done

View File

@@ -4,8 +4,6 @@
## Desc: Installs Bazel and Bazelisk (A user-friendly launcher for Bazel)
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
# Install bazel
curl https://bazel.build/bazel-release.pub.gpg | sudo apt-key add -
@@ -27,10 +25,3 @@ if ! command -v bazelisk; then
echo "Bazelisk was not installed"
exit 1
fi
# Document what was added to the image
bazelisk_version="$(bazelisk version 2>null | grep "Bazelisk version:" | cut -d "v" -f 3)"
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "Bazel ($(bazel --version))"
DocumentInstalledItem "Bazelisk ($bazelisk_version)"

View File

@@ -4,8 +4,7 @@
## Desc: Installs build-essential package
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
source $HELPER_SCRIPTS/install.sh
PACKAGE=build-essential
@@ -18,7 +17,3 @@ if ! IsPackageInstalled $PACKAGE; then
else
echo "$PACKAGE is already installed"
fi
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "$PACKAGE"

View File

@@ -1,17 +1,18 @@
#!/bin/bash
################################################################################
## File: clang.sh
## Desc: Installs Clang compiler (versions: 6, 8 and 9)
## Desc: Installs Clang compiler
################################################################################
set -e
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
source $HELPER_SCRIPTS/os.sh
function InstallClang {
version=$1
local version=$1
echo "Installing clang-$version..."
if [[ $version =~ 9 ]]; then
if [[ $version =~ (9|10) ]]; then
./llvm.sh $version
apt-get install -y "clang-format-$version"
else
@@ -26,30 +27,34 @@ function InstallClang {
exit 1
fi
done
}
# Document what was added to the image
echo "Documenting clang-$version..."
DocumentInstalledItem "Clang $version ($(clang-$version --version | head -n 1 | cut -d ' ' -f 3 | cut -d '-' -f 1))"
function SetDefaultClang {
local version=$1
echo "Make Clang ${version} default"
update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-${version} 100
update-alternatives --install /usr/bin/clang clang /usr/bin/clang-${version} 100
update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-${version} 100
}
# Download script for automatic installation
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
versions=(
"6.0"
"8"
"9"
)
if isUbuntu16 || isUbuntu18; then
versions=( "6.0" "8" "9" )
default_clang_version="9"
fi
for version in ${versions[*]}
do
if isUbuntu20 ; then
versions=( "8" "9" "10" )
default_clang_version="10"
fi
for version in ${versions[*]}; do
InstallClang $version
done
SetDefaultClang $default_clang_version
rm llvm.sh
# Make Clang 9 default
update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-9 100
update-alternatives --install /usr/bin/clang clang /usr/bin/clang-9 100
update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-9 100

View File

@@ -4,8 +4,6 @@
## Desc: Installs CMake
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
# Test to see if the software in question is already installed, if not install it
echo "Checking to see if the installer script has already been run"
@@ -24,7 +22,3 @@ if ! command -v cmake; then
echo "cmake was not installed"
exit 1
fi
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "CMake ($(cmake --version | head -n 1))"

View File

@@ -4,7 +4,6 @@
## Desc: Installs container tools: podman, buildah and skopeo onto the image
################################################################################
source $HELPER_SCRIPTS/document.sh
source /etc/os-release
sh -c "echo 'deb http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/x${NAME}_${VERSION_ID}/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list"
@@ -14,12 +13,3 @@ apt-get update -qq
apt-get -qq -y install podman buildah skopeo
mkdir -p /etc/containers
echo -e "[registries.search]\nregistries = ['docker.io', 'quay.io']" | tee /etc/containers/registries.conf
## Add version information to the metadata file
echo "Documenting container tools version"
PODMAN_VERSION="$(podman --version | cut -d " " -f 3)"
BUILDAH_VERSION="$(buildah --version | cut -d " " -f 3)"
SKOPEO_VERSION="$(skopeo --version | cut -d " " -f 3)"
DocumentInstalledItem "Podman ($PODMAN_VERSION)"
DocumentInstalledItem "Buildah ($BUILDAH_VERSION)"
DocumentInstalledItem "Skopeo ($SKOPEO_VERSION)"

View File

@@ -4,7 +4,6 @@
## Desc: Installs Docker Compose
################################################################################
source $HELPER_SCRIPTS/document.sh
URL=$(curl -s https://api.github.com/repos/docker/compose/releases/latest | jq -r '.assets[].browser_download_url | select(contains("docker-compose-Linux-x86_64"))' | head -1)
@@ -18,8 +17,3 @@ if ! command -v docker-compose; then
echo "docker-compose was not installed"
exit 1
fi
## Add version information to the metadata file
echo "Documenting Docker Compose version"
docker_compose_version=$(docker-compose -v)
DocumentInstalledItem "Docker Compose (${docker_compose_version})"

View File

@@ -6,7 +6,6 @@
set -e
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
source $HELPER_SCRIPTS/install.sh
source $HELPER_SCRIPTS/os.sh
@@ -54,18 +53,3 @@ images=$(jq -r '.docker.images[]' $toolset)
for image in $images; do
docker pull "$image"
done
# Add version information to the metadata file
echo "Documenting Docker version"
docker_version=$(docker -v)
DocumentInstalledItem "Docker-Moby ($docker_version)"
echo "Documenting Docker-buildx version"
DOCKER_BUILDX_VERSION=$(docker buildx version | cut -d ' ' -f2)
DocumentInstalledItem "Docker-Buildx ($DOCKER_BUILDX_VERSION)"
# Add container information to the metadata file
DocumentInstalledItem "Cached container images"
while read -r line; do
DocumentInstalledItemIndent "$line"
done <<< "$(docker images --digests --format '{{.Repository}}:{{.Tag}} (Digest: {{.Digest}})')"

View File

@@ -5,7 +5,6 @@
################################################################################
source $HELPER_SCRIPTS/etc-environment.sh
source $HELPER_SCRIPTS/document.sh
source $HELPER_SCRIPTS/install.sh
source $HELPER_SCRIPTS/os.sh
@@ -84,7 +83,6 @@ for tarball in *.tar.gz; do
done
rm urls
DocumentInstalledItem ".NET Core SDK:"
# Smoke test each SDK
for sdk in $sortedSdks; do
mksamples "$sdk" "console"
@@ -93,7 +91,6 @@ for sdk in $sortedSdks; do
mksamples "$sdk" "web"
mksamples "$sdk" "mvc"
mksamples "$sdk" "webapi"
DocumentInstalledItemIndent "$sdk"
done
# NuGetFallbackFolder at /usr/share/dotnet/sdk/NuGetFallbackFolder is warmed up by smoke test

View File

@@ -4,8 +4,6 @@
## Desc: Installs erlang
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
source_list=/etc/apt/sources.list.d/eslerlang.list
@@ -29,10 +27,5 @@ for cmd in erl erlc rebar3; do
fi
done
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
erlang_version="$(erl -version 2>&1 | tr -d '\n' | tr -d '\r')"
DocumentInstalledItem "Erlang ($erlang_version)"
# Clean up source list
rm $source_list

View File

@@ -5,8 +5,6 @@
## installer to the image
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
# Test to see if the software in question is already installed, if not install it
echo "Checking to see if the installer script has already been run"
@@ -24,7 +22,3 @@ if [ -z $EXAMPLE_VAR ]; then
else
echo "EXAMPLE_VAR was set properly"
fi
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "Example Var ($EXAMPLE_VAR)"

View File

@@ -4,8 +4,6 @@
## Desc: Installs Firefox
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
# Install Firefox
apt-get install -y firefox
@@ -20,13 +18,6 @@ fi
# Default firefox local is en_GB
echo 'pref("intl.locale.requested","en_US");' >> "/usr/lib/firefox/browser/defaults/preferences/syspref.js"
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
# Resolves: Running Firefox as root in a regular user's session is not supported.
# ($HOME is /home/packer which is owned by packer.)
HOME=/root
DocumentInstalledItem "Firefox ($(firefox --version))"
# Download and unpack latest release of geckodriver
URL=$(curl -s https://api.github.com/repos/mozilla/geckodriver/releases/latest | jq -r '.assets[].browser_download_url | select(test("linux64.tar.gz$"))')
echo "Downloading geckodriver $URL"
@@ -50,7 +41,3 @@ if ! command -v geckodriver; then
echo "geckodriver was not installed"
exit 1
fi
echo "Lastly, documenting what we added to the metadata file"
ver=`geckodriver --version | head -1 |awk '{print $2}'`
DocumentInstalledItem "Geckodriver (${ver}); Gecko Driver is available via GECKOWEBDRIVER environment variable"

View File

@@ -4,8 +4,6 @@
## Desc: Installs GNU C++
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
function InstallGcc {
version=$1
@@ -19,10 +17,6 @@ function InstallGcc {
echo "$version was not installed"
exit 1
fi
# Document what was added to the image
echo "Documenting $version..."
DocumentInstalledItem "GNU C++ $($version --version | head -n 1 | cut -d ' ' -f 4)"
}
# Install GNU C++ compiler

View File

@@ -4,8 +4,6 @@
## Desc: Installs GNU Fortran
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
function InstallFortran {
version=$1
@@ -19,10 +17,6 @@ function InstallFortran {
echo "$version was not installed"
exit 1
fi
# Document what was added to the image
echo "Documenting $version..."
DocumentInstalledItem "GNU Fortran $($version --version | head -n 1 | cut -d ' ' -f 5)"
}
# Install GNU Fortran compiler

View File

@@ -6,7 +6,6 @@
set -e
# Source the helpers for use with the script
source "$HELPER_SCRIPTS"/document.sh
source "$HELPER_SCRIPTS"/install.sh
## Install git
@@ -39,14 +38,6 @@ if ! command -v git-ftp; then
exit 1
fi
# Document what was added to the image
echo "Lastly, document the installed versions"
# git version 2.20.1
DocumentInstalledItem "Git ($(git --version 2>&1 | cut -d ' ' -f 3))"
# git-lfs/2.6.1 (GitHub; linux amd64; go 1.11.1)
DocumentInstalledItem "Git Large File Storage (LFS) ($(git-lfs --version 2>&1 | cut -d ' ' -f 1 | cut -d '/' -f 2))"
DocumentInstalledItem "Git-ftp ($(git-ftp --version | cut -d ' ' -f 3))"
#Install hub
tmp_hub="/tmp/hub"
mkdir -p "$tmp_hub"
@@ -57,7 +48,6 @@ mv "$tmp_hub"/bin/hub /usr/local/bin
if command -v hub; then
echo "hub CLI was installed successfully"
DocumentInstalledItem "Hub CLI ($(hub --version | grep "hub version" | cut -d ' ' -f 3))"
else
echo "[!] Hub CLI was not installed"
exit 1

View File

@@ -5,8 +5,6 @@
## Must be run as non-root user after homebrew
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
# Install GitHub CLI
url=$(curl -s https://api.github.com/repos/cli/cli/releases/latest | jq -r '.assets[].browser_download_url|select(contains("linux") and contains("amd64") and contains(".deb"))')
@@ -20,7 +18,3 @@ if ! gh --version; then
echo "GitHub CLI was not installed"
exit 1
fi
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "GitHub CLI $(gh --version|awk 'FNR==1 {print $3}')"

View File

@@ -4,8 +4,6 @@
## Desc: Installs google-chrome and chromedriver
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
LSB_RELEASE=$(lsb_release -rs)
@@ -22,10 +20,6 @@ if ! command -v google-chrome; then
exit 1
fi
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "Google Chrome ($(google-chrome --version))"
CHROME_VERSION=$(google-chrome --product-version)
CHROME_VERSION=${CHROME_VERSION%.*}
@@ -54,6 +48,3 @@ if ! command -v chromedriver; then
echo "chromedriver was not installed"
exit 1
fi
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "$(chromedriver --version); Chrome Driver is available via CHROMEWEBDRIVER environment variable"

View File

@@ -4,8 +4,6 @@
## Desc: Installs the Google Cloud SDK
################################################################################
# Source the helpers
source $HELPER_SCRIPTS/document.sh
# Install the Google Cloud SDK
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] http://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
@@ -19,7 +17,3 @@ if ! command -v gcloud; then
echo "gcloud was not installed"
exit 1
fi
# Document the installed version
echo "Document the installed version"
DocumentInstalledItem "Google Cloud SDK ($(gcloud --version | head -n 1 | cut -d ' ' -f 4))"

View File

@@ -6,7 +6,6 @@
# Source the helpers for use with the script
source $HELPER_SCRIPTS/etc-environment.sh
source $HELPER_SCRIPTS/document.sh
# Install Herbert V. Riedel's PPA for managing multiple version of ghc on ubuntu.
# https://launchpad.net/~hvr/+archive/ubuntu/ghc
@@ -58,9 +57,3 @@ fi
# Create symlink for ghc and cabal in /usr/bin
ln -s "/opt/ghc/$defaultGHCVersion/bin/ghc" "/usr/bin/ghc"
ln -s "/opt/cabal/$cabalVersion/bin/cabal" "/usr/bin/cabal"
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "Haskell Cabal ($(cabal --version))"
DocumentInstalledItem "GHC ($(ghc --version))"
DocumentInstalledItem "Haskell Stack ($(stack --version))"

View File

@@ -4,8 +4,6 @@
## Desc: Installs Heroku CLI
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
# Install Heroku CLI
curl https://cli-assets.heroku.com/install-ubuntu.sh | sh
@@ -15,7 +13,3 @@ echo "Testing to make sure that script performed as expected, and basic scenario
if ! command -v heroku; then
exit 1
fi
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "Heroku ($(heroku version))"

View File

@@ -5,7 +5,6 @@
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
source $HELPER_SCRIPTS/install.sh
hhvm_package=hhvm
@@ -31,7 +30,3 @@ fi
if ! command -v hhvm; then
exit 1
fi
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "HHVM ($(hhvm --version | head -n 1))"

View File

@@ -6,7 +6,6 @@
################################################################################
# Source the helpers
source $HELPER_SCRIPTS/document.sh
source $HELPER_SCRIPTS/etc-environment.sh
# Install the Homebrew on Linux
@@ -31,7 +30,3 @@ if ! command -v brew; then
echo "brew was not installed"
exit 1
fi
# Document the installed version
echo "Document the installed version"
DocumentInstalledItem "Homebrew on Linux ($(brew -v 2>&1))"

View File

@@ -4,8 +4,6 @@
## Desc: Downloads and installs hosted tools cache
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
# Fail out if any setups fail
set -e
@@ -43,9 +41,3 @@ for PACKAGE_NAME in ${PACKAGE_LIST[@]}; do
done;
popd
DocumentInstalledItem "Ruby:"
rubys=$(ls $AGENT_TOOLSDIRECTORY/Ruby)
for ruby in $rubys; do
DocumentInstalledItemIndent "Ruby $ruby"
done;

View File

@@ -4,8 +4,6 @@
## Desc: Installs ImageMagick
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
# Install ImageMagick
apt-get install -y --no-install-recommends --fix-missing \
@@ -13,7 +11,3 @@ apt-get install -y --no-install-recommends --fix-missing \
libmagickcore-dev \
libmagickwand-dev \
libmagic-dev
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "ImageMagick"

View File

@@ -4,8 +4,6 @@
## Desc: Installs Java and related tooling (Ant, Gradle, Maven)
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
source $HELPER_SCRIPTS/os.sh
set -e
@@ -103,19 +101,3 @@ javaVersion=$(java -version |& head -n 1 | cut -d\" -f 2)
javaTool "Java" $javaVersion
javacVersion=$(javac -version |& cut -d" " -f2)
javaTool "Javac" $javacVersion
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
if isUbuntu16 || isUbuntu18 ; then
DocumentInstalledItem "Azul Zulu OpenJDK:"
DocumentInstalledItemIndent "7 ($(/usr/lib/jvm/zulu-7-azure-amd64/bin/java -showversion |& head -n 1))"
fi
DocumentInstalledItem "Adopt OpenJDK:"
DocumentInstalledItemIndent "8 ($(/usr/lib/jvm/adoptopenjdk-8-hotspot-amd64/bin/java -showversion |& head -n 1)) $defaultLabel8"
DocumentInstalledItemIndent "11 ($(/usr/lib/jvm/adoptopenjdk-11-hotspot-amd64/bin/java -showversion |& head -n 1)) $defaultLabel11"
if isUbuntu16 || isUbuntu18 ; then
DocumentInstalledItemIndent "12 ($(/usr/lib/jvm/adoptopenjdk-12-hotspot-amd64/bin/java -showversion |& head -n 1))"
fi
DocumentInstalledItem "Ant ($(ant -version))"
DocumentInstalledItem "Gradle ${gradleVersion}"
DocumentInstalledItem "Maven ($(mvn -version | head -n 1))"

View File

@@ -4,8 +4,6 @@
## Desc: Installs Julia, and adds Julia to the path
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
# This function fetches the latest Julia release from the GitHub API
# Based on https://gist.github.com/lukechilds/a83e1d7127b78fef38c2914c4ececc3c
@@ -54,10 +52,6 @@ function InstallJulia () {
echo "Julia was not installed correctly"
exit 1
fi
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "Julia ($(julia --version))"
}
InstallJulia "$(GetLatestJuliaRelease)" true

View File

@@ -4,8 +4,6 @@
## Desc: Installs kind
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
# Install KIND
URL=$(curl -s https://api.github.com/repos/kubernetes-sigs/kind/releases/latest | jq -r '.assets[].browser_download_url | select(contains("kind-linux-amd64"))')
@@ -18,7 +16,3 @@ if ! command -v kind; then
echo "Kind was not installed or found on PATH"
exit 1
fi
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "Kind ($(kind version))"

View File

@@ -4,8 +4,6 @@
## Desc: Installs kubectl, helm, kustomize
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
## Install kubectl
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
@@ -52,12 +50,3 @@ if ! command -v kustomize; then
echo "kustomize was not installed"
exit 1
fi
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "kubectl ($(kubectl version --client --short |& head -n 1))"
DocumentInstalledItem "helm ($(helm version --short |& head -n 1))"
# minikube version output already has word minikube in it. example minikube version: v1.9.2
DocumentInstalledItem "$(minikube version --short)"
# kustomize version output has "{} in it". example {kustomize/v3.8.1 2020-07-16T00:58:46Z }
DocumentInstalledItem "kustomize ($(kustomize version --short))"

View File

@@ -4,8 +4,6 @@
## Desc: Installs Leiningen
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
set -e
@@ -29,7 +27,3 @@ if ! command -v lein; then
else
lein new app testapp && rm -rf testapp
fi
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "Leiningen ($(lein -v))"

View File

@@ -5,7 +5,6 @@
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
source $HELPER_SCRIPTS/os.sh
if isUbuntu16 ; then
@@ -22,7 +21,3 @@ echo "Testing to make sure that script performed as expected, and basic scenario
if ! command -v hg; then
exit 1
fi
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "Mercurial ($(hg --version | head -n 1))"

View File

@@ -4,8 +4,6 @@
## Desc: Installs miniconda
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
# Install Miniconda
curl -sL https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -o miniconda.sh \
@@ -17,7 +15,3 @@ CONDA=/usr/share/miniconda
echo "CONDA=$CONDA" | tee -a /etc/environment
ln -s $CONDA/bin/conda /usr/bin/conda
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "Miniconda ($($CONDA/bin/conda --version))"

View File

@@ -6,7 +6,6 @@
# Source the helpers
source $HELPER_SCRIPTS/os.sh
source $HELPER_SCRIPTS/document.sh
# Install Mongo DB
wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add -
@@ -21,7 +20,3 @@ if ! command -v mongod; then
echo "mongodb was not installed"
exit 1
fi
# Document the installed version
echo "Document the installed version"
DocumentInstalledItem "MongoDB on Linux $(mongod --version | awk 'NR==1{print $3}')"

View File

@@ -4,8 +4,6 @@
## Desc: Installs Mono
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
LSB_CODENAME=$(lsb_release -cs)
@@ -27,8 +25,3 @@ if ! command -v nuget; then
echo "nuget was not installed"
exit 1
fi
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "Mono ($(mono --version | head -n 1))"
DocumentInstalledItem "NuGet ($(nuget | tail -n +1 | head -n 1))" # Pipe to tail before piping to head because NuGet prints an ugly error if you close its stream before it's done writing.

View File

@@ -4,8 +4,6 @@
## Desc: Installs MySQL Client
################################################################################
## Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
export ACCEPT_EULA=Y
@@ -51,13 +49,6 @@ mysql -vvv -e 'CREATE DATABASE smoke_test' -uroot -proot
mysql -vvv -e 'DROP DATABASE smoke_test' -uroot -proot
set +e
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "MySQL ($(mysql --version))"
DocumentInstalledItem "MySQL Server (user:root password:root)"
DocumentInstalledItem "MS SQL Server Client Tools"
DocumentInstalledItem "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'"
# Disable mysql.service
systemctl is-active --quiet mysql.service && systemctl stop mysql.service
systemctl disable mysql.service

View File

@@ -4,8 +4,6 @@
## Desc: Installs the Netlify CLI
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
# Install the Netlify CLI
npm i -g netlify-cli
@@ -16,7 +14,3 @@ if ! command -v netlify; then
echo "Netlify CLI was not installed"
exit 1
fi
# Document the installed version
echo "Document the installed version"
DocumentInstalledItem "Netlify CLI ($(netlify --version))"

View File

@@ -4,8 +4,6 @@
## Desc: Installs Node.js LTS and related tooling (Gulp, Grunt)
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
# Install LTS Node.js and related build tools
curl -sL https://raw.githubusercontent.com/mklement0/n-install/stable/bin/n-install | bash -s -- -ny -
@@ -31,16 +29,3 @@ for cmd in node grunt gulp webpack parcel yarn newman; do
exit 1
fi
done
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "Node.js ($(node --version))"
DocumentInstalledItem "Grunt ($(grunt --version))"
DocumentInstalledItem "Gulp ($(gulp --version))"
DocumentInstalledItem "n ($(n --version))"
DocumentInstalledItem "Parcel ($(parcel --version))"
DocumentInstalledItem "TypeScript ($(tsc --version))"
DocumentInstalledItem "Webpack ($(webpack --version))"
DocumentInstalledItem "Webpack CLI ($(webpack-cli --version))"
DocumentInstalledItem "Yarn ($(yarn --version))"
DocumentInstalledItem "Newman ($(newman --version))"

View File

@@ -4,8 +4,6 @@
## Desc: Installs Nvm
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
export NVM_DIR="/etc/skel/.nvm"
mkdir $NVM_DIR
@@ -21,5 +19,3 @@ fi
# set system node.js as default one
nvm alias default system
DocumentInstalledItem "nvm ($(nvm --version))"

View File

@@ -4,8 +4,7 @@
## Desc: Installs the OC CLI
################################################################################
# Source the helpers
source $HELPER_SCRIPTS/document.sh
# Install the oc CLI
curl "https://mirror.openshift.com/pub/openshift-v4/clients/oc/latest/linux/oc.tar.gz" > oc.tar.gz
tar xvzf oc.tar.gz
@@ -18,7 +17,3 @@ if ! command -v oc; then
echo "oc was not installed"
exit 1
fi
# Document the installed version
echo "Document the installed version"
DocumentInstalledItem "oc CLI $(oc version)"

View File

@@ -4,8 +4,6 @@
## Desc: Installs ORAS CLI
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
source $HELPER_SCRIPTS/install.sh
# Determine latest ORAS CLI version
@@ -24,7 +22,3 @@ if ! oras version; then
echo "ORAS CLI was not installed"
exit 1
fi
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "ORAS CLI $(oras version | awk 'NR==1{print $2}')"

View File

@@ -3,8 +3,7 @@
## File: packer.sh
## Desc: Installs packer
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
# Install Packer
PACKER_VERSION=$(curl -s https://checkpoint-api.hashicorp.com/v1/check/packer | jq -r .current_version)
@@ -18,7 +17,3 @@ if ! command -v packer; then
echo "Packer was not installed or found on PATH"
exit 1
fi
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "Packer ($(packer --version))"

View File

@@ -6,9 +6,6 @@
set -e
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
# Install PhantomJS
apt-get install -y chrpath libssl-dev libxft-dev libfreetype6 libfreetype6-dev libfontconfig1 libfontconfig1-dev
PHANTOM_JS=phantomjs-2.1.1-linux-x86_64
@@ -23,7 +20,3 @@ if ! command -v phantomjs; then
echo "phantomjs was not installed"
exit 1
fi
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "PhantomJS ($(phantomjs --version))"

View File

@@ -6,7 +6,6 @@
# Source the helpers for use with the script
source $HELPER_SCRIPTS/etc-environment.sh
source $HELPER_SCRIPTS/document.sh
source $HELPER_SCRIPTS/os.sh
set -e
@@ -127,24 +126,9 @@ for cmd in php $php_versions composer phpunit; do
fi
done
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
for version in $php_versions; do
DocumentInstalledItem "PHP $version ($(php$version --version | head -n 1))"
done
# ubuntu 20.04 libzip-dev is libzip5 based and is not compatible libzip-dev of ppa:ondrej/php
# see https://github.com/actions/virtual-environments/issues/1084
if isUbuntu20 ; then
rm /etc/apt/sources.list.d/ondrej-ubuntu-php-focal.list
apt-get update
AddBlockquote "To use ppa:ondrej/php APT repository On Ubuntu 20.04 it is necessary to add it to the APT sources"
StartCode
WriteItem "apt-add-repository ppa:ondrej/php -y"
WriteItem "apt-get update"
EndCode
fi
DocumentInstalledItem "Composer ($(composer --version))"
DocumentInstalledItem "PHPUnit ($(phpunit --version))"

View File

@@ -4,8 +4,6 @@
## Desc: Installs Pollinate
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
# Install Pollinate
apt-get install -y --no-install-recommends pollinate
@@ -16,7 +14,3 @@ if ! command -v pollinate; then
echo "pollinate was not installed"
exit 1
fi
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "Pollinate"

View File

@@ -4,8 +4,6 @@
## Desc: Installs Postgresql
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
#Preparing repo for PostgreSQL 12.
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
@@ -25,8 +23,6 @@ apt-get install libpq-dev
# connection timeout - 2
pg_isready
DocumentInstalledItem "$(psql -V 2>&1 | cut -d ' ' -f 1,2,3)"
# Disable postgresql.service
systemctl is-active --quiet postgresql.service && systemctl stop postgresql.service
systemctl disable postgresql.service

View File

@@ -5,7 +5,6 @@
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
source $HELPER_SCRIPTS/os.sh
# Install Powershell
@@ -27,7 +26,3 @@ if ! pwsh -c 'Write-Host Hello world'; then
echo "pwsh failed to run"
exit 1
fi
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "Powershell ($(pwsh --version))"

View File

@@ -1,20 +0,0 @@
#!/bin/bash
################################################################################
## File: preparemetadata.sh
## Desc: This script adds a image title information to the metadata
## document
################################################################################
source $HELPER_SCRIPTS/document.sh
WriteItem "<!--- DO NOT EDIT - This markdown file is autogenerated. -->"
if [ -n "$ANNOUNCEMENTS" ]; then
WriteItem "$ANNOUNCEMENTS"
WriteItem "***"
fi
AddTitle "$(lsb_release -ds)"
WriteItem "The following software is installed on machines with the $IMAGE_VERSION update."
WriteItem "***"

View File

@@ -5,7 +5,6 @@
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
source $HELPER_SCRIPTS/install.sh
# Install Pulumi
@@ -20,7 +19,3 @@ if ! command -v pulumi ; then
echo "Pulumi was not installed"
exit 1
fi
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "Pulumi $(pulumi version)"

View File

@@ -4,8 +4,6 @@
## Desc: Installs PyPy
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
source $HELPER_SCRIPTS/install.sh
# This function installs PyPy using the specified arguments:

View File

@@ -5,7 +5,6 @@
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
source $HELPER_SCRIPTS/os.sh
# Install Python, Python 3, pip, pip3
@@ -28,10 +27,3 @@ for cmd in python pip python3 pip3; do
exit 1
fi
done
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "Python ($(python --version 2>&1))"
DocumentInstalledItem "pip ($(pip --version))"
DocumentInstalledItem "Python3 ($(python3 --version))"
DocumentInstalledItem "pip3 ($(pip3 --version))"

View File

@@ -1,7 +1,6 @@
#!/bin/bash
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
source $HELPER_SCRIPTS/os.sh
# install R
@@ -13,5 +12,3 @@ sudo add-apt-repository "deb https://cloud.r-project.org/bin/linux/ubuntu $osLab
sudo apt update
sudo apt install r-base
version=$(R --version | grep "R version" | cut -d " " -f 3)
DocumentInstalledItem "R $version"

View File

@@ -4,8 +4,6 @@
## Desc: Install random number generator
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
# Install haveged
apt-get -y install haveged
@@ -18,7 +16,3 @@ for cmd in haveged; do
exit 1
fi
done
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "Haveged $(dpkg-query --showformat='${Version}' --show haveged)"

View File

@@ -4,16 +4,9 @@
## Desc: Installs Ruby requirements
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
sudo apt-get install ruby-full
sudo gem update --system
# Install Ruby requirements
apt-get install -y libz-dev openssl libssl-dev
DocumentInstalledItem "ruby ($(ruby --version 2>&1 | cut -d ' ' -f 2))"
DocumentInstalledItem "gem ($(gem -v 2>&1 | tail -n 1))"
DocumentInstalledItem "$(openssl version)"
DocumentInstalledItem "Libssl $(dpkg -l libssl-dev | grep '^ii' | awk '{print $3}')"

View File

@@ -6,7 +6,6 @@
# Source the helpers for use with the script
source $HELPER_SCRIPTS/etc-environment.sh
source $HELPER_SCRIPTS/document.sh
export RUSTUP_HOME=/usr/share/rust/.rustup
export CARGO_HOME=/usr/share/rust/.cargo
@@ -45,16 +44,3 @@ pushd /etc/skel
ln -sf $RUSTUP_HOME .rustup
ln -sf $CARGO_HOME .cargo
popd
# Document what was added to the image
echo "Lastly, document what was added to the metadata file"
DocumentInstalledItem "rustup ($(rustup --version 2>&1 | cut -d ' ' -f 2))"
DocumentInstalledItem "rust ($(rustc --version 2>&1 | cut -d ' ' -f 2))"
DocumentInstalledItem "cargo ($(cargo --version 2>&1 | cut -d ' ' -f 2))"
DocumentInstalledItem "rustfmt ($(rustfmt --version 2>&1 | cut -d ' ' -f 2))"
DocumentInstalledItem "clippy ($(cargo-clippy --version 2>&1 | cut -d ' ' -f 2))"
DocumentInstalledItem "rustdoc ($(rustdoc --version 2>&1 | cut -d ' ' -f 2))"
DocumentInstalledItem "bindgen ($(bindgen --version 2>&1 | cut -d ' ' -f 2))"
DocumentInstalledItem "cbindgen ($(cbindgen --version 2>&1 | cut -d ' ' -f 2))"
DocumentInstalledItem "cargo audit ($(cargo audit --version 2>&1 | cut -d ' ' -f 2))"
DocumentInstalledItem "cargo outdated ($(cargo outdated --version 2>&1 | cut -d ' ' -f 2))"

View File

@@ -4,8 +4,6 @@
## Desc: Installs sbt
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
# Install sbt
# https://www.scala-sbt.org/1.x/docs/Installing-sbt-on-Linux.html
@@ -13,7 +11,3 @@ echo "deb https://dl.bintray.com/sbt/debian /" | sudo tee -a /etc/apt/sources.li
curl -sL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2EE0EA64E40A89B84B2DF73499E82A75642AC823" | apt-key add
apt-get -q update
apt-get -y install sbt
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "sbt ($(sbt --script-version))"

View File

@@ -4,8 +4,6 @@
## Desc: Installs selenium server
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
# Determine latest selenium standalone server version
SELENIUM_LATEST_VERSION_URL=https://api.github.com/repos/SeleniumHQ/selenium/releases/latest
@@ -26,6 +24,3 @@ fi
SELENIUM_JAR_PATH="/usr/share/java/selenium-server-standalone.jar"
mv $SELENIUM_JAR_NAME $SELENIUM_JAR_PATH
echo "SELENIUM_JAR_PATH=$SELENIUM_JAR_PATH" | tee -a /etc/environment
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "Selenium server standalone (available via SELENIUM_JAR_PATH environment variable)"

View File

@@ -4,12 +4,6 @@
## Desc: Installs Sphinx
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
# Install Sphinx
apt-get install -y sphinxsearch
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "Sphinx Open Source Search Server"

View File

@@ -4,8 +4,6 @@
## Desc: Installs Subversion client
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
# Install Subversion
apt-get install -y --no-install-recommends subversion
@@ -16,7 +14,3 @@ if ! command -v svn; then
echo "Subversion (svn) was not installed"
exit 1
fi
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "Subversion ($(svn --version | head -n 1))"

View File

@@ -4,8 +4,6 @@
## Desc: Installs Swift
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
# Install
image_label="$(lsb_release -rs)"
@@ -26,7 +24,3 @@ if ! command -v swift; then
echo "Swift was not installed"
exit 1
fi
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "$(swift --version)"

View File

@@ -1,7 +1,5 @@
#!/bin/bash
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
# Install Swig
sudo apt-get install -y swig
@@ -12,7 +10,3 @@ if ! command -v swig; then
echo "Swig was not installed"
exit 1
fi
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "Swig $(swig -version | sed -n 2p | cut -d ' ' -f 3)"

View File

@@ -4,8 +4,6 @@
## Desc: Installs terraform
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
# Install Terraform
TERRAFORM_VERSION=$(curl -s https://checkpoint-api.hashicorp.com/v1/check/terraform | jq -r .current_version)
@@ -19,7 +17,3 @@ if ! command -v terraform; then
echo "Terraform was not installed or found on PATH"
exit 1
fi
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "Terraform ($(terraform --version))"

View File

@@ -5,7 +5,6 @@
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
source $HELPER_SCRIPTS/os.sh
# Set env variable for vcpkg
@@ -36,7 +35,3 @@ if ! command -v vcpkg; then
echo "vcpkg was not installed"
exit 1
fi
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "Vcpkg $(vcpkg version | head -n 1 | cut -d ' ' -f 6)"

View File

@@ -4,9 +4,6 @@
## Desc: Installs the Vercel CLI
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
# Install the Vercel CLI
npm i -g vercel
@@ -25,7 +22,3 @@ if ! command -v now; then
echo "[Now] symlink to Vercel CLI was not created"
exit 1
fi
# Document the installed version
echo "Document the installed version"
DocumentInstalledItem "Vercel CLI ($(vercel --version))"