Repository navigation
Use Azure Artifacts feed only in CI, standard repos locally #35219
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
72cc860
0a2e892
5e67d8e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,14 @@ | ||
| // Top-level build file where you can add configuration options common to all sub-projects/modules. | ||
| buildscript { | ||
| repositories { | ||
| maven { | ||
| url = 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-maven/maven/v1' | ||
| name = 'dotnet-public-maven' | ||
| if (System.getenv('TF_BUILD') == 'True') { | ||
| maven { | ||
| url = 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-maven/maven/v1' | ||
| name = 'dotnet-public-maven' | ||
| } | ||
|
||
| } else { | ||
| google() | ||
| mavenCentral() | ||
| } | ||
|
||
| } | ||
| dependencies { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,40 +1,37 @@ | ||
| // Project Maven dependencies are resolved through the dnceng Azure Artifacts | ||
| // feed (dotnet-public-maven) for CFSClean network isolation compliance. The feed | ||
| // proxies Maven Central, Google Maven, and Gradle Plugin Portal. The credential | ||
| // provider plugin is fetched from a separate Azure Artifacts feed (artifacts-public). | ||
| // | ||
| // IMPORTANT: New packages must be ingested into the feed before CI can use them. | ||
| // The CI credential provider plugin skips auth in Azure Pipelines, so packages | ||
| // that aren't already in the feed will fail with 401. After adding or updating | ||
| // dependencies, run: | ||
| // | ||
| // ./eng/ingest-maven-deps.sh | ||
| // In CI (CFSClean network isolation), Maven dependencies resolve through the | ||
| // dnceng Azure Artifacts feed (dotnet-public-maven). Locally, standard Maven | ||
| // Central and Google Maven are used for faster builds. | ||
| // | ||
| // When adding or updating dependencies, run eng/ingest-maven-deps.sh to | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔴 Critical — 3/3 consensus | The ingestion script runs Additionally, the Impact: The next time a dependency is added, running Recommendation: Update
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Minor (2/3 consensus) The old comment included Suggestion: Consider restoring a stronger warning, e.g.: // IMPORTANT: New packages must be ingested before CI can use them.
// Run ./eng/ingest-maven-deps.sh after adding or updating any Maven dependency. |
||
| // pre-populate the Azure Artifacts feed for CI. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The old comment block documented the specific CI failure mode: uningested packages fail with 401, and Recommendation: Add a line explaining the failure mode, e.g.: // If CI fails with "Could not GET ... 401", the package is not yet in the feed.
// Run eng/ingest-maven-deps.sh to pre-populate it. |
||
| // See: https://aka.ms/1es/netiso/CFS | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Minor — Cross-reference to
|
||
|
|
||
| pluginManagement { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟢 Minor (2/3 consensus after follow-up) — Currently, AGP resolution works because If a future refactor removes the Suggestion: A brief comment noting this relationship would help future maintainers avoid accidentally breaking CI when modernizing the Gradle setup, e.g.: // NOTE: pluginManagement repos are currently secondary — AGP resolves via
// buildscript.dependencies in build.gradle. If buildscript is removed,
// this block becomes load-bearing for CI plugin resolution. |
||
| repositories { | ||
| maven { | ||
| url = 'https://pkgs.dev.azure.com/artifacts-public/PublicTools/_packaging/AzureArtifacts/maven/v1' | ||
| name = 'AzureArtifacts' | ||
| } | ||
| maven { | ||
| url = 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-maven/maven/v1' | ||
| name = 'dotnet-public-maven' | ||
| if (System.getenv('TF_BUILD') == 'True') { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟢 Minor — 2/3 consensus | Duplicated conditional logic increases drift risk The Recommendation: Extract to a variable at the top of each file: def isCi = (System.getenv('TF_BUILD') ?: '').equalsIgnoreCase('true')Then reuse |
||
| maven { | ||
| url = 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-maven/maven/v1' | ||
| name = 'dotnet-public-maven' | ||
|
||
| } | ||
| } else { | ||
| google() | ||
| mavenCentral() | ||
| gradlePluginPortal() | ||
|
||
| } | ||
| } | ||
| } | ||
|
|
||
| plugins { | ||
| id 'com.microsoft.azure.artifacts.credprovider' version '1.1.1' | ||
| } | ||
|
|
||
| dependencyResolutionManagement { | ||
| repositoriesMode.set(RepositoriesMode.PREFER_PROJECT) | ||
| repositories { | ||
| maven { | ||
| url = 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-maven/maven/v1' | ||
| name = 'dotnet-public-maven' | ||
| if (System.getenv('TF_BUILD') == 'True') { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 Moderate — 2/3 consensus | Non-obvious interaction with In CI, Meanwhile, for This asymmetry is invisible to future maintainers. Recommendation: Add a clarifying comment: // NOTE: In CI, project-level repos injected by eng/init.gradle (via allprojects)
// take precedence (PREFER_PROJECT mode). This block is a safety net.
// For buildscript and pluginManagement, TF_BUILD is the sole CI guard. |
||
| maven { | ||
| url = 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-maven/maven/v1' | ||
| name = 'dotnet-public-maven' | ||
| } | ||
| } else { | ||
| google() | ||
| mavenCentral() | ||
| } | ||
| } | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 Moderate — 2/3 consensus | Case-sensitive string comparison is brittle
System.getenv('TF_BUILD') == 'True'is case-sensitive in Groovy. While Azure Pipelines documents the value as exactlyTrue, any deviation (e.g., a wrapper script exportingTF_BUILD=trueorTRUE) will silently fall through togoogle()/mavenCentral(). In a CFSClean environment, this causes an opaque 401 failure with no diagnostic.Recommendation: Normalize once and compare case-insensitively:
Optionally add a
logger.lifecycle("Gradle repo routing: CI=\$\{isCi}")to make the routing decision visible in build logs.