Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
ebf8ae7
Merge pull request #1365 from microsoftgraph/dev
baywet Jun 18, 2025
51f128a
Merge pull request #1367 from microsoftgraph/dev
baywet Jul 3, 2025
9b3a3f6
Merge pull request #1369 from microsoftgraph/dev
baywet Jul 8, 2025
4d8b565
Merge pull request #1372 from microsoftgraph/dev
baywet Jul 11, 2025
e55a612
Merge branch 'main' of https://github.com/microsoftgraph/MSGraph-SDK-…
adrian05-ms Jul 21, 2025
ead96bf
Generation pipeline migration to 1ES
adrian05-ms Aug 7, 2025
6a38ff3
fixing param issue
adrian05-ms Aug 7, 2025
76eb499
adding missing repo
adrian05-ms Aug 7, 2025
a840a03
Fix template issues
adrian05-ms Aug 7, 2025
e8f6bc3
duplication error
adrian05-ms Aug 7, 2025
48aa66c
removing download steps
adrian05-ms Aug 7, 2025
4f2b968
sdl analysis
adrian05-ms Aug 7, 2025
4dec854
excluding repos
adrian05-ms Aug 7, 2025
06344f7
changing typewriter targetPath
adrian05-ms Aug 7, 2025
439329f
changing download path
adrian05-ms Aug 7, 2025
385f202
adding typewriter to the target path
adrian05-ms Aug 7, 2025
19c7918
Fixing openAPI outputPath
adrian05-ms Aug 7, 2025
442179e
fixing output path
adrian05-ms Aug 8, 2025
ef19de1
test run
adrian05-ms Aug 8, 2025
d742363
changing target path
adrian05-ms Aug 8, 2025
6a77e4b
testing change
adrian05-ms Aug 8, 2025
1d9f197
multiple artifacts
adrian05-ms Aug 8, 2025
e861987
testing copy files
adrian05-ms Aug 8, 2025
fb9fc16
hardcoding downloaded artifacts
adrian05-ms Aug 8, 2025
de66bbb
testing copy files
adrian05-ms Aug 8, 2025
c847a02
Fixing copy files
adrian05-ms Aug 8, 2025
a08a2e1
Attempting to fix kiota dir issue
adrian05-ms Aug 11, 2025
dd9b8e5
Testing downloaded paths
adrian05-ms Aug 11, 2025
564e226
moving from bash to powershell
adrian05-ms Aug 11, 2025
1af1d6b
changing targetPath
adrian05-ms Aug 11, 2025
009c893
adding template context
adrian05-ms Aug 12, 2025
b64aff7
adding kiota repo to scan
adrian05-ms Aug 12, 2025
e7c898c
reverting back change
adrian05-ms Aug 12, 2025
616e469
reverting back copyright comments
adrian05-ms Aug 12, 2025
d3c2e25
adding comments
adrian05-ms Aug 12, 2025
6a58a16
adding comment space
adrian05-ms Aug 12, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,560 changes: 892 additions & 668 deletions .azure-pipelines/generation-pipeline.yml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
steps:
- template: use-dotnet-sdk.yml
- template: /.azure-pipelines/generation-templates/use-dotnet-sdk.yml@self
parameters:
version: "9.x" #kiota uses a net9 target

Expand All @@ -15,9 +15,4 @@ steps:
sourceFolder: '$(Build.SourcesDirectory)/src/kiota/bin/$(BuildConfiguration)/net9.0'
contents: '**/*'
targetFolder: '$(Build.ArtifactStagingDirectory)'
displayName: Copy Kiota executable

- task: PublishBuildArtifacts@1
inputs:
pathToPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: kiota
displayName: Copy Kiota executable
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
steps:
- template: use-dotnet-sdk.yml

- template: /.azure-pipelines/generation-templates/use-dotnet-sdk.yml@self
- checkout: self
displayName: checkout generator
fetchDepth: 1
Expand All @@ -15,9 +14,4 @@ steps:
sourceFolder: '$(Build.SourcesDirectory)/src/Typewriter/bin/$(BuildConfiguration)/net8.0'
contents: '**/*'
targetFolder: '$(Build.ArtifactStagingDirectory)'
displayName: Copy Typewriter executable

