diff --git a/Steps/BinaryCopyAndPublish.yml b/Steps/BinaryCopyAndPublish.yml index 516567f9..4b1952f0 100644 --- a/Steps/BinaryCopyAndPublish.yml +++ b/Steps/BinaryCopyAndPublish.yml @@ -15,6 +15,10 @@ parameters: displayName: Artifacts Identifier type: string default: 'Artifacts' +- name: publish_artifacts + displayName: Publish Artifacts + type: boolean + default: true steps: - bash: | @@ -37,10 +41,11 @@ steps: condition: and(succeededOrFailed(), eq(variables.artifacts_present, 'true')) # Publish build artifacts to Azure Artifacts/TFS or a file share -- task: PublishBuildArtifacts@1 - continueOnError: true - displayName: Publish Build Binaries - inputs: - pathtoPublish: "$(Build.ArtifactStagingDirectory)/Binaries" - artifactName: "Binaries ${{ parameters.artifacts_identifier }}" - condition: and(succeededOrFailed(), eq(variables.artifacts_present, 'true')) +- ${{ if eq(parameters.publish_artifacts, true) }}: + - task: PublishPipelineArtifact@1 + continueOnError: true + displayName: Publish Build Binaries + inputs: + targetPath: "$(Build.ArtifactStagingDirectory)/Binaries" + artifactName: "Binaries ${{ parameters.artifacts_identifier }}" + condition: and(succeededOrFailed(), eq(variables.artifacts_present, 'true')) diff --git a/Steps/BuildPlatform.yml b/Steps/BuildPlatform.yml index 2414964a..979c1e39 100644 --- a/Steps/BuildPlatform.yml +++ b/Steps/BuildPlatform.yml @@ -66,6 +66,10 @@ parameters: displayName: Perform self checkout step type: boolean default: true +- name: publish_artifacts + displayName: Publish Artifacts + type: boolean + default: true steps: - ${{ if eq(parameters.checkout_self, true) }}: @@ -139,15 +143,18 @@ steps: - template: CommonLogCopyAndPublish.yml parameters: artifacts_identifier: ${{ parameters.artifacts_identifier }} + publish_artifacts: ${{ parameters.publish_artifacts }} # Copy build binaries to the artifact staging directory - template: BinaryCopyAndPublish.yml parameters: artifacts_binary: ${{ parameters.artifacts_binary }} artifacts_identifier: ${{ parameters.artifacts_identifier }} + publish_artifacts: ${{ parameters.publish_artifacts }} # Copy other files to the artifact staging directory - template: OtherCopyAndPublish.yml parameters: artifacts_other: ${{ parameters.artifacts_other }} artifacts_identifier: ${{ parameters.artifacts_identifier }} + publish_artifacts: ${{ parameters.publish_artifacts }} diff --git a/Steps/CommonLogCopyAndPublish.yml b/Steps/CommonLogCopyAndPublish.yml index b92bb077..13feb429 100644 --- a/Steps/CommonLogCopyAndPublish.yml +++ b/Steps/CommonLogCopyAndPublish.yml @@ -11,6 +11,10 @@ parameters: displayName: Artifacts Identifier type: string default: 'Artifacts' +- name: publish_artifacts + displayName: Publish Artifacts + type: boolean + default: true steps: - task: CopyFiles@2 @@ -38,10 +42,11 @@ steps: flattenFolders: true condition: succeededOrFailed() -- task: PublishBuildArtifacts@1 - continueOnError: true - displayName: Publish Build Logs - inputs: - pathtoPublish: '$(Build.ArtifactStagingDirectory)/Logs' - artifactName: 'Logs ${{ parameters.artifacts_identifier }}' - condition: succeededOrFailed() +- ${{ if eq(parameters.publish_artifacts, true) }}: + - task: PublishPipelineArtifact@1 + continueOnError: true + displayName: Publish Build Logs + inputs: + targetPath: '$(Build.ArtifactStagingDirectory)/Logs' + artifactName: 'Logs ${{ parameters.artifacts_identifier }}' + condition: succeededOrFailed() diff --git a/Steps/OtherCopyAndPublish.yml b/Steps/OtherCopyAndPublish.yml index 8493389f..bb5e9669 100644 --- a/Steps/OtherCopyAndPublish.yml +++ b/Steps/OtherCopyAndPublish.yml @@ -15,6 +15,10 @@ parameters: displayName: Other Artifacts to Publish type: string default: '' +- name: publish_artifacts + displayName: Publish Artifacts + type: boolean + default: true steps: - bash: | @@ -37,10 +41,11 @@ steps: condition: and(succeededOrFailed(), eq(variables.artifacts_present, 'true')) # Publish build artifacts to Azure Artifacts/TFS or a file share -- task: PublishBuildArtifacts@1 - continueOnError: true - displayName: Publish Other Files - inputs: - pathtoPublish: "$(Build.ArtifactStagingDirectory)/Other" - artifactName: "Other ${{ parameters.artifacts_identifier }}" - condition: and(succeededOrFailed(), eq(variables.artifacts_present, 'true')) +- ${{ if eq(parameters.publish_artifacts, true) }}: + - task: PublishPipelineArtifact@1 + continueOnError: true + displayName: Publish Other Files + inputs: + targetPath: "$(Build.ArtifactStagingDirectory)/Other" + artifactName: "Other ${{ parameters.artifacts_identifier }}" + condition: and(succeededOrFailed(), eq(variables.artifacts_present, 'true')) diff --git a/Steps/PrGate.yml b/Steps/PrGate.yml index 7c66b17c..f4575117 100644 --- a/Steps/PrGate.yml +++ b/Steps/PrGate.yml @@ -88,6 +88,10 @@ parameters: displayName: Indicate if this is a selfhost agent type: boolean default: false +- name: publish_artifacts + displayName: Publish Artifacts + type: boolean + default: true steps: - ${{ if eq(parameters.checkout_self, true) }}: @@ -206,15 +210,18 @@ steps: - template: CommonLogCopyAndPublish.yml parameters: artifacts_identifier: ${{ parameters.artifacts_identifier }} + publish_artifacts: ${{ parameters.publish_artifacts }} # Copy build binaries to the artifact staging directory - template: BinaryCopyAndPublish.yml parameters: artifacts_binary: ${{ parameters.artifacts_binary }} artifacts_identifier: ${{ parameters.artifacts_identifier }} + publish_artifacts: ${{ parameters.publish_artifacts }} # Copy other files to the artifact staging directory - template: OtherCopyAndPublish.yml parameters: artifacts_other: ${{ parameters.artifacts_other }} artifacts_identifier: ${{ parameters.artifacts_identifier }} + publish_artifacts: ${{ parameters.publish_artifacts }}