From d7a85b0d73fdc7c3b16486090c3af99982676742 Mon Sep 17 00:00:00 2001 From: Travis Plunk Date: Wed, 15 Aug 2018 15:20:09 -0700 Subject: [PATCH 1/2] Make sure we do not upload artifacts during a pull request --- build.psm1 | 7 ++++++- test/tools/Modules/HelpersCommon/HelpersCommon.psm1 | 7 +++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/build.psm1 b/build.psm1 index 33230e60f26..f6082fc7241 100644 --- a/build.psm1 +++ b/build.psm1 @@ -1331,7 +1331,12 @@ function Publish-TestResults { $resolvedPath = (Resolve-Path -Path $Path).ProviderPath Write-Host "##vso[results.publish type=$Type;mergeResults=true;runTitle=$Title;publishRunAttachments=true;resultFiles=$resolvedPath;]" - Write-Host "##vso[artifact.upload containerfolder=testResults;artifactname=testResults]$resolvedPath" + Build.Reason'], 'PullRequest + + if($env:BUILD_REASON -ne 'PullRequest') + { + Write-Host "##vso[artifact.upload containerfolder=testResults;artifactname=testResults]$resolvedPath" + } } } diff --git a/test/tools/Modules/HelpersCommon/HelpersCommon.psm1 b/test/tools/Modules/HelpersCommon/HelpersCommon.psm1 index 79fde738f26..828fc215583 100644 --- a/test/tools/Modules/HelpersCommon/HelpersCommon.psm1 +++ b/test/tools/Modules/HelpersCommon/HelpersCommon.psm1 @@ -233,8 +233,11 @@ function Send-VstsLogFile { Copy-Item -Path $Path -Destination $logFile } - Write-Host "##vso[artifact.upload containerfolder=$name;artifactname=$name]$logFile" - Write-Verbose "Log file captured as $name" -Verbose + if($env:BUILD_REASON -ne 'PullRequest') + { + Write-Host "##vso[artifact.upload containerfolder=$name;artifactname=$name]$logFile" + Write-Verbose "Log file captured as $name" -Verbose + } } # Tests if the Linux or macOS user is root From 1dd0d0d139fadec836d20c28867e84bf995214f7 Mon Sep 17 00:00:00 2001 From: Travis Plunk Date: Thu, 16 Aug 2018 12:13:42 -0700 Subject: [PATCH 2/2] remove extra code --- build.psm1 | 1 - 1 file changed, 1 deletion(-) diff --git a/build.psm1 b/build.psm1 index f6082fc7241..e88319a54b1 100644 --- a/build.psm1 +++ b/build.psm1 @@ -1331,7 +1331,6 @@ function Publish-TestResults { $resolvedPath = (Resolve-Path -Path $Path).ProviderPath Write-Host "##vso[results.publish type=$Type;mergeResults=true;runTitle=$Title;publishRunAttachments=true;resultFiles=$resolvedPath;]" - Build.Reason'], 'PullRequest if($env:BUILD_REASON -ne 'PullRequest') {