|
| 1 | +# Trigger: any `v*` release tag (e.g. v1.40.0). |
| 2 | +# Can also be queued manually from the ADO UI. |
| 3 | +trigger: |
| 4 | + tags: |
| 5 | + include: |
| 6 | + - v* |
| 7 | + |
| 8 | +pr: none |
| 9 | + |
| 10 | +parameters: |
| 11 | +- name: releaseChannel |
| 12 | + displayName: "IMPORTANT: set this to 'canary' when triggering manually" |
| 13 | + type: string |
| 14 | + default: stable |
| 15 | + values: |
| 16 | + - stable |
| 17 | + - canary |
| 18 | + |
| 19 | +resources: |
| 20 | + repositories: |
| 21 | + - repository: 1esPipelines |
| 22 | + type: git |
| 23 | + name: 1ESPipelineTemplates/1ESPipelineTemplates |
| 24 | + ref: refs/tags/release |
| 25 | + |
| 26 | +extends: |
| 27 | + template: v1/1ES.Official.PipelineTemplate.yml@1esPipelines |
| 28 | + parameters: |
| 29 | + pool: |
| 30 | + name: DevDivPlaywrightAzurePipelinesUbuntu2204 |
| 31 | + os: linux |
| 32 | + sdl: |
| 33 | + sourceAnalysisPool: |
| 34 | + name: DevDivPlaywrightAzurePipelinesWindows2022 |
| 35 | + # The image must be windows-based due to restrictions of the SDL tools. See: https://aka.ms/AAo6v8e |
| 36 | + os: windows |
| 37 | + suppression: |
| 38 | + suppressionFile: $(Build.SourcesDirectory)\.azure-pipelines\guardian\SDL\.gdnsuppress |
| 39 | + stages: |
| 40 | + - stage: Publish |
| 41 | + jobs: |
| 42 | + - job: PublishDocker |
| 43 | + displayName: "Publish Docker images to ACR" |
| 44 | + # arm64 images are cross-built under QEMU emulation, which is slow. |
| 45 | + timeoutInMinutes: 360 |
| 46 | + steps: |
| 47 | + # Full history and tags: setuptools-scm derives the package version |
| 48 | + # (and thus the image tags) from the release tag. |
| 49 | + - checkout: self |
| 50 | + fetchDepth: 0 |
| 51 | + fetchTags: true |
| 52 | + displayName: "Checkout code" |
| 53 | + |
| 54 | + - task: UsePythonVersion@0 |
| 55 | + inputs: |
| 56 | + versionSpec: '3.10' |
| 57 | + displayName: "Use Python" |
| 58 | + |
| 59 | + # Resolve pip installs through the DevDiv_PublicPackages feed. The task exports |
| 60 | + # an authenticated PIP_INDEX_URL, which build.sh also forwards to the image builds. |
| 61 | + - task: PipAuthenticate@1 |
| 62 | + inputs: |
| 63 | + artifactFeeds: DevDiv/DevDiv_PublicPackages |
| 64 | + displayName: "Authenticate pip to DevDiv_PublicPackages feed" |
| 65 | + |
| 66 | + - task: UseNode@1 |
| 67 | + inputs: |
| 68 | + version: '24.x' |
| 69 | + displayName: "Install Node.js" |
| 70 | + |
| 71 | + # Relocate the Docker data-root to the large /mnt volume: this job builds |
| 72 | + # 6 images (jammy/noble/resolute x amd64/arm64) and `docker system prune`s |
| 73 | + # between them, so the default disk fills up. |
| 74 | + - task: Bash@3 |
| 75 | + displayName: "Setup docker" |
| 76 | + inputs: |
| 77 | + targetType: "inline" |
| 78 | + script: | |
| 79 | + set -x |
| 80 | + sudo service docker stop |
| 81 | + sudo mkdir -p /etc/docker |
| 82 | + echo '{ "data-root": "/mnt/docker" }' | sudo tee /etc/docker/daemon.json |
| 83 | + sudo service docker start |
| 84 | +
|
| 85 | + # scripts/build_driver.py fetches playwright-core with `npm pack`, which |
| 86 | + # picks up the registry and credentials from this .npmrc. |
| 87 | + - task: Bash@3 |
| 88 | + displayName: "setup .npmrc" |
| 89 | + inputs: |
| 90 | + targetType: "inline" |
| 91 | + script: echo "registry=https://devdiv.pkgs.visualstudio.com/DevDiv/_packaging/DevDiv_PublicPackages/npm/registry/" >> .npmrc |
| 92 | + |
| 93 | + - task: npmAuthenticate@0 |
| 94 | + displayName: "authenticate the private npm registry" |
| 95 | + inputs: |
| 96 | + workingFile: .npmrc |
| 97 | + |
| 98 | + - script: | |
| 99 | + python -m pip install --upgrade pip --disable-pip-version-check |
| 100 | + pip install -r local-requirements.txt --disable-pip-version-check |
| 101 | + pip install -r requirements.txt --disable-pip-version-check |
| 102 | + pip install -e . --disable-pip-version-check |
| 103 | + displayName: "Install dependencies" |
| 104 | +
|
| 105 | + - task: AzureCLI@2 |
| 106 | + displayName: "Login to ACR via OIDC" |
| 107 | + inputs: |
| 108 | + azureSubscription: "Playwright-CDN" |
| 109 | + scriptType: "bash" |
| 110 | + scriptLocation: "inlineScript" |
| 111 | + inlineScript: "az acr login --name playwright" |
| 112 | + |
| 113 | + - task: Bash@3 |
| 114 | + displayName: "Register QEMU (binfmt) for arm64 cross-build" |
| 115 | + inputs: |
| 116 | + targetType: "inline" |
| 117 | + script: "docker run --rm --privileged ${ACR_CACHE_PREFIX}tonistiigi/binfmt --install arm64" |
| 118 | + env: |
| 119 | + ACR_CACHE_PREFIX: "playwright.azurecr.io/cached/" |
| 120 | + |
| 121 | + - task: Bash@3 |
| 122 | + displayName: "Build & publish Docker images" |
| 123 | + inputs: |
| 124 | + targetType: "inline" |
| 125 | + script: "./utils/docker/publish_docker.sh ${{ parameters.releaseChannel }}" |
| 126 | + env: |
| 127 | + ACR_CACHE_PREFIX: "playwright.azurecr.io/cached/" |
| 128 | + UBUNTU_MIRROR_PREFIX: "azure." |
0 commit comments