Skip to content

Commit 6116afe

Browse files
committed
chore: pull latest changes
2 parents 8a4fcc2 + e6cc29c commit 6116afe

File tree

9 files changed

+258
-78
lines changed

9 files changed

+258
-78
lines changed

.azure-pipelines/ci-build.yml

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,15 @@ pr:
1515
include:
1616
- main
1717
- support/v1
18+
1819
variables:
1920
buildPlatform: 'Any CPU'
2021
buildConfiguration: 'Release'
2122
ProductBinPath: '$(Build.SourcesDirectory)\src\Microsoft.OpenApi\bin\$(BuildConfiguration)'
23+
REGISTRY: 'msgraphprodregistry.azurecr.io'
24+
IMAGE_NAME: 'public/openapi/hidi'
25+
PREVIEW_BRANCH: 'refs/heads/main'
26+
2227
resources:
2328
repositories:
2429
- repository: 1ESPipelineTemplates
@@ -313,3 +318,119 @@ extends:
313318
assets: '$(Pipeline.Workspace)\**\*.exe'
314319
addChangeLog: false
315320

321+
- stage: Build_and_deploy_docker_images
322+
displayName: 'Build and deploy docker images'
323+
condition: or(eq(variables['build.sourceBranch'], 'refs/tags/v'), eq(variables['build.sourceBranch'], variables['PREVIEW_BRANCH']))
324+
dependsOn: build
325+
pool:
326+
name: Azure-Pipelines-1ESPT-ExDShared
327+
image: ubuntu-latest
328+
os: linux
329+
jobs:
330+
- job: buildAndPush
331+
steps:
332+
- task: AzureCLI@2
333+
displayName: 'Login to Azure Container Registry'
334+
inputs:
335+
azureSubscription: 'ACR Images Push Service Connection'
336+
scriptType: bash
337+
scriptLocation: inlineScript
338+
inlineScript: |
339+
az acr login --name msgraphprodregistry
340+
341+
- powershell: |
342+
$content = [XML](Get-Content ./Directory.Build.props)
343+
Write-Host "XML loaded, finding version..."
344+
345+
# Handle PropertyGroup as either a single element or array
346+
$version = $null
347+
if ($content.Project.PropertyGroup -is [array]) {
348+
Write-Host "PropertyGroup is an array, checking each entry..."
349+
foreach ($pg in $content.Project.PropertyGroup) {
350+
if ($pg.Version) {
351+
$version = $pg.Version.ToString().Trim()
352+
Write-Host "Found version in PropertyGroup array: $version"
353+
break
354+
}
355+
}
356+
} else {
357+
# Single PropertyGroup
358+
$version = $content.Project.PropertyGroup.Version
359+
if ($version) {
360+
$version = $version.ToString().Trim()
361+
Write-Host "Found version in PropertyGroup: $version"
362+
}
363+
}
364+
365+
if (-not $version) {
366+
Write-Host "##vso[task.logissue type=error]Version not found in Directory.Build.props"
367+
exit 1
368+
}
369+
370+
Write-Host "Version found: $version"
371+
Write-Host "##vso[task.setvariable variable=version;isoutput=true]$version"
372+
Write-Host "##vso[task.setvariable variable=VERSION]$version"
373+
displayName: 'Get version from csproj'
374+
name: getversion
375+
376+
- bash: |
377+
# Debug output to verify version variable
378+
echo "Version from previous step: $VERSION"
379+
displayName: 'Verify version variable'
380+
381+
- bash: |
382+
echo "Build Number: $(Build.BuildNumber)"
383+
# Extract the last 3 characters for the run number
384+
runnumber=$(echo "$(Build.BuildNumber)" | grep -o '[0-9]\+$')
385+
echo "Extracted Run Number: $runnumber"
386+
387+
# If extraction fails, set a default
388+
if [ -z "$runnumber" ]; then
389+
echo "Extraction failed, using default value"
390+
runnumber=$(date +"%S%N" | cut -c1-3)
391+
echo "Generated fallback run number: $runnumber"
392+
fi
393+
394+
# Set the variable for later steps
395+
echo "##vso[task.setvariable variable=RUNNUMBER]$runnumber"
396+
echo "##vso[task.setvariable variable=RUNNUMBER;isOutput=true]$runnumber"
397+
displayName: 'Get truncated run number'
398+
name: getrunnumber
399+
condition: eq(variables['Build.SourceBranch'], variables['PREVIEW_BRANCH'])
400+
401+
- bash: |
402+
date=$(date +'%Y%m%d')
403+
echo "Date value: $date"
404+
echo "##vso[task.setvariable variable=BUILDDATE;isOutput=true]$date"
405+
echo "##vso[task.setvariable variable=BUILDDATE]$date"
406+
displayName: 'Get current date'
407+
name: setdate
408+
condition: eq(variables['Build.SourceBranch'], variables['PREVIEW_BRANCH'])
409+
410+
- bash: |
411+
echo "Building Docker image..."
412+
echo "Using build date: ${BUILDDATE}"
413+
# Using quotes around tags to prevent flag interpretation
414+
docker build \
415+
-t "$(REGISTRY)/$(IMAGE_NAME):nightly" \
416+
-t "$(REGISTRY)/$(IMAGE_NAME):${VERSION}.${BUILDDATE}${RUNNUMBER}" \
417+
"$(Build.SourcesDirectory)"
418+
419+
echo "Pushing Docker image with nightly tag..."
420+
docker push "$(REGISTRY)/$(IMAGE_NAME):nightly"
421+
docker push "$(REGISTRY)/$(IMAGE_NAME):${VERSION}.${BUILDDATE}${RUNNUMBER}"
422+
displayName: 'Build and Push Nightly Image'
423+
condition: eq(variables['Build.SourceBranch'], variables['PREVIEW_BRANCH'])
424+
425+
- bash: |
426+
echo "Building Docker image for release..."
427+
docker build \
428+
-t "$(REGISTRY)/$(IMAGE_NAME):latest" \
429+
-t "$(REGISTRY)/$(IMAGE_NAME):${VERSION}.${BUILDDATE}${RUNNUMBER}" \
430+
"$(Build.SourcesDirectory)"
431+
432+
echo "Pushing Docker image with latest and version tags..."
433+
docker push "$(REGISTRY)/$(IMAGE_NAME):latest"
434+
docker push "$(REGISTRY)/$(IMAGE_NAME):${VERSION}.${BUILDDATE}${RUNNUMBER}"
435+
displayName: 'Build and Push Release Image'
436+
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/v')
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
id:
2+
name: GitOps.PullRequestIssueManagement
3+
description: GitOps.PullRequestIssueManagement primitive
4+
owner:
5+
resource: repository
6+
disabled: false
7+
where:
8+
configuration:
9+
resourceManagementConfiguration:
10+
scheduledSearches:
11+
- description:
12+
frequencies:
13+
- hourly:
14+
hour: 6
15+
filters:
16+
- isIssue
17+
- isOpen
18+
- hasLabel:
19+
label: 'status:waiting-for-author-feedback'
20+
- hasLabel:
21+
label: 'status:no-recent-activity'
22+
- noActivitySince:
23+
days: 3
24+
actions:
25+
- closeIssue
26+
- description:
27+
frequencies:
28+
- hourly:
29+
hour: 6
30+
filters:
31+
- isIssue
32+
- isOpen
33+
- hasLabel:
34+
label: 'status:waiting-for-author-feedback'
35+
- noActivitySince:
36+
days: 4
37+
- isNotLabeledWith:
38+
label: 'status:no-recent-activity'
39+
actions:
40+
- addLabel:
41+
label: 'status:no-recent-activity'
42+
- addReply:
43+
reply: This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for **4 days**. It will be closed if no further activity occurs **within 3 days of this comment**.
44+
- description:
45+
frequencies:
46+
- hourly:
47+
hour: 6
48+
filters:
49+
- isIssue
50+
- isOpen
51+
- hasLabel:
52+
label: 'status:duplicate'
53+
- noActivitySince:
54+
days: 1
55+
actions:
56+
- addReply:
57+
reply: This issue has been marked as duplicate and has not had any activity for **1 day**. It will be closed for housekeeping purposes.
58+
- closeIssue
59+
eventResponderTasks:
60+
- if:
61+
- payloadType: Issue_Comment
62+
- isAction:
63+
action: Created
64+
- isActivitySender:
65+
issueAuthor: True
66+
- hasLabel:
67+
label: 'status:waiting-for-author-feedback'
68+
- isOpen
69+
then:
70+
- addLabel:
71+
label: 'Needs: Attention :wave:'
72+
- removeLabel:
73+
label: 'status:waiting-for-author-feedback'
74+
description:
75+
- if:
76+
- payloadType: Issues
77+
- not:
78+
isAction:
79+
action: Closed
80+
- hasLabel:
81+
label: 'status:no-recent-activity'
82+
then:
83+
- removeLabel:
84+
label: 'status:no-recent-activity'
85+
description:
86+
- if:
87+
- payloadType: Issue_Comment
88+
- hasLabel:
89+
label: 'status:no-recent-activity'
90+
then:
91+
- removeLabel:
92+
label: 'status:no-recent-activity'
93+
description:
94+
- if:
95+
- payloadType: Pull_Request
96+
then:
97+
- inPrLabel:
98+
label: WIP
99+
description:
100+
onFailure:
101+
onSuccess:

.github/workflows/docker.yml

Lines changed: 0 additions & 54 deletions
This file was deleted.

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "2.0.0-preview10"
2+
".": "2.0.0-preview.11"
33
}

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
# Changelog
22

3+
## [2.0.0-preview.11](https://github.com/microsoft/OpenAPI.NET/compare/v2.0.0-preview10...v2.0.0-preview.11) (2025-03-03)
4+
5+
6+
### Bug Fixes
7+
8+
* rename `OpenApiDocument.SecurityRequirements` as `Security` ([d8553d6](https://github.com/microsoft/OpenAPI.NET/commit/d8553d6e007c1fa38bb982c9eb757678e789111b))
9+
10+
11+
### Miscellaneous Chores
12+
13+
* release 2.0.0-preview.11 ([f425b8e](https://github.com/microsoft/OpenAPI.NET/commit/f425b8ed48ce5e488f85ad3060e6c43734274250))
14+
315
## [2.0.0-preview10](https://github.com/microsoft/OpenAPI.NET/compare/v2.0.0-preview9...v2.0.0-preview10) (2025-02-27)
416

517

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<PackageProjectUrl>https://github.com/Microsoft/OpenAPI.NET</PackageProjectUrl>
1313
<Copyright>© Microsoft Corporation. All rights reserved.</Copyright>
1414
<PackageTags>OpenAPI .NET</PackageTags>
15-
<Version>2.0.0-preview10</Version>
15+
<Version>2.0.0-preview.11</Version>
1616
</PropertyGroup>
1717
<!-- https://github.com/clairernovotny/DeterministicBuilds#deterministic-builds -->
1818
<PropertyGroup Condition="'$(TF_BUILD)' == 'true'">

src/Microsoft.OpenApi/Models/OpenApiRequestBody.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ public IEnumerable<IOpenApiParameter> ConvertToFormDataParameters(IOpenApiWriter
139139
// we have a copy of a reference but don't want to mutate the source schema
140140
// TODO might need recursive resolution of references here
141141
OpenApiSchemaReference r when r.Target is not null => (OpenApiSchema)r.Target.CreateShallowCopy(),
142-
OpenApiSchemaReference r2 when r2.Target is null => throw new InvalidOperationException("Unresolved reference target"),
142+
OpenApiSchemaReference => throw new InvalidOperationException("Unresolved reference target"),
143143
_ => throw new InvalidOperationException("Unexpected schema type")
144144
};
145145

src/Microsoft.OpenApi/Models/OpenApiResponse.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,9 @@ public void SerializeAsV2(IOpenApiWriter writer)
135135
writer.WriteStartObject();
136136

137137
foreach (var example in Content
138-
.Where(mediaTypePair => mediaTypePair.Value.Examples is not null && mediaTypePair.Value.Examples.Any())
139-
.SelectMany(mediaTypePair => mediaTypePair.Value.Examples!))
138+
.Select(static x => x.Value.Examples)
139+
.OfType<IDictionary<string, IOpenApiExample>>()
140+
.SelectMany(static x => x))
140141
{
141142
writer.WritePropertyName(example.Key);
142143
example.Value.SerializeAsV2(writer);

src/Microsoft.OpenApi/Reader/ReadResult.cs

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,27 @@
33

44
using Microsoft.OpenApi.Models;
55

6-
namespace Microsoft.OpenApi.Reader
6+
namespace Microsoft.OpenApi.Reader;
7+
/// <summary>
8+
/// Container object used for returning the result of reading an OpenAPI description.
9+
/// </summary>
10+
public class ReadResult
711
{
812
/// <summary>
9-
/// Container object used for returning the result of reading an OpenAPI description.
13+
/// The parsed OpenApiDocument. Null will be returned if the document could not be parsed.
1014
/// </summary>
11-
public class ReadResult
15+
public OpenApiDocument? Document { get; set; }
16+
/// <summary>
17+
/// OpenApiDiagnostic contains the Errors reported while parsing
18+
/// </summary>
19+
public OpenApiDiagnostic? Diagnostic { get; set; }
20+
/// <summary>
21+
/// Deconstructs the result for easier assignment on the client application.
22+
/// </summary>
23+
public void Deconstruct(out OpenApiDocument? document, out OpenApiDiagnostic? diagnostic)
1224
{
13-
/// <summary>
14-
/// The parsed OpenApiDocument. Null will be returned if the document could not be parsed.
15-
/// </summary>
16-
public OpenApiDocument? Document { get; set; }
17-
/// <summary>
18-
/// OpenApiDiagnostic contains the Errors reported while parsing
19-
/// </summary>
20-
public OpenApiDiagnostic? Diagnostic { get; set; }
21-
/// <summary>
22-
/// Deconstructs the result for easier assignment on the client application.
23-
/// </summary>
24-
public void Deconstruct(out OpenApiDocument? document, out OpenApiDiagnostic? diagnostic)
25-
{
26-
document = Document;
27-
diagnostic = Diagnostic;
28-
}
25+
document = Document;
26+
diagnostic = Diagnostic;
2927
}
3028
}
29+

0 commit comments

Comments
 (0)