diff --git a/.vsts-ci/manifestSteps.yml b/.vsts-ci/manifestSteps.yml index 4d1cc63f3..0b971a5bc 100644 --- a/.vsts-ci/manifestSteps.yml +++ b/.vsts-ci/manifestSteps.yml @@ -7,6 +7,10 @@ steps: - powershell: 'Get-ChildItem env:' displayName: 'Capture Environment' +- pwsh: | + $PSVersionTable + displayName: Capture pwsh Version + - powershell: | $dockerConfigFolder = "$env:userprofile/.docker" if(!(Test-Path $dockerConfigFolder)){ $null = new-item -Type Directory -Path $dockerConfigFolder} diff --git a/.vsts-ci/templatesReleasePipeline/releaseJob.yml b/.vsts-ci/templatesReleasePipeline/releaseJob.yml index c169e70a8..385e9f42d 100644 --- a/.vsts-ci/templatesReleasePipeline/releaseJob.yml +++ b/.vsts-ci/templatesReleasePipeline/releaseJob.yml @@ -102,6 +102,7 @@ jobs: } } displayName: 'release - $(channel) - $(imagename)' + condition: and( succeeded(), ne(variables['Channel'],'')) - pwsh: 'az logout' displayName: 'az logout' diff --git a/.vsts-ci/templatesReleasePipeline/testJob.yml b/.vsts-ci/templatesReleasePipeline/testJob.yml index 38f1417db..bbeb35d9e 100644 --- a/.vsts-ci/templatesReleasePipeline/testJob.yml +++ b/.vsts-ci/templatesReleasePipeline/testJob.yml @@ -84,6 +84,8 @@ jobs: } .\build.ps1 -test -Channel $(Channel) -Pull -ImageName $(dockerHost) -name '$(ImageName)' -Version $(Version) -TestLogPostfix windows-$(Channel) -Repository $(dockerNamespace)/powershell @extraParams displayName: 'Run Tests for $(Channel) - $(ImageName)' + condition: and( succeeded(), ne(variables['Channel'],'')) + - task: PublishTestResults@2 displayName: 'Publish Test Results **/test*.xml' diff --git a/.vsts-ci/templatesReleasePipeline/testStage.yml b/.vsts-ci/templatesReleasePipeline/testStage.yml index b6a97d5ba..0b96d1457 100644 --- a/.vsts-ci/templatesReleasePipeline/testStage.yml +++ b/.vsts-ci/templatesReleasePipeline/testStage.yml @@ -53,7 +53,7 @@ stages: - template: ./testJob.yml parameters: - jobName: ${{ parameters.channel }}_linux + jobName: ${{ parameters.channel }}_linux_arm64 matrix: dependencies.GenerateYaml_${{ parameters.channel }}.outputs['matrix.matrix_${{ parameters.channel }}_linux_arm64'] vmImage: ubuntu-latest dependsOn: @@ -61,9 +61,9 @@ stages: - template: ./testJob.yml parameters: - jobName: ${{ parameters.channel }}_linux + jobName: ${{ parameters.channel }}_linux_arm32 matrix: dependencies.GenerateYaml_${{ parameters.channel }}.outputs['matrix.matrix_${{ parameters.channel }}_linux_arm32'] vmImage: ubuntu-latest dependsOn: - GenerateYaml_${{ parameters.channel }} - + diff --git a/build.ps1 b/build.ps1 index 97b620e99..b98e2a5fd 100755 --- a/build.ps1 +++ b/build.ps1 @@ -668,10 +668,25 @@ End { if ($GenerateManifestLists.IsPresent) { $manifestLists = @() $tags = @() + foreach ($repo in $tagGroups.Keys | Sort-Object) { $channelGroups = $tagGroups.$repo | Group-Object -Property Channel foreach ($channelGroup in $channelGroups) { $channelName = $channelGroup.Name + switch($channelName) { + 'stable' { + $channelTag = 'latest' + $channelTagPrefix = '' + $channelTagPostfix = '' + } + + default { + $channelTag = $channelName.ToLower() + $channelTagPrefix = $channelTag + '-' + $channelTagPostfix = '-' + $channelTag + } + } + Write-Verbose "generating $channelName json" $osGroups = $channelGroup.Group | Group-Object -Property os foreach ($osGroup in $osGroups) { @@ -681,14 +696,31 @@ End { foreach ($tag in $osGroup.Group | Where-Object { $_.Name -notlike '*/*' } | Sort-Object -Property ManifestLists) { if ($tag.ManifestLists) { foreach ($manifestList in $tag.ManifestLists) { + $originalManifestList = $manifestList + if ($manifestList -notlike '*${channel*') { + Write-Warning "Issue found with $osName $manifestList $($tag.Tags)" + throw 'ManifestLists entries must contain on of: ${channelTag} ${channelTagPrefix} ${channelTagPostfix}' + } + + $manifestList = $manifestList -replace '\${channelTag}', $channelTag + $manifestList = $manifestList -replace '\${channelTagPrefix}', $channelTagPrefix + $manifestList = $manifestList -replace '\${channelTagPostfix}', $channelTagPostfix + + if (!$manifestList) { + throw "error formatting $originalManifestList" + } if ($manifestLists -notcontains $manifestList) { $manifestLists += $manifestList } - $tag | Add-Member -MemberType NoteProperty -Value $repo -Name 'Repo' - - $tags += $tag + $tags += [PSCustomObject]@{ + Repo = $repo + FormattedManifestList = $manifestList + Tags = $tag.Tags + Channel = $tag.Channel + ContinueOnError = $tag.ContinueOnError + } } } } @@ -707,7 +739,7 @@ End { Repo = "" } - foreach ($tag in $tags | Where-Object { $_.ManifestLists -contains $manifestList }) { + foreach ($tag in $tags | Where-Object { $_.FormattedManifestList -eq $manifestList }) { if (-not $matrix.ContainsKey($manifestList)) { $matrix.Add($manifestList, @{ }) } diff --git a/createManifest.ps1 b/createManifest.ps1 index 21c2bea2b..dd88e6215 100644 --- a/createManifest.ps1 +++ b/createManifest.ps1 @@ -27,26 +27,31 @@ param( [switch] $SkipPush - ) $first = $true $manifestList = @() foreach($tag in $TagList) { + $arguments = @() $amend = "" if (!$first) { - $amend = '--amend' + $arguments += '--amend' } + $arguments += @( + "$ContainerRegistry/${Image}:$ManifestTag" + "$ContainerRegistry/${Image}:$tag" + ) - Write-Verbose -Message "running: docker manifest create $ammend $ContainerRegistry/${Image}:$ManifestTag $ContainerRegistry/${Image}:$tag" -Verbose - docker manifest create $amend $ContainerRegistry/${Image}:$ManifestTag "$ContainerRegistry/${Image}:$tag" + Write-Verbose -Message "running: docker manifest create $arguments" -Verbose + docker manifest create $arguments $first = $false } # Create the manifest # Inspect (print) the manifest +Write-Verbose -Verbose "capturing the manifest..." docker manifest inspect $ContainerRegistry/${Image}:$ManifestTag # push the manifest diff --git a/release/7-2/nanoserver1809/meta.json b/release/7-2/nanoserver1809/meta.json index b4fa7370d..c1afec468 100644 --- a/release/7-2/nanoserver1809/meta.json +++ b/release/7-2/nanoserver1809/meta.json @@ -12,7 +12,7 @@ "nanoserver-#shorttag#" ], "manifestLists": [ - "nanoserver" + "${channelTagPrefix}nanoserver" ], "Base64EncodePackageUrl": true, "TestProperties": { diff --git a/release/7-2/nanoserver2022/meta.json b/release/7-2/nanoserver2022/meta.json index 3709f4f92..5116529ef 100644 --- a/release/7-2/nanoserver2022/meta.json +++ b/release/7-2/nanoserver2022/meta.json @@ -12,7 +12,7 @@ "nanoserver-#shorttag#" ], "manifestLists": [ - "nanoserver" + "${channelTagPrefix}nanoserver" ], "Base64EncodePackageUrl": true, "TestProperties": { diff --git a/release/7-2/ubi8/meta.json b/release/7-2/ubi8/meta.json index aa635e425..d8571be22 100644 --- a/release/7-2/ubi8/meta.json +++ b/release/7-2/ubi8/meta.json @@ -12,7 +12,8 @@ {"Tag": "8"} ], "manifestLists": [ - "ubi" + "ubi${channelTagPostfix}", + "${channelTagPrefix}ubi" ], "SubImage": "test-deps", "TestProperties": { diff --git a/release/7-2/ubuntu22.04-arm32v7/meta.json b/release/7-2/ubuntu22.04-arm32v7/meta.json index 0c6ffb5aa..773901f31 100644 --- a/release/7-2/ubuntu22.04-arm32v7/meta.json +++ b/release/7-2/ubuntu22.04-arm32v7/meta.json @@ -20,7 +20,7 @@ "Arm32": true }, "manifestLists": [ - "latest" + "${channelTag}" ], "EndOfLife": "2023-04-02", "DistributionState": "Validated", diff --git a/release/7-2/ubuntu22.04/meta.json b/release/7-2/ubuntu22.04/meta.json index 6b3dbc7e5..24f17ee5c 100644 --- a/release/7-2/ubuntu22.04/meta.json +++ b/release/7-2/ubuntu22.04/meta.json @@ -13,7 +13,7 @@ {"Tag": "22.04"} ], "manifestLists": [ - "latest" + "${channelTag}" ], "TestProperties": { "size": 343 diff --git a/release/7-2/windowsserver2022/meta.json b/release/7-2/windowsserver2022/meta.json index 78225539d..e3be58233 100644 --- a/release/7-2/windowsserver2022/meta.json +++ b/release/7-2/windowsserver2022/meta.json @@ -13,7 +13,7 @@ "windowsserver-#shorttag#" ], "manifestLists": [ - "windowsserver" + "${channelTagPrefix}windowsserver" ], "TestProperties": { "size": 1 diff --git a/release/7-2/windowsservercore2022/meta.json b/release/7-2/windowsservercore2022/meta.json index 1a97e0576..e6e79d052 100644 --- a/release/7-2/windowsservercore2022/meta.json +++ b/release/7-2/windowsservercore2022/meta.json @@ -13,7 +13,7 @@ "windowsservercore-#shorttag#" ], "manifestLists": [ - "latest" + "${channelTag}" ], "TestProperties": { "size": 1 diff --git a/release/7-3/mariner2-arm64/meta.json b/release/7-3/mariner2-arm64/meta.json index 418d3850b..70a0f00f6 100644 --- a/release/7-3/mariner2-arm64/meta.json +++ b/release/7-3/mariner2-arm64/meta.json @@ -12,7 +12,7 @@ ], "TestProperties": { "size": 404, - "arm64": true + "Arm32": true }, "EndOfLife": "2023-12-14", "DistributionState": "Validating", diff --git a/release/7-3/nanoserver2022/meta.json b/release/7-3/nanoserver2022/meta.json index 91b80f257..f87ab883e 100644 --- a/release/7-3/nanoserver2022/meta.json +++ b/release/7-3/nanoserver2022/meta.json @@ -9,7 +9,7 @@ ], "ShortDistroName": "nanoserver", "manifestLists": [ - "nanoserver" + "${channelTagPrefix}nanoserver" ], "Base64EncodePackageUrl": true, "TestProperties": { diff --git a/release/7-3/ubi9/meta.json b/release/7-3/ubi9/meta.json index 3c067062b..cf260a311 100644 --- a/release/7-3/ubi9/meta.json +++ b/release/7-3/ubi9/meta.json @@ -9,7 +9,8 @@ {"Tag": "9"} ], "manifestLists": [ - "ubi-preview" + "ubi${channelTagPostfix}", + "${channelTagPrefix}ubi" ], "SubImage": "test-deps", "TestProperties": { diff --git a/release/7-3/ubuntu22.04-arm32v7/meta.json b/release/7-3/ubuntu22.04-arm32v7/meta.json index 66eb4370a..e846f4518 100644 --- a/release/7-3/ubuntu22.04-arm32v7/meta.json +++ b/release/7-3/ubuntu22.04-arm32v7/meta.json @@ -16,7 +16,7 @@ "Arm32": true }, "manifestLists": [ - "preview" + "${channelTag}" ], "EndOfLife": "2023-04-02", "DistributionState": "Validated", diff --git a/release/7-3/ubuntu22.04/meta.json b/release/7-3/ubuntu22.04/meta.json index 6aed4183b..647fa3c84 100644 --- a/release/7-3/ubuntu22.04/meta.json +++ b/release/7-3/ubuntu22.04/meta.json @@ -10,7 +10,7 @@ {"Tag": "22.04"} ], "manifestLists": [ - "preview" + "${channelTag}" ], "TestProperties": { "size": 338 diff --git a/release/7-3/windowsserver2022/meta.json b/release/7-3/windowsserver2022/meta.json index 1be0aa667..de7049fef 100644 --- a/release/7-3/windowsserver2022/meta.json +++ b/release/7-3/windowsserver2022/meta.json @@ -10,7 +10,7 @@ "Base64EncodePackageUrl": true, "ShortDistroName": "windowsserver", "manifestLists": [ - "windowsserver" + "${channelTagPrefix}windowsserver" ], "TestProperties": { "size": 1 diff --git a/release/7-3/windowsservercore2022/meta.json b/release/7-3/windowsservercore2022/meta.json index 849bbfb0d..a1b9c11ce 100644 --- a/release/7-3/windowsservercore2022/meta.json +++ b/release/7-3/windowsservercore2022/meta.json @@ -8,7 +8,7 @@ } ], "manifestLists": [ - "preview" + "${channelTag}" ], "Base64EncodePackageUrl": true, "ShortDistroName": "windowsservercore", diff --git a/release/7-4/mariner2-arm64/meta.json b/release/7-4/mariner2-arm64/meta.json index c2faa5f89..c586b4a90 100644 --- a/release/7-4/mariner2-arm64/meta.json +++ b/release/7-4/mariner2-arm64/meta.json @@ -12,7 +12,7 @@ ], "TestProperties": { "size": 404, - "arm64": true + "Arm32": true }, "EndOfLife": "2023-12-14", "DistributionState": "Validating", diff --git a/release/7-4/ubi9/meta.json b/release/7-4/ubi9/meta.json index 3c067062b..cf260a311 100644 --- a/release/7-4/ubi9/meta.json +++ b/release/7-4/ubi9/meta.json @@ -9,7 +9,8 @@ {"Tag": "9"} ], "manifestLists": [ - "ubi-preview" + "ubi${channelTagPostfix}", + "${channelTagPrefix}ubi" ], "SubImage": "test-deps", "TestProperties": { diff --git a/release/7-4/ubuntu22.04-arm32v7/meta.json b/release/7-4/ubuntu22.04-arm32v7/meta.json index 66eb4370a..e846f4518 100644 --- a/release/7-4/ubuntu22.04-arm32v7/meta.json +++ b/release/7-4/ubuntu22.04-arm32v7/meta.json @@ -16,7 +16,7 @@ "Arm32": true }, "manifestLists": [ - "preview" + "${channelTag}" ], "EndOfLife": "2023-04-02", "DistributionState": "Validated", diff --git a/release/7-4/ubuntu22.04/meta.json b/release/7-4/ubuntu22.04/meta.json index 6aed4183b..647fa3c84 100644 --- a/release/7-4/ubuntu22.04/meta.json +++ b/release/7-4/ubuntu22.04/meta.json @@ -10,7 +10,7 @@ {"Tag": "22.04"} ], "manifestLists": [ - "preview" + "${channelTag}" ], "TestProperties": { "size": 338 diff --git a/release/7-4/windowsserver2022/meta.json b/release/7-4/windowsserver2022/meta.json index 1be0aa667..de7049fef 100644 --- a/release/7-4/windowsserver2022/meta.json +++ b/release/7-4/windowsserver2022/meta.json @@ -10,7 +10,7 @@ "Base64EncodePackageUrl": true, "ShortDistroName": "windowsserver", "manifestLists": [ - "windowsserver" + "${channelTagPrefix}windowsserver" ], "TestProperties": { "size": 1 diff --git a/release/7-4/windowsservercore2022/meta.json b/release/7-4/windowsservercore2022/meta.json index 849bbfb0d..a1b9c11ce 100644 --- a/release/7-4/windowsservercore2022/meta.json +++ b/release/7-4/windowsservercore2022/meta.json @@ -8,7 +8,7 @@ } ], "manifestLists": [ - "preview" + "${channelTag}" ], "Base64EncodePackageUrl": true, "ShortDistroName": "windowsservercore", diff --git a/release/unstable/7-4/nanoserver2022/meta.json b/release/unstable/7-4/nanoserver2022/meta.json index 91b80f257..f87ab883e 100644 --- a/release/unstable/7-4/nanoserver2022/meta.json +++ b/release/unstable/7-4/nanoserver2022/meta.json @@ -9,7 +9,7 @@ ], "ShortDistroName": "nanoserver", "manifestLists": [ - "nanoserver" + "${channelTagPrefix}nanoserver" ], "Base64EncodePackageUrl": true, "TestProperties": { diff --git a/release/community-stable/amazonlinux/docker/Dockerfile b/release/unstable/amazonlinux/docker/Dockerfile similarity index 100% rename from release/community-stable/amazonlinux/docker/Dockerfile rename to release/unstable/amazonlinux/docker/Dockerfile diff --git a/release/community-stable/amazonlinux/meta.json b/release/unstable/amazonlinux/meta.json similarity index 100% rename from release/community-stable/amazonlinux/meta.json rename to release/unstable/amazonlinux/meta.json diff --git a/release/community-stable/amazonlinux/test-deps/docker/Dockerfile b/release/unstable/amazonlinux/test-deps/docker/Dockerfile similarity index 100% rename from release/community-stable/amazonlinux/test-deps/docker/Dockerfile rename to release/unstable/amazonlinux/test-deps/docker/Dockerfile diff --git a/release/community-stable/amazonlinux/test-deps/meta.json b/release/unstable/amazonlinux/test-deps/meta.json similarity index 100% rename from release/community-stable/amazonlinux/test-deps/meta.json rename to release/unstable/amazonlinux/test-deps/meta.json diff --git a/tools/buildHelper/buildHelper.psm1 b/tools/buildHelper/buildHelper.psm1 index d24c8d49e..dc4aa9e5e 100644 --- a/tools/buildHelper/buildHelper.psm1 +++ b/tools/buildHelper/buildHelper.psm1 @@ -266,7 +266,7 @@ class DockerImageMetaData { [bool] $ContinueOnError = $false - [string] + [string[]] $ManifestLists = @() [bool] diff --git a/tools/buildHelper/channels.json b/tools/buildHelper/channels.json index f42d923a4..c23778e5b 100644 --- a/tools/buildHelper/channels.json +++ b/tools/buildHelper/channels.json @@ -18,11 +18,5 @@ "tagPrefix": "lts", "pwshInstallVersion": "7-lts", "packageTag": "-lts" - }, - { - "name": "community-stable", - "path": "release/community-stable", - "pwshInstallVersion": "7", - "packageTag": "" } ] diff --git a/unittests/generateManifestLists.tests.ps1 b/unittests/generateManifestLists.tests.ps1 index 84a12edca..92bdc3a8c 100644 --- a/unittests/generateManifestLists.tests.ps1 +++ b/unittests/generateManifestLists.tests.ps1 @@ -13,4 +13,24 @@ Describe "build.ps1 -GenerateManifestLists" { $json | Should -Not -BeNullOrEmpty $json | ConvertFrom-Json -AsHashtable | Should -Not -BeNullOrEmpty } + + It "Each tag should only be in one channel" { + $json = & $buildScript -GenerateManifestLists -Channel stable, preview, lts -OsFilter All | ConvertFrom-Json + $tags = @{} + $json | ForEach-Object { + $channel = $_.channel + foreach ($tag in $_.tags) { + if (!$tags.ContainsKey($tag)) { + $tags[$tag] = @() + } + if ($tags[$tag] -notcontains $channel) { + $tags[$tag] += $channel + } + } + } + + foreach($tag in $tags.Keys) { + $tags.$tag.count | should -Be 1 -Because "$Tag should not be in multiple channels ($($tags.$tag))" + } + } } diff --git a/vsts-ci.yml b/vsts-ci.yml index c0cabc51a..eaa796fb5 100644 --- a/vsts-ci.yml +++ b/vsts-ci.yml @@ -31,10 +31,6 @@ stages: - template: .vsts-ci/stage.yml parameters: channel: lts - - template: .vsts-ci/stage.yml - parameters: - channel: community-stable - jobName: community_stable - stage: CheckForDuplicateTags displayName: Check for duplicate tags