mirror of
https://github.com/actions/runner-images-sangeeth.git
synced 2025-12-18 15:56:47 +00:00
[Windows] Add Apache and Nginx (#2517)
* [Windows] Add Apache and Nginx (#2501) * Remove dot-sourcing in web-server tests * Fix web servers readme generation
This commit is contained in:
@@ -7,6 +7,7 @@ Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Databases.psm1") -Disable
|
||||
Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Helpers.psm1") -DisableNameChecking
|
||||
Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Tools.psm1") -DisableNameChecking
|
||||
Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Java.psm1") -DisableNameChecking
|
||||
Import-Module (Join-Path $PSScriptRoot "SoftwareReport.WebServers.psm1") -DisableNameChecking
|
||||
Import-Module (Join-Path $PSScriptRoot "SoftwareReport.VisualStudio.psm1") -DisableNameChecking
|
||||
|
||||
$markdown = ""
|
||||
@@ -195,6 +196,8 @@ $markdown += New-MDList -Style Unordered -Lines (@(
|
||||
)
|
||||
$markdown += New-MDNewLine
|
||||
|
||||
$markdown += Build-WebServersSection
|
||||
|
||||
$vs = Get-VisualStudioVersion
|
||||
$markdown += New-MDHeader "$($vs.Name)" -Level 3
|
||||
$markdown += $vs | New-MDTable
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
function Get-ApachePath {
|
||||
return Join-Path "C:\tools\" (Get-Item C:\tools\apache*).Name
|
||||
}
|
||||
|
||||
function Get-NginxPath {
|
||||
return Join-Path "C:\tools\" (Get-Item C:\tools\nginx*).Name
|
||||
}
|
||||
|
||||
function Get-ApacheVersion {
|
||||
$apacheBinPath = Join-Path (Get-ApachePath) "\bin\httpd"
|
||||
(. $apacheBinPath -V | Select-String -Pattern "Apache/") -match "Apache/(?<version>\d+\.\d+\.\d+)" | Out-Null
|
||||
return $Matches.Version
|
||||
}
|
||||
|
||||
function Get-NginxVersion {
|
||||
$nginxBinPath = Join-Path (Get-NginxPath) "\nginx"
|
||||
(. $nginxBinPath -v 2>&1 | Select-String -Pattern "nginx/") -match "nginx/(?<version>\d+\.\d+\.\d+)" | Out-Null
|
||||
return $Matches.Version
|
||||
}
|
||||
|
||||
function Get-ApacheMarkdown
|
||||
{
|
||||
$name = "Apache"
|
||||
$apachePort = "80"
|
||||
$apacheService = Get-Service -Name $name
|
||||
$apacheVersion = Get-ApacheVersion
|
||||
$apacheConfigFile = Join-Path (Get-ApachePath) "\conf\httpd.conf"
|
||||
return [PSCustomObject]@{
|
||||
Name = $name
|
||||
Version = $apacheVersion
|
||||
ConfigFile = $apacheConfigFile
|
||||
ServiceName = $apacheService.Name
|
||||
ServiceStatus = $apacheService.Status
|
||||
ListenPort = $apachePort
|
||||
}
|
||||
}
|
||||
|
||||
function Get-NginxMarkdown
|
||||
{
|
||||
$name = "Nginx"
|
||||
$nginxPort = "80"
|
||||
$nginxService = Get-Service -Name $name
|
||||
$nginxVersion = Get-NginxVersion
|
||||
$nginxConfigFile = Join-Path (Get-NginxPath) "\conf\nginx.conf"
|
||||
return [PSCustomObject]@{
|
||||
Name = $name
|
||||
Version = $nginxVersion
|
||||
ConfigFile = $nginxConfigFile
|
||||
ServiceName = $nginxService.Name
|
||||
ServiceStatus = $nginxService.Status
|
||||
ListenPort = $nginxPort
|
||||
}
|
||||
}
|
||||
|
||||
function Build-WebServersSection {
|
||||
$output = ""
|
||||
$output += New-MDHeader "Web Servers" -Level 3
|
||||
$output += @(
|
||||
(Get-ApacheMarkdown),
|
||||
(Get-NginxMarkdown)
|
||||
) | Sort-Object Name | New-MDTable
|
||||
|
||||
$output += New-MDNewLine
|
||||
return $output
|
||||
}
|
||||
Reference in New Issue
Block a user