From 6f6ee2a31d684cd4239a80e4abbe69a32ad8da7e Mon Sep 17 00:00:00 2001 From: Sarangan Rajamanickam Date: Fri, 13 Dec 2024 18:10:09 +0000 Subject: [PATCH] `typespec` repository - Upload Manifest file to the new storage account (#5336) In the `cadl-ranch` repository, during the publish process, the CI publishes the manifest file to the `azuresdkcadlranch` storage account. You can find the code [here](https://github.com/Azure/cadl-ranch/blob/main/.azure-pipelines/publish.yml#L35) With the new Spec Dashboard, the `typespec` repository CI has to publish the manifest file to the `typespec` storage account. I have tested this code in CI in my branch. You can find the link [here](https://dev.azure.com/azure-sdk/internal/_build/results?buildId=4401569&view=logs&j=feeac6a1-95f5-5e4f-b973-2aeaa4cef844). Please review and approve the PR. Thanks --- eng/tsp-core/pipelines/publish.yml | 30 +++++++++++++++++++++++++++++ packages/spec-dashboard/src/apis.ts | 3 +++ 2 files changed, 33 insertions(+) diff --git a/eng/tsp-core/pipelines/publish.yml b/eng/tsp-core/pipelines/publish.yml index e70f764fb0..e31d1acca0 100644 --- a/eng/tsp-core/pipelines/publish.yml +++ b/eng/tsp-core/pipelines/publish.yml @@ -176,3 +176,33 @@ extends: displayName: "Build" - script: docker push $(imageName) --all-tags displayName: "Push" + + - stage: publish_manifest + displayName: Manifest + dependsOn: build + jobs: + - job: publish_manifest + displayName: Publish Manifest + pool: + name: $(WINDOWSPOOL) + image: $(WINDOWSVMIMAGE) + os: windows + variables: + TYPESPEC_SKIP_DOCUSAURUS_BUILD: true # Disable docusaurus build + steps: + - template: /eng/tsp-core/pipelines/templates/install.yml + - template: /eng/tsp-core/pipelines/templates/build.yml + + - script: pnpm run validate-scenarios --debug + displayName: Validate Scenarios + + - script: pnpm run validate-mock-apis --debug + displayName: Validate mock apis + + - task: AzureCLI@2 + displayName: Upload scenario manifest + inputs: + azureSubscription: "TypeSpec Storage" + scriptType: "bash" + scriptLocation: "inlineScript" + inlineScript: "pnpm upload-manifest" diff --git a/packages/spec-dashboard/src/apis.ts b/packages/spec-dashboard/src/apis.ts index 82ea1166ad..3e6090d3d7 100644 --- a/packages/spec-dashboard/src/apis.ts +++ b/packages/spec-dashboard/src/apis.ts @@ -70,6 +70,9 @@ export async function getCoverageSummaries(): Promise { (manifest: ScenarioManifest) => manifest.setName !== "@azure-tools/azure-http-specs", )[0]; for (const key in generatorReports["standard"]) { + if (!(generatorReports["standard"] as any)[key]) { + continue; + } (generatorReports["standard"] as any)[key] = { ...(generatorReports["standard"] as any)[key][0], generatorMetadata: (generatorReports["standard"] as any)[key]["generatorMetadata"],