Skip to content

Commit 1e57b38

Browse files
Merge pull request #1612 from microsoft/mk/sync-v2-with-vnext-changes
Sync v2 branch with vnext changes
2 parents c1b1616 + 6087665 commit 1e57b38

File tree

90 files changed

+985
-260
lines changed

Some content is hidden

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

90 files changed

+985
-260
lines changed

.azure-pipelines/ci-build.yml

Lines changed: 27 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pool:
2121
variables:
2222
buildPlatform: 'Any CPU'
2323
buildConfiguration: 'Release'
24-
ProductBinPath: '$(Build.SourcesDirectory)\src\Microsoft.OpenApi\bin\$(BuildConfiguration)'
24+
ProductBinPath: '$(Build.SourcesDirectory)\src\Microsoft.OpenApi\bin\$(BuildConfiguration)'
2525

2626

2727
stages:
@@ -31,22 +31,22 @@ stages:
3131
- job: build
3232
steps:
3333
- task: UseDotNet@2
34-
displayName: 'Use .NET 2' # needed for ESRP signing
34+
displayName: 'Use .NET 6' # needed for ESRP signing
3535
inputs:
36-
version: 2.x
36+
version: 6.x
3737

3838
- task: UseDotNet@2
3939
displayName: 'Use .NET 8'
4040
inputs:
4141
version: 8.x
4242

43-
- task: PoliCheck@1
43+
- task: PoliCheck@2
4444
displayName: 'Run PoliCheck "/src"'
4545
inputs:
4646
inputType: CmdLine
4747
cmdLineArgs: '/F:$(Build.SourcesDirectory)/src /T:9 /Sev:"1|2" /PE:2 /O:poli_result_src.xml'
4848

49-
- task: PoliCheck@1
49+
- task: PoliCheck@2
5050
displayName: 'Run PoliCheck "/test"'
5151
inputs:
5252
inputType: CmdLine
@@ -75,14 +75,14 @@ stages:
7575
arguments: '--configuration $(BuildConfiguration) --no-build'
7676

7777
# CredScan
78-
- task: securedevelopmentteam.vss-secure-development-tools.build-task-credscan.CredScan@2
78+
- task: securedevelopmentteam.vss-secure-development-tools.build-task-credscan.CredScan@3
7979
displayName: 'Run CredScan - Src'
8080
inputs:
8181
toolMajorVersion: 'V2'
8282
scanFolder: '$(Build.SourcesDirectory)\src'
8383
debugMode: false
8484

85-
- task: securedevelopmentteam.vss-secure-development-tools.build-task-credscan.CredScan@2
85+
- task: securedevelopmentteam.vss-secure-development-tools.build-task-credscan.CredScan@3
8686
displayName: 'Run CredScan - Test'
8787
inputs:
8888
toolMajorVersion: 'V2'
@@ -95,34 +95,38 @@ stages:
9595
FileDirPath: '$(ProductBinPath)'
9696
enabled: false
9797

98-
- task: BinSkim@3
98+
- task: BinSkim@4
9999
displayName: 'Run BinSkim - Product Binaries'
100100
inputs:
101101
InputType: Basic
102-
AnalyzeTarget: '$(ProductBinPath)\**\Microsoft.OpenApi.dll'
102+
AnalyzeTargetGlob: '$(ProductBinPath)\**\Microsoft.OpenApi.dll'
103103
AnalyzeSymPath: '$(ProductBinPath)'
104104
AnalyzeVerbose: true
105105
AnalyzeHashes: true
106106
AnalyzeEnvironment: true
107107

108-
- task: PublishSecurityAnalysisLogs@2
108+
- task: PublishSecurityAnalysisLogs@3
109109
displayName: 'Publish Security Analysis Logs'
110110
inputs:
111111
ArtifactName: SecurityLogs
112112

113-
- task: PostAnalysis@1
113+
- task: PostAnalysis@2
114114
displayName: 'Post Analysis'
115115
inputs:
116116
BinSkim: true
117117
CredScan: true
118118
PoliCheck: true
119119

