Skip to content

Commit e4a4388

Browse files
[main] Update common Docker engineering infrastructure with latest (#7085)
1 parent 56b2820 commit e4a4388

6 files changed

Lines changed: 44 additions & 14 deletions

File tree

eng/docker-tools/CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,23 @@ Service connections are now referenced per-job via
2626

2727
## 2026-03-04: Pre-build validation gated by `preBuildTestScriptPath` variable
2828

29+
- Pull request: [#1997](https://github.com/dotnet/docker-tools/pull/1997)
30+
2931
The `PreBuildValidation` job condition now checks the new `preBuildTestScriptPath` variable instead of `testScriptPath`.
3032
This allows repos to independently control whether pre-build validation runs, without affecting functional tests.
3133

3234
The new variable defaults to `$(testScriptPath)`, so existing repos that have pre-build tests are not affected.
3335
Repos that do not have pre-build tests can set `preBuildTestScriptPath` to `""` to skip the job entirely.
3436

37+
### Update (2026-03-11): Use `preBuildTestScriptPath` for test execution
38+
39+
- Pull request: [#2011](https://github.com/dotnet/docker-tools/pull/2011)
40+
41+
The `PreBuildValidation` job now uses `preBuildTestScriptPath` for test execution instead of `testScriptPath`.
42+
Previously, the job condition was gated on `preBuildTestScriptPath` but the test execution step still used `testScriptPath`,
43+
which meant PreBuildValidation could not be enabled independently when `testScriptPath` was empty.
44+
Repos that do not have pre-build tests can set `preBuildTestScriptPath` to `""` to skip the job entirely.
45+
3546
---
3647

3748
## 2026-02-19: Separate Registry Endpoints from Authentication

eng/docker-tools/templates/jobs/build-images.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ jobs:
4848
dockerClientOS: ${{ parameters.dockerClientOS }}
4949
usesRegistries:
5050
- ${{ parameters.publishConfig.BuildRegistry.server }}
51-
${{ if parameters.storageAccountServiceConnection }}:
51+
# Check .name instead of the whole object - null parameters can become
52+
# empty objects through template layers, making ${{ if }} truthy.
53+
${{ if parameters.storageAccountServiceConnection.name }}:
5254
serviceConnections:
5355
- name: ${{ parameters.storageAccountServiceConnection.name }}
5456
- template: /eng/docker-tools/templates/steps/set-image-info-path-var.yml@self

eng/docker-tools/templates/jobs/generate-matrix.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@ jobs:
2525
publishConfig: ${{ parameters.publishConfig }}
2626
versionsRepoRef: ${{ parameters.versionsRepoRef }}
2727
customInitSteps: ${{ parameters.customInitSteps }}
28+
# When --trim-cached-images is active, ImageBuilder checks base image digests
29+
# in the ACR mirror registry, which requires OIDC auth via this service connection.
30+
- template: /eng/docker-tools/templates/steps/reference-service-connections.yml@self
31+
parameters:
32+
publishConfig: ${{ parameters.publishConfig }}
33+
usesRegistries:
34+
- ${{ parameters.publishConfig.BuildRegistry.server }}
2835
- ${{ parameters.customGenerateMatrixInitSteps }}
2936
- template: /eng/docker-tools/templates/steps/retain-build.yml@self
3037
- template: /eng/docker-tools/templates/steps/validate-branch.yml@self

eng/docker-tools/templates/steps/reference-service-connections.yml

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,23 @@ parameters:
4343

4444
steps:
4545
- ${{ if and(eq(variables['System.TeamProject'], parameters.internalProjectName), ne(variables['Build.Reason'], 'PullRequest')) }}:
46+
# Guard on .name: null parameters passed through template layers can become
47+
# empty objects that are truthy, so check the concrete property instead.
4648
- ${{ each serviceConnection in parameters.serviceConnections }}:
47-
- task: AzureCLI@2
48-
displayName: Reference ${{ serviceConnection.name }}
49-
inputs:
50-
azureSubscription: ${{ serviceConnection.name }}
51-
${{ if eq(parameters.dockerClientOS, 'windows') }}:
52-
scriptType: ps
53-
${{ else }}:
54-
scriptType: pscore
55-
scriptLocation: inlineScript
56-
inlineScript: Write-Host "Service connection referenced for OIDC"
49+
- ${{ if serviceConnection.name }}:
50+
- task: AzureCLI@2
51+
displayName: Reference ${{ serviceConnection.name }}
52+
inputs:
53+
azureSubscription: ${{ serviceConnection.name }}
54+
${{ if eq(parameters.dockerClientOS, 'windows') }}:
55+
scriptType: ps
56+
${{ else }}:
57+
scriptType: pscore
58+
scriptLocation: inlineScript
59+
inlineScript: Write-Host "Service connection referenced for OIDC"
5760
- ${{ each auth in parameters.publishConfig.RegistryAuthentication }}:
58-
- ${{ if containsValue(parameters.usesRegistries, auth.server) }}:
61+
# Also guard on .name here for the same reason as the serviceConnections loop above.
62+
- ${{ if and(containsValue(parameters.usesRegistries, auth.server), auth.serviceConnection.name) }}:
5963
- task: AzureCLI@2
6064
displayName: Reference ${{ auth.serviceConnection.name }}
6165
inputs:

eng/docker-tools/templates/steps/test-images-linux-client.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ steps:
2525
- script: |
2626
echo "##vso[task.setvariable variable=testRunner.container]testrunner-$(Build.BuildId)-$(System.JobId)"
2727
28+
if [ "${{ parameters.preBuildValidation }}" == "true" ]; then
29+
echo "##vso[task.setvariable variable=effectiveTestScriptPath]$(preBuildTestScriptPath)"
30+
else
31+
echo "##vso[task.setvariable variable=effectiveTestScriptPath]$(testScriptPath)"
32+
fi
33+
2834
additionalTestArgs="$ADDITIONALTESTARGS"
2935
if [ "${{ parameters.preBuildValidation }}" == "true" ]; then
3036
additionalTestArgs="$additionalTestArgs -TestCategories pre-build"
@@ -74,7 +80,7 @@ steps:
7480
$(testRunner.options)
7581
$(testRunner.container)
7682
pwsh
77-
-Command "$(testScriptPath)
83+
-Command "$(effectiveTestScriptPath)
7884
-Paths $(imageBuilderPathsArrayInitStr)
7985
-OSVersions $(osVersionsArrayInitStr)
8086
-Architecture '$(architecture)'

eng/docker-tools/templates/variables/docker-images.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
variables:
2-
imageNames.imageBuilderName: mcr.microsoft.com/dotnet-buildtools/image-builder:2919324
2+
imageNames.imageBuilderName: mcr.microsoft.com/dotnet-buildtools/image-builder:2923333
33
imageNames.imageBuilder: $(imageNames.imageBuilderName)
44
imageNames.imageBuilder.withrepo: imagebuilder-withrepo:$(Build.BuildId)-$(System.JobId)
55
imageNames.testRunner: mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux3.0-docker-testrunner

0 commit comments

Comments
 (0)