File tree Expand file tree Collapse file tree 8 files changed +32
-19
lines changed Expand file tree Collapse file tree 8 files changed +32
-19
lines changed Original file line number Diff line number Diff line change 11# !/usr/bin/env pwsh
22
33# Load common image names
4- Get-Content $PSScriptRoot / templates/ variables/ docker- images.yml |
5- Where-Object { $_.Trim () -notlike ' variables:' } |
6- ForEach-Object {
7- $parts = $_.Split (' :' , 2 )
8- Set-Variable - Name $parts [0 ].Trim() - Value $parts [1 ].Trim() - Scope Global
4+ $imageNameVars = & $PSScriptRoot / Get-ImageNameVars.ps1
5+ foreach ($varName in $imageNameVars.Keys ) {
6+ Set-Variable - Name $varName - Value $imageNameVars [$varName ] - Scope Global
97}
108
11- & docker inspect ${imageNames.imagebuilder } | Out-Null
9+ & docker inspect ${imageNames.imagebuilderName } | Out-Null
1210if (-not $? ) {
1311 Write-Output " Pulling"
14- & $PSScriptRoot / Invoke-WithRetry.ps1 " docker pull ${imageNames.imagebuilder } "
12+ & $PSScriptRoot / Invoke-WithRetry.ps1 " docker pull ${imageNames.imagebuilderName } "
1513}
Original file line number Diff line number Diff line change 1+ # Returns a hashtable of variable name-to-value mapping representing the image name variables
2+ # used by the common build infrastructure.
3+
4+ $vars = @ {}
5+ Get-Content $PSScriptRoot / templates/ variables/ docker- images.yml |
6+ Where-Object { $_.Trim ().Length -gt 0 -and $_.Trim () -notlike ' variables:' -and $_.Trim () -notlike ' # *' } |
7+ ForEach-Object {
8+ $parts = $_.Split (' :' , 2 )
9+ $vars [$parts [0 ].Trim ()] = $parts [1 ].Trim()
10+ }
11+
12+ return $vars
Original file line number Diff line number Diff line change @@ -40,14 +40,16 @@ if (!(Test-Path $DotnetInstallScriptPath)) {
4040 & " $PSScriptRoot /Invoke-WithRetry.ps1" " Invoke-WebRequest 'https://dot.net/v1/$DotnetInstallScript ' -OutFile $DotnetInstallScriptPath "
4141}
4242
43+ $DotnetChannel = " 6.0"
44+
4345$InstallFailed = $false
4446if ($IsRunningOnUnix ) {
4547 & chmod + x $DotnetInstallScriptPath
46- & $DotnetInstallScriptPath -- version " latest " -- install-dir $InstallPath
48+ & $DotnetInstallScriptPath -- channel $DotnetChannel -- install-dir $InstallPath
4749 $InstallFailed = ($LASTEXITCODE -ne 0 )
4850}
4951else {
50- & $DotnetInstallScriptPath - Version " latest " - InstallDir $InstallPath
52+ & $DotnetInstallScriptPath - Channel $DotnetChannel - InstallDir $InstallPath
5153 $InstallFailed = (-not $? )
5254}
5355
Original file line number Diff line number Diff line change @@ -7,16 +7,14 @@ docker volume prune -f
77
88# Preserve the tagged Windows base images and the common eng infra images (e.g. ImageBuilder)
99# to avoid the expense of having to repull continuously.
10- $engInfraImages = Get-Content $PSScriptRoot / templates/ variables/ docker- images.yml |
11- Where-Object { $_.Trim () -notlike ' variables:' } |
12- ForEach-Object { $_.Split (' ' , [System.StringSplitOptions ]::RemoveEmptyEntries)[1 ] }
10+ $imageNameVars = & $PSScriptRoot / Get-ImageNameVars.ps1
1311
14- docker images -- format " {{.Repository}}:{{.Tag}} {{.ID}}" |
12+ docker images -- format " {{.Repository}}:{{.Tag}} {{.ID}}" |
1513 Where-Object {
1614 $localImage = $_
1715 $localImage.Contains (" :<none> " )`
1816 -Or -Not ($localImage.StartsWith (" mcr.microsoft.com/windows" )`
19- -Or ($engInfraImages .Where ({ $localImage.StartsWith ($_ ) }, ' First' ).Count -gt 0 )) } |
17+ -Or ($imageNameVars .Values .Where ({ $localImage.StartsWith ($_ ) }, ' First' ).Count -gt 0 )) } |
2018 ForEach-Object { $_.Split (' ' , [System.StringSplitOptions ]::RemoveEmptyEntries)[1 ] } |
2119 Select-Object - Unique |
2220 ForEach-Object { docker rmi -f $_ }
Original file line number Diff line number Diff line change 6666 if ($ReuseImageBuilderImage -ne $True ) {
6767 & ./ eng/ common/ Get-ImageBuilder.ps1
6868 Exec (" docker build -t $imageBuilderImageName --build-arg " `
69- + " IMAGE=${imageNames.imagebuilder } -f eng/common/Dockerfile.WithRepo ." )
69+ + " IMAGE=${imageNames.imageBuilderName } -f eng/common/Dockerfile.WithRepo ." )
7070 }
7171
7272 $imageBuilderCmd = " docker run --name $imageBuilderContainerName -v /var/run/docker.sock:/var/run/docker.sock $imageBuilderImageName "
7878 $imageBuilderCmd = [System.IO.Path ]::Combine($imageBuilderFolder , " Microsoft.DotNet.ImageBuilder.exe" )
7979 if (-not (Test-Path - Path " $imageBuilderCmd " - PathType Leaf)) {
8080 & ./ eng/ common/ Get-ImageBuilder.ps1
81- Exec " docker create --name $imageBuilderContainerName ${imageNames.imagebuilder } "
81+ Exec " docker create --name $imageBuilderContainerName ${imageNames.imageBuilderName } "
8282 $containerCreated = $true
8383 if (Test-Path - Path $imageBuilderFolder )
8484 {
Original file line number Diff line number Diff line change 2020 optionalTestArgs="$optionalTestArgs -TestCategories pre-build"
2121 else
2222 if [ "${{ variables['System.TeamProject'] }}" == "${{ parameters.internalProjectName }}" ] && [ "${{ variables['Build.Reason'] }}" != "PullRequest" ]; then
23- optionalTestArgs="$optionalTestArgs -PullImages -Registry $(acr.server) -RepoPrefix $(stagingRepoPrefix) -ImageInfoPath $(artifactsPath)/image-info/image-info .json"
23+ optionalTestArgs="$optionalTestArgs -PullImages -Registry $(acr.server) -RepoPrefix $(stagingRepoPrefix) -ImageInfoPath $(artifactsPath)/image-info.json"
2424 fi
2525 if [ "$REPOTESTARGS" != "" ]; then
2626 optionalTestArgs="$optionalTestArgs $REPOTESTARGS"
4949 - template : ../steps/download-build-artifact.yml
5050 parameters :
5151 targetPath : $(Build.ArtifactStagingDirectory)
52+ artifactName : image-info
5253 condition : ${{ parameters.condition }}
5354- template : parse-test-arg-arrays.yml
5455- powershell : >
Original file line number Diff line number Diff line change 1717 - ${{ parameters.customInitSteps }}
1818- powershell : |
1919 if ("${{ variables['System.TeamProject'] }}" -eq "${{ parameters.internalProjectName }}" -and "${{ variables['Build.Reason'] }}" -ne "PullRequest") {
20- $optionalTestArgs="$optionalTestArgs -PullImages -Registry $env:ACR_SERVER -RepoPrefix $env:STAGINGREPOPREFIX -ImageInfoPath $(artifactsPath)/image-info/image-info .json"
20+ $optionalTestArgs="$optionalTestArgs -PullImages -Registry $env:ACR_SERVER -RepoPrefix $env:STAGINGREPOPREFIX -ImageInfoPath $(artifactsPath)/image-info.json"
2121 }
2222 if ($env:REPOTESTARGS) {
2323 $optionalTestArgs += " $env:REPOTESTARGS"
3232 - template : ../steps/download-build-artifact.yml
3333 parameters :
3434 targetPath : $(Build.ArtifactStagingDirectory)
35+ artifactName : image-info
3536 condition : ${{ parameters.condition }}
3637- template : parse-test-arg-arrays.yml
3738- powershell : >
Original file line number Diff line number Diff line change 11variables :
2- imageNames.imageBuilder : mcr.microsoft.com/dotnet-buildtools/image-builder:2017609
2+ imageNames.imageBuilderName : mcr.microsoft.com/dotnet-buildtools/image-builder:2057093
3+ imageNames.imageBuilder : $(imageNames.imageBuilderName)
34 imageNames.imageBuilder.withrepo : imagebuilder-withrepo:$(Build.BuildId)-$(System.JobId)
45 imageNames.testRunner : mcr.microsoft.com/dotnet-buildtools/prereqs:debian-buster-slim-docker-testrunner-974165
56 imageNames.testRunner.withrepo : testrunner-withrepo:$(Build.BuildId)-$(System.JobId)
You can’t perform that action at this time.
0 commit comments