Skip to content

Commit cc2ff51

Browse files
Fix/daily ci pool image (#2098)
* fix: add missing image property to daily-ci pipeline pool configuration Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix: update spotbugs plugin to 6.5.4 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix: update sonarqube plugin to 7.3.0.8198 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Update SpotBugs plugin version to 6.5.5 * fix: add pluginManagement repositories to settings.gradle Adds gradlePluginPortal() and mavenCentral() as plugin repositories to ensure plugins can be resolved in restricted network environments like the Azure DevOps 1ESPT pipeline agents. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Downgrade SpotBugs plugin version to 6.5.4 * fix: make spotbugs/sonarqube plugins conditional for restricted CI environments Moves spotbugs and sonarqube from the plugins block to buildscript dependencies with conditional application. Pass -PskipCodeAnalysis to skip loading these plugins in environments without external Maven repository access (e.g., ADO 1ESPT pipeline agents). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Change build command from 'assemble' to 'build' * fix: use system properties for skipCodeAnalysis flag Project properties (-P) are not available in the buildscript block during early Gradle evaluation. Switch to system properties (-D) which are available everywhere via System.getProperty(). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix: use Gradle@4 ADO task for daily-ci build Replace shell script steps with the managed Gradle@4 task which handles Java setup, dependency resolution, and JUnit test result publishing natively within ADO infrastructure. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * revert: restore original plugins block in build.gradle Reverts the conditional buildscript/skipCodeAnalysis changes now that the daily-ci pipeline uses the managed Gradle@4 ADO task instead. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix: match Go SDK daily-ci pool config (remove image property) The Go SDK daily-ci pipeline works with the same pool without specifying an image. Removing the image property to use the pool's default image which has internet access. Also removes the skipCodeAnalysis flag since build.gradle uses the standard plugins block. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix: enable 1ES internal module proxy for Java dependency resolution Adds the java.internalModuleProxy feature flag (matching the Go SDK's golang.internalModuleProxy pattern) to route dependency resolution through the 1ES internal proxy, bypassing network isolation on the Azure-Pipelines-1ESPT-ExDShared pool. Also restores image: ubuntu-latest to match the working Go SDK pipeline configuration. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * test: strip spotbugs/sonarqube plugins in daily-ci to test core dep resolution Adds a sed step to remove the spotbugs and sonarqube plugin declarations from build.gradle before running Gradle on network-isolated 1ES agents. This tests whether the java.internalModuleProxy feature flag enables Maven Central access for core dependencies (okhttp, etc.). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix: also strip spotbugs/sonarqube config blocks from build.gradle The previous sed only removed plugin declarations but left the spotbugsMain, spotbugsTest, and sonarqube configuration blocks which reference the removed plugins. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * test: add networkIsolation overrideAllowRules for Maven/Gradle repos Attempts to whitelist Maven Central, Gradle Plugin Portal, and Gradle services endpoints through 1ES network isolation override rules. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Add network isolation policy to CI build pipeline * fix: correct YAML indentation for settings.networkIsolationPolicy Moves settings under parameters and removes the rejected networkIsolation.overrideAllowRules parameter. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix: route Gradle deps through CFS upstream Azure Artifacts feed Generates an init.gradle script that redirects all Gradle repositories (both dependencies and plugins) to the GraphDeveloperExperiences_Public Azure Artifacts feed, which has Maven Central as a CFS upstream. This complies with network isolation on 1ES agents by routing through the approved Centralized Feed Service instead of public endpoints. Also removes failed featureFlags and networkIsolationPolicy parameters that are not supported for Java in 1ES Pipeline Templates. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix: remove sed steps, let plugins resolve through CFS feed Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix: add CFS upstream feed to build.gradle and settings.gradle Adds the GraphDeveloperExperiences_Public Azure Artifacts feed (with Maven Central upstream) to both repositories and publishing.repositories in build.gradle, and to pluginManagement in settings.gradle. Removes the init.gradle pipeline workaround in favor of direct configuration. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix: add Gradle credentials step for CFS feed authentication Writes GraphDeveloperExperiences_Public credentials to ~/.gradle/gradle.properties using System.AccessToken for authentication against the Azure Artifacts CFS upstream feed. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix: move CFS feed credentials to gradle.properties Moves GraphDeveloperExperiences_Public credentials from pipeline script step to gradle.properties. The token will be overridden via ADO environment variables at pipeline runtime. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix: pass CFS feed token via ADO pipeline variable Overrides GraphDeveloperExperiences_PublicPassword at build time using the ARTIFACTS_PAT pipeline variable passed via -P flag. Configure ARTIFACTS_PAT as a secret variable in the ADO pipeline. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix: remove underscore from Gradle repo name (identity constraint) Gradle PasswordCredentials requires the repository name to contain only letters and digits. Renames GraphDeveloperExperiences_Public to GraphDeveloperExperiencesPublic across all config files. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix: restore underscores in Azure Artifacts feed URLs The Gradle repo name must be letters/digits only, but the actual feed URLs must use the real feed name with underscores. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix: restore sed step to strip spotbugs/sonarqube plugins SpotBugs and SonarQube Gradle plugin marker artifacts are only published to Gradle Plugin Portal, not Maven Central. The CFS upstream feed proxies Maven Central but not the Plugin Portal, so these plugins must be stripped before building. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix: strip mavenCentral() and gradlePluginPortal() in pipeline CFS blocks direct access to public repos with a hard socket error. Gradle treats this as a failure rather than falling through to the next repository. Remove public repo declarations so only the CFS upstream feed is used for dependency resolution. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * feat: enable SpotBugs via Gradle@4 built-in inputs Uses the Gradle@4 task's native SpotBugs support which resolves the plugin via Maven coordinates (available on CFS feed) rather than the Gradle Plugin Portal marker artifact. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * revert: remove SpotBugs from Gradle@4 inputs Gradle@4 resolves SpotBugs from plugins.gradle.org which is blocked by CFS. SpotBugs remains available in local dev and GitHub Actions CI. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 8be1ced commit cc2ff51