120-
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1
120+
- task: EsrpCodeSigning@2
121121
displayName: 'ESRP CodeSigning'
122122
inputs:
123123
ConnectedServiceName: 'microsoftgraph ESRP CodeSign DLL and NuGet (AKV)'
124124
FolderPath: src
125125
signConfigType: inlineSignParams
126+
UseMinimatch: true
127+
Pattern: |
128+
**\*.exe
129+
**\*.dll
126130
inlineOperation: |
127131
[
128132
{
@@ -162,26 +166,27 @@ stages:
162166
}
163167
]
164168
SessionTimeout: 20
165-
169+
166170
# Pack
167171
- 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
168172
displayName: 'pack OpenAPI'
169-
173+
170174
# Pack
171175
- 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
172176
displayName: 'pack Readers'
173177

174178
# Pack
175179
- 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
180+
displayName: 'pack Hidi'
181+
182+
- task: EsrpCodeSigning@2
179183
displayName: 'ESRP CodeSigning Nuget Packages'
180184
inputs:
181185
ConnectedServiceName: 'microsoftgraph ESRP CodeSign DLL and NuGet (AKV)'
182186
FolderPath: '$(Build.ArtifactStagingDirectory)'
183187
Pattern: '*.nupkg'
184188
signConfigType: inlineSignParams
189+
UseMinimatch: true
185190
inlineOperation: |
186191
[
187192
{
@@ -209,7 +214,7 @@ stages:
209214
$xml = [Xml] (Get-Content .\src\Microsoft.OpenApi.Hidi\Microsoft.OpenApi.Hidi.csproj)
210215
$version = $xml.Project.PropertyGroup.Version
211216
echo $version
212-
echo "##vso[task.setvariable variable=hidiversion]$version"
217+
echo "##vso[task.setvariable variable=hidiversion]$version"
213218
214219
# publish hidi as an .exe
215220
- task: DotNetCoreCLI@2
@@ -219,7 +224,7 @@ stages:
219224
arguments: -c Release --runtime win-x64 /p:PublishSingleFile=true /p:PackAsTool=false --self-contained --output $(Build.ArtifactStagingDirectory)/Microsoft.OpenApi.Hidi-v$(hidiversion)
220225
projects: 'src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj'
221226
publishWebProjects: False
222-
zipAfterPublish: false
227+
zipAfterPublish: false
223228

224229
- task: CopyFiles@2
225230
displayName: Prepare staging folder for upload
@@ -236,7 +241,7 @@ stages:
236241

237242
- task: PublishBuildArtifacts@1
238243
displayName: 'Publish Artifact: Hidi'
239-
inputs:
244+
inputs:
240245
ArtifactName: Microsoft.OpenApi.Hidi-v$(hidiversion)
241246
PathtoPublish: '$(Build.ArtifactStagingDirectory)/Microsoft.OpenApi.Hidi-v$(hidiversion)'
242247

@@ -295,8 +300,8 @@ stages:
295300
{ "label" : "enhancement", "V2-Enhancement", "displayName" : "Enhancements", "state" : "closed" },
296301
{ "label" : "bug", "bug-fix", "displayName" : "Bugs", "state" : "closed" },
297302
{ "label" : "documentation", "doc", "displayName" : "Documentation", "state" : "closed"},
298-
{ "label" : "dependencies", "displayName" : "Package Updates", "state" : "closed" }]'
299-
303+
{ "label" : "dependencies", "displayName" : "Package Updates", "state" : "closed" }]'
304+
300305
- deployment: deploy_lib
301306
dependsOn: []
302307
environment: nuget-org

.github/workflows/auto-merge-dependabot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
steps:
2020
- name: Dependabot metadata
2121
id: metadata
22-
uses: dependabot/fetch-metadata@v1.6.0
22+
uses: dependabot/fetch-metadata@v2.0.0
2323
with:
2424
github-token: "${{ secrets.GITHUB_TOKEN }}"
2525

.github/workflows/ci-cd.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ name: CI/CD Pipeline
22

33
on: [push, pull_request, workflow_dispatch]
44

5+
permissions:
6+
contents: write
7+
58
jobs:
69
ci:
710
name: Continuous Integration
@@ -49,7 +52,7 @@ jobs:
4952
- if: steps.conditionals_handler.outputs.is_default_branch == 'true'
5053
name: Bump GH tag
5154
id: tag_generator
52-
uses: mathieudutour/github-tag-action@v6.1
55+
uses: mathieudutour/github-tag-action@v6.2
5356
with:
5457
github_token: ${{ secrets.GITHUB_TOKEN }}
5558
default_bump: false

.github/workflows/codeql-analysis.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ on:
77
schedule:
88
- cron: '0 8 * * *'
99

10+
permissions:
11+
contents: read # these permissions are required to run the codeql analysis
12+
actions: read
13+
security-events: write
14+
1015
jobs:
1116
analyze:
1217
name: CodeQL Analysis
@@ -23,7 +28,7 @@ jobs:
2328

2429
- name: Initialize CodeQL
2530
id: init_codeql
26-
uses: github/codeql-action/init@v2
31+
uses: github/codeql-action/init@v3
2732
with:
2833
queries: security-and-quality
2934

@@ -43,6 +48,6 @@ jobs:
4348
4449
- name: Perform CodeQL Analysis
4550
id: analyze_codeql
46-
uses: github/codeql-action/analyze@v2
51+
uses: github/codeql-action/analyze@v3
4752

4853
# Built with ❤ by [Pipeline Foundation](https://pipeline.foundation)

.github/workflows/docker.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- name: Check out the repo
1818
uses: actions/checkout@v4
1919
- name: Login to GitHub package feed
20-
uses: docker/login-action@v3.0.0
20+
uses: docker/login-action@v3.1.0
2121
with:
2222
username: ${{ secrets.ACR_USERNAME }}
2323
password: ${{ secrets.ACR_PASSWORD }}
@@ -30,13 +30,13 @@ jobs:
3030
id: getversion
3131
- name: Push to GitHub Packages - Nightly
3232
if: ${{ github.ref == 'refs/heads/vnext' }}
33-
uses: docker/build-push-action@v5.1.0
33+
uses: docker/build-push-action@v5.3.0
3434
with:
3535
push: true
3636
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:nightly
3737
- name: Push to GitHub Packages - Release
3838
if: ${{ github.ref == 'refs/heads/master' }}
39-
uses: docker/build-push-action@v5.1.0
39+
uses: docker/build-push-action@v5.3.0
4040
with:
4141
push: true
4242
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest,${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.getversion.outputs.version }}

.github/workflows/sonarcloud.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ on:
99
types: [opened, synchronize, reopened]
1010
paths-ignore: ['.vscode/**']
1111

12+
13+
permissions:
14+
contents: read
15+
pull-requests: read
16+
1217
env:
1318
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
1419

@@ -34,10 +39,6 @@ jobs:
3439
with:
3540
distribution: 'adopt'
3641
java-version: 17
37-
- name: Setup .NET 5 # At the moment the scanner requires dotnet 5 https://www.nuget.org/packages/dotnet-sonarscanner
38-
uses: actions/setup-dotnet@v4
39-
with:
40-
dotnet-version: 5.0.x
4142
- name: Setup .NET
4243
uses: actions/setup-dotnet@v4
4344
with:
@@ -46,14 +47,14 @@ jobs:
4647
with:
4748
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
4849
- name: Cache SonarCloud packages
49-
uses: actions/cache@v3
50+
uses: actions/cache@v4
5051
with:
5152
path: ~/.sonar/cache
5253
key: ${{ runner.os }}-sonar
5354
restore-keys: ${{ runner.os }}-sonar
5455
- name: Cache SonarCloud scanner
5556
id: cache-sonar-scanner
56-
uses: actions/cache@v3
57+
uses: actions/cache@v4
5758
with:
5859
path: ./.sonar/scanner
5960
key: ${{ runner.os }}-sonar-scanner

.vscode/launch.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"request": "launch",
1111
"preLaunchTask": "build",
1212
// If you have changed target frameworks, make sure to update the program path.
13-
"program": "${workspaceFolder}/src/Microsoft.OpenApi.Hidi/bin/Debug/net7.0/Microsoft.OpenApi.Hidi.dll",
13+
"program": "${workspaceFolder}/src/Microsoft.OpenApi.Hidi/bin/Debug/net8.0/Microsoft.OpenApi.Hidi.dll",
1414
"args": ["plugin",
1515
"-m","C:\\Users\\darrmi\\src\\github\\microsoft\\openapi.net\\test\\Microsoft.OpenApi.Hidi.Tests\\UtilityFiles\\exampleapimanifest.json",
1616
"--of","./output"],
@@ -28,7 +28,7 @@
2828
"request": "launch",
2929
"preLaunchTask": "build",
3030
// If you have changed target frameworks, make sure to update the program path.
31-
"program": "${workspaceFolder}/src/Microsoft.OpenApi.WorkBench/bin/Debug/net7.0-windows/Microsoft.OpenApi.Workbench.exe",
31+
"program": "${workspaceFolder}/src/Microsoft.OpenApi.WorkBench/bin/Debug/net8.0-windows/Microsoft.OpenApi.Workbench.exe",
3232
"args": [],
3333
"cwd": "${workspaceFolder}/src/Microsoft.OpenApi.Workbench",
3434
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console

Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build-env
1+
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build-env
22
WORKDIR /app
33

44
COPY ./src ./hidi/src
@@ -7,10 +7,10 @@ COPY ./README.md ./hidi/README.md
77
WORKDIR /app/hidi
88
RUN dotnet publish ./src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj -c Release
99

10-
FROM mcr.microsoft.com/dotnet/runtime:7.0 AS runtime
10+
FROM mcr.microsoft.com/dotnet/runtime:8.0-jammy-chiseled AS runtime
1111
WORKDIR /app
1212

13-
COPY --from=build-env /app/hidi/src/Microsoft.OpenApi.Hidi/bin/Release/net7.0 ./
13+
COPY --from=build-env /app/hidi/src/Microsoft.OpenApi.Hidi/bin/Release/net8.0 ./
1414

1515
VOLUME /app/output
1616
VOLUME /app/openapi.yml

src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<Nullable>enable</Nullable>
1010
<ToolCommandName>hidi</ToolCommandName>
1111
<PackageOutputPath>./../../artifacts</PackageOutputPath>
12-
<Version>1.3.6</Version>
12+
<Version>1.4.0</Version>
1313
<Description>OpenAPI.NET CLI tool for slicing OpenAPI documents</Description>
1414
<SignAssembly>true</SignAssembly>
1515
<!-- https://github.com/dotnet/sourcelink/blob/main/docs/README.md#embeduntrackedsources -->
@@ -30,12 +30,12 @@
3030
<ItemGroup>
3131
<PackageReference Include="Humanizer.Core" Version="2.14.1" />
3232
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
33-
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0" />
33+
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.1" />
3434
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.0" />
3535
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0" />
3636
<PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
3737
<PackageReference Include="Microsoft.OData.Edm" Version="7.20.0" />
38-
<PackageReference Include="Microsoft.OpenApi.OData" Version="1.5.0" />
38+
<PackageReference Include="Microsoft.OpenApi.OData" Version="1.6.1" />
3939
<PackageReference Include="Microsoft.OpenApi.ApiManifest" Version="0.5.0-preview" />
4040
<PackageReference Include="System.CommandLine.Hosting" Version="0.4.0-alpha.22272.1" />
4141
</ItemGroup>

src/Microsoft.OpenApi.Hidi/OpenApiService.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) Microsoft Corporation. All rights reserved.
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT license.
33

44
using System;
@@ -285,7 +285,7 @@ private static async Task<OpenApiDocument> GetOpenApi(HidiOptions options, strin
285285
predicate = OpenApiFilterService.CreatePredicate(tags: filterByTags);
286286

287287
}
288-
if (requestUrls.Count != 0)
288+
if (requestUrls.Count > 0)
289289
{
290290
logger.LogTrace("Creating predicate based on the paths and Http methods defined in the Postman collection.");
291291
predicate = OpenApiFilterService.CreatePredicate(requestUrls: requestUrls, source: document);

0 commit comments

Comments
 (0)