Verify environment variable for OneBranch before we try to copy (#21441)

This commit is contained in:
Aditya Patwardhan
2024-04-05 12:55:14 -07:00
committed by GitHub
parent 1a52a93345
commit b7c2f2d2a9
+10 -3
View File
@@ -48,13 +48,20 @@ function New-BuildInfoJson {
Write-Verbose -Message "$vstsCommandString" -Verbose
Write-Host -Object "##$vstsCommandString"
# Upload for ADO pipelines
Write-Host "##vso[artifact.upload containerfolder=BuildInfoJson;artifactname=BuildInfoJson]$resolvedPath"
# Copy to location where OneBranch Pipelines uploads from
# if the environment variable does not exist, we are not in OneBranch. So just return.
if (-not $env:ob_outputDirectory) {
return
}
if (-not (Test-Path $env:ob_outputDirectory)) {
$null = New-Item -Path $env:ob_outputDirectory -ItemType Directory -Force -Verbose
}
# Upload for ADO pipelines
Write-Host "##vso[artifact.upload containerfolder=BuildInfoJson;artifactname=BuildInfoJson]$resolvedPath"
# Copy to location where OneBranch Pipelines uploads from
Copy-Item $resolvedPath -Destination $env:ob_outputDirectory -Force -Verbose
}