From 0c401d54b665c9a267840cab0503a8f7f63e9a0d Mon Sep 17 00:00:00 2001 From: Ray Chen Date: Fri, 19 Jun 2026 12:10:59 -0700 Subject: [PATCH] Support no-op for PR pipeline Add a SkipPrValidation parameter to the .NET pull request pipeline and archetype SDK client template. For manual runs with the flag enabled, emit a no-op stage and skip build/release validation stages. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- eng/pipelines/pullrequest.yml | 4 +++ .../templates/stages/archetype-sdk-client.yml | 25 +++++++++++++++++-- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/eng/pipelines/pullrequest.yml b/eng/pipelines/pullrequest.yml index 5003e08ec520..93c7bab45e50 100644 --- a/eng/pipelines/pullrequest.yml +++ b/eng/pipelines/pullrequest.yml @@ -14,6 +14,9 @@ parameters: - name: Service type: string default: auto + - name: SkipPrValidation + type: boolean + default: false # Switch to canary to test canary 1es branch. 1es template validation will set this parameter # to canary on run. - name: oneESTemplateTag @@ -27,6 +30,7 @@ extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: oneESTemplateTag: ${{ parameters.oneESTemplateTag }} + SkipPrValidation: ${{ parameters.SkipPrValidation }} # Short term hack to get 1es canary validation working until we can fix manual runs with 'auto' ${{ if and(eq(parameters.oneESTemplateTag, 'canary'), eq(parameters.Service, 'auto')) }}: ServiceDirectory: template diff --git a/eng/pipelines/templates/stages/archetype-sdk-client.yml b/eng/pipelines/templates/stages/archetype-sdk-client.yml index 1484a3ce5bcd..a726ec9af55d 100644 --- a/eng/pipelines/templates/stages/archetype-sdk-client.yml +++ b/eng/pipelines/templates/stages/archetype-sdk-client.yml @@ -14,6 +14,9 @@ parameters: - name: ServiceDirectory type: string default: not-specified + - name: SkipPrValidation + type: boolean + default: false - name: BuildSnippets type: boolean default: true @@ -63,7 +66,26 @@ extends: parameters: oneESTemplateTag: ${{ parameters.oneESTemplateTag }} stages: + - ${{ if and(eq(parameters.SkipPrValidation, true), eq(variables['Build.Reason'], 'Manual')) }}: + - stage: NoOp + displayName: No-op + variables: + - template: /eng/pipelines/templates/variables/globals.yml + - template: /eng/pipelines/templates/variables/image.yml + jobs: + - job: NoOp + displayName: No-op + pool: + name: $(LINUXPOOL) + image: $(LINUXVMIMAGE) + os: linux + steps: + - checkout: none + - pwsh: Write-Host "PR validation skipped because SkipPrValidation was set to true for a manual run." + displayName: Skip PR validation + - stage: Build + condition: not(and(eq(${{ parameters.SkipPrValidation }}, true), eq(variables['Build.Reason'], 'Manual'))) variables: - template: /eng/pipelines/templates/variables/globals.yml - template: /eng/pipelines/templates/variables/image.yml @@ -94,7 +116,7 @@ extends: TestDependsOnDependency: ${{ parameters.TestDependsOnDependency }} # The Prerelease and Release stages are conditioned on whether we are building a pull request and the branch. - - ${{if and(ne(variables['Build.Reason'], 'PullRequest'), eq(variables['System.TeamProject'], 'internal'))}}: + - ${{if and(not(and(eq(parameters.SkipPrValidation, true), eq(variables['Build.Reason'], 'Manual'))), ne(variables['Build.Reason'], 'PullRequest'), eq(variables['System.TeamProject'], 'internal'))}}: - template: archetype-net-release.yml parameters: @@ -111,4 +133,3 @@ extends: ArtifactName: packages PublicFeed: ${{ parameters.PublicFeed }} PublicPublishEnvironment: ${{ parameters.PublicPublishEnvironment }} -