- task: PublishBuildArtifacts@1
inputs:
pathToPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: typewriter
displayName: Copy Typewriter executable
23 changes: 5 additions & 18 deletions .azure-pipelines/generation-templates/capture-metadata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ steps:
fetchDepth: 1
persistCredentials: true

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

# required for TypeSpec
- task: UseNode@1
Expand Down Expand Up @@ -76,14 +76,10 @@ steps:
inputMetadataFile: ${{ parameters.inputMetadata }}
enabled: true

- template: download-typewriter.yml

# required for typewriter
- template: use-dotnet-sdk.yml
- template: /.azure-pipelines/generation-templates/use-dotnet-sdk.yml@self
parameters:
version: '8.x'

## Only run if the previous step was successful
- pwsh: '$(scriptsDirectory)/run-typewriter-clean-metadata.ps1'
env:
OutputPath: ${{ parameters.outputPath }}
Expand Down Expand Up @@ -153,20 +149,11 @@ steps:
contents: '**/*'
targetFolder: '$(Build.ArtifactStagingDirectory)'
displayName: Copy generated metadata

- task: PublishBuildArtifacts@1
inputs:
pathToPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: ${{ parameters.cleanMetadataFolder }}

# Use the clean metadata from the last step to generate DotNet files.

# required for the hidi installation validation
- template: use-dotnet-sdk.yml
- template: /.azure-pipelines/generation-templates/use-dotnet-sdk.yml@self
parameters:
version: '9.x'

- pwsh: dotnet tool install --global Microsoft.OpenApi.Hidi --version 1.6.24
- pwsh: dotnet tool install --global Microsoft.OpenApi.Hidi --version 1.6.24
displayName: 'Install hidi tool'

# verify that generated metadata is parsable as an Edm model
Expand Down
87 changes: 56 additions & 31 deletions .azure-pipelines/generation-templates/capture-openapi.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
# Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.
# contains an end to end validation pipeline using C# compilation tests for staging beta metadata

# capture-metadata.yml will result in the capture and cleaning of the metadata
# with the artifacts posted to GitHub.
# Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.
# The following template creates multiple artifacts from a matrix, this is the intended behavior to follow the same workflow before the governance migration

# For more information please refer to: https://github.com/microsoftgraph/MSGraph-SDK-Code-Generator/pull/1377#discussion_r2271024012
parameters:
- name: 'endpoint'
type: string
Expand All @@ -13,7 +11,6 @@ parameters:
default: $(System.ArtifactsDirectory)
- name: 'cleanMetadataFolder'
type: string

jobs:
- job: get_conversion_settings
displayName: "Get conversion settings"
Expand All @@ -23,8 +20,7 @@ jobs:
fetchDepth: 1
persistCredentials: true

- template: checkout-metadata.yml

- template: /.azure-pipelines/generation-templates/checkout-metadata.yml@self
- pwsh: |
$dirPath = "./conversion-settings"
$endpoint = "${{ parameters.endpoint }}"
Expand All @@ -41,38 +37,39 @@ jobs:
Write-Host "##vso[task.setvariable variable=targets;isOutput=true]$json"
name: setTargets
workingDirectory: $(Build.SourcesDirectory)/msgraph-metadata

- script: echo $(setTargets.targets)
displayName: "Print settings"

- job: convert_openapi
dependsOn: get_conversion_settings
displayName: Convert
strategy:
matrix: $[ dependencies.get_conversion_settings.outputs['setTargets.targets'] ]
variables:
targets: $[ dependencies.get_conversion_settings.outputs['setTargets.targets'] ]

templateContext:
outputs:
- output: pipelineArtifact
targetPath: '$(Build.ArtifactStagingDirectory)/$(Name)'
artifactName: '${{ parameters.cleanMetadataFolder }}-$(Name)'
steps:
# We only need the scripts
- checkout: self
displayName: checkout generator
fetchDepth: 1
persistCredentials: true

- template: checkout-metadata.yml
- template: /.azure-pipelines/generation-templates/checkout-metadata.yml@self

# required for the hidi to run
- template: use-dotnet-sdk.yml
- template: /.azure-pipelines/generation-templates/use-dotnet-sdk.yml@self
parameters:
version: '8.x'

# required for the hidi installation validation
- template: use-dotnet-sdk.yml
# required for the hidi installation validation
- template: /.azure-pipelines/generation-templates/use-dotnet-sdk.yml@self
parameters:
version: '9.x'

