Skip to content

Commit 755e785

Browse files
georgendGeorgeMicrosoft Graph DevX Tooling
authored
Integrated Build Pipeline & Simple build file (#355)
Create Integrated Build Pipeline Co-authored-by: George <[email protected]> Co-authored-by: Microsoft Graph DevX Tooling <[email protected]>
1 parent 9363eac commit 755e785

File tree

187 files changed

+184702
-149292
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

187 files changed

+184702
-149292
lines changed
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# Copyright (c) Microsoft Corporation. All rights reserved.
2+
# Licensed under the MIT License.
3+
4+
parameters:
5+
- name: BUILDNUMBER
6+
displayName: 'Build Number'
7+
type: string
8+
default: $[format('{0:yyMMddHH}', pipeline.startTime)]
9+
10+
jobs:
11+
- job: MsGraphDownloadOpenApiDocs
12+
displayName: Microsoft Graph PowerShell SDK Download OpenApiDocs Module Generation
13+
pool: MsGraphDevXAzureAgents
14+
timeoutInMinutes: 600
15+
16+
steps:
17+
- checkout: self
18+
persistCredentials: true
19+
20+
- template: ./install-tools-template.yml
21+
22+
- task: PowerShell@2
23+
displayName: 'Download v1.0 OpenApiDocs'
24+
continueOnError: true
25+
condition: and(succeeded(), eq(eq(variables['Build.SourceBranch'], 'refs/heads/master'), false))
26+
inputs:
27+
targetType: 'filePath'
28+
pwsh: true
29+
filePath: '$(System.DefaultWorkingDirectory)/tools/UpdateOpenApi.ps1'
30+
31+
32+
- task: PowerShell@2
33+
displayName: 'Download beta OpenApiDocs'
34+
continueOnError: false
35+
condition: and(succeeded(), eq(eq(variables['Build.SourceBranch'], 'refs/heads/master'), false))
36+
inputs:
37+
targetType: 'filePath'
38+
pwsh: true
39+
filePath: '$(System.DefaultWorkingDirectory)/tools/UpdateOpenApi.ps1'
40+
arguments: >
41+
-BetaGraphVersion
42+
43+
- task: PowerShell@2
44+
displayName: "Configure User"
45+
condition: and(succeeded(), eq(eq(variables['Build.SourceBranch'], 'refs/heads/master'), false))
46+
inputs:
47+
targetType: 'inline'
48+
pwsh: true
49+
script: |
50+
git config --global user.email '[email protected]'
51+
git config --global user.name 'Microsoft Graph DevX Tooling'
52+
53+
- task: CmdLine@2
54+
condition: and(succeeded(), eq(eq(variables['Build.SourceBranch'], 'refs/heads/master'), false))
55+
env:
56+
GITHUB_TOKEN: $(GITHUB_TOKEN)
57+
inputs:
58+
targetType: 'inline'
59+
script: |
60+
@echo off
61+
ECHO SOURCE BRANCH IS %BUILD_SOURCEBRANCH%
62+
IF %BUILD_SOURCEBRANCH% == refs/heads/master (
63+
ECHO Building master branch so no merge is needed.
64+
EXIT
65+
)
66+
SET sourceBranch=origin/%BUILD_SOURCEBRANCH:refs/heads/=%
67+
git status
68+
git checkout %sourceBranch%
69+
git pull origin %sourceBranch%
70+
git add -A
71+
git commit -m "$(BUILDNUMBER): Release OpenApiDocs Download for $(BUILDNUMBER)[skip ci]"
72+
git pull origin %sourceBranch%
73+
git push --set-upstream origin %sourceBranch%
74+
git push origin HEAD:%sourceBranch%
75+
git merge %sourceBranch% -m "$(BUILDNUMBER): Release OpenApiDocs Download for $(BUILDNUMBER)[skip ci]"
76+
git push origin %sourceBranch%
77+
git status
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Copyright (c) Microsoft Corporation. All rights reserved.
2+
# Licensed under the MIT License.
3+
4+
name: $(BuildDefinitionName)_$(SourceBranchName)_$(Date:yyyyMMdd)$(Rev:.r)
5+
6+
pool:
7+
vmImage: "windows-latest"
8+
9+
variables:
10+
BRANCH: 'weeklyOpenApiDocsDownload'
11+
GitUserEmail: '[email protected]'
12+
GitUserName: 'Microsoft Graph DevX Tooling'
13+
BaseBranch: 'dev'
14+
15+
schedules:
16+
- cron: "0 0 * * WED" # Run Every Wednesday
17+
displayName: "Weekly OpenApiDocs Download and PR"
18+
branches:
19+
include:
20+
- dev
21+
always: true
22+
23+
stages:
24+
- stage: DownloadOpenApiDocs
25+
displayName: 'Download Open Api Docs from DevX API'
26+
jobs:
27+
- job: DownloadOpenAPiDocs
28+
steps:
29+
- template: ./download-openapidocs-template.yml
30+
parameters:
31+
GitUserEmail: $(GitUserEmail)
32+
GitUserName: $(GitUserName)
33+
BaseBranch: $(BaseBranch)
Lines changed: 200 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,200 @@
1+
# Copyright (c) Microsoft Corporation. All rights reserved.
2+
# Licensed under the MIT License.
3+
4+
parameters:
5+
- name: AUTH_MODULE_PATH
6+
displayName: 'Authentication Module Path'
7+
type: string
8+
default: 'src\Authentication\Authentication\'
9+
- name: AUTH_MODULE_NAME
10+
displayName: 'Authentication Module Name'
11+
type: string
12+
default: 'Authentication'
13+
- name: AUTH_MODULE_DLL_PATTERN
14+
displayName: 'Authentication Module DLL Pattern'
15+
type: string
16+
default: 'Microsoft.Graph.Authentication.dll'
17+
- name: Api_Key
18+
displayName: 'Api Key'
19+
type: string
20+
- name: EnableSigning
21+
displayName: 'Enable Signing'
22+
type: boolean
23+
default: false
24+
- name: BUILDNUMBER
25+
displayName: 'Build Number'
26+
type: string
27+
default: $[format('{0:yyMMddHH}', pipeline.startTime)]
28+
29+
jobs:
30+
- job: MsGraphPSSDKAuthModuleGeneration
31+
displayName: Microsoft Graph PowerShell SDK Auth Module Generation
32+
pool: MsGraphDevXAzureAgents
33+
34+
steps:
35+
- template: ./install-tools-template.yml
36+
37+
- task: PowerShell@2
38+
displayName: 'Generate and Build Auth Module'
39+
inputs:
40+
targetType: 'inline'
41+
pwsh: true
42+
script: |
43+
Write-Host $(BUILDNUMBER)
44+
pwsh $(System.DefaultWorkingDirectory)/tools/GenerateAuthenticationModule.ps1 -ArtifactsLocation $(Build.ArtifactStagingDirectory) -Build -ModulePreviewNumber $(BUILDNUMBER)
45+
46+
- task: DotNetCoreCLI@2
47+
displayName: 'Run: Enabled Tests'
48+
inputs:
49+
command: 'test'
50+
publishTestResults: true
51+
projects: '$(System.DefaultWorkingDirectory)/src/Authentication/Authentication.Test/*.csproj'
52+
testRunTitle: 'Run Enabled Tests'
53+
54+
- task: RoslynAnalyzers@2
55+
inputs:
56+
userProvideBuildInfo: 'msBuildInfo'
57+
msBuildVersion: '16.0'
58+
msBuildArchitecture: 'x64'
59+
msBuildCommandline: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\amd64\msbuild.exe" $(System.DefaultWorkingDirectory)//src//Authentication//Authentication.sln /nologo /nr:false /p:VisualStudioVersion="16.0"'
60+
61+
- task: CodeMetrics@1
62+
displayName: 'Run CodeMetrics'
63+
inputs:
64+
Files: '$(System.DefaultWorkingDirectory)//**//*Microsoft.Graph*.dll;$(System.DefaultWorkingDirectory)//**//*Microsoft.Graph*.exe'
65+
file: '$(System.DefaultWorkingDirectory)//**//*Microsoft.Graph*.dll;$(System.DefaultWorkingDirectory)//**//*Microsoft.Graph*.exe'
66+
continueOnError: true
67+
68+
- task: PowerShell@2
69+
displayName: 'Generate and Build Auth Module'
70+
inputs:
71+
targetType: 'inline'
72+
pwsh: true
73+
script: |
74+
Write-Host $(BUILDNUMBER)
75+
pwsh $(System.DefaultWorkingDirectory)/tools/GenerateAuthenticationModule.ps1 -ArtifactsLocation $(Build.ArtifactStagingDirectory) -Build -EnableSigning -ModulePreviewNumber $(BUILDNUMBER) -RepositoryName "LocalNugetFeed"
76+
77+
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1
78+
displayName: 'ESRP DLL Strong Name (Graph Auth Module)'
79+
enabled: true
80+
inputs:
81+
ConnectedServiceName: 'microsoftgraph ESRP CodeSign DLL and NuGet (AKV)'
82+
FolderPath: $(AUTH_MODULE_PATH)
83+
Pattern: $(AUTH_MODULE_DLL_PATTERN)
84+
signConfigType: inlineSignParams
85+
inlineOperation: |
86+
[
87+
{
88+
"keyCode": "CP-233863-SN",
89+
"operationSetCode": "StrongNameSign",
90+
"parameters": [],
91+
"toolName": "sign",
92+
"toolVersion": "1.0"
93+
},
94+
{
95+
"keyCode": "CP-233863-SN",
96+
"operationSetCode": "StrongNameVerify",
97+
"parameters": [],
98+
"toolName": "sign",
99+
"toolVersion": "1.0"
100+
}
101+
]
102+
SessionTimeout: 20
103+
104+
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1
105+
displayName: 'ESRP DLL CodeSigning (Graph Auth Module)'
106+
enabled: true
107+
inputs:
108+
ConnectedServiceName: 'microsoftgraph ESRP CodeSign DLL and NuGet (AKV)'
109+
FolderPath: $(AUTH_MODULE_PATH)
110+
Pattern: $(AUTH_MODULE_DLL_PATTERN)
111+
signConfigType: inlineSignParams
112+
inlineOperation: |
113+
[
114+
{
115+
"keyCode": "CP-230012",
116+
"operationSetCode": "SigntoolSign",
117+
"parameters": [
118+
{
119+
"parameterName": "OpusName",
120+
"parameterValue": "Microsoft"
121+
},
122+
{
123+
"parameterName": "OpusInfo",
124+
"parameterValue": "http://www.microsoft.com"
125+
},
126+
{
127+
"parameterName": "FileDigest",
128+
"parameterValue": "/fd \"SHA256\""
129+
},
130+
{
131+
"parameterName": "PageHash",
132+
"parameterValue": "/NPH"
133+
},
134+
{
135+
"parameterName": "TimeStamp",
136+
"parameterValue": "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256"
137+
}
138+
],
139+
"toolName": "sign",
140+
"toolVersion": "1.0"
141+
},
142+
{
143+
"keyCode": "CP-230012",
144+
"operationSetCode": "SigntoolVerify",
145+
"parameters": [],
146+
"toolName": "sign",
147+
"toolVersion": "1.0"
148+
}
149+
]
150+
SessionTimeout: 20
151+
152+
- task: PowerShell@2
153+
displayName: 'Pack Auth Module'
154+
inputs:
155+
targetType: 'inline'
156+
pwsh: true
157+
script: |
158+
pwsh $(System.DefaultWorkingDirectory)/tools/PackModule.ps1 -Module $(AUTH_MODULE_NAME) -ArtifactsLocation $(Build.ArtifactStagingDirectory)
159+
160+
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1
161+
displayName: 'ESRP NuGet CodeSigning'
162+
enabled: true
163+
inputs:
164+
ConnectedServiceName: 'microsoftgraph ESRP CodeSign DLL and NuGet (AKV)'
165+
FolderPath: '$(Build.ArtifactStagingDirectory)\$(AUTH_MODULE_NAME)'
166+
Pattern: 'Microsoft.Graph.$(AUTH_MODULE_NAME)*.nupkg'
167+
signConfigType: inlineSignParams
168+
inlineOperation: |
169+
[
170+
{
171+
"keyCode": "CP-401405",
172+
"operationSetCode": "NuGetSign",
173+
"parameters": [ ],
174+
"toolName": "sign",
175+
"toolVersion": "1.0"
176+
},
177+
{
178+
"keyCode": "CP-401405",
179+
"operationSetCode": "NuGetVerify",
180+
"parameters": [ ],
181+
"toolName": "sign",
182+
"toolVersion": "1.0"
183+
}
184+
]
185+
SessionTimeout: 20
186+
187+
- task: NuGetCommand@2
188+
displayName: 'NuGet Publish To Local Build Feed'
189+
inputs:
190+
command: push
191+
packagesToPush: '$(Build.ArtifactStagingDirectory)\$(AUTH_MODULE_NAME)\Microsoft.Graph.$(AUTH_MODULE_NAME)*.nupkg'
192+
publishVstsFeed: '0985d294-5762-4bc2-a565-161ef349ca3e/edc337b9-e5ea-49dd-a2cb-e8d66668ca57'
193+
allowPackageConflicts: true
194+
195+
- task: PublishBuildArtifacts@1
196+
displayName: Publish Artifact Microsoft.Graph.Authentication.nupkg'
197+
inputs:
198+
PathtoPublish: '$(Build.ArtifactStagingDirectory)/$(AUTH_MODULE_NAME)'
199+
ArtifactName: 'drop'
200+
publishLocation: 'Container'

.azure-pipelines/generate-auth-module.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1
4343
displayName: 'ESRP DLL Strong Name (Graph Auth Module)'
4444
inputs:
45-
ConnectedServiceName: 'microsoftgraph ESRP CodeSign DLL and NuGet'
45+
ConnectedServiceName: 'microsoftgraph ESRP CodeSign DLL and NuGet (AKV)'
4646
FolderPath: $(MODULE_PATH)
4747
Pattern: $(MODULE_DLL_PATTERN)
4848
signConfigType: inlineSignParams
@@ -68,7 +68,7 @@ jobs:
6868
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1
6969
displayName: 'ESRP DLL CodeSigning (Graph Auth Module)'
7070
inputs:
71-
ConnectedServiceName: 'microsoftgraph ESRP CodeSign DLL and NuGet'
71+
ConnectedServiceName: 'microsoftgraph ESRP CodeSign DLL and NuGet (AKV)'
7272
FolderPath: $(MODULE_PATH)
7373
Pattern: $(MODULE_DLL_PATTERN)
7474
signConfigType: inlineSignParams
@@ -123,7 +123,7 @@ jobs:
123123
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1
124124
displayName: 'ESRP NuGet CodeSigning'
125125
inputs:
126-
ConnectedServiceName: 'microsoftgraph ESRP CodeSign DLL and NuGet'
126+
ConnectedServiceName: 'microsoftgraph ESRP CodeSign DLL and NuGet (AKV)'
127127
FolderPath: '$(Build.ArtifactStagingDirectory)\$(MODULE_NAME)'
128128
Pattern: 'Microsoft.Graph.$(MODULE_NAME)*.nupkg'
129129
signConfigType: inlineSignParams
@@ -161,4 +161,4 @@ jobs:
161161
title: '$(Build.DefinitionName) failure notification'
162162
text: 'This pipeline has failed. View the build details for further information. This is a blocking failure. '
163163
condition: and(failed(), ne(variables['Build.Reason'], 'Manual'))
164-
enabled: true
164+
enabled: true

0 commit comments

Comments
 (0)