From bee5a5060c2eaacfbb65c90207c6e354663f591c Mon Sep 17 00:00:00 2001 From: Jason Hartman Date: Thu, 17 Sep 2026 21:56:50 +0000 Subject: [PATCH 1/2] ci: refactor client build to have test stage follow build Simply separate test jobs under new verification stage. Future: consider a limited build job building only the parts needed to build packages. For example linting is not required during build and can be moved to verification stage. --- .../templates/build-npm-client-package.yml | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/tools/pipelines/templates/build-npm-client-package.yml b/tools/pipelines/templates/build-npm-client-package.yml index 24e3e9b7db59..301ef27b1440 100644 --- a/tools/pipelines/templates/build-npm-client-package.yml +++ b/tools/pipelines/templates/build-npm-client-package.yml @@ -207,9 +207,9 @@ extends: # Install all dependencies, not just the root ones dependencyInstallCommand: pnpm install --frozen-lockfile - # Install / Build / Test Stage + # Build Stage - stage: build - displayName: Build Stage + displayName: Build dependsOn: [] # this stage doesn't depend on preceding stage jobs: # Job - Build @@ -591,9 +591,14 @@ extends: sbomEnabled: false publishLocation: pipeline + # Verification Stage + - stage: verification + displayName: Verification + dependsOn: + - build + jobs: - job: Coverage_tests displayName: "Coverage tests" - dependsOn: build variables: - ${{ if eq(variables['Build.Reason'], 'PullRequest') }}: - name: targetBranchName @@ -608,7 +613,7 @@ extends: - name: ONEES_ENFORCED_CODEQL_ENABLED value: 'false' - name: COMMIT_SHA - value: $[ dependencies.build.outputs['setCommitSHA.COMMIT_SHA'] ] + value: $[ stageDependencies.build.build.outputs['setCommitSHA.COMMIT_SHA'] ] steps: # Setup @@ -766,7 +771,6 @@ extends: - ${{ each test in parameters.taskTest }}: - job: Test_${{ test.jobName }} displayName: "Run Task Test ${{ test.jobName }}" - dependsOn: build variables: - ${{ if eq(variables['Build.Reason'], 'PullRequest') }}: - name: targetBranchName @@ -781,7 +785,7 @@ extends: - name: ONEES_ENFORCED_CODEQL_ENABLED value: 'false' - name: COMMIT_SHA - value: $[ dependencies.build.outputs['setCommitSHA.COMMIT_SHA'] ] + value: $[ stageDependencies.build.build.outputs['setCommitSHA.COMMIT_SHA'] ] steps: # Setup - checkout: self @@ -911,7 +915,8 @@ extends: - template: /tools/pipelines/templates/upload-telemetry/include-stage-upload-telemetry.yml@self parameters: dependsOn: - - build + # This also depends on build stage transitively. + - verification telemetryDescription: 'stage_timing' telemetry_upload_steps: - template: /tools/pipelines/templates/upload-telemetry/include-steps-upload-stage-timing.yml@self From b7d9d3f5f7a636b5626f7d137180fe418f38da5a Mon Sep 17 00:00:00 2001 From: Jason Hartman Date: Wed, 23 Sep 2026 20:10:10 +0000 Subject: [PATCH 2/2] ci: patch telemetry upload hole --- .../pipelines/templates/build-npm-client-package.yml | 5 ++++- .../include-stage-upload-telemetry.yml | 12 +++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/tools/pipelines/templates/build-npm-client-package.yml b/tools/pipelines/templates/build-npm-client-package.yml index 301ef27b1440..9ea2f02779d7 100644 --- a/tools/pipelines/templates/build-npm-client-package.yml +++ b/tools/pipelines/templates/build-npm-client-package.yml @@ -917,6 +917,9 @@ extends: dependsOn: # This also depends on build stage transitively. - verification + # Run when verification skipped to be sure to pick up build stage telemetry + # (including when build failure causes verification to be skipped). + runOnSkippedDependencies: true telemetryDescription: 'stage_timing' telemetry_upload_steps: - template: /tools/pipelines/templates/upload-telemetry/include-steps-upload-stage-timing.yml@self @@ -926,7 +929,7 @@ extends: pipelineIdentifierForTelemetry: BuildClient # Upload bundle size telemetry in a separate stage that only depends on the build stage, - # so it isn't blocked by publish stage failures. Only runs on the internal project where + # so it isn't blocked by verification stage failures. Only runs on the internal project where # ff_pipeline_host is available. - ${{ if and(eq(parameters.telemetry, true), eq(parameters.taskBundleAnalysis, true), ne(variables['Build.Reason'], 'PullRequest'), eq(variables['System.TeamProject'], 'internal')) }}: - template: /tools/pipelines/templates/upload-telemetry/include-stage-upload-telemetry.yml@self diff --git a/tools/pipelines/templates/upload-telemetry/include-stage-upload-telemetry.yml b/tools/pipelines/templates/upload-telemetry/include-stage-upload-telemetry.yml index 3d85a3709adf..299152ec3544 100644 --- a/tools/pipelines/templates/upload-telemetry/include-stage-upload-telemetry.yml +++ b/tools/pipelines/templates/upload-telemetry/include-stage-upload-telemetry.yml @@ -19,6 +19,13 @@ parameters: type: object default: [] +# Whether to upload telemetry when a dependency is skipped. Canceled pipelines remain excluded. +# Use this when multiple stages are involved (especially if one might not run if prior fails) +# and telemetry is still desired for failures (which is commonly the case). +- name: runOnSkippedDependencies + type: boolean + default: false + # The steps to take after configuring for telemetry upload - name: telemetry_upload_steps type: stepList @@ -28,7 +35,10 @@ stages: displayName: Upload telemetry to Kusto ('${{ parameters.telemetryDescription }}') # Run for all possible pipeline triggers except manual # (manual runs tend to be for testing and can fail repeatedly, we don't want that creating incidents) - condition: and(succeededOrFailed(), ne(variables['Build.Reason'], 'Manual')) + ${{ if parameters.runOnSkippedDependencies }}: + condition: and(not(canceled()), ne(variables['Build.Reason'], 'Manual')) + ${{ else }}: + condition: and(succeededOrFailed(), ne(variables['Build.Reason'], 'Manual')) dependsOn: - ${{ each stage in parameters.dependsOn }}: - ${{ stage }}