Add Windows Server 2022 image templates (#3929)

* add windows2022 image template

Co-authored-by: Aleksandr Chebotov <v-aleche@microsoft.com>
Co-authored-by: Mikhail Timofeev <48208649+miketimofeev@users.noreply.github.com>
Co-authored-by: Aleksandr Chebotov <47745270+al-cheb@users.noreply.github.com>
Co-authored-by: MaksimZhukov <46996400+MaksimZhukov@users.noreply.github.com>
This commit is contained in:
Maxim Lobanov
2021-08-23 11:13:14 +03:00
committed by GitHub
parent 20584a4394
commit a2d76d2a0e
19 changed files with 679 additions and 75 deletions

View File

@@ -0,0 +1,20 @@
schedules:
- cron: "0 0 * * *"
displayName: Daily
branches:
include:
- main
always: true
trigger: none
pr:
autoCancel: true
branches:
include:
- main
jobs:
- template: image-generation.yml
parameters:
image_type: windows2022
image_readme_name: Windows2022-Readme.md

View File

@@ -25,6 +25,7 @@ Export-ModuleMember -Function @(
'Install-VsixExtension'
'Get-VSExtensionVersion'
'Get-WinVersion'
'Test-IsWin22'
'Test-IsWin19'
'Test-IsWin16'
'Choco-Install'

View File

@@ -380,6 +380,11 @@ function Get-WinVersion
(Get-CimInstance -ClassName Win32_OperatingSystem).Caption
}
function Test-IsWin22
{
(Get-WinVersion) -match "2022"
}
function Test-IsWin19
{
(Get-WinVersion) -match "2019"

View File

@@ -15,8 +15,8 @@ C:\msys64\usr\bin\bash.exe -leo pipefail %*
# gitbash <--> C:\Program Files\Git\bin\bash.exe
New-Item -ItemType SymbolicLink -Path "$shellPath\gitbash.exe" -Target "$env:ProgramFiles\Git\bin\bash.exe" | Out-Null
# WSL is available on Windows Server 2019
if (Test-IsWin19)
# WSL is available on Windows Server 2019 and Windows Server 2022
if (-not (Test-IsWin16))
{
# wslbash <--> C:\Windows\System32\bash.exe
New-Item -ItemType SymbolicLink -Path "$shellPath\wslbash.exe" -Target "$env:SystemRoot\System32\bash.exe" | Out-Null

View File

@@ -12,6 +12,32 @@ Set-SystemVariable -SystemVariable DOTNET_MULTILEVEL_LOOKUP -Value "0"
[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor "Tls12"
function Get-SDKVersionsToInstall (
$DotnetVersion
) {
$releaseJson = "https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/${DotnetVersion}/releases.json"
$releasesJsonPath = Start-DownloadWithRetry -Url $releaseJson -Name "releases-${DotnetVersion}.json"
$currentReleases = Get-Content -Path $releasesJsonPath | ConvertFrom-Json
# filtering out the preview/rc releases
$currentReleases = $currentReleases.'releases' | Where-Object { !$_.'release-version'.Contains('-') }
$sdks = @()
ForEach ($release in $currentReleases)
{
$sdks += $release.'sdk'
$sdks += $release.'sdks'
}
$sortedSdkVersions = $sdks.version | Sort-Object { [Version] $_ } -Unique
if (Test-IsWin22)
{
return $sortedSdkVersions | Group-Object { $_.Substring(0, $_.LastIndexOf('.') + 2) } | Foreach-Object { $_.Group[-1] }
}
return $sortedSdkVersions
}
function Invoke-Warmup (
$SdkVersion
) {
@@ -78,35 +104,11 @@ function InstallAllValidSdks()
ForEach ($dotnetVersion in $dotnetVersions)
{
$releaseJson = "https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/${dotnetVersion}/releases.json"
$releasesJsonPath = Start-DownloadWithRetry -Url $releaseJson -Name "releases-${dotnetVersion}.json"
$currentReleases = Get-Content -Path $releasesJsonPath | ConvertFrom-Json
# filtering out the preview/rc releases
$currentReleases = $currentReleases.'releases' | Where-Object { !$_.'release-version'.Contains('-') } | Sort-Object { [Version] $_.'release-version' }
ForEach ($release in $currentReleases)
$sdkVersionsToInstall = Get-SDKVersionsToInstall -DotnetVersion $dotnetVersion
ForEach ($sdkVersion in $sdkVersionsToInstall)
{
if ($release.'sdks'.Count -gt 0)
{
Write-Host 'Found sdks property in release: ' + $release.'release-version' + 'with sdks count: ' + $release.'sdks'.Count
# Remove duplicate entries & preview/rc version from download list
# Sort the sdks on version
$sdks = @($release.'sdk');
$sdks += $release.'sdks' | Where-Object { !$_.'version'.Contains('-') -and !$_.'version'.Equals($release.'sdk'.'version') }
$sdks = $sdks | Sort-Object { [Version] $_.'version' }
ForEach ($sdk in $sdks)
{
InstallSDKVersion -sdkVersion $sdk.'version' -Warmup $warmup
}
}
elseif (!$release.'sdk'.'version'.Contains('-'))
{
$sdkVersion = $release.'sdk'.'version'
InstallSDKVersion -SdkVersion $sdkVersion -Warmup $warmup
}
InstallSDKVersion -SdkVersion $sdkVersion -Warmup $warmup
}
}
}

View File

@@ -7,7 +7,11 @@ $imageVersion = $env:IMAGE_VERSION
$imageDataFile = $env:IMAGEDATA_FILE
$githubUrl="https://github.com/actions/virtual-environments/blob"
if (Test-IsWin19) {
if (Test-IsWin22) {
$imageLabel = "windows-2022"
$softwareUrl = "${githubUrl}/win22/${imageVersion}/images/win/Windows2022-Readme.md"
$releaseUrl="https://github.com/actions/virtual-environments/releases/tag/win22%2F${imageVersion}"
} elseif (Test-IsWin19) {
$imageLabel = "windows-2019"
$softwareUrl = "${githubUrl}/win19/${imageVersion}/images/win/Windows2019-Readme.md"
$releaseUrl="https://github.com/actions/virtual-environments/releases/tag/win19%2F${imageVersion}"

View File

@@ -9,7 +9,7 @@ function Get-OSVersion {
}
function Get-BashVersion {
$version = bash -c 'echo ${BASH_VERSION}'
$version = bash --% -c 'echo ${BASH_VERSION}'
return "Bash $version"
}
@@ -276,6 +276,10 @@ function Get-CachedDockerImages {
function Get-CachedDockerImagesTableData {
$allImages = docker images --digests --format "*{{.Repository}}:{{.Tag}}|{{.Digest}} |{{.CreatedAt}}"
if (-not $allImages) {
return $null
}
$allImages.Split("*") | Where-Object { $_ } | ForEach-Object {
$parts = $_.Split("|")
[PSCustomObject] @{
@@ -321,16 +325,21 @@ function Get-PipxVersion {
}
function Build-PackageManagementEnvironmentTable {
return @(
@{
"Name" = "CONDA"
"Value" = $env:CONDA
},
$envVariables = @(
@{
"Name" = "VCPKG_INSTALLATION_ROOT"
"Value" = $env:VCPKG_INSTALLATION_ROOT
}
) | ForEach-Object {
)
if ((Test-IsWin16) -or (Test-IsWin19)) {
$envVariables += @(
@{
"Name" = "CONDA"
"Value" = $env:CONDA
}
)
}
return $envVariables | ForEach-Object {
[PSCustomObject] @{
"Name" = $_.Name
"Value" = $_.Value

View File

@@ -31,25 +31,27 @@ if (Test-IsWin19)
$markdown += New-MDHeader "Installed Software" -Level 2
$markdown += New-MDHeader "Language and Runtime" -Level 3
$markdown += New-MDList -Style Unordered -Lines (@(
$languageTools = @(
(Get-BashVersion),
(Get-GoVersion),
(Get-JuliaVersion),
(Get-NodeVersion),
(Get-PerlVersion),
(Get-PHPVersion),
(Get-PythonVersion),
(Get-RubyVersion),
(Get-KotlinVersion)
) | Sort-Object
)
if ((Test-IsWin16) -or (Test-IsWin19)) {
$languageTools += @(
(Get-PerlVersion)
)
}
$markdown += New-MDList -Style Unordered -Lines ($languageTools | Sort-Object)
$markdown += New-MDHeader "Package Management" -Level 3
$markdown += New-MDList -Style Unordered -Lines (@(
$packageManagementList = @(
(Get-ChocoVersion),
(Get-ComposerVersion),
(Get-HelmVersion),
(Get-CondaVersion),
(Get-NPMVersion),
(Get-NugetVersion),
(Get-PipxVersion),
@@ -57,23 +59,36 @@ $markdown += New-MDList -Style Unordered -Lines (@(
(Get-RubyGemsVersion),
(Get-VcpkgVersion),
(Get-YarnVersion)
) | Sort-Object
)
if ((Test-IsWin16) -or (Test-IsWin19)) {
$packageManagementList += @(
(Get-CondaVersion)
)
}
$markdown += New-MDHeader "Package Management" -Level 3
$markdown += New-MDList -Style Unordered -Lines ($packageManagementList | Sort-Object)
$markdown += New-MDHeader "Environment variables" -Level 4
$markdown += Build-PackageManagementEnvironmentTable | New-MDTable
$markdown += New-MDNewLine
$markdown += New-MDHeader "Project Management" -Level 3
$markdown += New-MDList -Style Unordered -Lines (@(
$projectManagementTools = @(
(Get-AntVersion),
(Get-GradleVersion),
(Get-MavenVersion),
(Get-SbtVersion)
) | Sort-Object
(Get-MavenVersion)
)
if ((Test-IsWin16) -or (Test-IsWin19)) {
$projectManagementTools += @(
(Get-SbtVersion)
)
}
$markdown += New-MDList -Style Unordered -Lines ($projectManagementTools | Sort-Object)
$markdown += New-MDHeader "Tools" -Level 3
$markdown += New-MDList -Style Unordered -Lines (@(
$toolsList = @(
(Get-7zipVersion),
(Get-Aria2Version),
(Get-AzCopyVersion),
@@ -89,7 +104,6 @@ $markdown += New-MDList -Style Unordered -Lines (@(
(Get-GitVersion),
(Get-GitLFSVersion),
(Get-GVFSVersion),
(Get-GoogleCloudSDKVersion),
(Get-InnoSetupVersion),
(Get-JQVersion),
(Get-KindVersion),
@@ -97,7 +111,6 @@ $markdown += New-MDList -Style Unordered -Lines (@(
(Get-MercurialVersion),
(Get-MinGWVersion),
(Get-NewmanVersion),
(Get-NSISVersion),
(Get-OpenSSLVersion),
(Get-PackerVersion),
(Get-PulumiVersion),
@@ -109,22 +122,32 @@ $markdown += New-MDList -Style Unordered -Lines (@(
(Get-WinAppDriver),
(Get-ZstdVersion),
(Get-YAMLLintVersion)
) | Sort-Object
)
if ((Test-IsWin16) -or (Test-IsWin19)) {
$toolsList += @(
(Get-NSISVersion),
(Get-GoogleCloudSDKVersion)
)
}
$markdown += New-MDList -Style Unordered -Lines ($toolsList | Sort-Object)
$markdown += New-MDHeader "CLI Tools" -Level 3
$markdown += New-MDList -Style Unordered -Lines (@(
$cliTools = @(
(Get-AlibabaCLIVersion),
(Get-AWSCLIVersion),
(Get-AWSSAMVersion),
(Get-AWSSessionManagerVersion),
(Get-AzureCLIVersion),
(Get-AzureDevopsExtVersion),
(Get-CloudFoundryVersion),
(Get-GHVersion),
(Get-HubVersion)
) | Sort-Object
)
if ((Test-IsWin16) -or (Test-IsWin19)) {
$cliTools += @(
(Get-CloudFoundryVersion)
)
}
$markdown += New-MDList -Style Unordered -Lines ($cliTools | Sort-Object)
$markdown += New-MDHeader "Rust Tools" -Level 3
$markdown += New-MDList -Style Unordered -Lines (@(

View File

@@ -3,7 +3,7 @@
## Desc: Test BizTalk project build component installed.
################################################################################
Describe "BizTalk Build Component Setup" -Skip:(Test-IsWin16) {
Describe "BizTalk Build Component Setup" -Skip:(-not (Test-IsWin19)) {
It "BizTalk Registry Check" {
Test-Path "HKLM:\SOFTWARE\WOW6432Node\Microsoft\BizTalk Server\3.0" | Should -BeTrue
}

View File

@@ -39,7 +39,7 @@ Describe "GitHub CLI" {
}
}
Describe "CloudFoundry CLI" {
Describe "CloudFoundry CLI" -Skip:(Test-IsWin22) {
It "cf is located in C:\cf-cli" {
"C:\cf-cli\cf.exe" | Should -Exist
}

View File

@@ -22,13 +22,13 @@ Describe "Bicep" {
}
}
Describe "GitVersion" {
Describe "GitVersion" -Skip:(Test-IsWin22) {
It "gitversion is installed" {
"gitversion /version" | Should -ReturnZeroExitCode
}
}
Describe "InnoSetup" {
Describe "InnoSetup" -Skip:(Test-IsWin22) {
It "InnoSetup" {
(Get-Command -Name iscc).CommandType | Should -BeExactly "Application"
}
@@ -58,7 +58,7 @@ Describe "Packer" {
}
}
Describe "Perl" {
Describe "Perl" -Skip:(Test-IsWin22) {
It "Perl" {
"perl --version" | Should -ReturnZeroExitCode
}

View File

@@ -14,10 +14,15 @@ Describe "MSYS2 packages" {
$TestCases = @(
@{ ToolName = "bash.exe" }
@{ ToolName = "tar.exe" }
@{ ToolName = "make.exe" }
)
if ((Test-IsWin16) -or (Test-IsWin19)) {
$TestCases += @(
@{ ToolName = "tar.exe" }
@{ ToolName = "make.exe" }
)
}
It "<ToolName> is installed in <msys2Dir>" -TestCases $TestCases {
(Get-Command "$ToolName").Source | Should -BeLike "$msys2Dir*"
}

View File

@@ -1,4 +1,4 @@
Describe "Miniconda" {
Describe "Miniconda" -Skip:(Test-IsWin22) {
It "Miniconda Environment variables is set. " {
${env:CONDA} | Should -Not -BeNullOrEmpty
}

View File

@@ -59,8 +59,8 @@ Describe "AzureModules" {
if ($module.default) {
$moduleInfo = @{ moduleName = $moduleName; moduleDefault = $module.default }
It "<moduleDefault> set as default" -TestCases $moduleInfo {
$moduleVersion = (Get-Module -ListAvailable -Name $moduleName).Version.ToString()
$moduleVersion | Should -Match $moduleDefault
$moduleVersions = Get-Module -ListAvailable -Name $moduleName | ForEach-Object { $_.Version.ToString() }
$moduleVersions | Should -Contain $moduleDefault
}
}
}

View File

@@ -42,13 +42,16 @@ Describe "DACFx" {
It "DACFx" {
(Get-ItemProperty HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*).DisplayName -Contains "Microsoft SQL Server Data-Tier Application Framework (x64)" | Should -BeTrue
$sqlPackagePath = 'C:\Program Files\Microsoft SQL Server\150\DAC\bin\SqlPackage.exe'
$sqlLocalDBPath = 'C:\Program Files\Microsoft SQL Server\130\Tools\Binn\SqlLocalDB.exe'
"${sqlPackagePath}" | Should -Exist
}
It "SqlLocalDB" -Skip:(Test-IsWin22) {
$sqlLocalDBPath = 'C:\Program Files\Microsoft SQL Server\130\Tools\Binn\SqlLocalDB.exe'
"${sqlLocalDBPath}" | Should -Exist
}
}
Describe "DotnetTLS" {
Describe "DotnetTLS" -Skip:(Test-IsWin22) {
It "Tls 1.2 is enabled" {
[Net.ServicePointManager]::SecurityProtocol -band "Tls12" | Should -Be Tls12
}
@@ -88,7 +91,7 @@ Describe "Mingw64" {
}
}
Describe "GoogleCloudSDK" {
Describe "GoogleCloudSDK" -Skip:(Test-IsWin22) {
It "<ToolName>" -TestCases @(
@{ ToolName = "bq" }
@{ ToolName = "gcloud" }
@@ -105,7 +108,7 @@ Describe "NET48" {
}
}
Describe "NSIS" {
Describe "NSIS" -Skip:(Test-IsWin22) {
It "NSIS" {
"makensis /VERSION" | Should -ReturnZeroExitCode
}
@@ -121,13 +124,13 @@ Describe "PowerShell Core" {
}
}
Describe "Sbt" {
Describe "Sbt" -Skip:(Test-IsWin22) {
It "sbt" {
"sbt --version" | Should -ReturnZeroExitCode
}
}
Describe "ServiceFabricSDK" {
Describe "ServiceFabricSDK" -Skip:(Test-IsWin22) {
It "PowerShell Module" {
Get-Module -Name ServiceFabric -ListAvailable | Should -Not -BeNullOrEmpty
}
@@ -153,7 +156,7 @@ Describe "Vcpkg" {
}
}
Describe "WebPlatformInstaller" {
Describe "WebPlatformInstaller" -Skip:(Test-IsWin22) {
It "WebPlatformInstaller" {
"WebPICMD" | Should -ReturnZeroExitCode
}

View File

@@ -1,4 +1,4 @@
Describe "WDK" {
Describe "WDK" -Skip:(Test-IsWin22) {
It "WDK exists" {
$WDKVersion = (Get-CimInstance -ClassName Win32_Product -Filter "Name = 'Windows Driver Kit'").Version
$WDKVersion| Should -Not -BeNullOrEmpty

View File

@@ -1,4 +1,4 @@
Describe "Wix" {
Describe "Wix" -Skip:(Test-IsWin22) {
BeforeAll {
$regKey = "HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*"
$installedApplications = Get-ItemProperty -Path $regKey

View File

@@ -0,0 +1,247 @@
{
"toolcache": [
{
"name": "Ruby",
"arch": "x64",
"platform" : "win32",
"versions": [
"2.7",
"3.0"
],
"default": "3.0"
},
{
"name": "Python",
"url" : "https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json",
"arch": "x64",
"platform" : "win32",
"versions": [
"3.7.*",
"3.8.*",
"3.9.*"
],
"default": "3.9.*"
},
{
"name": "PyPy",
"arch": "x86",
"platform" : "win64",
"versions": [
"2.7",
"3.7"
]
},
{
"name": "node",
"url" : "https://raw.githubusercontent.com/actions/node-versions/main/versions-manifest.json",
"arch": "x64",
"platform" : "win32",
"versions": [
"10.*",
"12.*",
"14.*"
]
},
{
"name": "go",
"url" : "https://raw.githubusercontent.com/actions/go-versions/main/versions-manifest.json",
"arch": "x64",
"platform" : "win32",
"versions": [
"1.15.*",
"1.16.*"
],
"default": "1.16.*"
}
],
"powershellModules": [
{ "name": "DockerMsftProvider" },
{ "name": "MarkdownPS" },
{ "name": "Pester" },
{ "name": "PowerShellGet" },
{ "name": "PSScriptAnalyzer" },
{ "name": "PSWindowsUpdate" },
{ "name": "SqlServer" },
{ "name": "VSSetup" }
],
"azureModules": [
{
"name": "azurerm",
"blob_url": "https://vstsagenttools.blob.core.windows.net/tools/azurepowershellmodules/",
"versions": [
"2.1.0",
"6.13.1"
],
"zip_versions": [
"3.8.0",
"4.2.1",
"5.1.1",
"6.7.0"
],
"default": "2.1.0"
},
{
"name": "azure",
"blob_url": "https://vstsagenttools.blob.core.windows.net/tools/azurepowershellmodules/",
"versions": [
"2.1.0",
"5.3.0"
],
"zip_versions": [
"3.8.0",
"4.2.1",
"5.1.1"
],
"default": "2.1.0"
},
{
"name": "az",
"url" : "https://raw.githubusercontent.com/Azure/az-ps-module-versions/main/versions-manifest.json",
"versions": [
"6.1.0"
],
"zip_versions": []
}
],
"java": {
"default": "8",
"versions": [
"8", "11"
]
},
"android": {
"platform_min_version": "27",
"build_tools_min_version": "27.0.0",
"extra_list": [
"android;m2repository",
"google;m2repository",
"google;google_play_services"
],
"addon_list": [],
"additional_tools": [
"cmake;3.18.1",
"patcher;v4"
],
"ndk": {
"lts": "21",
"latest": "22"
}
},
"MsysPackages": {
"msys2": [],
"mingw": []
},
"windowsFeatures": [
{ "name": "Containers" },
{ "name": "Microsoft-Windows-Subsystem-Linux", "optionalFeature": true },
{ "name": "VirtualMachinePlatform", "optionalFeature": true },
{ "name": "NET-Framework-45-Features", "includeAllSubFeatures": true },
{ "name": "Client-ProjFS", "optionalFeature": true },
{ "name": "NET-Framework-Features", "includeAllSubFeatures": true }
],
"visualStudio": {
"version" : "2022",
"subversion" : "17",
"edition" : "Enterprise",
"channel": "pre",
"workloads": [
"Component.Linux.CMake",
"Component.UnityEngine.x64",
"Component.Unreal.Android",
"Microsoft.Component.VC.Runtime.UCRTSDK",
"Microsoft.Net.Component.4.7.2.TargetingPack",
"Microsoft.VisualStudio.Component.AspNet45",
"Microsoft.VisualStudio.Component.Azure.ServiceFabric.Tools",
"Microsoft.VisualStudio.Component.Debugger.JustInTime",
"Microsoft.VisualStudio.Component.EntityFramework",
"Microsoft.VisualStudio.Component.LinqToSql",
"Microsoft.VisualStudio.Component.SQL.SSDT",
"Microsoft.VisualStudio.Component.Sharepoint.Tools",
"Microsoft.VisualStudio.Component.PortableLibrary",
"Microsoft.VisualStudio.Component.TeamOffice",
"Microsoft.VisualStudio.Component.TestTools.CodedUITest",
"Microsoft.VisualStudio.Component.TestTools.WebLoadTest",
"Microsoft.VisualStudio.Component.VC.CLI.Support",
"Microsoft.VisualStudio.Component.VC.CMake.Project",
"Microsoft.VisualStudio.Component.VC.DiagnosticTools",
"Microsoft.VisualStudio.Component.VC.Llvm.ClangToolset",
"Microsoft.VisualStudio.Component.VC.Runtimes.x86.x64.Spectre",
"Microsoft.VisualStudio.Component.VC.TestAdapterForBoostTest",
"Microsoft.VisualStudio.Component.VC.TestAdapterForGoogleTest",
"Microsoft.VisualStudio.Component.VC.v141.x86.x64",
"Microsoft.VisualStudio.Component.VC.v141.x86.x64.Spectre",
"Microsoft.VisualStudio.Component.VC.v141.MFC",
"Microsoft.VisualStudio.Component.VC.v141.MFC.Spectre",
"Microsoft.VisualStudio.Component.Windows10SDK.19041",
"Microsoft.VisualStudio.Component.Workflow",
"Microsoft.VisualStudio.ComponentGroup.Azure.CloudServices",
"Microsoft.VisualStudio.ComponentGroup.Azure.ResourceManager.Tools",
"Microsoft.VisualStudio.ComponentGroup.Web.CloudTools",
"Microsoft.VisualStudio.Workload.Azure",
"Microsoft.VisualStudio.Workload.Data",
"Microsoft.VisualStudio.Workload.ManagedDesktop",
"Microsoft.VisualStudio.Workload.ManagedGame",
"Microsoft.VisualStudio.Workload.NativeCrossPlat",
"Microsoft.VisualStudio.Workload.NativeDesktop",
"Microsoft.VisualStudio.Workload.NativeGame",
"Microsoft.VisualStudio.Workload.NativeMobile",
"Microsoft.VisualStudio.Workload.NetCrossPlat",
"Microsoft.VisualStudio.Workload.NetWeb",
"Microsoft.VisualStudio.Workload.Node",
"Microsoft.VisualStudio.Workload.Office",
"Microsoft.VisualStudio.Workload.Python",
"Microsoft.VisualStudio.Workload.Universal",
"Microsoft.VisualStudio.Workload.VisualStudioExtension",
"Component.MDD.Linux"
],
"vsix": []
},
"docker": {
"images": []
},
"pipx": [
{
"package": "yamllint",
"cmd": "yamllint --version"
}
],
"npm": {
"global_packages": [
{ "name": "yarn", "test": "yarn --version" },
{ "name": "newman", "test": "newman --version" },
{ "name": "lerna", "test": "lerna --version" }
]
},
"dotnet": {
"versions": [
"3.1",
"5.0"
],
"warmup": false
},
"choco": {
"common_packages": [
{ "name": "7zip.install" },
{ "name": "aria2" },
{ "name": "azcopy10" },
{ "name": "Bicep" },
{ "name": "jq" },
{ "name": "NuGet.CommandLine" },
{ "name": "openssl.light" },
{ "name": "packer" },
{ "name": "pulumi" },
{ "name": "tortoisesvn" },
{ "name": "swig" },
{ "name": "vswhere" },
{ "name": "kotlinc" },
{
"name": "julia",
"args": [ "--ia", "/DIR=C:\\Julia" ]
},
{
"name": "cmake.install",
"args": [ "--installargs", "ADD_CMAKE_TO_PATH=\"System\"" ]
}
]
}
}

285
images/win/windows2022.json Normal file
View File

@@ -0,0 +1,285 @@
{
"variables": {
"client_id": "{{env `ARM_CLIENT_ID`}}",
"client_secret": "{{env `ARM_CLIENT_SECRET`}}",
"subscription_id": "{{env `ARM_SUBSCRIPTION_ID`}}",
"tenant_id": "{{env `ARM_TENANT_ID`}}",
"object_id": "{{env `ARM_OBJECT_ID`}}",
"resource_group": "{{env `ARM_RESOURCE_GROUP`}}",
"storage_account": "{{env `ARM_STORAGE_ACCOUNT`}}",
"build_resource_group_name": "{{env `BUILD_RESOURCE_GROUP_NAME`}}",
"temp_resource_group_name": "{{env `TEMP_RESOURCE_GROUP_NAME`}}",
"location": "{{env `ARM_RESOURCE_LOCATION`}}",
"virtual_network_name": "{{env `VNET_NAME`}}",
"virtual_network_resource_group_name": "{{env `VNET_RESOURCE_GROUP`}}",
"virtual_network_subnet_name": "{{env `VNET_SUBNET`}}",
"private_virtual_network_with_public_ip": "{{env `PRIVATE_VIRTUAL_NETWORK_WITH_PUBLIC_IP`}}",
"allowed_inbound_ip_addresses": "{{env `AGENT_IP`}}",
"vm_size": "Standard_D8s_v4",
"image_folder": "C:\\image",
"imagedata_file": "C:\\imagedata.json",
"helper_script_folder": "C:\\Program Files\\WindowsPowerShell\\Modules\\",
"agent_tools_directory": "C:\\hostedtoolcache\\windows",
"install_user": "installer",
"install_password": null,
"capture_name_prefix": "packer",
"image_version": "dev",
"image_os": "win22"
},
"sensitive-variables": [
"install_password",
"client_secret"
],
"builders": [
{
"name": "vhd",
"type": "azure-arm",
"client_id": "{{user `client_id`}}",
"client_secret": "{{user `client_secret`}}",
"subscription_id": "{{user `subscription_id`}}",
"object_id": "{{user `object_id`}}",
"tenant_id": "{{user `tenant_id`}}",
"os_disk_size_gb": "256",
"location": "{{user `location`}}",
"vm_size": "{{user `vm_size`}}",
"resource_group_name": "{{user `resource_group`}}",
"storage_account": "{{user `storage_account`}}",
"build_resource_group_name": "{{user `build_resource_group_name`}}",
"temp_resource_group_name": "{{user `temp_resource_group_name`}}",
"capture_container_name": "images",
"capture_name_prefix": "{{user `capture_name_prefix`}}",
"virtual_network_name": "{{user `virtual_network_name`}}",
"virtual_network_resource_group_name": "{{user `virtual_network_resource_group_name`}}",
"virtual_network_subnet_name": "{{user `virtual_network_subnet_name`}}",
"private_virtual_network_with_public_ip": "{{user `private_virtual_network_with_public_ip`}}",
"allowed_inbound_ip_addresses": "{{user `allowed_inbound_ip_addresses`}}",
"os_type": "Windows",
"image_publisher": "MicrosoftWindowsServer",
"image_offer": "WindowsServer",
"image_sku": "2022-Datacenter",
"communicator": "winrm",
"winrm_use_ssl": "true",
"winrm_insecure": "true",
"winrm_username": "packer"
}
],
"provisioners": [
{
"type": "powershell",
"inline": [
"New-Item -Path {{user `image_folder`}} -ItemType Directory -Force"
]
},
{
"type": "file",
"source": "{{ template_dir }}/scripts/ImageHelpers",
"destination": "{{user `helper_script_folder`}}"
},
{
"type": "file",
"source": "{{ template_dir }}/scripts/SoftwareReport",
"destination": "{{user `image_folder`}}"
},
{
"type": "file",
"source": "{{ template_dir }}/post-generation",
"destination": "C:/"
},
{
"type": "file",
"source": "{{ template_dir }}/scripts/Tests",
"destination": "{{user `image_folder`}}"
},
{
"type": "file",
"source": "{{template_dir}}/toolsets/toolset-2022.json",
"destination": "{{user `image_folder`}}\\toolset.json"
},
{
"type": "windows-shell",
"inline": [
"net user {{user `install_user`}} {{user `install_password`}} /add /passwordchg:no /passwordreq:yes /active:yes /Y",
"net localgroup Administrators {{user `install_user`}} /add",
"winrm set winrm/config/service/auth @{Basic=\"true\"}",
"winrm get winrm/config/service/auth"
]
},
{
"type": "powershell",
"inline": [
"if (-not ((net localgroup Administrators) -contains '{{user `install_user`}}')) { exit 1 }"
]
},
{
"type": "powershell",
"environment_vars": [
"IMAGE_VERSION={{user `image_version`}}",
"IMAGE_OS={{user `image_os`}}",
"AGENT_TOOLSDIRECTORY={{user `agent_tools_directory`}}",
"IMAGEDATA_FILE={{user `imagedata_file`}}"
],
"scripts": [
"{{ template_dir }}/scripts/Installers/Configure-Antivirus.ps1",
"{{ template_dir }}/scripts/Installers/Install-PowerShellModules.ps1",
"{{ template_dir }}/scripts/Installers/Install-WindowsFeatures.ps1",
"{{ template_dir }}/scripts/Installers/Install-Choco.ps1",
"{{ template_dir }}/scripts/Installers/Initialize-VM.ps1",
"{{ template_dir }}/scripts/Installers/Update-ImageData.ps1",
"{{ template_dir }}/scripts/Installers/Update-DotnetTLS.ps1"
],
"execution_policy": "unrestricted"
},
{
"type": "windows-restart",
"restart_timeout": "10m"
},
{
"type": "powershell",
"scripts": [
"{{ template_dir }}/scripts/Installers/Install-VCRedist.ps1",
"{{ template_dir }}/scripts/Installers/Install-Docker.ps1",
"{{ template_dir }}/scripts/Installers/Install-PowershellCore.ps1"
]
},
{
"type": "windows-restart",
"restart_timeout": "10m"
},
{
"type": "powershell",
"valid_exit_codes": [
0,
3010
],
"scripts": [
"{{ template_dir }}/scripts/Installers/Install-VS.ps1",
"{{ template_dir }}/scripts/Installers/Install-KubernetesTools.ps1"
],
"elevated_user": "{{user `install_user`}}",
"elevated_password": "{{user `install_password`}}"
},
{
"type": "powershell",
"scripts": [
"{{ template_dir }}/scripts/Installers/Install-Vsix.ps1",
"{{ template_dir }}/scripts/Installers/Install-AzureCli.ps1",
"{{ template_dir }}/scripts/Installers/Install-AzureDevOpsCli.ps1",
"{{ template_dir }}/scripts/Installers/Install-NodeLts.ps1",
"{{ template_dir }}/scripts/Installers/Install-CommonUtils.ps1",
"{{ template_dir }}/scripts/Installers/Install-JavaTools.ps1"
]
},
{
"type": "windows-restart",
"restart_timeout": "10m"
},
{
"type": "windows-shell",
"inline": [
"wmic product where \"name like '%%microsoft azure powershell%%'\" call uninstall /nointeractive"
]
},
{
"type": "powershell",
"scripts": [
"{{ template_dir }}/scripts/Installers/Install-Ruby.ps1",
"{{ template_dir }}/scripts/Installers/Install-PyPy.ps1",
"{{ template_dir }}/scripts/Installers/Install-Toolset.ps1",
"{{ template_dir }}/scripts/Installers/Configure-Toolset.ps1",
"{{ template_dir }}/scripts/Installers/Install-AndroidSDK.ps1",
"{{ template_dir }}/scripts/Installers/Install-AzureModules.ps1",
"{{ template_dir }}/scripts/Installers/Install-Pipx.ps1",
"{{ template_dir }}/scripts/Installers/Install-PipxPackages.ps1",
"{{ template_dir }}/scripts/Installers/Install-Git.ps1",
"{{ template_dir }}/scripts/Installers/Install-GitHub-CLI.ps1",
"{{ template_dir }}/scripts/Installers/Install-PHP.ps1",
"{{ template_dir }}/scripts/Installers/Install-Rust.ps1",
"{{ template_dir }}/scripts/Installers/Install-Chrome.ps1",
"{{ template_dir }}/scripts/Installers/Install-Edge.ps1",
"{{ template_dir }}/scripts/Installers/Install-Firefox.ps1",
"{{ template_dir }}/scripts/Installers/Install-Selenium.ps1",
"{{ template_dir }}/scripts/Installers/Install-IEWebDriver.ps1",
"{{ template_dir }}/scripts/Installers/Install-Apache.ps1",
"{{ template_dir }}/scripts/Installers/Install-Nginx.ps1",
"{{ template_dir }}/scripts/Installers/Install-Msys2.ps1",
"{{ template_dir }}/scripts/Installers/Install-WinAppDriver.ps1",
"{{ template_dir }}/scripts/Installers/Install-R.ps1",
"{{ template_dir }}/scripts/Installers/Install-AWS.ps1",
"{{ template_dir }}/scripts/Installers/Install-DACFx.ps1",
"{{ template_dir }}/scripts/Installers/Install-MysqlCli.ps1",
"{{ template_dir }}/scripts/Installers/Install-SQLPowerShellTools.ps1",
"{{ template_dir }}/scripts/Installers/Install-DotnetSDK.ps1",
"{{ template_dir }}/scripts/Installers/Install-Mingw64.ps1",
"{{ template_dir }}/scripts/Installers/Install-Haskell.ps1",
"{{ template_dir }}/scripts/Installers/Install-Stack.ps1",
"{{ template_dir }}/scripts/Installers/Install-AzureCosmosDbEmulator.ps1",
"{{ template_dir }}/scripts/Installers/Install-Mercurial.ps1",
"{{ template_dir }}/scripts/Installers/Install-Zstd.ps1",
"{{ template_dir }}/scripts/Installers/Install-Vcpkg.ps1",
"{{ template_dir }}/scripts/Installers/Install-PostgreSQL.ps1",
"{{ template_dir }}/scripts/Installers/Install-Bazel.ps1",
"{{ template_dir }}/scripts/Installers/Install-AliyunCli.ps1",
"{{ template_dir }}/scripts/Installers/Install-RootCA.ps1",
"{{ template_dir }}/scripts/Installers/Install-MongoDB.ps1",
"{{ template_dir }}/scripts/Installers/Install-CodeQLBundle.ps1",
"{{ template_dir }}/scripts/Installers/Disable-JITDebugger.ps1",
"{{ template_dir }}/scripts/Installers/Run-NGen.ps1"
]
},
{
"type": "powershell",
"scripts": [
"{{ template_dir }}/scripts/Installers/Install-WindowsUpdates.ps1",
"{{ template_dir }}/scripts/Installers/Configure-DynamicPort.ps1",
"{{ template_dir }}/scripts/Installers/Configure-GDIProcessHandleQuota.ps1",
"{{ template_dir }}/scripts/Installers/Configure-Shell.ps1",
"{{ template_dir }}/scripts/Installers/Enable-DeveloperMode.ps1"
],
"elevated_user": "{{user `install_user`}}",
"elevated_password": "{{user `install_password`}}"
},
{
"type": "windows-restart",
"restart_timeout": "30m"
},
{
"type": "powershell",
"scripts": [
"{{ template_dir }}/scripts/Tests/RunAll-Tests.ps1"
]
},
{
"type": "powershell",
"inline": [
"pwsh -File '{{user `image_folder`}}\\SoftwareReport\\SoftwareReport.Generator.ps1'"
],
"environment_vars": [
"IMAGE_VERSION={{user `image_version`}}"
]
},
{
"type": "file",
"source": "C:\\InstalledSoftware.md",
"destination": "{{ template_dir }}/Windows2022-Readme.md",
"direction": "download"
},
{
"type": "powershell",
"scripts": [
"{{ template_dir }}/scripts/Installers/Finalize-VM.ps1"
]
},
{
"type": "windows-restart",
"restart_timeout": "10m"
},
{
"type": "powershell",
"inline": [
"if( Test-Path $Env:SystemRoot\\System32\\Sysprep\\unattend.xml ){ rm $Env:SystemRoot\\System32\\Sysprep\\unattend.xml -Force}",
"& $env:SystemRoot\\System32\\Sysprep\\Sysprep.exe /oobe /generalize /quiet /quit",
"while($true) { $imageState = Get-ItemProperty HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Setup\\State | Select ImageState; if($imageState.ImageState -ne 'IMAGE_STATE_GENERALIZE_RESEAL_TO_OOBE') { Write-Output $imageState.ImageState; Start-Sleep -s 10 } else { break } }"
]
}
]
}