|
17 | 17 | # Register it against the ado-aw Azure Repos mirror so the `self` checkout |
18 | 18 | # also carries `scripts/ado-script/` to build the bundles from source. |
19 | 19 | # - The build identity ($(System.AccessToken)) needs: Code (read) on the repo |
20 | | -# (PR/label/iteration lookups), Build (edit build quality / add tags) and |
21 | | -# the ability to cancel builds (gate self-cancel). See |
22 | | -# docs/safe-output-permissions.md if it hits 401/403. |
| 20 | +# for checkout and synth PR lookups. Gate evaluation uses a short-lived ADO |
| 21 | +# token minted from `agent-playground-write`; that dedicated identity needs |
| 22 | +# repo Read plus project-level Stop builds for gate self-cancel. See |
| 23 | +# docs/safe-output-permissions.md if either path hits 401/403. |
23 | 24 | # |
24 | 25 | # ## Observable build tags |
25 | 26 | # - trig.synth.promoted | trig.synth.skipped | trig.synth.real-pr |
|
82 | 83 | workingDirectory: scripts/ado-script |
83 | 84 | displayName: Build gate + synth bundles from checkout |
84 | 85 |
|
| 86 | + - task: AzureCLI@2 |
| 87 | + displayName: Acquire ADO token for gate self-cancel |
| 88 | + inputs: |
| 89 | + azureSubscription: agent-playground-write |
| 90 | + scriptType: bash |
| 91 | + scriptLocation: inlineScript |
| 92 | + inlineScript: | |
| 93 | + set -euo pipefail |
| 94 | + ADO_TOKEN=$(az account get-access-token \ |
| 95 | + --resource 499b84ac-1321-427f-aa17-267ca6975798 \ |
| 96 | + --query accessToken -o tsv) |
| 97 | + test -n "$ADO_TOKEN" |
| 98 | + echo "##vso[task.setvariable variable=SC_WRITE_TOKEN;issecret=true]$ADO_TOKEN" |
| 99 | +
|
85 | 100 | - script: | |
86 | 101 | set -euo pipefail |
87 | 102 | node scripts/ado-script/exec-context-pr-synth.js |
@@ -140,8 +155,9 @@ jobs: |
140 | 155 | ADO_SOURCE_BRANCH: ${{ parameters.sourceBranchFact }} |
141 | 156 | ADO_TARGET_BRANCH: ${{ parameters.targetBranchFact }} |
142 | 157 | ADO_COMMIT_MESSAGE: ${{ parameters.commitMessage }} |
143 | | - # REST auth for API facts (labels, changed files) + self-cancel. |
144 | | - SYSTEM_ACCESSTOKEN: $(System.AccessToken) |
| 158 | + # Dedicated short-lived write identity for API facts + self-cancel. |
| 159 | + # The token is mapped only into this gate step. |
| 160 | + SYSTEM_ACCESSTOKEN: $(SC_WRITE_TOKEN) |
145 | 161 |
|
146 | 162 | - script: | |
147 | 163 | set -euo pipefail |
|
0 commit comments