Skip to content

Commit 7b62bdd

Browse files
authored
Merge pull request #623 from microsoft/ci/alignment-to-v1
ci: aligns v1 ci with latest main changes
2 parents 24520b0 + 101cfab commit 7b62bdd

File tree

9 files changed

+179
-32
lines changed

9 files changed

+179
-32
lines changed

.azure-pipelines/ci-build.yml

Lines changed: 83 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@ name: $(BuildDefinitionName)_$(SourceBranchName)_$(Date:yyyyMMdd)$(Rev:.r)
66
trigger:
77
branches:
88
include:
9-
- master
9+
- main
10+
- support/v1
1011
pr:
1112
branches:
1213
include:
13-
- master
14+
- main
15+
- support/v1
1416

1517
variables:
1618
buildPlatform: 'Any CPU'
@@ -60,10 +62,10 @@ extends:
6062
version: 8.x
6163

6264
# Install the nuget tool.
63-
- task: NuGetToolInstaller@0
64-
displayName: 'Use NuGet >=5.2.0'
65+
- task: NuGetToolInstaller@1
66+
displayName: 'Use NuGet >=6.11.0'
6567
inputs:
66-
versionSpec: '>=5.2.0'
68+
versionSpec: '>=6.11.0'
6769
checkLatest: true
6870

6971
# Build the Product project
@@ -81,11 +83,16 @@ extends:
8183
projects: '$(Build.SourcesDirectory)\Microsoft.OpenApi.OData.sln'
8284
arguments: '--configuration $(BuildConfiguration) --no-build'
8385

84-
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@3
86+
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@5
8587
displayName: 'ESRP CodeSigning'
8688
inputs:
87-
ConnectedServiceName: 'microsoftgraph ESRP CodeSign DLL and NuGet (AKV)'
88-
FolderPath: src
89+
ConnectedServiceName: 'Federated DevX ESRP Managed Identity Connection'
90+
FolderPath: 'src'
91+
AppRegistrationClientId: '65035b7f-7357-4f29-bf25-c5ee5c3949f8'
92+
AppRegistrationTenantId: 'cdc5aeea-15c5-4db6-b079-fcadd2505dc2'
93+
AuthAKVName: 'akv-prod-eastus'
94+
AuthCertName: 'ReferenceLibraryPrivateCert'
95+
AuthSignCertName: 'ReferencePackagePublisherCertificate'
8996
signConfigType: inlineSignParams
9097
inlineOperation: |
9198
[
@@ -125,7 +132,10 @@ extends:
125132
"toolVersion": "1.0"
126133
}
127134
]
128-
SessionTimeout: 20
135+
SessionTimeout: '20'
136+
MaxConcurrency: '50'
137+
MaxRetryAttempts: '5'
138+
PendingAnalysisWaitTimeoutMinutes: '5'
129139

130140
# Pack
131141
- task: DotNetCoreCLI@2
@@ -137,17 +147,22 @@ extends:
137147

138148
- task: PowerShell@2
139149
displayName: 'Validate project version has been incremented'
140-
condition: and(contains(variables['build.sourceBranch'], 'refs/heads/master'), succeeded())
150+
condition: and(or(contains(variables['build.sourceBranch'], 'refs/heads/main'), contains(variables['build.sourceBranch'], 'refs/heads/support/v1')), succeeded())
141151
inputs:
142152
targetType: 'filePath'
143153
filePath: $(System.DefaultWorkingDirectory)\scripts\ValidateProjectVersionUpdated.ps1
144154
pwsh: true
145155

146-
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@3
156+
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@5
147157
displayName: 'ESRP CodeSigning Nuget Packages'
148158
inputs:
149-
ConnectedServiceName: 'microsoftgraph ESRP CodeSign DLL and NuGet (AKV)'
159+
ConnectedServiceName: 'Federated DevX ESRP Managed Identity Connection'
150160
FolderPath: '$(Build.ArtifactStagingDirectory)'
161+
AppRegistrationClientId: '65035b7f-7357-4f29-bf25-c5ee5c3949f8'
162+
AppRegistrationTenantId: 'cdc5aeea-15c5-4db6-b079-fcadd2505dc2'
163+
AuthAKVName: 'akv-prod-eastus'
164+
AuthCertName: 'ReferenceLibraryPrivateCert'
165+
AuthSignCertName: 'ReferencePackagePublisherCertificate'
151166
Pattern: '*.nupkg'
152167
signConfigType: inlineSignParams
153168
inlineOperation: |
@@ -167,30 +182,78 @@ extends:
167182
"toolVersion": "1.0"
168183
}
169184
]
170-
SessionTimeout: 20
185+
SessionTimeout: '60'
186+
MaxConcurrency: '50'
187+
MaxRetryAttempts: '5'
188+
PendingAnalysisWaitTimeoutMinutes: '5'
171189

