Merge main into install-codeql-bundle.

This commit is contained in:
Chris Gavin
2020-09-16 07:50:05 +01:00
161 changed files with 8253 additions and 1184 deletions

View File

@@ -0,0 +1,14 @@
# https://support.microsoft.com/en-us/help/929851/the-default-dynamic-port-range-for-tcp-ip-has-changed-in-windows-vista
# The new default start port is 49152, and the new default end port is 65535.
# Default port configuration was changed during image generation by Visual Studio Enterprise Installer to:
# Protocol tcp Dynamic Port Range
# ---------------------------------
# Start Port : 1024
# Number of Ports : 64511
Write-Host "Set the dynamic port range to start at port 49152 and to end at the 65536 (16384 ports)"
$null = netsh int ipv4 set dynamicport tcp start=49152 num=16384
$null = netsh int ipv4 set dynamicport udp start=49152 num=16384
$null = netsh int ipv6 set dynamicport tcp start=49152 num=16384
$null = netsh int ipv6 set dynamicport udp start=49152 num=16384
Invoke-PesterTests -TestFile "WindowsFeatures" -TestName "DynamicPorts"

View File

@@ -119,6 +119,11 @@ if (Test-IsWin16) {
Choco-Install -PackageName vcredist140
}
if (Test-IsWin19) {
# Install vcredist2010
Choco-Install -PackageName vcredist2010
}
# Expand disk size of OS drive
New-Item -Path d:\ -Name cmds.txt -ItemType File -Force
Add-Content -Path d:\cmds.txt "SELECT VOLUME=C`r`nEXTEND"

View File

@@ -6,7 +6,7 @@
Import-Module -Name ImageHelpers -Force
$InstallerName = "DacFramework.msi"
$InstallerUrl = "https://go.microsoft.com/fwlink/?linkid=2128142"
$InstallerUrl = "https://go.microsoft.com/fwlink/?linkid=2134206"
Install-Binary -Url $InstallerUrl -Name $InstallerName

View File

@@ -62,7 +62,7 @@ function InstallAllValidSdks()
# Consider all channels except preview/eol channels.
# Sort the channels in ascending order
$dotnetChannels = $dotnetChannels.'releases-index' | Where-Object { (!$_."support-phase".Equals('preview') -and !$_."support-phase".Equals('eol')) } | Sort-Object { [Version] $_."channel-version" }
$dotnetChannels = $dotnetChannels.'releases-index' | Where-Object { (!$_."support-phase".Equals('preview') -and !$_."support-phase".Equals('eol') -and !$_."support-phase".Equals('rc')) } | Sort-Object { [Version] $_."channel-version" }
# Download installation script.
$installationName = "dotnet-install.ps1"

View File

@@ -8,4 +8,4 @@ $googleCloudSDKInstaller = "https://dl.google.com/dl/cloudsdk/channels/rapid/Goo
$argumentList = @("/S", "/allusers", "/noreporting")
Install-Binary -Url $googleCloudSDKInstaller -Name "GoogleCloudSDKInstaller.exe" -ArgumentList $argumentList
Invoke-PesterTests -TestFile "Tools" -TestName "GoogleCouldSDK"
Invoke-PesterTests -TestFile "Tools" -TestName "GoogleCloudSDK"

View File

@@ -119,7 +119,7 @@ setx M2_REPO $m2_repo /M
setx MAVEN_OPTS $maven_opts /M
# Download cobertura jars
$uri = 'https://ayera.dl.sourceforge.net/project/cobertura/cobertura/2.1.1/cobertura-2.1.1-bin.zip'
$uri = 'https://downloads.sourceforge.net/project/cobertura/cobertura/2.1.1/cobertura-2.1.1-bin.zip'
$coberturaPath = "C:\cobertura-2.1.1"
$archivePath = Start-DownloadWithRetry -Url $uri -Name "cobertura.zip"

View File

