Skip to content

[build] Restrict Maven authentication to mirror seeding#12055

Merged
simonrozsival merged 4 commits into
mainfrom
jonathanpeppers-limit-maven-mirror-to-ci
Jul 13, 2026
Merged

[build] Restrict Maven authentication to mirror seeding#12055
simonrozsival merged 4 commits into
mainfrom
jonathanpeppers-limit-maven-mirror-to-ci

Conversation

@jonathanpeppers

@jonathanpeppers jonathanpeppers commented Jul 13, 2026

Copy link
Copy Markdown
Member

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-maven anonymously.

This keeps repository selection and authentication as separate controls:

  • RUNNINGONCI=true selects dotnet-public-maven for Azure DevOps builds.
  • ANDROID_MIRROR_MAVEN_DEPENDENCIES=true loads the credential provider only while mirror-dependencies.ps1 seeds uncached packages.
  • Local builds use Google, Maven Central, and the Gradle Plugin Portal without loading Azure authentication code.

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 buildscript classpath, so this context requires its implementation class.

jonathanpeppers and others added 3 commits July 13, 2026 10:31
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
Copilot AI review requested due to automatic review settings July 13, 2026 15:52

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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=true and move it into a shared eng/gradle/credential-provider.gradle.
  • Update settings.gradle files 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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
@jonathanpeppers jonathanpeppers changed the title [build] Limit Maven mirror authentication to CI [build] Restrict Maven authentication to mirror seeding Jul 13, 2026
@simonrozsival simonrozsival merged commit 3c62389 into main Jul 13, 2026
42 checks passed
@simonrozsival simonrozsival deleted the jonathanpeppers-limit-maven-mirror-to-ci branch July 13, 2026 21:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants