Skip to content

Commit 14b1c10

Browse files
committed
Merge branch 'dev' into mmainer/update-vipr-submodule
2 parents c2b84c2 + 0c8ef9f commit 14b1c10

13 files changed

+987
-805
lines changed

.azure-pipelines/generation-pipeline.yml

Lines changed: 892 additions & 668 deletions
Large diffs are not rendered by default.

.azure-pipelines/generation-templates/build-and-publish-kiota.yml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
steps:
2-
- template: use-dotnet-sdk.yml
2+
- template: /.azure-pipelines/generation-templates/use-dotnet-sdk.yml@self
33
parameters:
44
version: "9.x" #kiota uses a net9 target
55

@@ -15,9 +15,4 @@ steps:
1515
sourceFolder: '$(Build.SourcesDirectory)/src/kiota/bin/$(BuildConfiguration)/net9.0'
1616
contents: '**/*'
1717
targetFolder: '$(Build.ArtifactStagingDirectory)'
18-
displayName: Copy Kiota executable
19-
20-
- task: PublishBuildArtifacts@1
21-
inputs:
22-
pathToPublish: '$(Build.ArtifactStagingDirectory)'
23-
artifactName: kiota
18+
displayName: Copy Kiota executable
Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
steps:
2-
- template: use-dotnet-sdk.yml
3-
2+
- template: /.azure-pipelines/generation-templates/use-dotnet-sdk.yml@self
43
- checkout: self
54
displayName: checkout generator
65
fetchDepth: 1
@@ -15,9 +14,4 @@ steps:
1514
sourceFolder: '$(Build.SourcesDirectory)/src/Typewriter/bin/$(BuildConfiguration)/net8.0'
1615
contents: '**/*'
1716
targetFolder: '$(Build.ArtifactStagingDirectory)'
18-
displayName: Copy Typewriter executable
19-
20-
- task: PublishBuildArtifacts@1
21-
inputs:
22-
pathToPublish: '$(Build.ArtifactStagingDirectory)'
23-
artifactName: typewriter
17+
displayName: Copy Typewriter executable

.azure-pipelines/generation-templates/capture-metadata.yml

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ steps:
4545
fetchDepth: 1
4646
persistCredentials: true
4747

48-
- template: checkout-metadata.yml
49-
- template: set-user-config.yml
48+
- template: /.azure-pipelines/generation-templates/checkout-metadata.yml@self
49+
- template: /.azure-pipelines/generation-templates/set-user-config.yml@self
5050

5151
# required for TypeSpec
5252
- task: UseNode@1
@@ -76,14 +76,10 @@ steps:
7676
inputMetadataFile: ${{ parameters.inputMetadata }}
7777
enabled: true
7878

79-
- template: download-typewriter.yml
80-
8179
# required for typewriter
82-
- template: use-dotnet-sdk.yml
80+
- template: /.azure-pipelines/generation-templates/use-dotnet-sdk.yml@self
8381
parameters:
8482
version: '8.x'
85-
86-
## Only run if the previous step was successful
8783
- pwsh: '$(scriptsDirectory)/run-typewriter-clean-metadata.ps1'
8884
env:
8985
OutputPath: ${{ parameters.outputPath }}
@@ -153,20 +149,11 @@ steps:
153149
contents: '**/*'
154150
targetFolder: '$(Build.ArtifactStagingDirectory)'
155151
displayName: Copy generated metadata
156-
157-
- task: PublishBuildArtifacts@1
158-
inputs:
159-
pathToPublish: '$(Build.ArtifactStagingDirectory)'
160-
artifactName: ${{ parameters.cleanMetadataFolder }}
161-
162-
# Use the clean metadata from the last step to generate DotNet files.
163-
164-
# required for the hidi installation validation
165-
- template: use-dotnet-sdk.yml
152+
- template: /.azure-pipelines/generation-templates/use-dotnet-sdk.yml@self
166153
parameters:
167154
version: '9.x'
168155

169-
- pwsh: dotnet tool install --global Microsoft.OpenApi.Hidi --version 1.6.24
156+
- pwsh: dotnet tool install --global Microsoft.OpenApi.Hidi --version 1.6.24
170157
displayName: 'Install hidi tool'
171158

172159
# verify that generated metadata is parsable as an Edm model

.azure-pipelines/generation-templates/capture-openapi.yml

Lines changed: 56 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
# Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.
2-
# contains an end to end validation pipeline using C# compilation tests for staging beta metadata
3-
4-
# capture-metadata.yml will result in the capture and cleaning of the metadata
5-
# with the artifacts posted to GitHub.
1+
# Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.
2+
# The following template creates multiple artifacts from a matrix, this is the intended behavior to follow the same workflow before the governance migration
63

4+
# For more information please refer to: https://github.com/microsoftgraph/MSGraph-SDK-Code-Generator/pull/1377#discussion_r2271024012
75
parameters:
86
- name: 'endpoint'
97
type: string
@@ -13,7 +11,6 @@ parameters:
1311
default: $(System.ArtifactsDirectory)
1412
- name: 'cleanMetadataFolder'
1513
type: string
16-
1714
jobs:
1815
- job: get_conversion_settings
1916
displayName: "Get conversion settings"
@@ -23,8 +20,7 @@ jobs:
2320
fetchDepth: 1
2421
persistCredentials: true
2522

26-
- template: checkout-metadata.yml
27-
23+
- template: /.azure-pipelines/generation-templates/checkout-metadata.yml@self
2824
- pwsh: |
2925
$dirPath = "./conversion-settings"
3026
$endpoint = "${{ parameters.endpoint }}"
@@ -41,38 +37,39 @@ jobs:
4137
Write-Host "##vso[task.setvariable variable=targets;isOutput=true]$json"
4238
name: setTargets
4339
workingDirectory: $(Build.SourcesDirectory)/msgraph-metadata
44-
4540
- script: echo $(setTargets.targets)
4641
displayName: "Print settings"
47-
4842
- job: convert_openapi
4943
dependsOn: get_conversion_settings
5044
displayName: Convert
5145
strategy:
5246
matrix: $[ dependencies.get_conversion_settings.outputs['setTargets.targets'] ]
5347
variables:
5448
targets: $[ dependencies.get_conversion_settings.outputs['setTargets.targets'] ]
55-
49+
templateContext:
50+
outputs:
51+
- output: pipelineArtifact
52+
targetPath: '$(Build.ArtifactStagingDirectory)/$(Name)'
53+
artifactName: '${{ parameters.cleanMetadataFolder }}-$(Name)'
5654
steps:
57-
# We only need the scripts
5855
- checkout: self
5956
displayName: checkout generator
6057
fetchDepth: 1
6158
persistCredentials: true
6259

63-
- template: checkout-metadata.yml
60+
- template: /.azure-pipelines/generation-templates/checkout-metadata.yml@self
6461

6562
# required for the hidi to run
66-
- template: use-dotnet-sdk.yml
63+
- template: /.azure-pipelines/generation-templates/use-dotnet-sdk.yml@self
6764
parameters:
6865
version: '8.x'
6966

70-
# required for the hidi installation validation
71-
- template: use-dotnet-sdk.yml
67+
# required for the hidi installation validation
68+
- template: /.azure-pipelines/generation-templates/use-dotnet-sdk.yml@self
7269
parameters:
7370
version: '9.x'
7471

75-
- pwsh: dotnet tool install --global Microsoft.OpenApi.Hidi --version 1.6.24
72+
- pwsh: dotnet tool install --global Microsoft.OpenApi.Hidi --version 1.6.24
7673
displayName: install hidi
7774

7875
- pwsh: |
@@ -90,14 +87,8 @@ jobs:
9087
inputs:
9188
sourceFolder: ${{ parameters.outputPath }}
9289
contents: '**/$(Name).yaml'
93-
targetFolder: '$(Build.ArtifactStagingDirectory)'
90+
targetFolder: '$(Build.ArtifactStagingDirectory)/$(Name)'
9491
displayName: Copy generated metadata
95-
96-
- task: PublishBuildArtifacts@1
97-
inputs:
98-
pathToPublish: '$(Build.ArtifactStagingDirectory)'
99-
artifactName: ${{ parameters.cleanMetadataFolder }}
100-
10192
- pwsh: |
10293
./scripts/run-openapi-validation.ps1 -repoDirectory (Get-Location).Path -version "${{ parameters.endpoint }}" -platformName "$(Name)"
10394
displayName: ensure that OpenAPI docs can be parsed
@@ -107,21 +98,55 @@ jobs:
10798
- job: publish_openapi
10899
dependsOn: convert_openapi
109100
displayName: Publish
101+
## If there's new settings added please add them here too
102+
templateContext:
103+
inputs:
104+
- input: pipelineArtifact
105+
artifactName: '${{ parameters.cleanMetadataFolder }}-default'
106+
targetPath: '$(Build.SourcesDirectory)/artifacts'
107+
- input: pipelineArtifact
108+
artifactName: '${{ parameters.cleanMetadataFolder }}-graphexplorer'
109+
targetPath: '$(Build.SourcesDirectory)/artifacts'
110+
- input: pipelineArtifact
111+
artifactName: '${{ parameters.cleanMetadataFolder }}-openapi'
112+
targetPath: '$(Build.SourcesDirectory)/artifacts'
113+
- input: pipelineArtifact
114+
artifactName: '${{ parameters.cleanMetadataFolder }}-powershell_v2'
115+
targetPath: '$(Build.SourcesDirectory)/artifacts'
116+
outputs:
117+
- output: pipelineArtifact
118+
targetPath: '$(Build.ArtifactStagingDirectory)'
119+
artifactName: ${{ parameters.cleanMetadataFolder }}
110120
steps:
111121
# We only need the scripts
112122
- checkout: self
113123
displayName: checkout generator
114124
fetchDepth: 1
115125
persistCredentials: true
116-
117-
- template: checkout-metadata.yml
118-
- template: set-user-config.yml
119-
- task: DownloadPipelineArtifact@2
126+
# Copy files from the maxtrix artifacts to a single folder
127+
- task: CopyFiles@2
120128
inputs:
121-
path: $(Build.SourcesDirectory)/msgraph-metadata/openapi/${{ parameters.endpoint }}
122-
artifact: ${{ parameters.cleanMetadataFolder }}
129+
sourceFolder: '$(Build.SourcesDirectory)/artifacts'
130+
contents: '**/*.yaml'
131+
targetFolder: '$(Build.ArtifactStagingDirectory)'
132+
displayName: Copy artifact metadata
133+
# Copy files from the target path where artifacts should be downloaded
134+
- task: CopyFiles@2
135+
inputs:
136+
sourceFolder: '$(Build.ArtifactStagingDirectory)'
137+
contents: '**/*.yaml'
138+
targetFolder: '$(Build.SourcesDirectory)/msgraph-metadata/openapi/${{ parameters.endpoint }}'
139+
displayName: Copy downloaded metadata
123140

