From 9d07ca362136e2cc3a9d05f41de0d6bd197d989d Mon Sep 17 00:00:00 2001 From: Yi Zhang Date: Thu, 12 Oct 2023 15:48:04 +0800 Subject: [PATCH] Move compliance check before publishing pipeline artifact (#17857) ### Description ### Motivation and Context Compliance check would fail randomly but the stage couldn't be rerun if the pipeline artifacts are already published. There's the error like `Artifact xxxx already exists`. We had to restart the whole pipeline if there's a random error in compliance check. --- .../nuget/templates/dml-vs-2022.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tools/ci_build/github/azure-pipelines/nuget/templates/dml-vs-2022.yml b/tools/ci_build/github/azure-pipelines/nuget/templates/dml-vs-2022.yml index b1e36e63e8..81e8d67b79 100644 --- a/tools/ci_build/github/azure-pipelines/nuget/templates/dml-vs-2022.yml +++ b/tools/ci_build/github/azure-pipelines/nuget/templates/dml-vs-2022.yml @@ -231,6 +231,15 @@ stages: searchPattern: '**/*.pdb' symbolServerType: teamServices + - ${{ if eq(parameters['DoCompliance'], 'true') }}: + - template: ../../templates/compliance.yml + parameters : + msbuildPlatform: ${{ parameters.sln_platform }} + + - template: ../../templates/component-governance-component-detection-steps.yml + parameters : + condition : 'succeeded' + # Node.js Publish - ${{ if eq(parameters['DoNodejsPack'], 'true') }}: - task: BatchScript@1 @@ -285,15 +294,6 @@ stages: targetPath: '$(Build.SourcesDirectory)\js\node\bin\napi-v3\win32\${{ parameters.sln_platform }}' artifactName: 'drop-onnxruntime-nodejs-win-${{ parameters.sln_platform }}-dml' - - ${{ if eq(parameters['DoCompliance'], 'true') }}: - - template: ../../templates/compliance.yml - parameters : - msbuildPlatform: ${{ parameters.sln_platform }} - - - template: ../../templates/component-governance-component-detection-steps.yml - parameters : - condition : 'succeeded' - - task: mspremier.PostBuildCleanup.PostBuildCleanup-task.PostBuildCleanup@3 displayName: 'Clean Agent Directories' condition: always()