172190
- stage: deploy
173-
condition: and(contains(variables['build.sourceBranch'], 'refs/heads/master'), succeeded())
191+
condition: and(or(contains(variables['build.sourceBranch'], 'refs/heads/main'), contains(variables['build.sourceBranch'], 'refs/heads/support/v1')), succeeded())
174192
dependsOn: build
175193
jobs:
176194
- deployment: deploy
195+
templateContext:
196+
type: releaseJob
197+
isProduction: true
198+
inputs:
199+
- input: pipelineArtifact
200+
artifactName: Nugets
201+
targetPath: '$(Pipeline.Workspace)'
177202
environment: nuget-org
178203
strategy:
179204
runOnce:
180205
deploy:
181206
pool:
182207
vmImage: ubuntu-latest
183208
steps:
184-
- task: DownloadPipelineArtifact@2
185-
displayName: Download nupkg from artifacts
186-
inputs:
187-
artifact: Nugets
188-
source: current
189209
- task: 1ES.PublishNuget@1
190210
displayName: 'NuGet push'
191211
inputs:
192-
packagesToPush: '$(Pipeline.Workspace)/Nugets/Microsoft.OpenApi.OData.*.nupkg'
212+
packagesToPush: '$(Pipeline.Workspace)/Microsoft.OpenApi.OData.*.nupkg'
193213
nuGetFeedType: external
194214
publishFeedCredentials: 'OpenAPI Nuget Connection'
195215
packageParentPath: '$(Pipeline.Workspace)'
216+
217+
- deployment: create_github_release
218+
templateContext:
219+
type: releaseJob
220+
isProduction: true
221+
inputs:
222+
- input: pipelineArtifact
223+
artifactName: Nugets
224+
targetPath: '$(Pipeline.Workspace)'
225+
dependsOn: []
226+
environment: kiota-github-releases
227+
strategy:
228+
runOnce:
229+
deploy:
230+
pool:
231+
vmImage: ubuntu-latest
232+
steps:
233+
- pwsh: |
234+
$artifactName = Get-ChildItem -Path $(Pipeline.Workspace) -Filter Microsoft.OpenApi.*.nupkg -recurse | select -First 1
235+
$artifactVersion= $artifactName.Name -replace "Microsoft.OpenApi.OData", "" -replace ".nupkg", ""
236+
#Set Variable $artifactName and $artifactVersion
237+
Write-Host "##vso[task.setvariable variable=artifactVersion; isSecret=false;]$artifactVersion"
238+
echo "$artifactVersion"
239+
displayName: 'Fetch Artifact Name'
240+
- task: GitHubRelease@1
241+
displayName: 'GitHub release'
242+
condition: succeededOrFailed()
243+
inputs:
244+
gitHubConnection: 'Github-MaggieKimani1'
245+
action: create
246+
tagSource: userSpecifiedTag
247+
tag: 'v$(artifactVersion)'
248+
title: 'v$(artifactVersion)'
249+
releaseNotesSource: inline
250+
assets: '$(Pipeline.Workspace)\**\*.nupkg'
251+
changeLogType: issueBased
252+
changeLogLabels: '[
253+
{ "label" : "feature-work", "feature", "displayName" : "New Features", "state" : "closed" },
254+
{ "label" : "enhancement", "V2-Enhancement", "displayName" : "Enhancements", "state" : "closed" },
255+
{ "label" : "bug", "bug-fix", "displayName" : "Bugs", "state" : "closed" },
256+
{ "label" : "documentation", "doc", "displayName" : "Documentation", "state" : "closed"},
257+
{ "label" : "dependencies", "displayName" : "Package Updates", "state" : "closed" }
258+
]'
196259

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# Copyright (c) Microsoft Corporation.
2+
# Licensed under the MIT License.
3+
4+
# File initially created using https://github.com/MIchaelMainer/policyservicetoolkit/blob/main/branch_protection_export.ps1.
5+
6+
name: OpenAPI.NET.OData-branch-protection
7+
description: Branch protection policy for the OpenAPI.NET.OData repository
8+
resource: repository
9+
configuration:
10+
branchProtectionRules:
11+
12+
- branchNamePattern: main
13+
# This branch pattern applies to the following branches as of 06/09/2024 20:45:44:
14+
# main
15+
16+
# Specifies whether this branch can be deleted. boolean
17+
allowsDeletions: false
18+
# Specifies whether forced pushes are allowed on this branch. boolean
19+
allowsForcePushes: false
20+
# Specifies whether new commits pushed to the matching branches dismiss pull request review approvals. boolean
21+
dismissStaleReviews: true
22+
# Specifies whether admins can overwrite branch protection. boolean
23+
isAdminEnforced: false
24+
# Indicates whether "Require a pull request before merging" is enabled. boolean
25+
requiresPullRequestBeforeMerging: true
26+
# Specifies the number of pull request reviews before merging. int (0-6). Should be null/empty if PRs are not required
27+
requiredApprovingReviewsCount: 1
28+
# Require review from Code Owners. Requires requiredApprovingReviewsCount. boolean
29+
requireCodeOwnersReview: true
30+
# Are commits required to be signed. boolean. TODO: all contributors must have commit signing on local machines.
31+
requiresCommitSignatures: false
32+
# Are conversations required to be resolved before merging? boolean
33+
requiresConversationResolution: true
34+
# Are merge commits prohibited from being pushed to this branch. boolean
35+
requiresLinearHistory: false
36+
# Required status checks to pass before merging. Values can be any string, but if the value does not correspond to any existing status check, the status check will be stuck on pending for status since nothing exists to push an actual status
37+
requiredStatusChecks:
38+
- license/cla
39+
- Continuous Integration
40+
- CodeQL
41+
# Require branches to be up to date before merging. This should be false since the repo contains autogenerated files. boolean
42+
requiresStrictStatusChecks: false
43+
# Indicates whether there are restrictions on who can push. boolean. Should be set with whoCanPush.
44+
restrictsPushes: false
45+
# Restrict who can dismiss pull request reviews. boolean
46+
restrictsReviewDismissals: false
47+
48+
- branchNamePattern: support/v1
49+
# This branch pattern applies to the following branches as of 06/09/2024 20:45:44:
50+
# support/v1
51+
52+
# Specifies whether this branch can be deleted. boolean
53+
allowsDeletions: false
54+
# Specifies whether forced pushes are allowed on this branch. boolean
55+
allowsForcePushes: false
56+
# Specifies whether new commits pushed to the matching branches dismiss pull request review approvals. boolean
57+
dismissStaleReviews: true
58+
# Specifies whether admins can overwrite branch protection. boolean
59+
isAdminEnforced: false
60+
# Indicates whether "Require a pull request before merging" is enabled. boolean
61+
requiresPullRequestBeforeMerging: true
62+
# Specifies the number of pull request reviews before merging. int (0-6). Should be null/empty if PRs are not required
63+
requiredApprovingReviewsCount: 1
64+
# Require review from Code Owners. Requires requiredApprovingReviewsCount. boolean
65+
requireCodeOwnersReview: true
66+
# Are commits required to be signed. boolean. TODO: all contributors must have commit signing on local machines.
67+
requiresCommitSignatures: false
68+
# Are conversations required to be resolved before merging? boolean
69+
requiresConversationResolution: true
70+
# Are merge commits prohibited from being pushed to this branch. boolean
71+
requiresLinearHistory: false
72+
# Required status checks to pass before merging. Values can be any string, but if the value does not correspond to any existing status check, the status check will be stuck on pending for status since nothing exists to push an actual status
73+
requiredStatusChecks:
74+
- license/cla
75+
- Continuous Integration
76+
- CodeQL
77+
# Require branches to be up to date before merging. This should be false since the repo contains autogenerated files. boolean
78+
requiresStrictStatusChecks: false
79+
# Indicates whether there are restrictions on who can push. boolean. Should be set with whoCanPush.
80+
restrictsPushes: false
81+
# Restrict who can dismiss pull request reviews. boolean
82+
restrictsReviewDismissals: false

