Skip to content

Commit 837d519

Browse files
Merge branch 'main' into gavinbarron/connect-mggraph-loginhint
2 parents 7b0c93d + 6028659 commit 837d519

1 file changed

Lines changed: 21 additions & 26 deletions

File tree

.azure-pipelines/docker-image-refresh.yml

Lines changed: 21 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,16 @@
1515
name: $(Date:yyyyMMdd)$(Rev:.r)_docker-image-refresh
1616

1717
parameters:
18+
- name: WindowsPool
19+
type: string
20+
default: 1es-windows-ps-compute-m
1821
- name: LinuxPool
1922
type: string
2023
default: Azure-Pipelines-1ESPT-ExDShared
2124

2225
variables:
2326
REGISTRY: 'msgraphprodregistry.azurecr.io'
27+
REGISTRY_NAME: 'msgraphprodregistry' # ACR resource name (az acr build uses this, not the FQDN)
2428
IMAGE_NAME: 'public/microsoftgraph/powershell'
2529

2630
# Rebuild weekly so the image regularly picks up patched OS layers. `always: true` forces a run
@@ -47,10 +51,10 @@ resources:
4751
extends:
4852
template: v1/1ES.Official.PipelineTemplate.yml@1ESPipelineTemplates
4953
parameters:
50-
pool:
51-
name: ${{ parameters.LinuxPool }}
52-
image: ubuntu-latest
53-
os: linux
54+
# The 1ES template injects an SDL/compliance stage that MUST run on a Windows pool, so the
55+
# template-level pool is Windows. The actual container build overrides to a Linux pool at the
56+
# job level below. (Same pattern as sdk-release.yml.)
57+
pool: ${{ parameters.WindowsPool }}
5458
settings:
5559
networkIsolationPolicy: Permissive
5660
customBuildTags:
@@ -68,31 +72,22 @@ extends:
6872
steps:
6973
- checkout: self
7074

75+
# Build server-side with ACR Tasks: no local Docker daemon, no buildx/QEMU, and no
76+
# Docker Hub dependency (which the network-isolated 1ES pool can't reach). ACR pulls the
77+
# base image from MCR and pushes the result back to the registry.
7178
- task: AzureCLI@2
72-
displayName: 'Log in to Azure Container Registry'
79+
displayName: 'Build and push patched image (ACR Tasks)'
7380
inputs:
7481
azureSubscription: 'ACR Images Push Service Connection'
7582
scriptType: 'bash'
7683
scriptLocation: 'inlineScript'
7784
inlineScript: |
78-
az acr login --name $(REGISTRY)
79-
80-
- script: |
81-
docker run --privileged --rm tonistiigi/binfmt --install all
82-
displayName: 'Enable multi-platform builds'
83-
84-
- script: |
85-
docker buildx create --use --name refreshbuilder
86-
displayName: 'Set up Docker BuildX'
87-
88-
- bash: |
89-
set -euo pipefail
90-
formatted_date=$(date +"%Y%m%d%H%M%S")
91-
echo "Rebuilding $(REGISTRY)/$(IMAGE_NAME) on a patched base"
92-
docker buildx build \
93-
--platform linux/amd64 \
94-
--push \
95-
-t "$(REGISTRY)/$(IMAGE_NAME):latest" \
96-
-t "$(REGISTRY)/$(IMAGE_NAME):$formatted_date" \
97-
"$(Build.SourcesDirectory)"
98-
displayName: 'Build and push refreshed image'
85+
set -euo pipefail
86+
formatted_date=$(date +"%Y%m%d%H%M%S")
87+
echo "Rebuilding $(REGISTRY_NAME) / $(IMAGE_NAME) on a patched base via ACR Tasks"
88+
az acr build \
89+
--registry $(REGISTRY_NAME) \
90+
--image "$(IMAGE_NAME):latest" \
91+
--image "$(IMAGE_NAME):$formatted_date" \
92+
--platform linux/amd64 \
93+
"$(Build.SourcesDirectory)"

0 commit comments

Comments
 (0)