azure-pipelines-tasks: [REGRESSION]: AzureFileCopyV6 uses wrong path for azcopy.exe
New issue checklist
- I searched for existing GitHub issues
- I read pipeline troubleshooting guide
- I checked how to collect logs
Task name
AzureFileCopy
Breaking task version
6
Last working task version
5
Regression Description
Builds consuming AzureFileCopy@6
fail with:
FAILING OUTPUT
& azcopy copy "C:\__w\1\s\_out\*"
The term ‘azcopy’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
PASSING OUTPUT
& "AzCopy\AzCopy.exe" copy "C:\__w\1\s\_out\*"
Notice the different path to AzCopy.exe
.
I have pinpointed where in the task this change was made. This diff is the reason AzCopy is not found. The utility code is now ignoring the $azCopyExeLocation
variable.
diff --git a/Utility.ps1 b/Utility.ps1
index 94beb25e9f..0d8272dd3d 100644
--- a/Utility.ps1
+++ b/Utility.ps1
@@ -242,23 +231,22 @@ function Upload-FilesToAzureContainer
if ($useSanitizerActivate) {
# Splitting arguments on space, but not on space inside quotes
$sanitizedArguments = [regex]::Split($additionalArguments, ' (?=(?:[^"]|"[^"]*")*$)')
Write-Output "##[command] & azcopy copy `"$sourcePath`" `"$containerURL`" $sanitizedArguments"
- & azcopy copy $sourcePath $containerURL$containerSasToken $sanitizedArguments
+ & azcopy copy $sourcePath $containerURL $sanitizedArguments
} else {
- Write-Output "##[command] & `"$azCopyExeLocation`" copy `"$sourcePath`" `"$containerURL`" $additionalArguments"
- $uploadToBlobCommand = "& `"$azCopyExeLocation`" copy `"$sourcePath`" `"$containerURL`" $additionalArguments"
- Invoke-Expression $uploadToBlobCommand
+ Write-Output "##[command] & azcopy copy `"$sourcePath`" `"$containerURL`" $additionalArguments"
+ $azCopyCommand = "azcopy copy `"$sourcePath`" `"$containerURL`" $additionalArguments"
+ Invoke-Expression -Command $azCopyCommand
}
Regressed in #19650
This change was made in every instance where azcopy
is invoked. /cc @v-mohithgc
Environment type (Please select at least one enviroment where you face this issue)
- Self-Hosted
- Microsoft Hosted
- VMSS Pool
- Container
Azure DevOps Server type
dev.azure.com (formerly visualstudio.com)
Azure DevOps Server Version (if applicable)
No response
Operation system
Windows
Relevant log output
Log output included above.
Full task logs with system.debug enabled
Log output included above.
Repro steps
No response
About this issue
- Original URL
- State: open
- Created 3 months ago
- Comments: 19 (9 by maintainers)
We are also still receiving this error on a self-hosted Windows 2019 Server based image. Any ideas on how to resolve? We are using a WIF for our Azure DevOps Service connection for this task. This was part of why we upgraded to version 6.
PowerShell Version: 5.1.14393.5582 AzFileCopy Version: 6.238.9
Yes, judging by the contents of the task’s
make.json
:… and the contents of that archive …
the path to azcopy.exe must contain
AzCopy/
, otherwise the task is actually taking a dependency on the azcopy.exe available in the environment. This means that the task, instead of using AzCopy 10.12 which it ships with, will use whatever AzCopy is on the machine already. That can result in significant regressions if the agent contains an olderAzCopy
.Hi @DevTestUser123, the changes have been merged today and it will take 5-7 working days to be deployed on all the regions. The new version of the task (ie 6.238.0) will contain the fix.