Skip to content

Use mirror settings for CFS in CI#48718

Open
raych1 wants to merge 4 commits intomainfrom
users/raych1/use-mirror-settings
Open

Use mirror settings for CFS in CI#48718
raych1 wants to merge 4 commits intomainfrom
users/raych1/use-mirror-settings

Conversation

@raych1
Copy link
Copy Markdown
Member

@raych1 raych1 commented Apr 7, 2026

We're still seeing traffics to the maven central in pipeline runs. The reason is the super pom resolves the plug-in installation to the maven central website. The repository override settings in the parent POM and project level POM won't intercept this kind of traffic. The right approach is to use the mirror settings to redirect all the traffics to maven central.

Now we use mirror settings approach for CI scenario. Meanwhile, we keep using repository override approach for local scenarios so that maven packages should be installed from CFS except maven plug-ins.

Changes

Centralized Maven Mirror Configuration:

  • Added a new eng/settings.xml file that defines the Azure Artifacts mirror, replacing per-module repository and pluginRepository blocks.
  • Updated the CI pipeline (eng/pipelines/templates/steps/maven-authenticate.yml) to copy the shared settings.xml to the default Maven location, ensuring all Maven requests in CI use the CFS mirror.

Documentation Updates:

  • Updated CONTRIBUTING.md to provide instructions for using the CFS mirror locally, including how to copy or reference the shared settings.xml for local builds.

Copilot AI review requested due to automatic review settings April 7, 2026 23:52
@raych1 raych1 self-assigned this Apr 7, 2026
@github-actions github-actions bot added azure-sdk-bom Azure Java SDK BOM (Bill of Materials) azure-spring All azure-spring related issues Azure.Core azure-core labels Apr 7, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR centralizes Maven repository routing in CI by introducing a shared Maven settings.xml mirror configuration (CFS) and removing per-module <repositories> / <pluginRepositories> overrides from various POMs so Maven Central traffic is consistently redirected.

Changes:

  • Added eng/settings.xml with a Maven mirror pointing external resolution to the Azure Artifacts feed.
  • Updated CI Maven authentication step to install the shared settings.xml into the default ~/.m2/settings.xml before running MavenAuthenticate@0.
  • Removed redundant repository and pluginRepository configuration blocks from affected BOMs, parents, and Spring starter modules; updated contributor docs for local usage.

Reviewed changes

Copilot reviewed 36 out of 36 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
sdk/spring/spring-cloud-azure-starter/pom.xml Removes per-module repositories/pluginRepositories in favor of mirror-based resolution.
sdk/spring/spring-cloud-azure-starter-stream-servicebus/pom.xml Removes per-module repositories/pluginRepositories in favor of mirror-based resolution.
sdk/spring/spring-cloud-azure-starter-stream-eventhubs/pom.xml Removes per-module repositories/pluginRepositories in favor of mirror-based resolution.
sdk/spring/spring-cloud-azure-starter-storage/pom.xml Removes per-module repositories/pluginRepositories in favor of mirror-based resolution.
sdk/spring/spring-cloud-azure-starter-storage-queue/pom.xml Removes per-module repositories/pluginRepositories in favor of mirror-based resolution.
sdk/spring/spring-cloud-azure-starter-storage-file-share/pom.xml Removes per-module repositories/pluginRepositories in favor of mirror-based resolution.
sdk/spring/spring-cloud-azure-starter-storage-blob/pom.xml Removes per-module repositories/pluginRepositories in favor of mirror-based resolution.
sdk/spring/spring-cloud-azure-starter-servicebus/pom.xml Removes per-module repositories/pluginRepositories in favor of mirror-based resolution.
sdk/spring/spring-cloud-azure-starter-servicebus-jms/pom.xml Removes per-module repositories/pluginRepositories in favor of mirror-based resolution.
sdk/spring/spring-cloud-azure-starter-keyvault/pom.xml Removes per-module repositories/pluginRepositories in favor of mirror-based resolution.
sdk/spring/spring-cloud-azure-starter-keyvault-secrets/pom.xml Removes per-module repositories/pluginRepositories in favor of mirror-based resolution.
sdk/spring/spring-cloud-azure-starter-keyvault-jca/pom.xml Removes per-module repositories/pluginRepositories in favor of mirror-based resolution.
sdk/spring/spring-cloud-azure-starter-keyvault-certificates/pom.xml Removes per-module repositories/pluginRepositories in favor of mirror-based resolution.
sdk/spring/spring-cloud-azure-starter-jdbc-postgresql/pom.xml Removes per-module repositories/pluginRepositories in favor of mirror-based resolution.
sdk/spring/spring-cloud-azure-starter-jdbc-mysql/pom.xml Removes per-module repositories/pluginRepositories in favor of mirror-based resolution.
sdk/spring/spring-cloud-azure-starter-integration-storage-queue/pom.xml Removes per-module repositories/pluginRepositories in favor of mirror-based resolution.
sdk/spring/spring-cloud-azure-starter-integration-servicebus/pom.xml Removes per-module repositories/pluginRepositories in favor of mirror-based resolution.
sdk/spring/spring-cloud-azure-starter-integration-eventhubs/pom.xml Removes per-module repositories/pluginRepositories in favor of mirror-based resolution.
sdk/spring/spring-cloud-azure-starter-eventhubs/pom.xml Removes per-module repositories/pluginRepositories in favor of mirror-based resolution.
sdk/spring/spring-cloud-azure-starter-eventgrid/pom.xml Removes per-module repositories/pluginRepositories in favor of mirror-based resolution.
sdk/spring/spring-cloud-azure-starter-data-redis-lettuce/pom.xml Removes per-module repositories/pluginRepositories in favor of mirror-based resolution.
sdk/spring/spring-cloud-azure-starter-data-cosmos/pom.xml Removes per-module repositories/pluginRepositories in favor of mirror-based resolution.
sdk/spring/spring-cloud-azure-starter-cosmos/pom.xml Removes per-module repositories/pluginRepositories in favor of mirror-based resolution.
sdk/spring/spring-cloud-azure-starter-appconfiguration/pom.xml Removes per-module repositories/pluginRepositories in favor of mirror-based resolution.
sdk/spring/spring-cloud-azure-starter-appconfiguration-config/pom.xml Removes per-module repositories/pluginRepositories in favor of mirror-based resolution.
sdk/spring/spring-cloud-azure-starter-actuator/pom.xml Removes per-module repositories/pluginRepositories in favor of mirror-based resolution.
sdk/spring/spring-cloud-azure-starter-active-directory/pom.xml Removes per-module repositories/pluginRepositories in favor of mirror-based resolution.
sdk/spring/spring-cloud-azure-starter-active-directory-b2c/pom.xml Removes per-module repositories/pluginRepositories in favor of mirror-based resolution.
sdk/parents/clientcore-parent/pom.xml Removes parent-level repositories/pluginRepositories overrides (previously used to route/disable Central).
sdk/parents/azure-sdk-parent/pom.xml Removes parent-level repositories/pluginRepositories overrides (previously used to route/disable Central).
sdk/boms/spring-cloud-azure-dependencies/pom.xml Removes BOM-level repositories/pluginRepositories overrides in favor of mirror-based resolution.
sdk/boms/azure-sdk-template-bom/pom.xml Removes BOM-level repositories/pluginRepositories overrides in favor of mirror-based resolution.
sdk/boms/azure-sdk-bom/pom.xml Removes BOM-level repositories/pluginRepositories overrides in favor of mirror-based resolution.
eng/settings.xml Adds centralized Maven mirror configuration for CI/local opt-in.
eng/pipelines/templates/steps/maven-authenticate.yml Copies shared settings.xml into ~/.m2/settings.xml before MavenAuthenticate to enforce mirroring.
CONTRIBUTING.md Documents how to use the new mirror settings locally (copy or --settings).