@@ -3,7 +3,7 @@
## Desc: Install MongoDB
####################################################################################
Choco-Install -PackageName mongodb -ArgumentList @("--version","4.2.8")
Choco-Install -PackageName mongodb
$mongoPath = (Get-CimInstance Win32_Service -Filter "Name LIKE 'mongodb'").PathName
$mongoBin = Split-Path -Path $mongoPath.split('"')[1]
Add-MachinePathItem "$mongoBin"

View File

@@ -17,11 +17,11 @@ Choco-Install -PackageName nodejs-lts -ArgumentList "--force"
Add-MachinePathItem $PrefixPath
$env:Path = Get-MachinePath
setx NPM_CONFIG_PREFIX $PrefixPath /M
$env:NPM_CONFIG_PREFIX = $PrefixPath
setx npm_config_prefix $PrefixPath /M
$env:npm_config_prefix = $PrefixPath
setx NPM_CONFIG_CACHE $CachePath /M
$env:NPM_CONFIG_CACHE = $CachePath
setx npm_config_cache $CachePath /M
$env:npm_config_cache = $CachePath
npm config set registry http://registry.npmjs.org/
@@ -35,4 +35,4 @@ npm install -g lerna
npm install -g node-sass
npm install -g newman
Invoke-PesterTests -TestFile "Node"
Invoke-PesterTests -TestFile "Node"

View File

@@ -0,0 +1,8 @@
################################################################################
## File: Install-Pulumi.ps1
## Desc: Install Pulumi
################################################################################
Choco-Install -PackageName pulumi
Invoke-PesterTests -TestFile "Tools" -TestName "Pulumi"

View File

@@ -94,6 +94,7 @@ $markdown += New-MDList -Style Unordered -Lines @(
(Get-NewmanVersion),
(Get-OpenSSLVersion),
(Get-PackerVersion),
(Get-PulumiVersion),
(Get-SQLPSVersion),
(Get-SQLServerPSVersion),
(Get-SVNVersion),
@@ -173,6 +174,11 @@ $markdown += New-MDNewLine
$markdown += ((Get-VisualStudioComponents) + (Get-VisualStudioExtensions)) | New-MDTable
$markdown += New-MDNewLine
$markdown += New-MDHeader "Microsoft Visual C++:" -Level 4
$markdown += New-MDNewLine
$markdown += Get-VisualCPPComponents | New-MDTable
$markdown += New-MDNewLine
$markdown += New-MDHeader ".NET Core SDK" -Level 3
$sdk = Get-DotnetSdks
$markdown += "``Location $($sdk.Path)``"

View File

@@ -107,6 +107,10 @@ function Get-PackerVersion {
return "Packer $(packer --version)"
}
function Get-PulumiVersion {
return "Pulumi $(pulumi version)"
}
function Get-SQLPSVersion {
$module = Get-Module -Name SQLPS -ListAvailable
$version = $module.Version
@@ -222,5 +226,24 @@ function Get-NewmanVersion {
}
function Get-GHVersion {
return "GitHub CLI $(gh --version)"
($(gh --version) | Select-String -Pattern "gh version") -match "gh version (?<version>\d+\.\d+\.\d+)" | Out-Null
$ghVersion = $Matches.Version
return "GitHub CLI $ghVersion"
}
function Get-VisualCPPComponents {
$vcpp = Get-CimInstance -ClassName Win32_Product -Filter "Name LIKE 'Microsoft Visual C++%'"
$vcpp | Sort-Object Name, Version | ForEach-Object {
$isMatch = $_.Name -match "^(?<Name>Microsoft Visual C\+\+ \d{4})\s+(?<Arch>\w{3})\s+(?<Ext>.+)\s+-"
if ($isMatch) {
$name = '{0} {1}' -f $matches["Name"], $matches["Ext"]
$arch = $matches["Arch"].ToLower()
$version = $_.Version
[PSCustomObject]@{
Name = $name
Architecture = $arch
Version = $version
}
}
}
}

View File

@@ -17,13 +17,14 @@ Describe "Chrome" {
Context "Browser" {
$chromeRegPath = "HKLM:SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe"
$chromePath = (Get-ItemProperty $chromeRegPath).'(default)'
It "Chrome '<chromeRegPath>' registry path exists" -TestCases @{chromeRegPath = $chromeRegPath} {
$chromeRegPath | Should -Exist
}
It "Chrome VersionInfo registry value exists" -TestCases @{chromeRegPath = $chromeRegPath} {
$versionInfo = (Get-Item (Get-ItemProperty $chromeRegPath).'(Default)').VersionInfo
It "Chrome VersionInfo registry value exists" -TestCases @{chromePath = $chromePath} {
$versionInfo = (Get-Item $chromePath).VersionInfo
$versionInfo | Should -Not -BeNullOrEmpty
}
@@ -41,8 +42,10 @@ Describe "Chrome" {
Get-NetFirewallRule -DisplayName BlockGoogleUpdate | Should -Not -BeNullOrEmpty
}
It "chrome.exe is installed" {
"${env:ProgramFiles(x86)}\Google\Chrome\Application\chrome.exe" | Should -Exist
It "<chromePath> is installed" -TestCases @{chromePath = $chromePath} {
$chromeName = (Get-Item $chromePath).Name
$chromePath | Should -Exist
$chromeName | Should -BeExactly "chrome.exe"
}
}
}

View File

@@ -1,6 +1,6 @@
$releaseIndexUrl = "https://raw.githubusercontent.com/dotnet/core/master/release-notes/releases-index.json"
$dotnetChannels = (New-Object system.net.webclient).DownloadString($releaseIndexUrl) | ConvertFrom-Json
$dotnetVersions = $dotnetChannels.'releases-index' | Where-Object { (!$_."support-phase".Equals('preview') -and !$_."support-phase".Equals('eol')) } | Select-Object -ExpandProperty "channel-version"
$dotnetVersions = $dotnetChannels.'releases-index' | Where-Object { (!$_."support-phase".Equals('preview') -and !$_."support-phase".Equals('eol') -and !$_."support-phase".Equals('rc')) } | Select-Object -ExpandProperty "channel-version"
Describe "Dotnet SDK" {

View File

@@ -139,7 +139,7 @@ Describe "InnoSetup" {
}
}
Describe "GoogleCouldSDK" {
Describe "GoogleCloudSDK" {
It "<ToolName>" -TestCases @(
@{ ToolName = "bq" }
@{ ToolName = "gcloud" }
@@ -196,6 +196,12 @@ Describe "PowerShell Core" {
}
}
Describe "Pulumi" {
It "pulumi" {
"pulumi version" | Should -ReturnZeroExitCode
}
}
Describe "Sbt" {
It "sbt" {
"sbt --version" | Should -ReturnZeroExitCode

View File

@@ -32,10 +32,28 @@ Describe "ContainersFeature" {
}
Describe "DiskSpace" {
it "The image has enough disk space"{
It "The image has enough disk space"{
$availableSpaceMB = [math]::Round((Get-PSDrive -Name C).Free / 1MB)
$minimumFreeSpaceMB = 18 * 1024
$availableSpaceMB | Should -BeGreaterThan $minimumFreeSpaceMB
}
}
Describe "DynamicPorts" {
It "Test TCP dynamicport start=49152 num=16384" {
$tcpPorts = Get-NetTCPSetting | Where-Object {$_.SettingName -ne "Automatic"} | Where-Object {
$_.DynamicPortRangeStartPort -ne 49152 -or $_.DynamicPortRangeNumberOfPorts -ne 16384
}
$tcpPorts | Should -BeNullOrEmpty
}
It "Test UDP dynamicport start=49152 num=16384" {
$udpPorts = Get-NetUDPSetting | Where-Object {
$_.DynamicPortRangeStartPort -ne 49152 -or $_.DynamicPortRangeNumberOfPorts -ne 16384
}
$udpPorts | Should -BeNullOrEmpty
}
}