Skip to content

Commit e74cae9

Browse files
authored
Merge branch 'vnext' into feature/add-path-signature-unique-validation
2 parents 3ce6830 + a4ffde3 commit e74cae9

File tree

606 files changed

+48644
-22867
lines changed

Some content is hidden

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

606 files changed

+48644
-22867
lines changed

.azure-pipelines/ci-build.yml

Lines changed: 350 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,350 @@
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+
trigger:
7+
branches:
8+
include:
9+
- master
10+
- vnext
11+
pr:
12+
branches:
13+
include:
14+
- master
15+
- vnext
16+
17+
pool:
18+
name: Azure Pipelines
19+
vmImage: windows-latest
20+
21+
variables:
22+
buildPlatform: 'Any CPU'
23+
buildConfiguration: 'Release'
24+
ProductBinPath: '$(Build.SourcesDirectory)\src\Microsoft.OpenApi\bin\$(BuildConfiguration)'
25+
26+
27+
stages:
28+
29+
- stage: build
30+
jobs:
31+
- job: build
32+
steps:
33+
- task: UseDotNet@2
34+
displayName: 'Use .NET 2' # needed for ESRP signing
35+
inputs:
36+
version: 2.x
37+
38+
- task: UseDotNet@2
39+
displayName: 'Use .NET 7'
40+
inputs:
41+
version: 7.x
42+
43+
- task: PoliCheck@1
44+
displayName: 'Run PoliCheck "/src"'
45+
inputs:
46+
inputType: CmdLine
47+
cmdLineArgs: '/F:$(Build.SourcesDirectory)/src /T:9 /Sev:"1|2" /PE:2 /O:poli_result_src.xml'
48+
49+
- task: PoliCheck@1
50+
displayName: 'Run PoliCheck "/test"'
51+
inputs:
52+
inputType: CmdLine
53+
cmdLineArgs: '/F:$(Build.SourcesDirectory)/test /T:9 /Sev:"1|2" /PE:2 /O:poli_result_test.xml'
54+
55+
# Install the nuget tool.
56+
- task: NuGetToolInstaller@0
57+
displayName: 'Use NuGet >=5.2.0'
58+
inputs:
59+
versionSpec: '>=5.2.0'
60+
checkLatest: true
61+
62+
# Build the Product project
63+
- task: DotNetCoreCLI@2
64+
displayName: 'build'
65+
inputs:
66+
projects: '$(Build.SourcesDirectory)\Microsoft.OpenApi.sln'
67+
arguments: '--configuration $(BuildConfiguration) --no-incremental'
68+
69+
# Run the Unit test
70+
- task: DotNetCoreCLI@2
71+
displayName: 'test'
72+
inputs:
73+
command: test
74+
projects: '$(Build.SourcesDirectory)\Microsoft.OpenApi.sln'
75+
arguments: '--configuration $(BuildConfiguration) --no-build'
76+
77+
# CredScan
78+
- task: securedevelopmentteam.vss-secure-development-tools.build-task-credscan.CredScan@2
79+
displayName: 'Run CredScan - Src'
80+
inputs:
81+
toolMajorVersion: 'V2'
82+
scanFolder: '$(Build.SourcesDirectory)\src'
83+
debugMode: false
84+
85+
- task: securedevelopmentteam.vss-secure-development-tools.build-task-credscan.CredScan@2
86+
displayName: 'Run CredScan - Test'
87+
inputs:
88+
toolMajorVersion: 'V2'
89+
scanFolder: '$(Build.SourcesDirectory)\test'
90+
debugMode: false
91+
92+
- task: AntiMalware@3
93+
displayName: 'Run MpCmdRun.exe - ProductBinPath'
94+
inputs:
95+
FileDirPath: '$(ProductBinPath)'
96+
enabled: false
97+
98+
- task: BinSkim@3
99+
displayName: 'Run BinSkim - Product Binaries'
100+
inputs:
101+
InputType: Basic
102+
AnalyzeTarget: '$(ProductBinPath)\**\Microsoft.OpenApi.dll'
103+
AnalyzeSymPath: '$(ProductBinPath)'
104+
AnalyzeVerbose: true
105+
AnalyzeHashes: true
106+
AnalyzeEnvironment: true
107+
108+
- task: PublishSecurityAnalysisLogs@2
109+
displayName: 'Publish Security Analysis Logs'
110+
inputs:
111+
ArtifactName: SecurityLogs
112+
113+
- task: PostAnalysis@1
114+
displayName: 'Post Analysis'
115+
inputs:
116+
BinSkim: true
117+
CredScan: true
118+
PoliCheck: true
119+
120+
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1
121+
displayName: 'ESRP CodeSigning'
122+
inputs:
123+
ConnectedServiceName: 'microsoftgraph ESRP CodeSign DLL and NuGet (AKV)'
124+
FolderPath: src
125+
signConfigType: inlineSignParams
126+
inlineOperation: |
127+
[
128+
{
129+
"keyCode": "CP-230012",
130+
"operationSetCode": "SigntoolSign",
131+
"parameters": [
132+
{
133+
"parameterName": "OpusName",
134+
"parameterValue": "Microsoft"
135+
},
136+
{
137+
"parameterName": "OpusInfo",
138+
"parameterValue": "http://www.microsoft.com"
139+
},
140+
{
141+
"parameterName": "FileDigest",
142+
"parameterValue": "/fd \"SHA256\""
143+
},
144+
{
145+
"parameterName": "PageHash",
146+
"parameterValue": "/NPH"
147+
},
148+
{
149+
"parameterName": "TimeStamp",
150+
"parameterValue": "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256"
151+
}
152+
],
153+
"toolName": "sign",
154+
"toolVersion": "1.0"
155+
},
156+
{
157+
"keyCode": "CP-230012",
158+
"operationSetCode": "SigntoolVerify",
159+
"parameters": [ ],
160+
"toolName": "sign",
161+
"toolVersion": "1.0"
162+
}
163+
]
164+
SessionTimeout: 20
165+
166+
# Pack
167+
- pwsh: dotnet pack $(Build.SourcesDirectory)/src/Microsoft.OpenApi/Microsoft.OpenApi.csproj -o $(Build.ArtifactStagingDirectory) --configuration $(BuildConfiguration) --no-build --include-symbols --include-source /p:SymbolPackageFormat=snupkg
168+
displayName: 'pack OpenAPI'
169+
170+
# Pack
171+
- pwsh: dotnet pack $(Build.SourcesDirectory)/src/Microsoft.OpenApi.Readers/Microsoft.OpenApi.Readers.csproj -o $(Build.ArtifactStagingDirectory) --configuration $(BuildConfiguration) --no-build --include-symbols --include-source /p:SymbolPackageFormat=snupkg
172+
displayName: 'pack Readers'
173+
174+
# Pack
175+
- pwsh: dotnet pack $(Build.SourcesDirectory)/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj -o $(Build.ArtifactStagingDirectory) --configuration $(BuildConfiguration) --no-build --include-symbols --include-source /p:SymbolPackageFormat=snupkg
176+
displayName: 'pack Hidi'
177+
178+
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1
179+
displayName: 'ESRP CodeSigning Nuget Packages'
180+
inputs:
181+
ConnectedServiceName: 'microsoftgraph ESRP CodeSign DLL and NuGet (AKV)'
182+
FolderPath: '$(Build.ArtifactStagingDirectory)'
183+
Pattern: '*.nupkg'
184+
signConfigType: inlineSignParams
185+
inlineOperation: |
186+
[
187+
{
188+
"keyCode": "CP-401405",
189+
"operationSetCode": "NuGetSign",
190+
"parameters": [ ],
191+
"toolName": "sign",
192+
"toolVersion": "1.0"
193+
},
194+
{
195+
"keyCode": "CP-401405",
196+
"operationSetCode": "NuGetVerify",
197+
"parameters": [ ],
198+
"toolName": "sign",
199+
"toolVersion": "1.0"
200+
}
201+
]
202+
SessionTimeout: 20
203+
204+
- task: PowerShell@2
205+
displayName: "Get Hidi's version-number from .csproj"
206+
inputs:
207+
targetType: 'inline'
208+
script: |
209+
$xml = [Xml] (Get-Content .\src\Microsoft.OpenApi.Hidi\Microsoft.OpenApi.Hidi.csproj)
210+
$version = $xml.Project.PropertyGroup.Version
211+
echo $version
212+
echo "##vso[task.setvariable variable=hidiversion]$version"
213+
214+
# publish hidi as an .exe
215+
- task: DotNetCoreCLI@2
216+
displayName: publish Hidi as executable
217+
inputs:
218+
command: 'publish'
219+
arguments: -c Release --runtime win-x64 /p:PublishSingleFile=true /p:PackAsTool=false --self-contained --output $(Build.ArtifactStagingDirectory)/Microsoft.OpenApi.Hidi-v$(hidiversion)
220+
projects: 'src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj'
221+
publishWebProjects: False
222+
zipAfterPublish: false
223+
224+
- task: CopyFiles@2
225+
displayName: Prepare staging folder for upload
226+
inputs:
227+
targetFolder: $(Build.ArtifactStagingDirectory)/Nugets
228+
sourceFolder: $(Build.ArtifactStagingDirectory)
229+
content: '*.nupkg'
230+
231+
- task: PublishBuildArtifacts@1
232+
displayName: 'Publish Artifact: Nugets'
233+
inputs:
234+
ArtifactName: Nugets
235+
PathtoPublish: '$(Build.ArtifactStagingDirectory)/Nugets'
236+
237+
- task: PublishBuildArtifacts@1
238+
displayName: 'Publish Artifact: Hidi'
239+
inputs:
240+
ArtifactName: Microsoft.OpenApi.Hidi-v$(hidiversion)
241+
PathtoPublish: '$(Build.ArtifactStagingDirectory)/Microsoft.OpenApi.Hidi-v$(hidiversion)'
242+
243+
- stage: deploy
244+
condition: and(contains(variables['build.sourceBranch'], 'refs/heads/master'), succeeded())
245+
dependsOn: build
246+
jobs:
247+
- deployment: deploy_hidi
248+
dependsOn: []
249+
environment: nuget-org
250+
strategy:
251+
runOnce:
252+
deploy:
253+
pool:
254+
vmImage: ubuntu-latest
255+
steps:
256+
- task: DownloadPipelineArtifact@2
257+
displayName: Download nupkg from artifacts
258+
inputs:
259+
artifact: Nugets
260+
source: current
261+
- task: DownloadPipelineArtifact@2
262+
displayName: Download hidi executable from artifacts
263+
inputs:
264+
source: current
265+
- pwsh: |
266+
$artifactName = Get-ChildItem -Path $(Pipeline.Workspace)\Nugets -Filter Microsoft.OpenApi.*.nupkg -recurse | select -First 1
267+
$artifactVersion= $artifactName.Name -replace "Microsoft.OpenApi.", "" -replace ".nupkg", ""
268+
#Set Variable $artifactName and $artifactVersion
269+
Write-Host "##vso[task.setvariable variable=artifactVersion; isSecret=false; isOutput=true]$artifactVersion"
270+
Write-Host "##vso[task.setvariable variable=artifactName; isSecret=false; isOutput=true]$artifactName.FullName"
271+
echo "$artifactName"
272+
echo "$artifactVersion"
273+
displayName: 'Fetch Artifact Name'
274+
- task: NuGetCommand@2
275+
displayName: 'NuGet push'
276+
inputs:
277+
command: push
278+
packagesToPush: '$(Pipeline.Workspace)/Nugets/Microsoft.OpenApi.Hidi.*.nupkg'
279+
nuGetFeedType: external
280+
publishFeedCredentials: 'OpenAPI Nuget Connection'
281+
- task: GitHubRelease@1
282+
displayName: 'GitHub release (edit)'
283+
condition: succeededOrFailed()
284+
inputs:
285+
gitHubConnection: 'Github-MaggieKimani1'
286+
action: edit
287+
tagSource: userSpecifiedTag
288+
tag: '$(artifactVersion)'
289+
title: '$(artifactVersion)'
290+
releaseNotesSource: inline
291+
assets: '$(Pipeline.Workspace)\**\*.exe'
292+
changeLogType: issueBased
293+
changeLogLabels: '[
294+
{ "label" : "feature-work", "feature", "displayName" : "New Features", "state" : "closed" },
295+
{ "label" : "enhancement", "V2-Enhancement", "displayName" : "Enhancements", "state" : "closed" },
296+
{ "label" : "bug", "bug-fix", "displayName" : "Bugs", "state" : "closed" },
297+
{ "label" : "documentation", "doc", "displayName" : "Documentation", "state" : "closed"},
298+
{ "label" : "dependencies", "displayName" : "Package Updates", "state" : "closed" }]'
299+
300+
- deployment: deploy_lib
301+
dependsOn: []
302+
environment: nuget-org
303+
strategy:
304+
runOnce:
305+
deploy:
306+
pool:
307+
vmImage: ubuntu-latest
308+
steps:
309+
- task: DownloadPipelineArtifact@2
310+
displayName: Download nupkg from artifacts
311+
inputs:
312+
artifact: Nugets
313+
source: current
314+
- powershell: |
315+
$fileNames = "$(Pipeline.Workspace)/Nugets/Microsoft.OpenApi.Hidi.*.nupkg", "$(Pipeline.Workspace)/Nugets/Microsoft.OpenApi.Readers.*.nupkg", "$(Pipeline.Workspace)/Nugets/Microsoft.OpenApi.Workbench.*.nupkg"
316+
foreach($fileName in $fileNames) {
317+
if(Test-Path $fileName) {
318+
rm $fileName -Verbose
319+
}
320+
}
321+
displayName: remove other nupkgs to avoid duplication
322+
- task: NuGetCommand@2
323+
displayName: 'NuGet push'
324+
inputs:
325+
command: push
326+
packagesToPush: '$(Pipeline.Workspace)/Nugets/Microsoft.OpenApi.*.nupkg'
327+
nuGetFeedType: external
328+
publishFeedCredentials: 'OpenAPI Nuget Connection'
329+
330+
- deployment: deploy_readers
331+
dependsOn: deploy_lib
332+
environment: nuget-org
333+
strategy:
334+
runOnce:
335+
deploy:
336+
pool:
337+
vmImage: ubuntu-latest
338+
steps:
339+
- task: DownloadPipelineArtifact@2
340+
displayName: Download nupkg from artifacts
341+
inputs:
342+
artifact: Nugets
343+
source: current
344+
- task: NuGetCommand@2
345+
displayName: 'NuGet push'
346+
inputs:
347+
command: push
348+
packagesToPush: '$(Pipeline.Workspace)/Nugets/Microsoft.OpenApi.Readers.*.nupkg'
349+
nuGetFeedType: external
350+
publishFeedCredentials: 'OpenAPI Nuget Connection'

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ csharp_prefer_braces = true:silent
8484
csharp_style_deconstructed_variable_declaration = true:suggestion
8585
csharp_prefer_simple_default_expression = true:suggestion
8686
csharp_style_pattern_local_over_anonymous_function = true:suggestion
87-
csharp_style_inlined_variable_declaration = true:suggestion
87+
csharp_style_inlined_variable_declaration = true:error
8888
###############################
8989
# C# Formatting Rules #
9090
###############################

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @irvinesunday @darrelmiller @peombwa @zengin @baywet @millicentachieng @MaggieKimani1 @andrueastman

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
**Describe the bug**
11+
A clear and concise description of what the bug is.
12+
13+
**To Reproduce**
14+
Steps to reproduce the current behavior:
15+
16+
**Expected behavior**
17+
A clear and concise description of what you expected to happen.
18+
19+
**Screenshots/Code Snippets**
20+
If applicable, add screenshots of the stack trace or a code snippet to help explain your problem.
21+
If applicable, add a link to your project
22+
23+
**Additional context**
24+
Add any other context about the problem here.

0 commit comments

Comments
 (0)