diff --git a/.azure-pipelines/publish-docker.yml b/.azure-pipelines/publish-docker.yml new file mode 100644 index 000000000..48ef7f9a6 --- /dev/null +++ b/.azure-pipelines/publish-docker.yml @@ -0,0 +1,122 @@ +# Trigger: any `v*` release tag (e.g. v1.40.0). +# Can also be queued manually from the ADO UI. +trigger: + tags: + include: + - v* + exclude: + - v*-* + +pr: none + +parameters: +- name: releaseChannel + displayName: "IMPORTANT: set this to 'canary' when triggering manually" + type: string + default: stable + values: + - stable + - canary + +resources: + repositories: + - repository: 1esPipelines + type: git + name: 1ESPipelineTemplates/1ESPipelineTemplates + ref: refs/tags/release + +extends: + template: v1/1ES.Official.PipelineTemplate.yml@1esPipelines + parameters: + pool: + name: DevDivPlaywrightAzurePipelinesUbuntu2204 + os: linux + sdl: + sourceAnalysisPool: + name: DevDivPlaywrightAzurePipelinesWindows2022 + # The image must be windows-based due to restrictions of the SDL tools. See: https://aka.ms/AAo6v8e + os: windows + suppression: + suppressionFile: $(Build.SourcesDirectory)\.azure-pipelines\guardian\SDL\.gdnsuppress + stages: + - stage: Publish + jobs: + - job: PublishDocker + displayName: "Publish Docker images to ACR" + # arm64 images are cross-built under QEMU emulation, which is slow. + timeoutInMinutes: 360 + steps: + - checkout: self + displayName: "Checkout code" + + - task: UseNode@1 + inputs: + version: '26.x' + displayName: "Install Node.js" + + # Relocate the Docker data-root to the large /mnt volume: this job builds + # 6 images (jammy/noble/resolute x amd64/arm64) and `docker system prune`s + # between them, so the default disk fills up. + - task: Bash@3 + displayName: "Setup docker" + inputs: + targetType: "inline" + script: | + set -x + sudo service docker stop + sudo mkdir -p /etc/docker + echo '{ "data-root": "/mnt/docker" }' | sudo tee /etc/docker/daemon.json + sudo service docker start + + # Used by scripts/download_driver.sh on the host. The repository root is the + # Docker build context, so .dockerignore keeps this file out of the images. + - task: Bash@3 + displayName: "setup .npmrc" + inputs: + targetType: "inline" + script: | + echo "registry=https://devdiv.pkgs.visualstudio.com/DevDiv/_packaging/DevDiv_PublicPackages/npm/registry/" >> .npmrc + + - task: npmAuthenticate@0 + displayName: "authenticate the private npm registry" + inputs: + workingFile: .npmrc + + # Must run before MavenAuthenticate@0 so the credentials it injects into + # ~/.m2/settings.xml are not overwritten by the copy. + - bash: | + mkdir -p ~/.m2 + cp .azure-pipelines/settings.xml ~/.m2/settings.xml + displayName: 'Copy settings.xml (mirror Maven Central to DevDiv_PublicPackages)' + + - task: MavenAuthenticate@0 + displayName: 'Authenticate to DevDiv_PublicPackages feed' + inputs: + artifactsFeeds: DevDiv_PublicPackages + + - task: AzureCLI@2 + displayName: "Login to ACR via OIDC" + inputs: + azureSubscription: "Playwright-CDN" + scriptType: "bash" + scriptLocation: "inlineScript" + inlineScript: "az acr login --name playwright" + + - task: Bash@3 + displayName: "Register QEMU (binfmt) for arm64 cross-build" + inputs: + targetType: "inline" + script: "docker run --rm --privileged ${ACR_CACHE_PREFIX}tonistiigi/binfmt --install arm64" + env: + ACR_CACHE_PREFIX: "playwright.azurecr.io/cached/" + + - task: Bash@3 + displayName: "Build & publish Docker images" + inputs: + targetType: "inline" + # The authenticated settings.xml is passed to `docker build` as a secret so + # that Maven inside the image also resolves from DevDiv_PublicPackages. + script: MAVEN_SETTINGS_SECRET="$HOME/.m2/settings.xml" ./utils/docker/publish_docker.sh ${{ parameters.releaseChannel }} + env: + ACR_CACHE_PREFIX: "playwright.azurecr.io/cached/" + UBUNTU_MIRROR_PREFIX: "azure." diff --git a/.azure-pipelines/settings.xml b/.azure-pipelines/settings.xml index 34e9be56f..1617d36e9 100644 --- a/.azure-pipelines/settings.xml +++ b/.azure-pipelines/settings.xml @@ -1,6 +1,7 @@