[build] Restrict Maven authentication to mirror seeding#12055
Conversation
Remove the unused Azure Artifacts credential provider. CI consumes the Maven mirror anonymously, while the mirror helper authenticates through Azure CLI when dependencies need to be seeded. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: c002d2dd-f957-4940-92a4-d23037322e70
Keep Azure DevOps mirror authentication available when RunningOnCI is true, without resolving or applying the credential provider during local builds. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: c002d2dd-f957-4940-92a4-d23037322e70
Use Azure DevOps' exported RUNNINGONCI spelling consistently and update the mirror helper to set that same environment variable for local cache warming. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: c002d2dd-f957-4940-92a4-d23037322e70
There was a problem hiding this comment.
Pull request overview
Adjusts the repo’s shared Gradle configuration so Azure Artifacts credential-provider authentication is only loaded on the CI path, avoiding interactive auth prompts during local development while keeping the CI Maven-mirror workflow intact.
Changes:
- Gate Azure Artifacts credential-provider loading behind
RUNNINGONCI=trueand move it into a sharedeng/gradle/credential-provider.gradle. - Update
settings.gradlefiles to conditionally apply the credential-provider script. - Normalize CI detection and documentation around
RUNNINGONCI, and update the dependency-mirroring helper accordingly.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/CodeGen-Binding/Xamarin.Android.LibraryProjectZip-LibBinding/java/JavaLib/settings.gradle | Conditionally applies shared credential-provider script when RUNNINGONCI=true. |
| src/r8/settings.gradle | Conditionally applies shared credential-provider script when RUNNINGONCI=true. |
| src/proguard-android/settings.gradle | Conditionally applies shared credential-provider script when RUNNINGONCI=true. |
| src/manifestmerger/settings.gradle | Conditionally applies shared credential-provider script when RUNNINGONCI=true. |
| eng/gradle/plugin-repositories.gradle | Uses RUNNINGONCI to switch plugin repositories; removes always-on AzureArtifacts repo. |
| eng/gradle/dependency-repositories.gradle | Uses RUNNINGONCI to switch dependency repositories. |
| eng/gradle/mirror-dependencies.ps1 | Sets RUNNINGONCI=true for reproducing CI mirror behavior locally. |
| eng/gradle/credential-provider.gradle | New shared script that wires up the Azure Artifacts credential provider for the CI path. |
| .github/instructions/gradle.instructions.md | Updates the documented Gradle pattern and CI/local guidance to match RUNNINGONCI + credential-provider script. |
| } | ||
| } | ||
|
|
||
| apply plugin: com.microsoft.azure.artifacts.credprovider.gradle.GradleCredentialProviderPlugin |
There was a problem hiding this comment.
I tested applying the plugin by ID from this applied script, but Gradle fails with Plugin with id ... not found. Plugins loaded through an applied script buildscript classpath are not registered for ID lookup, so this context requires the implementation class. I added a comment documenting that constraint. The script itself is now loaded only when ANDROID_MIRROR_MAVEN_DEPENDENCIES=true, which is set exclusively by the mirror helper.
Use a dedicated environment variable set only by mirror-dependencies.ps1 to load the Azure Artifacts credential provider. Regular CI continues reading cached dependencies anonymously from the Maven mirror. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: c002d2dd-f957-4940-92a4-d23037322e70
PR #11711 centralized Gradle repository configuration, but applying the Azure Artifacts credential provider during ordinary builds caused authentication dialogs for local developers. CI does not need that provider because it reads packages already cached in
dotnet-public-mavenanonymously.This keeps repository selection and authentication as separate controls:
RUNNINGONCI=trueselectsdotnet-public-mavenfor Azure DevOps builds.ANDROID_MIRROR_MAVEN_DEPENDENCIES=trueloads the credential provider only whilemirror-dependencies.ps1seeds uncached packages.The credential provider is loaded through an applied script so it can be gated dynamically. Gradle cannot resolve a plugin by ID from that script's isolated
buildscriptclasspath, so this context requires its implementation class.