Skip to content

Commit ead96bf

Browse files
committed
Generation pipeline migration to 1ES
1 parent e55a612 commit ead96bf

11 files changed

+913
-803
lines changed

.azure-pipelines/generation-pipeline.yml

Lines changed: 869 additions & 670 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: 18 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
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.
6-
71
parameters:
82
- name: 'endpoint'
93
type: string
@@ -13,7 +7,6 @@ parameters:
137
default: $(System.ArtifactsDirectory)
148
- name: 'cleanMetadataFolder'
159
type: string
16-
1710
jobs:
1811
- job: get_conversion_settings
1912
displayName: "Get conversion settings"
@@ -23,8 +16,7 @@ jobs:
2316
fetchDepth: 1
2417
persistCredentials: true
2518

26-
- template: checkout-metadata.yml
27-
19+
- template: /.azure-pipelines/generation-templates/checkout-metadata.yml@self
2820
- pwsh: |
2921
$dirPath = "./conversion-settings"
3022
$endpoint = "${{ parameters.endpoint }}"
@@ -41,38 +33,39 @@ jobs:
4133
Write-Host "##vso[task.setvariable variable=targets;isOutput=true]$json"
4234
name: setTargets
4335
workingDirectory: $(Build.SourcesDirectory)/msgraph-metadata
44-
4536
- script: echo $(setTargets.targets)
4637
displayName: "Print settings"
47-
4838
- job: convert_openapi
4939
dependsOn: get_conversion_settings
5040
displayName: Convert
5141
strategy:
5242
matrix: $[ dependencies.get_conversion_settings.outputs['setTargets.targets'] ]
5343
variables:
5444
targets: $[ dependencies.get_conversion_settings.outputs['setTargets.targets'] ]
55-
45+
templateContext:
46+
outputs:
47+
- output: pipelineArtifact
48+
targetPath: '$(Build.ArtifactStagingDirectory)'
49+
artifactName: ${{ parameters.cleanMetadataFolder }}
5650
steps:
57-
# We only need the scripts
5851
- checkout: self
5952
displayName: checkout generator
6053
fetchDepth: 1
6154
persistCredentials: true
6255

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

6558
# required for the hidi to run
66-
- template: use-dotnet-sdk.yml
59+
- template: /.azure-pipelines/generation-templates/use-dotnet-sdk.yml@self
6760
parameters:
6861
version: '8.x'
6962

70-
# required for the hidi installation validation
71-
- template: use-dotnet-sdk.yml
63+
# required for the hidi installation validation
64+
- template: /.azure-pipelines/generation-templates/use-dotnet-sdk.yml@self
7265
parameters:
7366
version: '9.x'
7467

75-
- pwsh: dotnet tool install --global Microsoft.OpenApi.Hidi --version 1.6.24
68+
- pwsh: dotnet tool install --global Microsoft.OpenApi.Hidi --version 1.6.24
7669
displayName: install hidi
7770

7871
- pwsh: |
@@ -92,12 +85,6 @@ jobs:
9285
contents: '**/$(Name).yaml'
9386
targetFolder: '$(Build.ArtifactStagingDirectory)'
9487
displayName: Copy generated metadata
95-
96-
- task: PublishBuildArtifacts@1
97-
inputs:
98-
pathToPublish: '$(Build.ArtifactStagingDirectory)'
99-
artifactName: ${{ parameters.cleanMetadataFolder }}
100-
10188
- pwsh: |
10289
./scripts/run-openapi-validation.ps1 -repoDirectory (Get-Location).Path -version "${{ parameters.endpoint }}" -platformName "$(Name)"
10390
displayName: ensure that OpenAPI docs can be parsed
@@ -107,21 +94,19 @@ jobs:
10794
- job: publish_openapi
10895
dependsOn: convert_openapi
10996
displayName: Publish
97+
templateContext:
98+
inputs:
99+
- input: pipelineArtifact
100+
targetPath: $(Build.SourcesDirectory)/msgraph-metadata/openapi/${{ parameters.endpoint }}
101+
artifactName: ${{ parameters.cleanMetadataFolder }}
110102
steps:
111103
# We only need the scripts
112104
- checkout: self
113105
displayName: checkout generator
114106
fetchDepth: 1
115107
persistCredentials: true
116-
117-
- template: checkout-metadata.yml
118-
- template: set-user-config.yml
119-
- task: DownloadPipelineArtifact@2
120-
inputs:
121-
path: $(Build.SourcesDirectory)/msgraph-metadata/openapi/${{ parameters.endpoint }}
122-
artifact: ${{ parameters.cleanMetadataFolder }}
123-
124-
# Checkin clean metadata into metadata repo or make it an artifact.
108+
- template: /.azure-pipelines/generation-templates/checkout-metadata.yml@self
109+
- template: /.azure-pipelines/generation-templates/set-user-config.yml@self
125110
- pwsh: '$(scriptsDirectory)/git-push-cleanmetadata.ps1'
126111

127112
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: 1 addition & 3 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 }}'

.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)