Skip to content

Commit a9c2437

Browse files
authored
Add latest JDK run to all CI pipelines (Azure#35833)
Add latest JDK run to all CI pipelines
1 parent 21d71f7 commit a9c2437

File tree

13 files changed

+153
-76
lines changed

13 files changed

+153
-76
lines changed

eng/pipelines/latest-jdk.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,12 @@ stages:
6060

6161
- template: /eng/pipelines/templates/steps/install-reporting-tools.yml
6262

63+
- pwsh: |
64+
Write-Host "##vso[task.setvariable variable=IsLatestNonLtsJdk;]true"
65+
6366
- template: /eng/pipelines/templates/steps/install-latest-jdk.yml
6467
parameters:
65-
LatestJdkFeatureVersion: '19'
68+
LatestJdkFeatureVersion: $(LatestNonLtsJdkFeatureVersion)
6669

6770
- task: Maven@3
6871
displayName: 'Run All Libraries Latest JDK'
@@ -71,7 +74,7 @@ stages:
7174
options: '$(DefaultOptions) -T 1C -Dgpg.skip'
7275
mavenOptions: '$(MemoryOptions) $(LoggingOptions)'
7376
javaHomeOption: 'JDKVersion'
74-
jdkVersionOption: '1.19'
77+
jdkVersionOption: $(LatestNonLtsJavaVersion)
7578
jdkArchitectureOption: 'x64'
7679
publishJUnitResults: false
7780
goals: 'clean install'

eng/pipelines/templates/jobs/build-validate-pom.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
displayName: 'Build and Validate'
1515

1616
variables:
17-
- template: ../variables/globals.yml
17+
- template: /eng/pipelines/templates/variables/globals.yml
1818

1919
pool:
2020
name: azsdk-pool-mms-ubuntu-2004-general

eng/pipelines/templates/jobs/ci.tests.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ parameters:
4343
- name: BuildParallelization
4444
type: string
4545
default: '2C'
46+
- name: AdditionalLintingOptions
47+
type: string
48+
default: ''
4649

4750
jobs:
4851
- job: 'Test'
@@ -90,6 +93,15 @@ jobs:
9093
displayName: Dump Test-Proxy Logs
9194
condition: succeededOrFailed()
9295
96+
# If the Java test versions isn't one of the LTS versions, or in other words is the latest Java version we're
97+
# testing against and that isn't an LTS version at the time (ex. latest LTS is Java 17 but we're testing against
98+
# Java 18), then install the latest Java version and use that to run a full build for validation of the latest
99+
# Java version.
100+
# Otherwise, run a normal test run.
101+
- template: /eng/pipelines/templates/steps/install-latest-jdk.yml
102+
parameters:
103+
LatestJdkFeatureVersion: $(LatestNonLtsJdkFeatureVersion)
104+
93105
- template: /eng/pipelines/templates/steps/install-reporting-tools.yml
94106
parameters:
95107
JdkVersion: $(JavaTestVersion)
@@ -98,6 +110,13 @@ jobs:
98110

99111
- ${{ parameters.PreTestSteps }}
100112

113+
- template: /eng/pipelines/templates/steps/run-and-validate-linting.yml
114+
parameters:
115+
JavaBuildVersion: $(JavaTestVersion)
116+
AdditionalLintingOptions: ${{ parameters.AdditionalLintingOptions }}
117+
BuildParallelization: ${{ parameters.BuildParallelization }}
118+
ContinueOnError: true
119+
101120
- template: /eng/pipelines/templates/steps/build-and-test.yml
102121
parameters:
103122
SDKType: ${{ parameters.SDKType }}

eng/pipelines/templates/jobs/ci.yml

Lines changed: 10 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ jobs:
218218
parameters:
219219
Artifacts: ${{parameters.Artifacts}}
220220

221-
- template: ../steps/upload-repository-on-failure.yml
221+
- template: /eng/pipelines/templates/steps/upload-repository-on-failure.yml
222222

223223
- job: 'Analyze'
224224
condition: and(succeeded(), ne(variables['Skip.Analyze'], 'true'))
@@ -321,7 +321,7 @@ jobs:
321321

322322
# We `install` the code quality reports tooling into our local m2 cache separately from building the Maven project
323323
# reports. This means it is available as part of that, but also so that this is not documented in the project report.
324-
- template: ../steps/install-reporting-tools.yml
324+
- template: /eng/pipelines/templates/steps/install-reporting-tools.yml
325325
parameters:
326326
JdkVersion: ${{ parameters.JavaBuildVersion }}
327327

@@ -341,65 +341,14 @@ jobs:
341341
arguments: >
342342
-Directory sdk/${{ parameters.ServiceDirectory }}
343343
344-
# maven dependency:tree needs to be able to resolve dependencies, so these should be installed.
345-
- task: Maven@3
346-
displayName: 'Build and Install'
347-
inputs:
348-
mavenPomFile: pom.xml
349-
goals: 'install'
350-
options: '$(DefaultOptions) -T ${{parameters.BuildParallelization}} -DskipTests $(DefaultSkipOptions) -pl $(ProjectList) -am'
351-
mavenOptions: '$(MemoryOptions) $(LoggingOptions)'
352-
javaHomeOption: 'JDKVersion'
353-
jdkVersionOption: ${{ parameters.JavaBuildVersion }}
354-
jdkArchitectureOption: 'x64'
355-
publishJUnitResults: false
356-
357-
- task: Maven@3
358-
displayName: 'Run SpotBugs, Checkstyle, and RevApi'
359-
inputs:
360-
mavenPomFile: pom.xml
361-
options: '$(DefaultOptions) --no-transfer-progress -T 1C -Dcheckstyle.failOnViolation=false -Dcheckstyle.failsOnError=false -Dspotbugs.failOnError=false -Drevapi.failBuildOnProblemsFound=false -Dcodesnippet.skip -Dmaven.javadoc.skip -DskipTests -Dgpg.skip -DskipCompile=true -DskipTestCompile=true -pl $(ProjectList)'
362-
mavenOptions: '$(MemoryOptions)'
363-
javaHomeOption: 'JDKVersion'
364-
jdkVersionOption: ${{ parameters.JavaBuildVersion }}
365-
jdkArchitectureOption: 'x64'
366-
publishJUnitResults: false
367-
goals: 'verify'
368-
369-
- task: PowerShell@2
370-
inputs:
371-
filePath: $(System.DefaultWorkingDirectory)/eng/pipelines/scripts/Get-Linting-Reports.ps1
372-
arguments: -OutputDirectory $(Build.ArtifactStagingDirectory)/linting-reports
373-
pwsh: true
374-
workingDirectory: $(Pipeline.Workspace)
375-
displayName: 'Generate Linting Reports'
376-
condition: always()
377-
378-
- publish: $(Build.ArtifactStagingDirectory)/linting-reports.zip
379-
displayName: 'Publish Linting Reports'
380-
artifact: linting-reports-$(System.StageName)-$(System.JobName)-$(System.JobAttempt)
381-
condition: always()
382-
383-
- pwsh: |
384-
if ((Get-ChildItem -Path $(Build.ArtifactStagingDirectory)/linting-reports -Directory | Measure-Object).Count -gt 0) {
385-
Write-Host "Linting errors have been found, download the 'linting-reports.zip' artifact to see what was found."
386-
exit 1
387-
}
388-
displayName: 'Fail Pipeline if Linting Reports Exist'
389-
390-
- task: Maven@3
391-
displayName: 'Run Javadoc'
392-
inputs:
393-
mavenPomFile: pom.xml
394-
options: '$(DefaultOptions) --no-transfer-progress -DskipTests -Dgpg.skip -Dverify-readme -DskipCompile=true -DskipTestCompile=true -Dcheckstyle.skip -Dspotbugs.skip -Drevapi.skip ${{ parameters.AdditionalLintingOptions }} -pl $(ProjectList)'
395-
mavenOptions: '$(MemoryOptions)'
396-
javaHomeOption: 'JDKVersion'
397-
jdkVersionOption: ${{ parameters.JavaBuildVersion }}
398-
jdkArchitectureOption: 'x64'
399-
publishJUnitResults: false
400-
goals: 'verify'
344+
- template: /eng/pipelines/templates/steps/run-and-validate-linting.yml
345+
parameters:
346+
JavaBuildVersion: ${{ parameters.JavaBuildVersion }}
347+
AdditionalLintingOptions: ${{ parameters.AdditionalLintingOptions }}
348+
BuildParallelization: ${{ parameters.BuildParallelization }}
349+
RunLinting: true
401350

402-
- template: ../steps/upload-repository-on-failure.yml
351+
- template: /eng/pipelines/templates/steps/upload-repository-on-failure.yml
403352

404353
- template: /eng/common/pipelines/templates/steps/eng-common-workflow-enforcer.yml
405354

@@ -478,3 +427,4 @@ jobs:
478427
TestOptions: ${{ parameters.TestOptions }}
479428
TestParallelization: ${{ parameters.TestParallelization }}
480429
BuildParallelization: ${{ parameters.BuildParallelization }}
430+
AdditionalLintingOptions: ${{ parameters.AdditionalLintingOptions }}

eng/pipelines/templates/jobs/live.tests.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,13 @@ jobs:
6060
- ${{ if and(eq(parameters.UseHttpFaultInjector, 'true'), not(contains(variables['OSVmImage'], 'mac'))) }}:
6161
- template: /eng/pipelines/templates/steps/http-fault-injector.yml
6262

63+
# If the Java test versions isn't one of the LTS versions, or in other words is the latest Java version we're
64+
# testing against and that isn't an LTS version at the time (ex. latest LTS is Java 17 but we're testing against
65+
# Java 18), then install the latest Java version and use that to run tests.
66+
- template: /eng/pipelines/templates/steps/install-latest-jdk.yml
67+
parameters:
68+
LatestJdkFeatureVersion: $(LatestNonLtsJdkFeatureVersion)
69+
6370
- template: /eng/pipelines/templates/steps/install-reporting-tools.yml
6471
parameters:
6572
JdkVersion: $(JavaTestVersion)

eng/pipelines/templates/jobs/native.live.tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
matrix: $[ ${{ parameters.Matrix }} ]
3333

3434
variables:
35-
- template: ../variables/globals.yml
35+
- template: /eng/pipelines/templates/variables/globals.yml
3636
- name: ArmTemplateParameters
3737
value: '@{}'
3838

@@ -54,7 +54,7 @@ jobs:
5454
ServiceDirectory: ${{ parameters.ServiceDirectory }}
5555
SDKType: ${{ parameters.SDKType }}
5656

57-
- template: ../steps/install-reporting-tools.yml
57+
- template: /eng/pipelines/templates/steps/install-reporting-tools.yml
5858
parameters:
5959
JdkVersion: $(JavaTestVersion)
6060

eng/pipelines/templates/stages/archetype-sdk-native-tests.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,6 @@ parameters:
104104
- name: TestOptions
105105
type: string
106106
default: $(TestOptions)
107-
- name: LtsVersion
108-
type: string
109-
default: $(JavaTestVersion)
110107

111108
stages:
112109
- ${{ each cloud in parameters.CloudConfig }}:

eng/pipelines/templates/stages/archetype-sdk-tests.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,6 @@ parameters:
104104
- name: TestOptions
105105
type: string
106106
default: $(TestOptions)
107-
- name: LtsVersion
108-
type: string
109-
default: $(JavaTestVersion)
110107
- name: UseHttpFaultInjector
111108
type: boolean
112109
default: false

eng/pipelines/templates/stages/platform-matrix.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,18 @@
5454
"RunAggregateReports": false,
5555
"TestGoals": "surefire:test",
5656
"TestOptions": ""
57+
},
58+
{
59+
"Agent": {
60+
"ubuntu-20.04": { "OSVmImage": "MMSUbuntu20.04", "Pool": "azsdk-pool-mms-ubuntu-2004-general" }
61+
},
62+
"JavaTestVersion": "1.20",
63+
"AZURE_TEST_HTTP_CLIENTS": "netty",
64+
"TestFromSource": false,
65+
"RunAggregateReports": false,
66+
"TestGoals": "surefire:test",
67+
"TestOptions": "",
68+
"IsLatestNonLtsJdk": true
5769
}
5870
]
5971
}