.github/workflows/codeql-analysis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ name: "CodeQL"
1313

1414
on:
1515
push:
16-
branches: [ master ]
16+
branches: [ main, support/v1 ]
1717
pull_request:
1818
# The branches below must be a subset of the branches above
19-
branches: [ master ]
19+
branches: [ main, support/v1 ]
2020
schedule:
2121
- cron: '32 2 * * 6'
2222
workflow_dispatch:

.github/workflows/sonarcloud.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
push:
55
branches:
66
- main
7+
- support/v1
78
paths-ignore: ['.vscode/**']
89
pull_request:
910
types: [opened, synchronize, reopened]
@@ -60,8 +61,8 @@ jobs:
6061
CoverletOutputFormat: 'opencover' # https://github.com/microsoft/vstest/issues/4014#issuecomment-1307913682
6162
shell: pwsh
6263
run: |
63-
dotnet tool run dotnet-sonarscanner begin /k:"microsoft_OpenAPI.NET.OData" /o:"microsoft" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.opencover.reportsPaths="test/**/coverage.net7.0.opencover.xml"
64+
dotnet tool run dotnet-sonarscanner begin /k:"microsoft_OpenAPI.NET.OData" /o:"microsoft" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.opencover.reportsPaths="test/**/coverage.net8.0.opencover.xml"
6465
dotnet workload restore
6566
dotnet build
6667
dotnet test Microsoft.OpenApi.OData.sln --no-build --verbosity normal /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
67-
dotnet tool run dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"
68+
dotnet tool run dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
## Ignore Visual Studio temporary files, build results, and
22
## files generated by popular Visual Studio add-ons.
33
##
4-
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
4+
## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore
55

