Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add rotation between the two mariner images #17277

Merged
merged 3 commits into from May 6, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
29 changes: 25 additions & 4 deletions .vsts-ci/linux.yml
Expand Up @@ -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
Expand Down