- pwsh: dotnet tool install --global Microsoft.OpenApi.Hidi --version 1.6.24
- pwsh: dotnet tool install --global Microsoft.OpenApi.Hidi --version 1.6.24
displayName: install hidi

- pwsh: |
Expand All @@ -90,14 +87,8 @@ jobs:
inputs:
sourceFolder: ${{ parameters.outputPath }}
contents: '**/$(Name).yaml'
targetFolder: '$(Build.ArtifactStagingDirectory)'
targetFolder: '$(Build.ArtifactStagingDirectory)/$(Name)'
displayName: Copy generated metadata

- task: PublishBuildArtifacts@1
inputs:
pathToPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: ${{ parameters.cleanMetadataFolder }}

- pwsh: |
./scripts/run-openapi-validation.ps1 -repoDirectory (Get-Location).Path -version "${{ parameters.endpoint }}" -platformName "$(Name)"
displayName: ensure that OpenAPI docs can be parsed
Expand All @@ -107,21 +98,55 @@ jobs:
- job: publish_openapi
dependsOn: convert_openapi
displayName: Publish
## If there's new settings added please add them here too
templateContext:
inputs:
- input: pipelineArtifact
artifactName: '${{ parameters.cleanMetadataFolder }}-default'
targetPath: '$(Build.SourcesDirectory)/artifacts'
- input: pipelineArtifact
artifactName: '${{ parameters.cleanMetadataFolder }}-graphexplorer'
targetPath: '$(Build.SourcesDirectory)/artifacts'
- input: pipelineArtifact
artifactName: '${{ parameters.cleanMetadataFolder }}-openapi'
targetPath: '$(Build.SourcesDirectory)/artifacts'
- input: pipelineArtifact
artifactName: '${{ parameters.cleanMetadataFolder }}-powershell_v2'
targetPath: '$(Build.SourcesDirectory)/artifacts'
outputs:
- output: pipelineArtifact
targetPath: '$(Build.ArtifactStagingDirectory)'
artifactName: ${{ parameters.cleanMetadataFolder }}
steps:
# We only need the scripts
- checkout: self
displayName: checkout generator
fetchDepth: 1
persistCredentials: true

- template: checkout-metadata.yml
- template: set-user-config.yml
- task: DownloadPipelineArtifact@2
# Copy files from the maxtrix artifacts to a single folder
- task: CopyFiles@2
inputs:
path: $(Build.SourcesDirectory)/msgraph-metadata/openapi/${{ parameters.endpoint }}
artifact: ${{ parameters.cleanMetadataFolder }}
sourceFolder: '$(Build.SourcesDirectory)/artifacts'
contents: '**/*.yaml'
targetFolder: '$(Build.ArtifactStagingDirectory)'
displayName: Copy artifact metadata
# Copy files from the target path where artifacts should be downloaded
- task: CopyFiles@2
inputs:
sourceFolder: '$(Build.ArtifactStagingDirectory)'
contents: '**/*.yaml'
targetFolder: '$(Build.SourcesDirectory)/msgraph-metadata/openapi/${{ parameters.endpoint }}'
displayName: Copy downloaded metadata

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

displayName: push clean ${{ parameters.endpoint }} OpenAPI description to msgraph-metadata repo
Expand Down
12 changes: 4 additions & 8 deletions .azure-pipelines/generation-templates/download-kiota.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
# This Yaml Document has been converted by ESAI Yaml Pipeline Conversion Tool.
# 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.
# The 'DownloadBuildArtifacts@0' tasks have been converted to inputs within the `templateContext` section of each job.
steps:
- task: DownloadBuildArtifacts@0
inputs:
buildType: 'current'
downloadType: 'single'
artifactName: 'kiota'
downloadPath: '$(Build.SourcesDirectory)'

- bash: chmod +x $(Build.SourcesDirectory)/kiota/kiota
- bash: chmod +x $(Build.SourcesDirectory)/kiota/kiota
11 changes: 4 additions & 7 deletions .azure-pipelines/generation-templates/download-typewriter.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
steps:
- task: DownloadBuildArtifacts@0
inputs:
buildType: 'current'
downloadType: 'single'
artifactName: 'typewriter'
downloadPath: '$(Build.SourcesDirectory)'
# This Yaml Document has been converted by ESAI Yaml Pipeline Conversion Tool.
# 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.
# The 'DownloadBuildArtifacts@0' tasks have been converted to inputs within the `templateContext` section of each job.
steps: []
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,9 @@ parameters:
default: "-e '/copilot' -e '/copilot/**'"

