Skip to content

Commit 62d7db1

Browse files
Migrate daily-ci to PAT-less Maven auth via MavenAuthenticate@0
Replace the ARTIFACTS_PAT-based settings.xml server with the MavenAuthenticate@0 task, which injects the build identity's OAuth token (System.AccessToken) into ~/.m2/settings.xml. The mirror is now mirrorOf=* with id matching the generated server id (feed name), so the single token-backed server authenticates all feed traffic under network isolation. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 848ccdd commit 62d7db1

1 file changed

Lines changed: 12 additions & 10 deletions

File tree

.azure-pipelines/daily-ci-build.yml

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,19 +50,16 @@ extends:
5050
jdkSourceOption: 'PreInstalled'
5151

5252
- pwsh: |
53+
# Route all Maven resolution through the Azure Artifacts feed (Maven Central upstream)
54+
# so the network-isolated build never reaches the public internet. Credentials for the
55+
# mirror are injected PAT-less by the MavenAuthenticate task below; the mirror <id> must
56+
# match the <server> id it generates (the feed name).
5357
$settingsXml = @"
5458
<settings>
55-
<servers>
56-
<server>
57-
<id>GraphDeveloperExperiencesPublic</id>
58-
<username>microsoftgraph</username>
59-
<password>$(ARTIFACTS_PAT)</password>
60-
</server>
61-
</servers>
6259
<mirrors>
6360
<mirror>
64-
<id>GraphDeveloperExperiencesPublic</id>
65-
<mirrorOf>central</mirrorOf>
61+
<id>GraphDeveloperExperiences_Public</id>
62+
<mirrorOf>*</mirrorOf>
6663
<url>https://microsoftgraph.pkgs.visualstudio.com/0985d294-5762-4bc2-a565-161ef349ca3e/_packaging/GraphDeveloperExperiences_Public/maven/v1</url>
6764
</mirror>
6865
</mirrors>
@@ -71,7 +68,12 @@ extends:
7168
$settingsDir = Join-Path $HOME ".m2"
7269
New-Item -ItemType Directory -Path $settingsDir -Force | Out-Null
7370
$settingsXml | Set-Content (Join-Path $settingsDir "settings.xml") -Encoding UTF8
74-
displayName: Configure Maven settings for network-isolated build
71+
displayName: Configure Maven mirror for network-isolated build
72+
73+
- task: MavenAuthenticate@0
74+
displayName: Authenticate to Azure Artifacts feed (PAT-less)
75+
inputs:
76+
artifactsFeeds: 'GraphDeveloperExperiences_Public'
7577

7678
- task: Maven@4
7779
displayName: Build and Test SDK

0 commit comments

Comments
 (0)