4 files changed

Lines changed: 59 additions & 14 deletions

File tree

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

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ extends:
2121
parameters:
2222
pool:
2323
name: Azure-Pipelines-1ESPT-ExDShared
24+
image: ubuntu-latest
2425
os: linux
2526
sdl:
2627
sourceAnalysisPool:
@@ -42,17 +43,26 @@ extends:
4243
- checkout: self
4344
submodules: recursive
4445

45-
- task: JavaToolInstaller@0
46-
displayName: Set up Java
46+
- script: |
47+
sed -i "/com.github.spotbugs/d" build.gradle
48+
sed -i "/org.sonarqube/d" build.gradle
49+
sed -i "/spotbugsMain/,/^}/d" build.gradle
50+
sed -i "/spotbugsTest/,/^}/d" build.gradle
51+
sed -i "/sonarqube {/,/^}/d" build.gradle
52+
sed -i "/mavenCentral()/d" build.gradle
53+
sed -i "/gradlePluginPortal()/d" settings.gradle
54+
sed -i "/mavenCentral()/d" settings.gradle
55+
displayName: Strip plugins and public repos for network-isolated build
56+
57+
- task: Gradle@4
58+
displayName: Build and Test SDK
4759
inputs:
48-
versionSpec: '17'
60+
gradleWrapperFile: 'gradlew'
61+
workingDirectory: '$(Build.SourcesDirectory)'
62+
tasks: 'assemble test'
63+
options: '--no-daemon -PGraphDeveloperExperiencesPublicPassword=$(ARTIFACTS_PAT)'
64+
publishJUnitResults: true
65+
testResultsFiles: '**/TEST-*.xml'
66+
javaHomeOption: 'JDKVersion'
67+
jdkVersionOption: '1.17'
4968
jdkArchitectureOption: 'x64'
50-
jdkSourceOption: 'PreInstalled'
51-
52-
- script: chmod +x gradlew && ./gradlew assemble
53-
displayName: Build SDK
54-
workingDirectory: $(Build.SourcesDirectory)
55-
56-
- script: ./gradlew test
57-
displayName: Run unit tests
58-
workingDirectory: $(Build.SourcesDirectory)

build.gradle

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ plugins {
55
id 'maven-publish'
66
id 'signing'
77
id 'jacoco'
8-
id 'com.github.spotbugs' version '6.2.5'
9-
id "org.sonarqube" version "7.2.2.6593"
8+
id 'com.github.spotbugs' version '6.5.4'
9+
id "org.sonarqube" version "7.3.0.8198"
1010

1111
}
1212

@@ -69,6 +69,14 @@ sourceSets {
6969
repositories {
7070
// You can declare any Maven/Ivy/file repository here.
7171
mavenCentral()
72+
maven {
73+
url 'https://microsoftgraph.pkgs.visualstudio.com/0985d294-5762-4bc2-a565-161ef349ca3e/_packaging/GraphDeveloperExperiences_Public/maven/v1'
74+
name 'GraphDeveloperExperiencesPublic'
75+
credentials(PasswordCredentials)
76+
authentication {
77+
basic(BasicAuthentication)
78+
}
79+
}
7280
}
7381

7482
apply from: "gradle/dependencies.gradle"
@@ -119,6 +127,14 @@ publishing {
119127
name = "ADO"
120128
url = layout.buildDirectory.dir("publishing-repository")
121129
}
130+
maven {
131+
url 'https://microsoftgraph.pkgs.visualstudio.com/0985d294-5762-4bc2-a565-161ef349ca3e/_packaging/GraphDeveloperExperiences_Public/maven/v1'
132+
name 'GraphDeveloperExperiencesPublic'
133+
credentials(PasswordCredentials)
134+
authentication {
135+
basic(BasicAuthentication)
136+
}
137+
}
122138
}
123139
}
124140

gradle.properties

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,7 @@ mavenArtifactSuffix =
3737
#enable mavenCentralPublishingEnabled to publish to maven central
3838
mavenCentralSnapshotArtifactSuffix = -SNAPSHOT
3939
mavenCentralPublishingEnabled=false
40+
41+
# Azure Artifacts CFS feed credentials
42+
GraphDeveloperExperiencesPublicUsername=microsoftgraph
43+
GraphDeveloperExperiencesPublicPassword=PERSONAL_ACCESS_TOKEN

settings.gradle

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
pluginManagement {
2+
repositories {
3+
gradlePluginPortal()
4+
mavenCentral()
5+
maven {
6+
url 'https://microsoftgraph.pkgs.visualstudio.com/0985d294-5762-4bc2-a565-161ef349ca3e/_packaging/GraphDeveloperExperiences_Public/maven/v1'
7+
name 'GraphDeveloperExperiencesPublic'
8+
credentials(PasswordCredentials)
9+
authentication {
10+
basic(BasicAuthentication)
11+
}
12+
}
13+
}
14+
}
15+
116
/*
217
* This file was generated by the Gradle 'init' task.
318
*

0 commit comments

Comments
 (0)