steps:
- template: set-up-for-generation-kiota.yml
- template: /.azure-pipelines/generation-templates/set-up-for-generation-kiota.yml@self
parameters:
cleanMetadataFolder: ${{ parameters.cleanMetadataFolder }}
downloadSteps:
- template: download-kiota.yml

- checkout: ${{ parameters.repoName }}
displayName: 'checkout ${{ parameters.repoName }}'
Expand Down Expand Up @@ -89,8 +87,16 @@ steps:
RepoDirectory: $(Build.SourcesDirectory)/${{ parameters.repoName }}
BranchName: ${{ parameters.branchName }}
workingDirectory: ${{ parameters.repoName }}

- 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 }}'
- pwsh: |
Write-Host "=== Files in Kiota Directory ==="
Write-Host "Kiota Directory: $(kiotaDirectory)"
if (Test-Path "$(kiotaDirectory)") {
Get-ChildItem "$(kiotaDirectory)" -Recurse | Format-Table Name, FullName, Length, LastWriteTime -AutoSize
} else {
Write-Warning "Kiota directory not found: $(kiotaDirectory)"
}
displayName: 'List files in Kiota directory'
- 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 }}'
displayName: 'Run Kiota for ${{ parameters.language }} ${{ parameters.version }}'
env:
KIOTA_GENERATION:EXPORTPUBLICAPI: ${{ parameters.exportDom }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,9 @@ parameters:
displayName: Generate PR after publish changes?

steps:
- template: set-up-for-generation.yml
- template: /.azure-pipelines/generation-templates/set-up-for-generation.yml@self
parameters:
cleanMetadataFolder: ${{ parameters.cleanMetadataFolder }}
downloadSteps:
- template: download-typewriter.yml

- checkout: ${{ parameters.repoName }}
displayName: 'checkout ${{ parameters.repoName }}'
fetchDepth: 1
Expand Down Expand Up @@ -67,7 +64,7 @@ steps:
TypewriterExecutable: $(typewriterExecutable)
TypewriterDirectory: $(typewriterDirectory)
Language: ${{ parameters.language }}
Endpoint: ${{ parameters.version }}
Endpoint: ${{ parameters.version }}
displayName: 'Run Typewriter for ${{ parameters.language }} ${{ parameters.version }}'

- ${{ parameters.languageSpecificSteps }}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
parameters:
- name: cleanMetadataFolder
type: string
- name: downloadSteps
type: stepList
default:
- pwsh: |
Write-Error "No download step is provided"
- name: cleanMetadataFolder
type: string

steps:
- template: set-user-config.yml
- template: use-dotnet-sdk.yml
- template: /.azure-pipelines/generation-templates/set-user-config.yml@self
- template: /.azure-pipelines/generation-templates/use-dotnet-sdk.yml@self
parameters:
version: "9.x" #kiota uses a net9 target

- ${{ parameters.downloadSteps }}

# checkout metadata repo if capture and clean step is skipped
- checkout: msgraph-metadata
displayName: checkout metadata
Expand All @@ -30,16 +23,3 @@ steps:
Move-Item -Path $(Build.SourcesDirectory)/msgraph-metadata/openapi/beta/openapi.yaml -Destination $(Build.SourcesDirectory)/msgraph-metadata/clean_beta_openapi/
displayName: Move metadata to expected location
condition: or(eq(variables.skipMetadataCaptureAndClean, true), eq(variables.skipOpenApiCaptureAndClean, true))

# if capture and clean step is not skipped
# then download the artifact from capture and clean steps
# follow the same folder structure as msgraph-metadata repo
# so that metadata reference path is always the same
- task: DownloadBuildArtifacts@0
inputs:
buildType: 'current'
downloadType: 'single'
artifactName: ${{ parameters.cleanMetadataFolder }}
downloadPath: '$(Build.SourcesDirectory)/msgraph-metadata'
condition: and(eq(variables.skipMetadataCaptureAndClean, false), eq(variables.skipOpenApiCaptureAndClean, false))
displayName: Downloading metadata from artifacts
Loading
Loading