Skip to content

Commit 0a29822

Browse files
Merge pull request #846 from microsoftgraph/rsh/PipelineStages
Rsh/pipeline stages
2 parents 7196032 + a3e07ae commit 0a29822

File tree

8 files changed

+148
-19
lines changed

8 files changed

+148
-19
lines changed

.azure-pipelines/buildAndPackage.yml

Lines changed: 67 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@
66
trigger:
77
branches:
88
include:
9-
- dev
10-
- main
11-
- feature/v3
9+
- dev
1210
paths:
1311
include:
1412
- src/*
@@ -22,15 +20,74 @@ trigger:
2220
- THIRD PARTY NOTICES
2321
- README.md
2422

25-
pr: none
23+
pr:
24+
- dev
2625

2726
pool:
28-
vmImage: ubuntu-latest
27+
vmImage: windows-latest
2928

30-
steps:
31-
- template: templates/secure-files.yml
32-
- template: templates/build-and-coverage.yml
33-
- template: templates/publish-artifacts.yml
34-
- template: templates/alert-failure.yml
29+
stages:
30+
- stage: Build
31+
jobs:
32+
- job: Build
33+
steps:
34+
- template: templates/build/checkout-and-credscan.yml
35+
- template: templates/build/install-java.yml
36+
- template: templates/secure-files.yml
37+
parameters:
38+
stageID: 'build'
39+
- template: templates/build/build-and-coverage.yml
40+
- template: templates/build/publish-artifacts.yml
41+
- template: templates/alert-failure.yml
3542

43+
- stage: Maven-Preview
44+
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/dev'))
45+
jobs:
46+
- deployment: Maven-Preview
47+
environment: 'MSGraph SDK Development - Java'
48+
pool:
49+
vmImage: windows-latest
50+
strategy:
51+
runOnce:
52+
deploy:
53+
steps:
54+
- template: templates/download-artifacts.yml
55+
- template: templates/secure-files.yml
56+
- template: templates/maven-preview/copy-and-build.yml
57+
parameters:
58+
task: 'publishSnapshotPublicationToSonatypeSnapshotRepository'
59+
- template: templates/alert-failure.yml
3660

61+
- stage: Maven-Release-And-Github-Release
62+
dependsOn: []
63+
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/dev'))
64+
jobs:
65+
- deployment: Maven-Release
66+
environment: 'MSGraph SDK Development - Java'
67+
pool:
68+
vmImage: windows-latest
69+
strategy:
70+
runOnce:
71+
deploy:
72+
steps:
73+
- template: templates/secure-files.yml
74+
parameters:
75+
stageID: 'release'
76+
- template: templates/maven-release/copy-and-build.yml
77+
parameters:
78+
task: 'publishMavenCentralReleasePublicationToSonatypeRepository'
79+
- template: templates/alert-failure.yml
80+
81+
- deployment: Github-Release
82+
dependsOn: Maven-Release
83+
environment: 'MSGraph SDK Development - Java'
84+
pool:
85+
vmImage: windows-latest
86+
strategy:
87+
runOnce:
88+
deploy:
89+
steps:
90+
- template: templates/version-and-release.yml
91+
parameters:
92+
gitConnection: 'ramsessanchez'
93+
- template: templates/alert-failure.yml
File renamed without changes.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
steps:
2+
- checkout: self
3+
clean: true
4+
fetchDepth: 1
5+
6+
- task: securedevelopmentteam.vss-secure-development-tools.build-task-credscan.CredScan@2
7+
displayName: 'Run CredScan'
8+
inputs:
9+
debugMode: false
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
steps:
2+
- pwsh: 'Invoke-WebRequest -Uri https://github.com/AdoptOpenJDK/openjdk16-binaries/releases/download/jdk-16%2B36/OpenJDK16-jdk_x64_windows_hotspot_16_36.zip -OutFile OpenJDK.zip'
3+
displayName: 'Download JDK'
4+
5+
- task: JavaToolInstaller@0
6+
inputs:
7+
versionSpec: '16'
8+
jdkArchitectureOption: 'x64'
9+
jdkSourceOption: 'LocalDirectory'
10+
jdkFile: 'OpenJDK.zip'
11+
jdkDestinationDirectory: 'binaries'

.azure-pipelines/templates/publish-artifacts.yml renamed to .azure-pipelines/templates/build/publish-artifacts.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ steps:
1515
Scripts/getLatestVersion.ps1
1616
TargetFolder: '$(build.artifactstagingdirectory)/'
1717

18-
- task: PublishBuildArtifacts@1
19-
inputs:
20-
PathtoPublish: '$(build.artifactstagingdirectory)'
21-
ArtifactName: 'drop'
22-
publishLocation: 'Container'
18+
- publish: $(Build.ArtifactStagingDirectory)
19+
artifact: Drop
20+
displayName: Publish Build Artifact
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
parameters:
2+
- name: task
3+
type: string
4+
default: ''
5+
6+
steps:
7+
- task: CopyFiles@2
8+
inputs:
9+
SourceFolder: '$(Agent.TempDirectory)'
10+
Contents: '**'
11+
TargetFolder: '$(DROP_PATH)/'
12+
13+
- task: Gradle@2
14+
inputs:
15+
gradleWrapperFile: '$(DROP_PATH)/gradlew'
16+
workingDirectory: '$(DROP_PATH)/'
17+
options: '-x jar -x javadoc -x javadocJar -x compileJava -x processResources -x classes -x sourceJar'
18+
tasks: ${{ parameters.task }}
19+
publishJUnitResults: true
20+
testResultsFiles: '**/TEST-*.xml'
21+
javaHomeOption: 'JDKVersion'
22+
sonarQubeRunAnalysis: false
23+
spotBugsAnalysis: false

.azure-pipelines/templates/secure-files.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
1+
parameters:
2+
- name: stageID
3+
type: string
4+
default: ''
5+
16
steps:
2-
- task: DownloadSecureFile@1
3-
inputs:
4-
secureFile: 'local.properties'
5-
retryCount: '5'
7+
- task: DownloadSecureFile@1
8+
inputs:
9+
secureFile: 'local.properties'
10+
retryCount: '5'
611

12+
- ${{ if or(eq(parameters.stageID, 'build'), eq(parameters.stageID, 'release') }}:
713
- task: DownloadSecureFile@1
814
inputs:
915
secureFile: 'secring.gpg'
@@ -14,6 +20,7 @@ steps:
1420
secureFile: 'secring.gpg.lock'
1521
retryCount: '5'
1622

23+
- ${{ if eq(parameters.stageID, 'build') }}:
1724
- task: CopyFiles@2
1825
inputs:
1926
SourceFolder: '$(Agent.TempDirectory)'
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
parameters:
2+
- name: gitConnection
3+
type: string
4+
default: ''
5+
6+
steps:
7+
- task: PowerShell@2
8+
inputs:
9+
filePath: '$(DROP_PATH)/Scripts/getLatestVersion.ps1'
10+
arguments: '-propertiesPath "$(PROPERTIES_PATH)"'
11+
12+
- task: GitHubRelease@1
13+
inputs:
14+
gitHubConnection: ${{ parameters.gitConnection }}
15+
repositoryName: '$(Build.Repository.Name)'
16+
action: 'create'
17+
target: '$(Build.SourceVersion)'
18+
tagSource: 'userSpecifiedTag'
19+
tag: '$(VERSION_STRING)'
20+
assets: |
21+
!**/**
22+
$(Build.ArtifactStagingDirectory)/*
23+
changeLogCompareToRelease: 'lastFullRelease'
24+
changeLogType: 'commitBased'

0 commit comments

Comments
 (0)