From 9dc84b17a2d0e5b3d77ce417b5989a71a2d1efec Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 27 Jun 2025 15:32:02 -0400 Subject: [PATCH 01/10] ci: adds TS annotations augmentations Signed-off-by: Vincent Biret --- .azure-pipelines/generation-pipeline.yml | 3 ++ .../generation-templates/capture-metadata.yml | 36 +++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/.azure-pipelines/generation-pipeline.yml b/.azure-pipelines/generation-pipeline.yml index 8afce4f14..3460e7abd 100644 --- a/.azure-pipelines/generation-pipeline.yml +++ b/.azure-pipelines/generation-pipeline.yml @@ -159,6 +159,7 @@ variables: cleanOpenAPIFileBetaOutputPath: '$(Build.SourcesDirectory)/msgraph-metadata/openapi/beta/' cleanMetadataFileV1OutputPath: '$(Build.SourcesDirectory)/msgraph-metadata/clean_v10_metadata/' cleanMetadataFileBetaOutputPath: '$(Build.SourcesDirectory)/msgraph-metadata/clean_beta_metadata/' + metadataTypeSpecAnnotationsSource: '$(Build.SourcesDirectory)/msgraph-metadata/additions/' cleanMetadataFolderBeta: 'clean_beta_metadata' cleanMetadataFolderV1: 'clean_v10_metadata' cleanOpenAPIFolderBeta: 'clean_beta_openapi' @@ -218,6 +219,7 @@ stages: cleanMetadataFile: $(cleanMetadataFileV1) cleanMetadataFolder: $(cleanMetadataFolderV1) cleanMetadataFileWithAnnotations: $(cleanMetadataFileWithAnnotationsV1) + metadataTypeSpecAnnotationsSource: $(metadataTypeSpecAnnotationsSource) # Same description as stage_v1_metadata - stage: stage_beta_metadata @@ -236,6 +238,7 @@ stages: cleanMetadataFile: $(cleanMetadataFileBeta) cleanMetadataFolder: $(cleanMetadataFolderBeta) cleanMetadataFileWithAnnotations: $(cleanMetadataFileWithAnnotationsBeta) + metadataTypeSpecAnnotationsSource: $(metadataTypeSpecAnnotationsSource) - stage: stage_v1_openapi dependsOn: stage_v1_metadata diff --git a/.azure-pipelines/generation-templates/capture-metadata.yml b/.azure-pipelines/generation-templates/capture-metadata.yml index 2e0812046..cfd4c4c8c 100644 --- a/.azure-pipelines/generation-templates/capture-metadata.yml +++ b/.azure-pipelines/generation-templates/capture-metadata.yml @@ -22,6 +22,18 @@ parameters: - name: 'cleanMetadataFileWithAnnotations' type: string default: $(cleanMetadataFileWithAnnotationsV1) +- name: 'metadataTypeSpecAnnotationsSource' + type: string + default: $(metadataTypeSpecAnnotationsSource) +- name: 'metadataTypeSpecAnnotationsOutputDir' + type: string + default: 'tsp-output' +- name: metadataAnnotationsCopyScriptPath + type: string + default: '$(metadataTypeSpecAnnotationsSource)/../scripts/copy-annotations-to-csdl.ps1' + +variables: + sanitizedEndpoint: $[replace(parameters['endpoint'], '/', ''))] steps: @@ -57,6 +69,23 @@ steps: parameters: version: '8.x' +# required for TypeSpec +- task: UseNode@1 + inputs: + versionSpec: '22.x' + checkLatest: true + +- pwsh: 'npm install -g @typespec/compiler typescript' + displayName: 'install TypeSpec and TypeScript globally' + +- pwsh: 'npm ci' + displayName: 'install TypeSpec dependencies' + workingDirectory: '$(metadataTypeSpecAnnotationsSource)' + +- pwsh: 'tsc compile .' + displayName: 'compile TypeSpec annotations' + workingDirectory: '$(metadataTypeSpecAnnotationsSource)' + ## Only run if the previous step was successful - pwsh: '$(scriptsDirectory)/run-typewriter-clean-metadata.ps1' env: @@ -70,6 +99,8 @@ steps: endpointVersion: ${{ parameters.endpoint }} displayName: 'run Typewriter to clean ${{ parameters.endpoint }} metadata' +- pwsh: '$(metadataAnnotationsCopyScriptPath) -targetCsdlPath "$(Build.SourcesDirectory)/msgraph-metadata/clean_$(sanitizedEndpoint)_metadata/cleanMetadataWithDescriptions${{ parameters.endpoint }}.xml" -sourceCsdlDirectoryPath "$(metadataTypeSpecAnnotationsSource)/$(metadataTypeSpecAnnotationsOutputDir)"' + ## Only run if the previous step was successful - pwsh: '$(scriptsDirectory)/run-typewriter-clean-metadata.ps1' env: @@ -85,6 +116,8 @@ steps: OutputMetadataFileName: 'cleanMetadataWithDescriptionsAndAnnotations' displayName: 'run Typewriter to clean ${{ parameters.endpoint }} metadata and keep capability annotations' +- pwsh: '$(metadataAnnotationsCopyScriptPath) -targetCsdlPath "$(Build.SourcesDirectory)/msgraph-metadata/clean_$(sanitizedEndpoint)_metadata/cleanMetadataWithDescriptionsAndAnnotations${{ parameters.endpoint }}.xml" -sourceCsdlDirectoryPath "$(metadataTypeSpecAnnotationsSource)/$(metadataTypeSpecAnnotationsOutputDir)"' + ## Only run if the previous step was successful - pwsh: '$(scriptsDirectory)/run-typewriter-clean-metadata.ps1' env: @@ -101,6 +134,9 @@ steps: OutputMetadataFileName: 'cleanMetadataWithDescriptionsAndAnnotationsAndErrors' displayName: 'run Typewriter to clean ${{ parameters.endpoint }} metadata and keep capability annotations and include error information' +- pwsh: '$(metadataAnnotationsCopyScriptPath) -targetCsdlPath "$(Build.SourcesDirectory)/msgraph-metadata/clean_$(sanitizedEndpoint)_metadata/cleanMetadataWithDescriptionsAndAnnotationsAndErrors${{ parameters.endpoint }}.xml" -sourceCsdlDirectoryPath "$(metadataTypeSpecAnnotationsSource)/$(metadataTypeSpecAnnotationsOutputDir)"' + + # publish metadata as an artifact - task: CopyFiles@2 inputs: From b296b9b5f50ec42c92eced1e2568ce94f7108e12 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 27 Jun 2025 15:36:54 -0400 Subject: [PATCH 02/10] chore: switches to a parameter for endpoint cleanup Signed-off-by: Vincent Biret --- .../generation-templates/capture-metadata.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.azure-pipelines/generation-templates/capture-metadata.yml b/.azure-pipelines/generation-templates/capture-metadata.yml index cfd4c4c8c..14eec23b6 100644 --- a/.azure-pipelines/generation-templates/capture-metadata.yml +++ b/.azure-pipelines/generation-templates/capture-metadata.yml @@ -31,9 +31,9 @@ parameters: - name: metadataAnnotationsCopyScriptPath type: string default: '$(metadataTypeSpecAnnotationsSource)/../scripts/copy-annotations-to-csdl.ps1' - -variables: - sanitizedEndpoint: $[replace(parameters['endpoint'], '/', ''))] +- name: sanitizedEndpoint + type: string + default: $[replace(parameters['endpoint'], '/', ''))] steps: @@ -99,7 +99,7 @@ steps: endpointVersion: ${{ parameters.endpoint }} displayName: 'run Typewriter to clean ${{ parameters.endpoint }} metadata' -- pwsh: '$(metadataAnnotationsCopyScriptPath) -targetCsdlPath "$(Build.SourcesDirectory)/msgraph-metadata/clean_$(sanitizedEndpoint)_metadata/cleanMetadataWithDescriptions${{ parameters.endpoint }}.xml" -sourceCsdlDirectoryPath "$(metadataTypeSpecAnnotationsSource)/$(metadataTypeSpecAnnotationsOutputDir)"' +- pwsh: '$(metadataAnnotationsCopyScriptPath) -targetCsdlPath "$(Build.SourcesDirectory)/msgraph-metadata/clean_${{ parameters.sanitizedEndpoint }}_metadata/cleanMetadataWithDescriptions${{ parameters.endpoint }}.xml" -sourceCsdlDirectoryPath "$(metadataTypeSpecAnnotationsSource)/$(metadataTypeSpecAnnotationsOutputDir)"' ## Only run if the previous step was successful - pwsh: '$(scriptsDirectory)/run-typewriter-clean-metadata.ps1' From a73ad538dc355985f7d0a44dc8c6e78fd09eb920 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 27 Jun 2025 16:06:39 -0400 Subject: [PATCH 03/10] ci: moves the tsc steps before the metadata diff which switches branches Signed-off-by: Vincent Biret --- .../generation-templates/capture-metadata.yml | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/.azure-pipelines/generation-templates/capture-metadata.yml b/.azure-pipelines/generation-templates/capture-metadata.yml index 14eec23b6..80590e8a7 100644 --- a/.azure-pipelines/generation-templates/capture-metadata.yml +++ b/.azure-pipelines/generation-templates/capture-metadata.yml @@ -51,6 +51,23 @@ steps: - template: checkout-metadata.yml - template: set-user-config.yml +# required for TypeSpec +- task: UseNode@1 + inputs: + versionSpec: '22.x' + checkLatest: true + +- pwsh: 'npm install -g @typespec/compiler typescript' + displayName: 'install TypeSpec and TypeScript globally' + +- pwsh: 'npm ci' + displayName: 'install TypeSpec dependencies' + workingDirectory: '$(metadataTypeSpecAnnotationsSource)' + +- pwsh: 'tsc compile .' + displayName: 'compile TypeSpec annotations' + workingDirectory: '$(metadataTypeSpecAnnotationsSource)' + # Results in a raw metadata file written to microsoftgraph/msgraph-metadata if there are changes. # An error will cancel this step if there are no changes. - pwsh: '$(scriptsDirectory)/download-diff-metadata.ps1' @@ -69,23 +86,6 @@ steps: parameters: version: '8.x' -# required for TypeSpec -- task: UseNode@1 - inputs: - versionSpec: '22.x' - checkLatest: true - -- pwsh: 'npm install -g @typespec/compiler typescript' - displayName: 'install TypeSpec and TypeScript globally' - -- pwsh: 'npm ci' - displayName: 'install TypeSpec dependencies' - workingDirectory: '$(metadataTypeSpecAnnotationsSource)' - -- pwsh: 'tsc compile .' - displayName: 'compile TypeSpec annotations' - workingDirectory: '$(metadataTypeSpecAnnotationsSource)' - ## Only run if the previous step was successful - pwsh: '$(scriptsDirectory)/run-typewriter-clean-metadata.ps1' env: From 38dcf1502a17101c99424bdef2f0a6fe84602fa3 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 2 Jul 2025 13:06:00 -0400 Subject: [PATCH 04/10] ci: fixes version spec for node install step --- .azure-pipelines/generation-templates/capture-metadata.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/generation-templates/capture-metadata.yml b/.azure-pipelines/generation-templates/capture-metadata.yml index 80590e8a7..e07af1785 100644 --- a/.azure-pipelines/generation-templates/capture-metadata.yml +++ b/.azure-pipelines/generation-templates/capture-metadata.yml @@ -54,7 +54,7 @@ steps: # required for TypeSpec - task: UseNode@1 inputs: - versionSpec: '22.x' + version: '22.x' checkLatest: true - pwsh: 'npm install -g @typespec/compiler typescript' From bd436e03498997480a8d92f9587ef3870aa8dccd Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 2 Jul 2025 13:26:09 -0400 Subject: [PATCH 05/10] fix: use tsp and not tsc for compile step Signed-off-by: Vincent Biret --- .azure-pipelines/generation-templates/capture-metadata.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/generation-templates/capture-metadata.yml b/.azure-pipelines/generation-templates/capture-metadata.yml index e07af1785..9ade48438 100644 --- a/.azure-pipelines/generation-templates/capture-metadata.yml +++ b/.azure-pipelines/generation-templates/capture-metadata.yml @@ -64,7 +64,7 @@ steps: displayName: 'install TypeSpec dependencies' workingDirectory: '$(metadataTypeSpecAnnotationsSource)' -- pwsh: 'tsc compile .' +- pwsh: 'tsp compile .' displayName: 'compile TypeSpec annotations' workingDirectory: '$(metadataTypeSpecAnnotationsSource)' From e9daf5acf59366247689b2248f6d3c89bbd74fd0 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 2 Jul 2025 14:55:31 -0400 Subject: [PATCH 06/10] fix: script path for ts changes merge Signed-off-by: Vincent Biret --- .../generation-templates/capture-metadata.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.azure-pipelines/generation-templates/capture-metadata.yml b/.azure-pipelines/generation-templates/capture-metadata.yml index 9ade48438..ea572d880 100644 --- a/.azure-pipelines/generation-templates/capture-metadata.yml +++ b/.azure-pipelines/generation-templates/capture-metadata.yml @@ -30,7 +30,7 @@ parameters: default: 'tsp-output' - name: metadataAnnotationsCopyScriptPath type: string - default: '$(metadataTypeSpecAnnotationsSource)/../scripts/copy-annotations-to-csdl.ps1' + default: $[format('{0}/../scripts/copy-annotations-to-csdl.ps1', parameters['metadataTypeSpecAnnotationsSource'])] - name: sanitizedEndpoint type: string default: $[replace(parameters['endpoint'], '/', ''))] @@ -99,7 +99,7 @@ steps: endpointVersion: ${{ parameters.endpoint }} displayName: 'run Typewriter to clean ${{ parameters.endpoint }} metadata' -- pwsh: '$(metadataAnnotationsCopyScriptPath) -targetCsdlPath "$(Build.SourcesDirectory)/msgraph-metadata/clean_${{ parameters.sanitizedEndpoint }}_metadata/cleanMetadataWithDescriptions${{ parameters.endpoint }}.xml" -sourceCsdlDirectoryPath "$(metadataTypeSpecAnnotationsSource)/$(metadataTypeSpecAnnotationsOutputDir)"' +- pwsh: '$[parameters[''metadataAnnotationsCopyScriptPath'']] -targetCsdlPath "$(Build.SourcesDirectory)/msgraph-metadata/clean_${{ parameters.sanitizedEndpoint }}_metadata/cleanMetadataWithDescriptions${{ parameters.endpoint }}.xml" -sourceCsdlDirectoryPath "$(metadataTypeSpecAnnotationsSource)/$(metadataTypeSpecAnnotationsOutputDir)"' ## Only run if the previous step was successful - pwsh: '$(scriptsDirectory)/run-typewriter-clean-metadata.ps1' @@ -116,7 +116,7 @@ steps: OutputMetadataFileName: 'cleanMetadataWithDescriptionsAndAnnotations' displayName: 'run Typewriter to clean ${{ parameters.endpoint }} metadata and keep capability annotations' -- pwsh: '$(metadataAnnotationsCopyScriptPath) -targetCsdlPath "$(Build.SourcesDirectory)/msgraph-metadata/clean_$(sanitizedEndpoint)_metadata/cleanMetadataWithDescriptionsAndAnnotations${{ parameters.endpoint }}.xml" -sourceCsdlDirectoryPath "$(metadataTypeSpecAnnotationsSource)/$(metadataTypeSpecAnnotationsOutputDir)"' +- pwsh: '$[parameters[''metadataAnnotationsCopyScriptPath'']] -targetCsdlPath "$(Build.SourcesDirectory)/msgraph-metadata/clean_$(sanitizedEndpoint)_metadata/cleanMetadataWithDescriptionsAndAnnotations${{ parameters.endpoint }}.xml" -sourceCsdlDirectoryPath "$(metadataTypeSpecAnnotationsSource)/$(metadataTypeSpecAnnotationsOutputDir)"' ## Only run if the previous step was successful - pwsh: '$(scriptsDirectory)/run-typewriter-clean-metadata.ps1' @@ -134,7 +134,7 @@ steps: OutputMetadataFileName: 'cleanMetadataWithDescriptionsAndAnnotationsAndErrors' displayName: 'run Typewriter to clean ${{ parameters.endpoint }} metadata and keep capability annotations and include error information' -- pwsh: '$(metadataAnnotationsCopyScriptPath) -targetCsdlPath "$(Build.SourcesDirectory)/msgraph-metadata/clean_$(sanitizedEndpoint)_metadata/cleanMetadataWithDescriptionsAndAnnotationsAndErrors${{ parameters.endpoint }}.xml" -sourceCsdlDirectoryPath "$(metadataTypeSpecAnnotationsSource)/$(metadataTypeSpecAnnotationsOutputDir)"' +- pwsh: '$[parameters[''metadataAnnotationsCopyScriptPath'']] -targetCsdlPath "$(Build.SourcesDirectory)/msgraph-metadata/clean_$(sanitizedEndpoint)_metadata/cleanMetadataWithDescriptionsAndAnnotationsAndErrors${{ parameters.endpoint }}.xml" -sourceCsdlDirectoryPath "$(metadataTypeSpecAnnotationsSource)/$(metadataTypeSpecAnnotationsOutputDir)"' # publish metadata as an artifact From f04944c89bcb910acdb09b52726b7aa80f022f61 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 2 Jul 2025 15:30:49 -0400 Subject: [PATCH 07/10] fix: tsp xml output reference Signed-off-by: Vincent Biret --- .azure-pipelines/generation-templates/capture-metadata.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.azure-pipelines/generation-templates/capture-metadata.yml b/.azure-pipelines/generation-templates/capture-metadata.yml index ea572d880..0a0ac9c79 100644 --- a/.azure-pipelines/generation-templates/capture-metadata.yml +++ b/.azure-pipelines/generation-templates/capture-metadata.yml @@ -99,7 +99,7 @@ steps: endpointVersion: ${{ parameters.endpoint }} displayName: 'run Typewriter to clean ${{ parameters.endpoint }} metadata' -- pwsh: '$[parameters[''metadataAnnotationsCopyScriptPath'']] -targetCsdlPath "$(Build.SourcesDirectory)/msgraph-metadata/clean_${{ parameters.sanitizedEndpoint }}_metadata/cleanMetadataWithDescriptions${{ parameters.endpoint }}.xml" -sourceCsdlDirectoryPath "$(metadataTypeSpecAnnotationsSource)/$(metadataTypeSpecAnnotationsOutputDir)"' +- pwsh: '$[parameters[''metadataAnnotationsCopyScriptPath'']] -targetCsdlPath "$(Build.SourcesDirectory)/msgraph-metadata/clean_${{ parameters.sanitizedEndpoint }}_metadata/cleanMetadataWithDescriptions${{ parameters.endpoint }}.xml" -sourceCsdlDirectoryPath "$(metadataTypeSpecAnnotationsSource)/${{ parameters.metadataTypeSpecAnnotationsOutputDir }}"' ## Only run if the previous step was successful - pwsh: '$(scriptsDirectory)/run-typewriter-clean-metadata.ps1' @@ -116,7 +116,7 @@ steps: OutputMetadataFileName: 'cleanMetadataWithDescriptionsAndAnnotations' displayName: 'run Typewriter to clean ${{ parameters.endpoint }} metadata and keep capability annotations' -- pwsh: '$[parameters[''metadataAnnotationsCopyScriptPath'']] -targetCsdlPath "$(Build.SourcesDirectory)/msgraph-metadata/clean_$(sanitizedEndpoint)_metadata/cleanMetadataWithDescriptionsAndAnnotations${{ parameters.endpoint }}.xml" -sourceCsdlDirectoryPath "$(metadataTypeSpecAnnotationsSource)/$(metadataTypeSpecAnnotationsOutputDir)"' +- pwsh: '$[parameters[''metadataAnnotationsCopyScriptPath'']] -targetCsdlPath "$(Build.SourcesDirectory)/msgraph-metadata/clean_$(sanitizedEndpoint)_metadata/cleanMetadataWithDescriptionsAndAnnotations${{ parameters.endpoint }}.xml" -sourceCsdlDirectoryPath "$(metadataTypeSpecAnnotationsSource)/${{ parameters.metadataTypeSpecAnnotationsOutputDir }}"' ## Only run if the previous step was successful - pwsh: '$(scriptsDirectory)/run-typewriter-clean-metadata.ps1' @@ -134,7 +134,7 @@ steps: OutputMetadataFileName: 'cleanMetadataWithDescriptionsAndAnnotationsAndErrors' displayName: 'run Typewriter to clean ${{ parameters.endpoint }} metadata and keep capability annotations and include error information' -- pwsh: '$[parameters[''metadataAnnotationsCopyScriptPath'']] -targetCsdlPath "$(Build.SourcesDirectory)/msgraph-metadata/clean_$(sanitizedEndpoint)_metadata/cleanMetadataWithDescriptionsAndAnnotationsAndErrors${{ parameters.endpoint }}.xml" -sourceCsdlDirectoryPath "$(metadataTypeSpecAnnotationsSource)/$(metadataTypeSpecAnnotationsOutputDir)"' +- pwsh: '$[parameters[''metadataAnnotationsCopyScriptPath'']] -targetCsdlPath "$(Build.SourcesDirectory)/msgraph-metadata/clean_$(sanitizedEndpoint)_metadata/cleanMetadataWithDescriptionsAndAnnotationsAndErrors${{ parameters.endpoint }}.xml" -sourceCsdlDirectoryPath "$(metadataTypeSpecAnnotationsSource)/${{ parameters.metadataTypeSpecAnnotationsOutputDir }}"' # publish metadata as an artifact From bb48fef832024866fdd7cbede4f43f989c2831b4 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 2 Jul 2025 15:51:44 -0400 Subject: [PATCH 08/10] fix: another attempt at fixing the script path Signed-off-by: Vincent Biret --- .../generation-templates/capture-metadata.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.azure-pipelines/generation-templates/capture-metadata.yml b/.azure-pipelines/generation-templates/capture-metadata.yml index 0a0ac9c79..1e655cef7 100644 --- a/.azure-pipelines/generation-templates/capture-metadata.yml +++ b/.azure-pipelines/generation-templates/capture-metadata.yml @@ -99,7 +99,9 @@ steps: endpointVersion: ${{ parameters.endpoint }} displayName: 'run Typewriter to clean ${{ parameters.endpoint }} metadata' -- pwsh: '$[parameters[''metadataAnnotationsCopyScriptPath'']] -targetCsdlPath "$(Build.SourcesDirectory)/msgraph-metadata/clean_${{ parameters.sanitizedEndpoint }}_metadata/cleanMetadataWithDescriptions${{ parameters.endpoint }}.xml" -sourceCsdlDirectoryPath "$(metadataTypeSpecAnnotationsSource)/${{ parameters.metadataTypeSpecAnnotationsOutputDir }}"' +- pwsh: '. $Env:ScriptPath -targetCsdlPath "$(Build.SourcesDirectory)/msgraph-metadata/clean_${{ parameters.sanitizedEndpoint }}_metadata/cleanMetadataWithDescriptions${{ parameters.endpoint }}.xml" -sourceCsdlDirectoryPath "$(metadataTypeSpecAnnotationsSource)/${{ parameters.metadataTypeSpecAnnotationsOutputDir }}"' + env: + ScriptPath: ${{ parameters.metadataAnnotationsCopyScriptPath }} ## Only run if the previous step was successful - pwsh: '$(scriptsDirectory)/run-typewriter-clean-metadata.ps1' @@ -116,7 +118,9 @@ steps: OutputMetadataFileName: 'cleanMetadataWithDescriptionsAndAnnotations' displayName: 'run Typewriter to clean ${{ parameters.endpoint }} metadata and keep capability annotations' -- pwsh: '$[parameters[''metadataAnnotationsCopyScriptPath'']] -targetCsdlPath "$(Build.SourcesDirectory)/msgraph-metadata/clean_$(sanitizedEndpoint)_metadata/cleanMetadataWithDescriptionsAndAnnotations${{ parameters.endpoint }}.xml" -sourceCsdlDirectoryPath "$(metadataTypeSpecAnnotationsSource)/${{ parameters.metadataTypeSpecAnnotationsOutputDir }}"' +- pwsh: '. $Env:ScriptPath -targetCsdlPath "$(Build.SourcesDirectory)/msgraph-metadata/clean_$(sanitizedEndpoint)_metadata/cleanMetadataWithDescriptionsAndAnnotations${{ parameters.endpoint }}.xml" -sourceCsdlDirectoryPath "$(metadataTypeSpecAnnotationsSource)/${{ parameters.metadataTypeSpecAnnotationsOutputDir }}"' + env: + ScriptPath: ${{ parameters.metadataAnnotationsCopyScriptPath }} ## Only run if the previous step was successful - pwsh: '$(scriptsDirectory)/run-typewriter-clean-metadata.ps1' @@ -134,7 +138,9 @@ steps: OutputMetadataFileName: 'cleanMetadataWithDescriptionsAndAnnotationsAndErrors' displayName: 'run Typewriter to clean ${{ parameters.endpoint }} metadata and keep capability annotations and include error information' -- pwsh: '$[parameters[''metadataAnnotationsCopyScriptPath'']] -targetCsdlPath "$(Build.SourcesDirectory)/msgraph-metadata/clean_$(sanitizedEndpoint)_metadata/cleanMetadataWithDescriptionsAndAnnotationsAndErrors${{ parameters.endpoint }}.xml" -sourceCsdlDirectoryPath "$(metadataTypeSpecAnnotationsSource)/${{ parameters.metadataTypeSpecAnnotationsOutputDir }}"' +- pwsh: '. $Env:ScriptPath -targetCsdlPath "$(Build.SourcesDirectory)/msgraph-metadata/clean_$(sanitizedEndpoint)_metadata/cleanMetadataWithDescriptionsAndAnnotationsAndErrors${{ parameters.endpoint }}.xml" -sourceCsdlDirectoryPath "$(metadataTypeSpecAnnotationsSource)/${{ parameters.metadataTypeSpecAnnotationsOutputDir }}"' + env: + ScriptPath: ${{ parameters.metadataAnnotationsCopyScriptPath }} # publish metadata as an artifact From 3432d83e98de982785d52345d2ab3b97e576709b Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 3 Jul 2025 10:13:08 -0400 Subject: [PATCH 09/10] ci: another attempt at fixing script path Signed-off-by: Vincent Biret --- .../generation-templates/capture-metadata.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.azure-pipelines/generation-templates/capture-metadata.yml b/.azure-pipelines/generation-templates/capture-metadata.yml index 1e655cef7..448269305 100644 --- a/.azure-pipelines/generation-templates/capture-metadata.yml +++ b/.azure-pipelines/generation-templates/capture-metadata.yml @@ -30,7 +30,7 @@ parameters: default: 'tsp-output' - name: metadataAnnotationsCopyScriptPath type: string - default: $[format('{0}/../scripts/copy-annotations-to-csdl.ps1', parameters['metadataTypeSpecAnnotationsSource'])] + default: '/../scripts/copy-annotations-to-csdl.ps1' - name: sanitizedEndpoint type: string default: $[replace(parameters['endpoint'], '/', ''))] @@ -99,7 +99,7 @@ steps: endpointVersion: ${{ parameters.endpoint }} displayName: 'run Typewriter to clean ${{ parameters.endpoint }} metadata' -- pwsh: '. $Env:ScriptPath -targetCsdlPath "$(Build.SourcesDirectory)/msgraph-metadata/clean_${{ parameters.sanitizedEndpoint }}_metadata/cleanMetadataWithDescriptions${{ parameters.endpoint }}.xml" -sourceCsdlDirectoryPath "$(metadataTypeSpecAnnotationsSource)/${{ parameters.metadataTypeSpecAnnotationsOutputDir }}"' +- pwsh: '. $(metadataTypeSpecAnnotationsSource)/$Env:ScriptPath -targetCsdlPath "$(Build.SourcesDirectory)/msgraph-metadata/clean_${{ parameters.sanitizedEndpoint }}_metadata/cleanMetadataWithDescriptions${{ parameters.endpoint }}.xml" -sourceCsdlDirectoryPath "$(metadataTypeSpecAnnotationsSource)/${{ parameters.metadataTypeSpecAnnotationsOutputDir }}"' env: ScriptPath: ${{ parameters.metadataAnnotationsCopyScriptPath }} @@ -118,7 +118,7 @@ steps: OutputMetadataFileName: 'cleanMetadataWithDescriptionsAndAnnotations' displayName: 'run Typewriter to clean ${{ parameters.endpoint }} metadata and keep capability annotations' -- pwsh: '. $Env:ScriptPath -targetCsdlPath "$(Build.SourcesDirectory)/msgraph-metadata/clean_$(sanitizedEndpoint)_metadata/cleanMetadataWithDescriptionsAndAnnotations${{ parameters.endpoint }}.xml" -sourceCsdlDirectoryPath "$(metadataTypeSpecAnnotationsSource)/${{ parameters.metadataTypeSpecAnnotationsOutputDir }}"' +- pwsh: '. $(metadataTypeSpecAnnotationsSource)/$Env:ScriptPath -targetCsdlPath "$(Build.SourcesDirectory)/msgraph-metadata/clean_$(sanitizedEndpoint)_metadata/cleanMetadataWithDescriptionsAndAnnotations${{ parameters.endpoint }}.xml" -sourceCsdlDirectoryPath "$(metadataTypeSpecAnnotationsSource)/${{ parameters.metadataTypeSpecAnnotationsOutputDir }}"' env: ScriptPath: ${{ parameters.metadataAnnotationsCopyScriptPath }} @@ -138,7 +138,7 @@ steps: OutputMetadataFileName: 'cleanMetadataWithDescriptionsAndAnnotationsAndErrors' displayName: 'run Typewriter to clean ${{ parameters.endpoint }} metadata and keep capability annotations and include error information' -- pwsh: '. $Env:ScriptPath -targetCsdlPath "$(Build.SourcesDirectory)/msgraph-metadata/clean_$(sanitizedEndpoint)_metadata/cleanMetadataWithDescriptionsAndAnnotationsAndErrors${{ parameters.endpoint }}.xml" -sourceCsdlDirectoryPath "$(metadataTypeSpecAnnotationsSource)/${{ parameters.metadataTypeSpecAnnotationsOutputDir }}"' +- pwsh: '. $(metadataTypeSpecAnnotationsSource)/$Env:ScriptPath -targetCsdlPath "$(Build.SourcesDirectory)/msgraph-metadata/clean_$(sanitizedEndpoint)_metadata/cleanMetadataWithDescriptionsAndAnnotationsAndErrors${{ parameters.endpoint }}.xml" -sourceCsdlDirectoryPath "$(metadataTypeSpecAnnotationsSource)/${{ parameters.metadataTypeSpecAnnotationsOutputDir }}"' env: ScriptPath: ${{ parameters.metadataAnnotationsCopyScriptPath }} From 5a00a799166636b19c118b1f02aff8e568621a45 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 3 Jul 2025 13:10:17 -0400 Subject: [PATCH 10/10] ci: fixes endpoint sanitation Signed-off-by: Vincent Biret --- .../generation-templates/capture-metadata.yml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/.azure-pipelines/generation-templates/capture-metadata.yml b/.azure-pipelines/generation-templates/capture-metadata.yml index 448269305..6becdb047 100644 --- a/.azure-pipelines/generation-templates/capture-metadata.yml +++ b/.azure-pipelines/generation-templates/capture-metadata.yml @@ -31,9 +31,6 @@ parameters: - name: metadataAnnotationsCopyScriptPath type: string default: '/../scripts/copy-annotations-to-csdl.ps1' -- name: sanitizedEndpoint - type: string - default: $[replace(parameters['endpoint'], '/', ''))] steps: @@ -99,9 +96,11 @@ steps: endpointVersion: ${{ parameters.endpoint }} displayName: 'run Typewriter to clean ${{ parameters.endpoint }} metadata' -- pwsh: '. $(metadataTypeSpecAnnotationsSource)/$Env:ScriptPath -targetCsdlPath "$(Build.SourcesDirectory)/msgraph-metadata/clean_${{ parameters.sanitizedEndpoint }}_metadata/cleanMetadataWithDescriptions${{ parameters.endpoint }}.xml" -sourceCsdlDirectoryPath "$(metadataTypeSpecAnnotationsSource)/${{ parameters.metadataTypeSpecAnnotationsOutputDir }}"' +- pwsh: '. $(metadataTypeSpecAnnotationsSource)/$Env:ScriptPath -targetCsdlPath "$(Build.SourcesDirectory)/msgraph-metadata/clean_$($Env:Endpoint.Replace(''.'', ''''))_metadata/cleanMetadataWithDescriptions${{ parameters.endpoint }}.xml" -sourceCsdlDirectoryPath "$(metadataTypeSpecAnnotationsSource)/${{ parameters.metadataTypeSpecAnnotationsOutputDir }}"' env: ScriptPath: ${{ parameters.metadataAnnotationsCopyScriptPath }} + Endpoint: ${{ parameters.endpoint }} + displayName: 'copy TypeSpec annotations to cleaned metadata' ## Only run if the previous step was successful - pwsh: '$(scriptsDirectory)/run-typewriter-clean-metadata.ps1' @@ -118,9 +117,11 @@ steps: OutputMetadataFileName: 'cleanMetadataWithDescriptionsAndAnnotations' displayName: 'run Typewriter to clean ${{ parameters.endpoint }} metadata and keep capability annotations' -- pwsh: '. $(metadataTypeSpecAnnotationsSource)/$Env:ScriptPath -targetCsdlPath "$(Build.SourcesDirectory)/msgraph-metadata/clean_$(sanitizedEndpoint)_metadata/cleanMetadataWithDescriptionsAndAnnotations${{ parameters.endpoint }}.xml" -sourceCsdlDirectoryPath "$(metadataTypeSpecAnnotationsSource)/${{ parameters.metadataTypeSpecAnnotationsOutputDir }}"' +- pwsh: '. $(metadataTypeSpecAnnotationsSource)/$Env:ScriptPath -targetCsdlPath "$(Build.SourcesDirectory)/msgraph-metadata/clean_$($Env:Endpoint.Replace(''.'', ''''))_metadata/cleanMetadataWithDescriptionsAndAnnotations${{ parameters.endpoint }}.xml" -sourceCsdlDirectoryPath "$(metadataTypeSpecAnnotationsSource)/${{ parameters.metadataTypeSpecAnnotationsOutputDir }}"' env: ScriptPath: ${{ parameters.metadataAnnotationsCopyScriptPath }} + Endpoint: ${{ parameters.endpoint }} + displayName: 'copy TypeSpec annotations to cleaned metadata' ## Only run if the previous step was successful - pwsh: '$(scriptsDirectory)/run-typewriter-clean-metadata.ps1' @@ -138,9 +139,11 @@ steps: OutputMetadataFileName: 'cleanMetadataWithDescriptionsAndAnnotationsAndErrors' displayName: 'run Typewriter to clean ${{ parameters.endpoint }} metadata and keep capability annotations and include error information' -- pwsh: '. $(metadataTypeSpecAnnotationsSource)/$Env:ScriptPath -targetCsdlPath "$(Build.SourcesDirectory)/msgraph-metadata/clean_$(sanitizedEndpoint)_metadata/cleanMetadataWithDescriptionsAndAnnotationsAndErrors${{ parameters.endpoint }}.xml" -sourceCsdlDirectoryPath "$(metadataTypeSpecAnnotationsSource)/${{ parameters.metadataTypeSpecAnnotationsOutputDir }}"' +- pwsh: '. $(metadataTypeSpecAnnotationsSource)/$Env:ScriptPath -targetCsdlPath "$(Build.SourcesDirectory)/msgraph-metadata/clean_$($Env:Endpoint.Replace(''.'', ''''))_metadata/cleanMetadataWithDescriptionsAndAnnotationsAndErrors${{ parameters.endpoint }}.xml" -sourceCsdlDirectoryPath "$(metadataTypeSpecAnnotationsSource)/${{ parameters.metadataTypeSpecAnnotationsOutputDir }}"' env: ScriptPath: ${{ parameters.metadataAnnotationsCopyScriptPath }} + Endpoint: ${{ parameters.endpoint }} + displayName: 'copy TypeSpec annotations to cleaned metadata' # publish metadata as an artifact