-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Enable caching of local maven repository #21797
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,15 +1,6 @@ | ||
| steps: | ||
| - script: | | ||
| echo "##vso[task.setvariable variable=Maven.RepositoryPath;]%USERPROFILE%\.m2\repository" | ||
| condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT')) | ||
| displayName: Detecting Maven repository on Windows | ||
| - script: | | ||
| echo "##vso[task.setvariable variable=Maven.RepositoryPath;]$HOME/.m2/repository" | ||
| condition: and(succeeded(), ne(variables['Agent.OS'], 'Windows_NT')) | ||
| displayName: Detecting Maven repository on Linux and macOS | ||
| - task: CacheBeta@0 | ||
| - task: Cache@2 | ||
| inputs: | ||
| key: $(Agent.JobName)|$(CacheSalt)|$(Build.SourcesDirectory)/sdk/**/pom.xml|$(Build.SourcesDirectory)/pom*.xml | ||
| path: $(Maven.RepositoryPath) | ||
| displayName: 'Download/upload cache' | ||
| condition: and(succeeded(), ne(variables['EnableCaching'], 'false')) | ||
| key: 'maven | $(CacheSalt) | $(Agent.OS) | $(Build.SourcesDirectory)/eng/versioning/external_dependencies.txt' | ||
| path: $(MAVEN_CACHE_FOLDER) | ||
| displayName: Cache Maven local repo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,31 +1,28 @@ | ||
| # This job template uses the artifact list in the ci.yml file | ||
| # to generate a variable at build time that can be passed into | ||
| # the Maven -pl command-line switch to constrain what subset of | ||
| # projects are targetted based on the artifacts this pipeline | ||
| # projects are targeted based on the artifacts this pipeline | ||
| # produces. The -am and -amd switches are then applied as | ||
| # appropriate to constrain the full graph that is built depending | ||
| # on whether we are doing a recorded test play back or a full live | ||
| # test. | ||
|
|
||
| steps: | ||
| - template: ../steps/cache-maven-repository.yml | ||
|
|
||
| - pwsh: | | ||
| Write-Host "##vso[task.setvariable variable=ProjectList;]" | ||
| displayName: Initialize project list variable | ||
| $artifacts = '${{ convertToJson(parameters.Artifacts) }}' | ConvertFrom-Json | ||
|
weshaggard marked this conversation as resolved.
Outdated
|
||
| $additionalModules = '${{ convertToJson(parameters.AdditionalModules) }}' | ConvertFrom-Json | ||
|
|
||
| # These artifacts are the principal outputs of the build. We source | ||
| # them from the artifact list. | ||
| - ${{each artifact in parameters.Artifacts }}: | ||
| - pwsh: | | ||
| Write-Host "##vso[task.setvariable variable=ProjectList;]$(ProjectList),${{artifact.groupId}}:${{artifact.name}}" | ||
| displayName: Append ${{artifact.groupId}}:${{artifact.name}} to project list | ||
| $projectList = @() | ||
| foreach ($artifact in $artifacts) { | ||
| $projectList += "$($artifact.groupId):$($artifact.name)" | ||
| } | ||
| foreach ($artifact in $additionalModules) { | ||
| $projectList += "$($artifact.groupId):$($artifact.name)" | ||
| } | ||
| $projects = $projectList -join ',' | ||
|
|
||
| # From time to time we might need to also build another module which | ||
| # we don't actually want to ship, so we list that here. We can't rely | ||
| # on the -amd switch to do this since is doesn't resolve dependencies | ||
| # AFTER dependents have been resolved, which means some projects might | ||
| # be missing from the resulting build graph. This works around that | ||
| # limitation in Maven. | ||
| - ${{each artifact in parameters.AdditionalModules }}: | ||
| - pwsh: | | ||
| Write-Host "##vso[task.setvariable variable=ProjectList;]$(ProjectList),${{artifact.groupId}}:${{artifact.name}}" | ||
| displayName: Append ${{artifact.groupId}}:${{artifact.name}} to project list | ||
| Write-Host "ProjectList = $projects" | ||
| Write-Host "##vso[task.setvariable variable=ProjectList;]$projects" | ||
| displayName: Initialize project list variable | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,16 +1,20 @@ | ||
| variables: | ||
| DocWardenVersion: '0.7.1' | ||
| WagonOptions: '-Dmaven.wagon.rto=300000 -Dmaven.wagon.http.retryHandler.count=3' | ||
| DefaultOptions: '--batch-mode --fail-at-end --settings eng/settings.xml $(WagonOptions)' | ||
| LoggingOptions: '-Dorg.slf4j.simpleLogger.defaultLogLevel=error -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn' | ||
| MemoryOptions: '-Xmx3072m' | ||
| #Agent.Source.Git.ShallowFetchDepth: 1 | ||
| skipComponentGovernanceDetection: true | ||
| AdditionalOptions: '' | ||
| # format !<group1Id>:<artifact1Id>, !<group2Id>:<artifact2Id>,... no trailing comma is necessary | ||
| PLSkipOptions: '' | ||
| # This is the default Java build version. It's the version used to build the shipping libraries, Spotbugs etc. | ||
| JavaBuildVersion: '1.11' | ||
| # This is the default Java test version. It's the version used when running tests. | ||
| JavaTestVersion: '1.11' | ||
|
|
||
| # Maven build/test options | ||
| MAVEN_CACHE_FOLDER: $(Pipeline.Workspace)/.m2/repository | ||
| # See https://github.com/actions/virtual-environments/issues/1499 for more info about the wagon options | ||
| WagonOptions: '-Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.httpconnectionManager.ttlSeconds=120' | ||
| DefaultOptions: '-Dmaven.repo.local=$(MAVEN_CACHE_FOLDER) --batch-mode --fail-at-end --settings eng/settings.xml $(WagonOptions)' | ||
| LoggingOptions: '-Dorg.slf4j.simpleLogger.defaultLogLevel=error -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn' | ||
| MemoryOptions: '-Xmx3072m' | ||
| DefaultTestOptions: '$(DefaultOptions) -Dgpg.skip -Dmaven.javadoc.skip=true -Dspotbugs.skip=true -Dcheckstyle.skip=true -Drevapi.skip=true -DtrimStackTrace=false -pl $(ProjectList)' | ||
| DefaultTestMavenOptions: '$(MemoryOptions) $(LoggingOptions)' | ||
| AdditionalOptions: '' | ||
|
|
||
| skipComponentGovernanceDetection: true | ||
| IsDebug: $[coalesce(variables['System.Debug'], 'false')] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.