eng/pipelines/templates/steps/build-and-test.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ steps:
8080
AZURE_VERSION_OVERRIDE_TESTS: ${{ parameters.TestVersionSupport }}
8181
condition: and(succeeded(), eq(variables['TestVersionSupport'], 'true'))
8282

83+
# we want to run this when TestFromSource isn't true
8384
- task: Maven@3
8485
${{ if ne(parameters.VersionOverride, '') }}:
8586
displayName: '${{ parameters.VersionOverride }} - Run tests'
@@ -95,21 +96,19 @@ steps:
9596
publishJUnitResults: false
9697
goals: ${{ parameters.TestGoals }}
9798
env: ${{ parameters.TestEnvVars }}
98-
# we want to run this when TestFromSource isn't true
9999
condition: and(succeeded(), ne(variables['TestFromSource'], 'true'))
100100

101101
# Generate the pom file with all the modules required for creating an aggregate code coverage report
102102
- task: PythonScript@0
103103
displayName: 'Generate pom for aggregate code coverage report'
104-
condition: eq(variables['RunAggregateReports'], 'true')
105104
inputs:
106105
scriptPath: 'eng/scripts/generate_aggregate_pom.py'
107106
arguments: '--project-list $(ProjectList) --exclude-project-list ${{ parameters.ExcludeProjectList }} --type coverage'
108107
workingDirectory: '$(System.DefaultWorkingDirectory)'
108+
condition: eq(variables['RunAggregateReports'], 'true')
109109

110110
- task: Maven@3
111111
displayName: 'Generate aggregate code coverage report'
112-
condition: eq(variables['RunAggregateReports'], 'true')
113112
inputs:
114113
mavenPomFile: aggregate-pom.xml
115114
options: '$(DefaultOptions)'
@@ -118,6 +117,7 @@ steps:
118117
jdkVersionOption: $(JavaTestVersion)
119118
jdkArchitectureOption: 'x64'
120119
goals: jacoco:report-aggregate
120+
condition: eq(variables['RunAggregateReports'], 'true')
121121

122122
- task: Maven@3
123123
displayName: 'Build for From Source run'
@@ -184,9 +184,9 @@ steps:
184184
# Azure DevOps only seems to respect the last code coverage result published, so only do this for Windows + Java LTS.
185185
# Code coverage reporting is set up only for Track 2 modules.
186186
- task: PublishCodeCoverageResults@1
187-
condition: eq(variables['RunAggregateReports'], 'true')
188187
inputs:
189188
codeCoverageTool: JaCoCo
190189
summaryFileLocation: target/site/test-coverage/jacoco.xml
191190
reportDirectory: target/site/test-coverage/
192191
failIfCoverageEmpty: false
192+
condition: eq(variables['RunAggregateReports'], 'true')

0 commit comments

Comments
 (0)