124-
# Checkin clean metadata into metadata repo or make it an artifact.
141+
# publish metadata as an artifact
142+
- task: CopyFiles@2
143+
inputs:
144+
sourceFolder: ${{ parameters.outputPath }}
145+
contents: '**/*.yaml'
146+
targetFolder: '$(Build.ArtifactStagingDirectory)'
147+
displayName: Copy downloaded metadata
148+
- template: /.azure-pipelines/generation-templates/checkout-metadata.yml@self
149+
- template: /.azure-pipelines/generation-templates/set-user-config.yml@self
125150
- pwsh: '$(scriptsDirectory)/git-push-cleanmetadata.ps1'
126151

127152
displayName: push clean ${{ parameters.endpoint }} OpenAPI description to msgraph-metadata repo
Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
1+
# This Yaml Document has been converted by ESAI Yaml Pipeline Conversion Tool.
2+
# Please make sure to check all the converted content, it is your team's responsibility to make sure that the pipeline is still valid and functions as expected.
3+
# The 'DownloadBuildArtifacts@0' tasks have been converted to inputs within the `templateContext` section of each job.
14
steps:
2-
- task: DownloadBuildArtifacts@0
3-
inputs:
4-
buildType: 'current'
5-
downloadType: 'single'
6-
artifactName: 'kiota'
7-
downloadPath: '$(Build.SourcesDirectory)'
8-
9-
- bash: chmod +x $(Build.SourcesDirectory)/kiota/kiota
5+
- bash: chmod +x $(Build.SourcesDirectory)/kiota/kiota
Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
steps:
2-
- task: DownloadBuildArtifacts@0
3-
inputs:
4-
buildType: 'current'
5-
downloadType: 'single'
6-
artifactName: 'typewriter'
7-
downloadPath: '$(Build.SourcesDirectory)'
1+
# This Yaml Document has been converted by ESAI Yaml Pipeline Conversion Tool.
2+
# Please make sure to check all the converted content, it is your team's responsibility to make sure that the pipeline is still valid and functions as expected.
3+
# The 'DownloadBuildArtifacts@0' tasks have been converted to inputs within the `templateContext` section of each job.
4+
steps: []

.azure-pipelines/generation-templates/language-generation-kiota.yml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,9 @@ parameters:
5757
default: "-e '/copilot' -e '/copilot/**'"
5858

5959
steps:
60-
- template: set-up-for-generation-kiota.yml
60+
- template: /.azure-pipelines/generation-templates/set-up-for-generation-kiota.yml@self
6161
parameters:
6262
cleanMetadataFolder: ${{ parameters.cleanMetadataFolder }}
63-
downloadSteps:
64-
- template: download-kiota.yml
6563