steps:
# Copy mirror settings to default Maven location so all requests go through CFS
- pwsh: |
$m2Dir = if ($env:USERPROFILE) { "$env:USERPROFILE\.m2" } else { "$HOME/.m2" }
Copy link
Copy Markdown
Member

@benbp benbp Apr 8, 2026

Choose a reason for hiding this comment

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

The pipeline steps use $(MAVEN_CACHE_FOLDER) from https://github.com/Azure/azure-sdk-for-java/blob/main/eng/pipelines/templates/variables/globals.yml#L25 I think we would want to point it to that parent? ($(Pipeline.Workspace)/.m2).

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.

@benbp maven-authenticate task can only write secret to the default setting file. Given $(Pipeline.Workspace) might have more storage, I'd rather keep the package cached folder and settings file in separate places as is now.
https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/reference/maven-authenticate-v0?view=azure-pipelines#where-is-the-settingsxml-file-containing-the-authenticated-repositories-located

@weshaggard
Copy link
Copy Markdown
Member

@raych1 I thought we were going to keep what we had and only add the copy of the settings mirror for pipelines. I would like local development to use the CFS feed for most cases and the only exception is those maven tools that don't respect the override and need the mirror.

Copy link
Copy Markdown
Member

@weshaggard weshaggard left a comment

Choose a reason for hiding this comment

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

I would like to understand if we need to do a full revert. I was hoping it would only be copy the mirror settings if you needed to resolve the maven tool extensions from the CFS feed but everything else would still use CFS by default.

raych1 added 2 commits April 8, 2026 13:58
Keep <repositories> and <pluginRepositories> blocks in POMs so local
development continues to route through CFS (no-auth) by default.
The CI mirror settings in eng/settings.xml handle the tools/extensions
that don't respect POM-level repos.
@raych1 raych1 changed the title Switched back to use mirror settings for CFS in CI Use mirror settings for CFS in CI Apr 8, 2026

##### Matching CI behavior locally

After setting up the credential provider above, you can route all Maven traffic through the Azure Artifacts feed locally by copying the mirror settings:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We should at least add a note as to why this is needed. Something like all maven traffic is already using the CFS feed by default expect for the maven plugins and to get them to use the feed you need to do this.

Copy link
Copy Markdown
Member

@weshaggard weshaggard left a comment

Choose a reason for hiding this comment

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

One note about docs but otherwise this is what I was expecting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Azure.Core azure-core azure-sdk-bom Azure Java SDK BOM (Bill of Materials) azure-spring All azure-spring related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants