Add rotation between the two mariner images (#17277)

* Add rotation between the two mariner images

* Add comments and fix issues

* select the tag that works with test-deps
This commit is contained in:
Travis Plunk
2022-05-06 11:24:24 -07:00
committed by GitHub
parent e08edcb82d
commit c000fc5430
+25 -4
View File
@@ -116,20 +116,41 @@ stages:
clean: true
- pwsh: |
# For PRs set the seed to the PR number so that the image is always the same
$seed = $env:SYSTEM_PULLREQUEST_PULLREQUESTID
if(!$seed) {
# for non-PRs use the integer identifier of the build as the seed.
$seed = $env:SYSTEM_BUILD_BUILDID
}
Write-Verbose "Seed: $seed" -Verbose
# Get the latest image matrix JSON for preview
$matrix = ./PowerShell-Docker/build.ps1 -GenerateMatrixJson -FullJson -Channel preview | ConvertFrom-Json
# Filter out containers that won't run on AzDevOps Linux host as an agent
# Windows, nano server, alpine, and any ARM image
$linuxImages = $matrix.preview |
Where-Object {$_.osversion -notmatch 'windows|nano|alpine|arm'} |
Select-Object JobName, Taglist |
Sort-Object -property JobName
# Force mariner for now, later we will add automated rotation by the month.
# Force mariner for now
$marinerImage = $linuxImages | where-object {$_.JobName -like 'mariner*'}
Import-Module ./PowerShell/tools/ci.psm1
$tag = $marinerImage.Taglist -split ';' | select-object -first 1
# Use the selected seed to pick a container
$index = Get-Random -Minimum 0 -Maximum $marinerImage.Count -SetSeed $seed
$selectedImage = $marinerImage[$index]
# Filter to the first test-deps compatible tag
$tag = $selectedImage.Taglist -split ';' | Where-Object {$_ -match 'preview-\D+'} | Select-Object -First 1
# Calculate the container name
$containerName = "mcr.microsoft.com/powershell/test-deps:$tag"
# Set variables for later jobs to use
Import-Module ./PowerShell/tools/ci.psm1
Set-BuildVariable -Name containerName -Value $containerName -IsOutput
Set-BuildVariable -Name containerBuildName -Value $marinerImage.JobName -IsOutput
Set-BuildVariable -Name containerBuildName -Value $selectedImage.JobName -IsOutput
name: getContainerTask
displayName: Get Container
continueOnError: true