6664
- checkout: ${{ parameters.repoName }}
6765
displayName: 'checkout ${{ parameters.repoName }}'
@@ -89,8 +87,16 @@ steps:
8987
RepoDirectory: $(Build.SourcesDirectory)/${{ parameters.repoName }}
9088
BranchName: ${{ parameters.branchName }}
9189
workingDirectory: ${{ parameters.repoName }}
92-
93-
- bash: '$(kiotaDirectory)/kiota generate --openapi $(Build.SourcesDirectory)/msgraph-metadata/${{ parameters.cleanMetadataFolder }}/openapi.yaml --language ${{ parameters.language }} -o $(kiotaDirectory)/output -n ${{ parameters.targetNamespace }} -c ${{ parameters.targetClassName }} ${{ parameters.customArguments }} ${{ parameters.pathExclusionArguments }}'
90+
- pwsh: |
91+
Write-Host "=== Files in Kiota Directory ==="
92+
Write-Host "Kiota Directory: $(kiotaDirectory)"
93+
if (Test-Path "$(kiotaDirectory)") {
94+
Get-ChildItem "$(kiotaDirectory)" -Recurse | Format-Table Name, FullName, Length, LastWriteTime -AutoSize
95+
} else {
96+
Write-Warning "Kiota directory not found: $(kiotaDirectory)"
97+
}
98+
displayName: 'List files in Kiota directory'
99+
- pwsh: '& "$(kiotaDirectory)/kiota.exe" generate --openapi "$(Build.SourcesDirectory)/msgraph-metadata/${{ parameters.cleanMetadataFolder }}/openapi.yaml" --language "${{ parameters.language }}" -o "$(kiotaDirectory)/output" -n "${{ parameters.targetNamespace }}" -c "${{ parameters.targetClassName }}" ${{ parameters.customArguments }} ${{ parameters.pathExclusionArguments }}'
94100
displayName: 'Run Kiota for ${{ parameters.language }} ${{ parameters.version }}'
95101
env:
96102
KIOTA_GENERATION:EXPORTPUBLICAPI: ${{ parameters.exportDom }}

.azure-pipelines/generation-templates/language-generation.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,9 @@ parameters:
3434
displayName: Generate PR after publish changes?
3535

3636
steps:
37-
- template: set-up-for-generation.yml
37+
- template: /.azure-pipelines/generation-templates/set-up-for-generation.yml@self
3838
parameters:
3939
cleanMetadataFolder: ${{ parameters.cleanMetadataFolder }}
40-
downloadSteps:
41-
- template: download-typewriter.yml
42-
4340
- checkout: ${{ parameters.repoName }}
4441
displayName: 'checkout ${{ parameters.repoName }}'
4542
fetchDepth: 1
@@ -67,7 +64,7 @@ steps:
6764
TypewriterExecutable: $(typewriterExecutable)
6865
TypewriterDirectory: $(typewriterDirectory)
6966
Language: ${{ parameters.language }}
70-
Endpoint: ${{ parameters.version }}
67+
Endpoint: ${{ parameters.version }}
7168
displayName: 'Run Typewriter for ${{ parameters.language }} ${{ parameters.version }}'
7269

7370
- ${{ parameters.languageSpecificSteps }}
Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,13 @@
11
parameters:
2-
- name: cleanMetadataFolder
3-
type: string
4-
- name: downloadSteps
5-
type: stepList
6-
default:
7-
- pwsh: |
8-
Write-Error "No download step is provided"
2+
- name: cleanMetadataFolder
3+
type: string
94

105
steps:
11-
- template: set-user-config.yml
12-
- template: use-dotnet-sdk.yml
6+
- template: /.azure-pipelines/generation-templates/set-user-config.yml@self
7+
- template: /.azure-pipelines/generation-templates/use-dotnet-sdk.yml@self
138
parameters:
149
version: "9.x" #kiota uses a net9 target
1510

16-
- ${{ parameters.downloadSteps }}
17-
1811
# checkout metadata repo if capture and clean step is skipped
1912
- checkout: msgraph-metadata
2013
displayName: checkout metadata
@@ -30,16 +23,3 @@ steps:
3023
Move-Item -Path $(Build.SourcesDirectory)/msgraph-metadata/openapi/beta/openapi.yaml -Destination $(Build.SourcesDirectory)/msgraph-metadata/clean_beta_openapi/
3124
displayName: Move metadata to expected location
3225
condition: or(eq(variables.skipMetadataCaptureAndClean, true), eq(variables.skipOpenApiCaptureAndClean, true))
33-
34-
# if capture and clean step is not skipped
35-
# then download the artifact from capture and clean steps
36-
# follow the same folder structure as msgraph-metadata repo
37-
# so that metadata reference path is always the same
38-
- task: DownloadBuildArtifacts@0
39-
inputs:
40-
buildType: 'current'
41-
downloadType: 'single'
42-
artifactName: ${{ parameters.cleanMetadataFolder }}
43-
downloadPath: '$(Build.SourcesDirectory)/msgraph-metadata'
44-
condition: and(eq(variables.skipMetadataCaptureAndClean, false), eq(variables.skipOpenApiCaptureAndClean, false))
45-
displayName: Downloading metadata from artifacts

0 commit comments

Comments
 (0)