66
# User-specific files
77
*.suo

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@
55
"MD025": {
66
"front_matter_title": ""
77
}
8-
}
8+
},
9+
"azure-pipelines.1ESPipelineTemplatesSchemaFile": true
910
}

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ The **Microsoft.OpenAPI.OData.Reader** library helps represent an OData service
88

99
The conversion is based on the mapping doc from [OASIS OData OpenAPI v1.0](https://www.oasis-open.org/committees/document.php?document_id=61852&wg_abbrev=odata) and uses the following :
1010

11-
1. [Capabilities vocabulary annotation](https://github.com/oasis-tcs/odata-vocabularies/blob/master/vocabularies/Org.OData.Capabilities.V1.xml)
12-
2. [Authorization vocabulary annotation](https://github.com/oasis-tcs/odata-vocabularies/blob/master/vocabularies/Org.OData.Authorization.V1.xml)
13-
3. [Core vocabulary annotation](https://github.com/oasis-tcs/odata-vocabularies/blob/master/vocabularies/Org.OData.Core.V1.xml)
11+
1. [Capabilities vocabulary annotation](https://github.com/oasis-tcs/odata-vocabularies/blob/main/vocabularies/Org.OData.Capabilities.V1.xml)
12+
2. [Authorization vocabulary annotation](https://github.com/oasis-tcs/odata-vocabularies/blob/main/vocabularies/Org.OData.Authorization.V1.xml)
13+
3. [Core vocabulary annotation](https://github.com/oasis-tcs/odata-vocabularies/blob/main/vocabularies/Org.OData.Core.V1.xml)
1414
4. Navigation property path
1515
5. Edm operation and operation import path
1616

1717
## Overview
1818

19-
The image below is generic overview of how this library can convert the EDM model to an [OpenAPI.NET document](https://github.com/Microsoft/OpenAPI.NET/blob/master/src/Microsoft.OpenApi/Models/OpenApiDocument.cs) object.
19+
The image below is generic overview of how this library can convert the EDM model to an [OpenAPI.NET document](https://github.com/Microsoft/OpenAPI.NET/blob/main/src/Microsoft.OpenApi/Models/OpenApiDocument.cs) object.
2020

2121
![Convert OData CSDL to OpenAPI](docs/images/odata-2-openapi.png "Map /// OData CSDL --> OpenAPI.NET")
2222

src/OoasUtil/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ Indicate to output file name.
7070

7171
`OoasUtil.exe -j -k -drs -drq -p -u -s 3 -i http://services.odata.org/TrippinRESTierService -o trip.json`
7272

73-
The content of `trip.json` is similar at https://github.com/xuzhg/OData.OpenAPI/blob/master/Microsoft.OData.OpenAPI/Microsoft.OData.OpenAPI.Tests/Resources/TripService.OpenApi.json
73+
The content of `trip.json` is similar at https://github.com/xuzhg/OData.OpenAPI/blob/main/Microsoft.OData.OpenAPI/Microsoft.OData.OpenAPI.Tests/Resources/TripService.OpenApi.json
7474

7575
# Alternative Tool - Hidi
7676

tool/PoliCheck/RunPoliCheck.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ param(
1010
#Example:
1111
# RunPoliCheck.ps1 -BuildSourceDir "C:\BuildAgent\_work\32\s"
1212
# -folderName "src"
13-
# -branchName "odata.net-master"
13+
# -branchName "odata.net-main"
1414
# -resultRoot "C:\Users\ODatabld\Documents\PoliCheck\LatestRunResult"
1515
# -PoliCheckPath "C:\Program Files (x86)\Microsoft\PoliCheck\"
1616
#

0 commit comments

Comments
 (0)