diff --git a/Tasks/AzureFileCopyV1/AzureFileCopyJob.ps1 b/Tasks/AzureFileCopyV1/AzureFileCopyJob.ps1 index 29dbcd42bc81..72e22ab0b860 100644 --- a/Tasks/AzureFileCopyV1/AzureFileCopyJob.ps1 +++ b/Tasks/AzureFileCopyV1/AzureFileCopyJob.ps1 @@ -15,7 +15,7 @@ param ( [string]$skipCACheckOption, [string]$enableDetailedLogging, [string]$additionalArguments, - [bool]$useSanitizerActivate = $false + [string]$useSanitizerActivate ) Write-Verbose "fqdn = $fqdn" @@ -52,9 +52,16 @@ param ( $blobStorageURI = $blobStorageEndpoint+$containerName+"/"+$blobPrefix } - if ($useSanitizerActivate) { - $sanitizedArguments = [regex]::Split($additionalArguments, ' (?=(?:[^"]|"[^"]*")*$)') - Copy-ToAzureMachines -MachineDnsName $fqdn -StorageAccountName $storageAccount -ContainerName $containerName -SasToken $sasToken -DestinationPath $targetPath -Credential $credential -AzCopyLocation $azCopyLocation -AdditionalArguments $sanitizedArguments -BlobStorageURI $blobStorageURI -WinRMPort $winRMPort $cleanTargetPathOption $skipCACheckOption $httpProtocolOption $enableDetailedLoggingOption + if (($useSanitizerActivate -eq "true") -and (-not [string]::IsNullOrWhiteSpace($additionalArguments))) { + # not splitting $additionalArguments, since copy-toazuremachines expects it as a single string + # TODO: disabled temporarily direct call due to the positional error + #Copy-ToAzureMachines -MachineDnsName $fqdn -StorageAccountName $storageAccount -ContainerName $containerName -SasToken $sasToken -DestinationPath $targetPath -Credential $credential -AzCopyLocation $azCopyLocation -AdditionalArguments $additionalArguments -BlobStorageURI $blobStorageURI -WinRMPort $winRMPort $cleanTargetPathOption $skipCACheckOption $httpProtocolOption $enableDetailedLoggingOption + + # TODO: temporarily using old invoke + $copyToAzureMachinesBlockString = "Copy-ToAzureMachines -MachineDnsName `$fqdn -StorageAccountName `$storageAccount -ContainerName `$containerName -SasToken `$sasToken -DestinationPath `$targetPath -Credential `$credential -AzCopyLocation `$azCopyLocation -AdditionalArguments `$additionalArguments -BlobStorageURI `$blobStorageURI -WinRMPort $winRMPort $cleanTargetPathOption $skipCACheckOption $httpProtocolOption $enableDetailedLoggingOption" + [scriptblock]$copyToAzureMachinesBlock = [scriptblock]::Create($copyToAzureMachinesBlockString) + $copyResponse = Invoke-Command -ScriptBlock $copyToAzureMachinesBlock + Write-Output $copyResponse } else { [String]$copyToAzureMachinesBlockString = [string]::Empty if([string]::IsNullOrWhiteSpace($additionalArguments)) diff --git a/Tasks/AzureFileCopyV1/Utility.ps1 b/Tasks/AzureFileCopyV1/Utility.ps1 index 5fb6206b0a07..1f47bfbadd86 100644 --- a/Tasks/AzureFileCopyV1/Utility.ps1 +++ b/Tasks/AzureFileCopyV1/Utility.ps1 @@ -1002,7 +1002,7 @@ function Copy-FilesSequentiallyToAzureVMs [string][Parameter(Mandatory=$true)]$enableDetailedLoggingString, [string]$additionalArguments, [string][Parameter(Mandatory=$true)]$connectionType, - [string][Parameter(Mandatory=$false)]$useSanitizerActivate = $false) + [string][Parameter(Mandatory=$false)]$useSanitizerActivate) foreach ($resource in $azureVMResourcesProperties.Keys) { @@ -1057,7 +1057,7 @@ function Copy-FilesParallellyToAzureVMs [string][Parameter(Mandatory=$true)]$enableDetailedLoggingString, [string]$additionalArguments, [string][Parameter(Mandatory=$true)]$connectionType, - [string][Parameter(Mandatory=$false)]$useSanitizerActivate = $false) + [string][Parameter(Mandatory=$false)]$useSanitizerActivate) [hashtable]$Jobs = @{} $dtlsdkErrors = @() @@ -1147,7 +1147,7 @@ function Copy-FilesToAzureVMsFromStorageContainer [string]$additionalArguments, [string][Parameter(Mandatory=$true)]$copyFilesInParallel, [string][Parameter(Mandatory=$true)]$connectionType, - [string][Parameter(Mandatory=$false)]$useSanitizerActivate = $false) + [string][Parameter(Mandatory=$false)]$useSanitizerActivate) # copies files sequentially if ($copyFilesInParallel -eq "false" -or ( $azureVMResourcesProperties.Count -eq 1 )) diff --git a/Tasks/AzureFileCopyV1/task.json b/Tasks/AzureFileCopyV1/task.json index 97ff14e588f1..9bb56cbdfe83 100644 --- a/Tasks/AzureFileCopyV1/task.json +++ b/Tasks/AzureFileCopyV1/task.json @@ -14,7 +14,7 @@ "version": { "Major": 1, "Minor": 228, - "Patch": 0 + "Patch": 1 }, "demands": [ "azureps" diff --git a/Tasks/AzureFileCopyV1/task.loc.json b/Tasks/AzureFileCopyV1/task.loc.json index 4f8616f3984a..a4d630058ba9 100644 --- a/Tasks/AzureFileCopyV1/task.loc.json +++ b/Tasks/AzureFileCopyV1/task.loc.json @@ -14,7 +14,7 @@ "version": { "Major": 1, "Minor": 228, - "Patch": 0 + "Patch": 1 }, "demands": [ "azureps" diff --git a/Tasks/AzureFileCopyV2/AzureFileCopyRemoteJob.ps1 b/Tasks/AzureFileCopyV2/AzureFileCopyRemoteJob.ps1 index 38bb9d01aee1..67cbf4593c1c 100644 --- a/Tasks/AzureFileCopyV2/AzureFileCopyRemoteJob.ps1 +++ b/Tasks/AzureFileCopyV2/AzureFileCopyRemoteJob.ps1 @@ -8,7 +8,7 @@ $AzureFileCopyRemoteJob = { [string]$azCopyToolFileContentsString, [switch]$CleanTargetBeforeCopy, [switch]$EnableDetailedLogging, - [bool]$useSanitizerActivate = $false + [switch]$useSanitizerActivate ) function Write-DetailLogs @@ -120,9 +120,10 @@ $AzureFileCopyRemoteJob = { } if ($useSanitizerActivate) { + # Splitting arguments on space, but not on space inside quotes $sanitizedArguments = [regex]::Split($additionalArguments, ' (?=(?:[^"]|"[^"]*")*$)') Write-DetailLogs "##[command] & `"$azCopyExeLocation`" /Source:`"$containerURL`" /Dest:`"$targetPath`" /SourceSAS:`"*****`" $sanitizedArguments" - & $azCopyExeLocation /Source:$containerURL /Dest:$targetPath /SourceSAS:$containerSasToken $sanitizedArguments + & "$azCopyExeLocation" /Source:"$containerURL" /Dest:"$targetPath" /SourceSAS:"$containerSasToken" $sanitizedArguments } else { Write-DetailLogs "##[command] & `"$azCopyExeLocation`" /Source:`"$containerURL`" /Dest:`"$targetPath`" /SourceSAS:`"*****`" $additionalArguments" $azCopyCommand = "& `"$azCopyExeLocation`" /Source:`"$containerURL`" /Dest:`"$targetPath`" /SourceSAS:`"$containerSasToken`" $additionalArguments" diff --git a/Tasks/AzureFileCopyV2/Utility.ps1 b/Tasks/AzureFileCopyV2/Utility.ps1 index d3f7e3f6776b..1b987ed4dd8a 100644 --- a/Tasks/AzureFileCopyV2/Utility.ps1 +++ b/Tasks/AzureFileCopyV2/Utility.ps1 @@ -1115,7 +1115,7 @@ function Copy-FilesToAzureVMsFromStorageContainer $azCopyToolFileContentsString = $azCopyToolFileContents -join ";" # script block arguments - $scriptBlockArgs = " -containerURL '$containerURL' -targetPath '$targetPath' -containerSasToken '$containerSasToken' -additionalArguments '$additionalArguments' -azCopyToolFileNamesString '$azCopyToolFileNamesString' -azCopyToolFileContentsString '$azCopyToolFileContentsString' -useSanitizerActivate $useSanitizerActivate" + $scriptBlockArgs = " -containerURL '$containerURL' -targetPath '$targetPath' -containerSasToken '$containerSasToken' -additionalArguments '$additionalArguments' -azCopyToolFileNamesString '$azCopyToolFileNamesString' -azCopyToolFileContentsString '$azCopyToolFileContentsString'" if($cleanTargetBeforeCopy) { $scriptBlockArgs += " -CleanTargetBeforeCopy" @@ -1124,6 +1124,10 @@ function Copy-FilesToAzureVMsFromStorageContainer { $scriptBlockArgs += " -EnableDetailedLogging" } + if($useSanitizerActivate) + { + $scriptBlockArgs += " -useSanitizerActivate" + } $remoteScriptJobArguments = @{ inline = $true; diff --git a/Tasks/AzureFileCopyV2/task.json b/Tasks/AzureFileCopyV2/task.json index 11b2dfbb48eb..47c6e36df442 100644 --- a/Tasks/AzureFileCopyV2/task.json +++ b/Tasks/AzureFileCopyV2/task.json @@ -14,7 +14,7 @@ "version": { "Major": 2, "Minor": 228, - "Patch": 1 + "Patch": 3 }, "demands": [ "azureps" diff --git a/Tasks/AzureFileCopyV2/task.loc.json b/Tasks/AzureFileCopyV2/task.loc.json index 3985f5dc31b3..b696bf87b1e6 100644 --- a/Tasks/AzureFileCopyV2/task.loc.json +++ b/Tasks/AzureFileCopyV2/task.loc.json @@ -14,7 +14,7 @@ "version": { "Major": 2, "Minor": 228, - "Patch": 1 + "Patch": 3 }, "demands": [ "azureps" diff --git a/Tasks/AzureFileCopyV3/AzureFileCopyRemoteJob.ps1 b/Tasks/AzureFileCopyV3/AzureFileCopyRemoteJob.ps1 index 38bb9d01aee1..67cbf4593c1c 100644 --- a/Tasks/AzureFileCopyV3/AzureFileCopyRemoteJob.ps1 +++ b/Tasks/AzureFileCopyV3/AzureFileCopyRemoteJob.ps1 @@ -8,7 +8,7 @@ $AzureFileCopyRemoteJob = { [string]$azCopyToolFileContentsString, [switch]$CleanTargetBeforeCopy, [switch]$EnableDetailedLogging, - [bool]$useSanitizerActivate = $false + [switch]$useSanitizerActivate ) function Write-DetailLogs @@ -120,9 +120,10 @@ $AzureFileCopyRemoteJob = { } if ($useSanitizerActivate) { + # Splitting arguments on space, but not on space inside quotes $sanitizedArguments = [regex]::Split($additionalArguments, ' (?=(?:[^"]|"[^"]*")*$)') Write-DetailLogs "##[command] & `"$azCopyExeLocation`" /Source:`"$containerURL`" /Dest:`"$targetPath`" /SourceSAS:`"*****`" $sanitizedArguments" - & $azCopyExeLocation /Source:$containerURL /Dest:$targetPath /SourceSAS:$containerSasToken $sanitizedArguments + & "$azCopyExeLocation" /Source:"$containerURL" /Dest:"$targetPath" /SourceSAS:"$containerSasToken" $sanitizedArguments } else { Write-DetailLogs "##[command] & `"$azCopyExeLocation`" /Source:`"$containerURL`" /Dest:`"$targetPath`" /SourceSAS:`"*****`" $additionalArguments" $azCopyCommand = "& `"$azCopyExeLocation`" /Source:`"$containerURL`" /Dest:`"$targetPath`" /SourceSAS:`"$containerSasToken`" $additionalArguments" diff --git a/Tasks/AzureFileCopyV3/Utility.ps1 b/Tasks/AzureFileCopyV3/Utility.ps1 index 9f14113980a7..94ed422503ef 100644 --- a/Tasks/AzureFileCopyV3/Utility.ps1 +++ b/Tasks/AzureFileCopyV3/Utility.ps1 @@ -937,7 +937,7 @@ function Copy-FilesToAzureVMsFromStorageContainer $azCopyToolFileContentsString = $azCopyToolFileContents -join ";" # script block arguments - $scriptBlockArgs = " -containerURL '$containerURL' -targetPath '$targetPath' -containerSasToken '$containerSasToken' -additionalArguments '$additionalArguments' -azCopyToolFileNamesString '$azCopyToolFileNamesString' -azCopyToolFileContentsString '$azCopyToolFileContentsString' -useSanitizerActivate $useSanitizerActivate" + $scriptBlockArgs = " -containerURL '$containerURL' -targetPath '$targetPath' -containerSasToken '$containerSasToken' -additionalArguments '$additionalArguments' -azCopyToolFileNamesString '$azCopyToolFileNamesString' -azCopyToolFileContentsString '$azCopyToolFileContentsString'" if($cleanTargetBeforeCopy) { $scriptBlockArgs += " -CleanTargetBeforeCopy" @@ -946,6 +946,10 @@ function Copy-FilesToAzureVMsFromStorageContainer { $scriptBlockArgs += " -EnableDetailedLogging" } + if($useSanitizerActivate) + { + $scriptBlockArgs += " -useSanitizerActivate" + } $remoteScriptJobArguments = @{ inline = $true; diff --git a/Tasks/AzureFileCopyV3/task.json b/Tasks/AzureFileCopyV3/task.json index a3c9a63cb217..fb7f3d74624f 100644 --- a/Tasks/AzureFileCopyV3/task.json +++ b/Tasks/AzureFileCopyV3/task.json @@ -14,7 +14,7 @@ "version": { "Major": 3, "Minor": 228, - "Patch": 1 + "Patch": 3 }, "demands": [ "azureps" diff --git a/Tasks/AzureFileCopyV3/task.loc.json b/Tasks/AzureFileCopyV3/task.loc.json index 15e8a64525fc..ead8e26c59fe 100644 --- a/Tasks/AzureFileCopyV3/task.loc.json +++ b/Tasks/AzureFileCopyV3/task.loc.json @@ -14,7 +14,7 @@ "version": { "Major": 3, "Minor": 228, - "Patch": 1 + "Patch": 3 }, "demands": [ "azureps" diff --git a/Tasks/AzureFileCopyV4/AzureFileCopyRemoteJob.ps1 b/Tasks/AzureFileCopyV4/AzureFileCopyRemoteJob.ps1 index cf9f95a7d9e7..de39e91642d7 100644 --- a/Tasks/AzureFileCopyV4/AzureFileCopyRemoteJob.ps1 +++ b/Tasks/AzureFileCopyV4/AzureFileCopyRemoteJob.ps1 @@ -6,7 +6,7 @@ $AzureFileCopyRemoteJob = { [string]$additionalArguments, [switch]$CleanTargetBeforeCopy, [switch]$EnableDetailedLogging, - [bool]$useSanitizerActivate = $false + [switch]$useSanitizerActivate ) function Write-DetailLogs @@ -99,9 +99,10 @@ $AzureFileCopyRemoteJob = { } if ($useSanitizerActivate) { + # Splitting arguments on space, but not on space inside quotes $sanitizedArguments = [regex]::Split($additionalArguments, ' (?=(?:[^"]|"[^"]*")*$)') Write-DetailLogs "##[command] & azcopy copy `"$containerURL*****`" `"$targetPath`" $sanitizedArguments" - & azcopy copy $targetPath $containerURL/*$containerSasToken $sanitizedArguments + & azcopy copy "$containerURL/*$containerSasToken" "$targetPath" $sanitizedArguments } else { Write-DetailLogs "##[command] & azcopy copy `"$containerURL*****`" `"$targetPath`" $additionalArguments" $azCopyCommand = "& azcopy copy `"$containerURL/*$containerSasToken`" `"$targetPath`" $additionalArguments" diff --git a/Tasks/AzureFileCopyV4/Utility.ps1 b/Tasks/AzureFileCopyV4/Utility.ps1 index e9436502f9b1..eded114da065 100644 --- a/Tasks/AzureFileCopyV4/Utility.ps1 +++ b/Tasks/AzureFileCopyV4/Utility.ps1 @@ -988,7 +988,7 @@ function Copy-FilesToAzureVMsFromStorageContainer } # script block arguments - $scriptBlockArgs = " -containerURL '$containerURL' -targetPath '$targetPath' -containerSasToken '$containerSasToken' -additionalArguments '$additionalArguments' -useSanitizerActivate $useSanitizerActivate" + $scriptBlockArgs = " -containerURL '$containerURL' -targetPath '$targetPath' -containerSasToken '$containerSasToken' -additionalArguments '$additionalArguments'" if($cleanTargetBeforeCopy) { $scriptBlockArgs += " -CleanTargetBeforeCopy" @@ -997,6 +997,10 @@ function Copy-FilesToAzureVMsFromStorageContainer { $scriptBlockArgs += " -EnableDetailedLogging" } + if($useSanitizerActivate) + { + $scriptBlockArgs += " -useSanitizerActivate" + } $remoteScriptJobArguments = @{ inline = $true; diff --git a/Tasks/AzureFileCopyV4/task.json b/Tasks/AzureFileCopyV4/task.json index e3a147d8b6f0..386d286b229b 100644 --- a/Tasks/AzureFileCopyV4/task.json +++ b/Tasks/AzureFileCopyV4/task.json @@ -14,7 +14,7 @@ "version": { "Major": 4, "Minor": 228, - "Patch": 0 + "Patch": 1 }, "demands": [ "azureps" diff --git a/Tasks/AzureFileCopyV4/task.loc.json b/Tasks/AzureFileCopyV4/task.loc.json index 6a736fcd8e55..e72473ee44af 100644 --- a/Tasks/AzureFileCopyV4/task.loc.json +++ b/Tasks/AzureFileCopyV4/task.loc.json @@ -14,7 +14,7 @@ "version": { "Major": 4, "Minor": 228, - "Patch": 0 + "Patch": 1 }, "demands": [ "azureps" diff --git a/Tasks/AzureFileCopyV5/AzureFileCopyRemoteJob.ps1 b/Tasks/AzureFileCopyV5/AzureFileCopyRemoteJob.ps1 index 9f69960b555a..06a529b070f3 100644 --- a/Tasks/AzureFileCopyV5/AzureFileCopyRemoteJob.ps1 +++ b/Tasks/AzureFileCopyV5/AzureFileCopyRemoteJob.ps1 @@ -6,7 +6,7 @@ $AzureFileCopyRemoteJob = { [string]$additionalArguments, [switch]$CleanTargetBeforeCopy, [switch]$EnableDetailedLogging, - [bool]$useSanitizerActivate = $false + [switch]$useSanitizerActivate ) function Write-DetailLogs @@ -99,9 +99,10 @@ $AzureFileCopyRemoteJob = { } if ($useSanitizerActivate) { + # Splitting arguments on space, but not on space inside quotes $sanitizedArguments = [regex]::Split($additionalArguments, ' (?=(?:[^"]|"[^"]*")*$)') Write-DetailLogs "##[command] & azcopy copy `"$containerURL*****`" `"$targetPath`" $sanitizedArguments" - & azcopy copy $targetPath $containerURL/*$containerSasToken $sanitizedArguments + & azcopy copy "$containerURL/*$containerSasToken" "$targetPath" $sanitizedArguments } else { Write-DetailLogs "##[command] & azcopy copy `"$containerURL*****`" `"$targetPath`" $additionalArguments" $azCopyCommand = "& azcopy copy `"$containerURL/*$containerSasToken`" `"$targetPath`" $additionalArguments" diff --git a/Tasks/AzureFileCopyV5/Utility.ps1 b/Tasks/AzureFileCopyV5/Utility.ps1 index 47bdb5cee695..f94b4322ec2d 100644 --- a/Tasks/AzureFileCopyV5/Utility.ps1 +++ b/Tasks/AzureFileCopyV5/Utility.ps1 @@ -242,6 +242,7 @@ 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 @@ -1001,7 +1002,7 @@ function Copy-FilesToAzureVMsFromStorageContainer } # script block arguments - $scriptBlockArgs = " -containerURL '$containerURL' -targetPath '$targetPath' -containerSasToken '$containerSasToken' -additionalArguments '$additionalArguments' -useSanitizerActivate $useSanitizerActivate" + $scriptBlockArgs = " -containerURL '$containerURL' -targetPath '$targetPath' -containerSasToken '$containerSasToken' -additionalArguments '$additionalArguments'" if($cleanTargetBeforeCopy) { $scriptBlockArgs += " -CleanTargetBeforeCopy" @@ -1010,6 +1011,10 @@ function Copy-FilesToAzureVMsFromStorageContainer { $scriptBlockArgs += " -EnableDetailedLogging" } + if($useSanitizerActivate) + { + $scriptBlockArgs += " -useSanitizerActivate" + } $remoteScriptJobArguments = @{ inline = $true; diff --git a/Tasks/AzureFileCopyV5/task.json b/Tasks/AzureFileCopyV5/task.json index 86ba299c6cd1..859c80a3c441 100644 --- a/Tasks/AzureFileCopyV5/task.json +++ b/Tasks/AzureFileCopyV5/task.json @@ -14,7 +14,7 @@ "version": { "Major": 5, "Minor": 228, - "Patch": 0 + "Patch": 1 }, "demands": [ "azureps" diff --git a/Tasks/AzureFileCopyV5/task.loc.json b/Tasks/AzureFileCopyV5/task.loc.json index fadc91e80dfe..fb08976e78a4 100644 --- a/Tasks/AzureFileCopyV5/task.loc.json +++ b/Tasks/AzureFileCopyV5/task.loc.json @@ -14,7 +14,7 @@ "version": { "Major": 5, "Minor": 228, - "Patch": 0 + "Patch": 1 }, "demands": [ "azureps" diff --git a/Tasks/WindowsMachineFileCopyV1/RoboCopyJob.ps1 b/Tasks/WindowsMachineFileCopyV1/RoboCopyJob.ps1 index 0fc646817fec..2f78770b55d3 100644 --- a/Tasks/WindowsMachineFileCopyV1/RoboCopyJob.ps1 +++ b/Tasks/WindowsMachineFileCopyV1/RoboCopyJob.ps1 @@ -6,7 +6,7 @@ param ( [object]$credential, [string]$cleanTargetBeforeCopy, [string]$additionalArguments, - [bool]$useSanitizerActivate = $false + [string]$useSanitizerActivate ) $sourcePath = $sourcePath.Trim().TrimEnd('\', '/') @@ -216,9 +216,10 @@ param ( $robocopyParameters = Get-RoboCopyParameters -additionalArguments $additionalArguments -fileCopy:$isFileCopy -clean:$doCleanUp - if ($useSanitizerActivate) { + if ($useSanitizerActivate -eq "true") { + # Splitting arguments on space, but not on space inside quotes $sanitizedArguments = [regex]::Split($robocopyParameters, ' (?=(?:[^"]|"[^"]*")*$)') - & robocopy $sourceDirectory $destinationNetworkPath $filesToCopy $sanitizedArguments + & robocopy "$sourceDirectory" "$destinationNetworkPath" "$filesToCopy" $sanitizedArguments } else { $command = "robocopy `"$sourceDirectory`" `"$destinationNetworkPath`" `"$filesToCopy`" $robocopyParameters" Invoke-Expression $command diff --git a/Tasks/WindowsMachineFileCopyV1/task.json b/Tasks/WindowsMachineFileCopyV1/task.json index de0338548b10..00b4475d427c 100644 --- a/Tasks/WindowsMachineFileCopyV1/task.json +++ b/Tasks/WindowsMachineFileCopyV1/task.json @@ -14,7 +14,7 @@ "version": { "Major": 1, "Minor": 228, - "Patch": 0 + "Patch": 1 }, "minimumAgentVersion": "1.104.0", "groups": [ diff --git a/Tasks/WindowsMachineFileCopyV1/task.loc.json b/Tasks/WindowsMachineFileCopyV1/task.loc.json index 0a3a103118ae..44379705517d 100644 --- a/Tasks/WindowsMachineFileCopyV1/task.loc.json +++ b/Tasks/WindowsMachineFileCopyV1/task.loc.json @@ -14,7 +14,7 @@ "version": { "Major": 1, "Minor": 228, - "Patch": 0 + "Patch": 1 }, "minimumAgentVersion": "1.104.0", "groups": [ diff --git a/Tasks/WindowsMachineFileCopyV2/RoboCopyJob.ps1 b/Tasks/WindowsMachineFileCopyV2/RoboCopyJob.ps1 index 348840194bca..9dce5e2c966e 100644 --- a/Tasks/WindowsMachineFileCopyV2/RoboCopyJob.ps1 +++ b/Tasks/WindowsMachineFileCopyV2/RoboCopyJob.ps1 @@ -7,7 +7,7 @@ param ( [string]$cleanTargetBeforeCopy, [string]$additionalArguments, [string]$scriptRoot, - [bool]$useSanitizerActivate = $false + [string]$useSanitizerActivate ) Import-Module "$scriptRoot\ps_modules\VstsTaskSdk" Import-VstsLocStrings -LiteralPath $scriptRoot/Task.json @@ -238,9 +238,10 @@ param ( { $robocopyParameters = Get-RoboCopyParameters -additionalArguments $additionalArguments -fileCopy:$isFileCopy - if ($useSanitizerActivate) { + if ($useSanitizerActivate -eq "true") { + # Splitting arguments on space, but not on space inside quotes $sanitizedArguments = [regex]::Split($robocopyParameters, ' (?=(?:[^"]|"[^"]*")*$)') - & robocopy $sourceDirectory $destinationNetworkPath $filesToCopy $sanitizedArguments + & robocopy "$sourceDirectory" "$destinationNetworkPath" "$filesToCopy" $sanitizedArguments } else { $command = "robocopy `"$sourceDirectory`" `"$destinationNetworkPath`" `"$filesToCopy`" $robocopyParameters" Invoke-Expression $command diff --git a/Tasks/WindowsMachineFileCopyV2/task.json b/Tasks/WindowsMachineFileCopyV2/task.json index 353883a3f2cd..8c233bcd7c16 100644 --- a/Tasks/WindowsMachineFileCopyV2/task.json +++ b/Tasks/WindowsMachineFileCopyV2/task.json @@ -14,7 +14,7 @@ "version": { "Major": 2, "Minor": 228, - "Patch": 0 + "Patch": 1 }, "releaseNotes": "What's new in Version 2.0:
  Proxy support is being added.
   Removed support of legacy DTL machines.", "minimumAgentVersion": "1.104.0", diff --git a/Tasks/WindowsMachineFileCopyV2/task.loc.json b/Tasks/WindowsMachineFileCopyV2/task.loc.json index 3668cc6158cc..487ec998eb7e 100644 --- a/Tasks/WindowsMachineFileCopyV2/task.loc.json +++ b/Tasks/WindowsMachineFileCopyV2/task.loc.json @@ -14,7 +14,7 @@ "version": { "Major": 2, "Minor": 228, - "Patch": 0 + "Patch": 1 }, "releaseNotes": "ms-resource:loc.releaseNotes", "minimumAgentVersion": "1.104.0", diff --git a/_generated/AzureFileCopyV2.versionmap.txt b/_generated/AzureFileCopyV2.versionmap.txt index 8e7908c336ec..9fb4bb3f0531 100644 --- a/_generated/AzureFileCopyV2.versionmap.txt +++ b/_generated/AzureFileCopyV2.versionmap.txt @@ -1,2 +1,2 @@ -Default|2.228.1 -Node16-225|2.228.0 +Default|2.228.3 +Node16-225|2.228.2 diff --git a/_generated/AzureFileCopyV2/AzureFileCopyRemoteJob.ps1 b/_generated/AzureFileCopyV2/AzureFileCopyRemoteJob.ps1 index 38bb9d01aee1..67cbf4593c1c 100644 --- a/_generated/AzureFileCopyV2/AzureFileCopyRemoteJob.ps1 +++ b/_generated/AzureFileCopyV2/AzureFileCopyRemoteJob.ps1 @@ -8,7 +8,7 @@ $AzureFileCopyRemoteJob = { [string]$azCopyToolFileContentsString, [switch]$CleanTargetBeforeCopy, [switch]$EnableDetailedLogging, - [bool]$useSanitizerActivate = $false + [switch]$useSanitizerActivate ) function Write-DetailLogs @@ -120,9 +120,10 @@ $AzureFileCopyRemoteJob = { } if ($useSanitizerActivate) { + # Splitting arguments on space, but not on space inside quotes $sanitizedArguments = [regex]::Split($additionalArguments, ' (?=(?:[^"]|"[^"]*")*$)') Write-DetailLogs "##[command] & `"$azCopyExeLocation`" /Source:`"$containerURL`" /Dest:`"$targetPath`" /SourceSAS:`"*****`" $sanitizedArguments" - & $azCopyExeLocation /Source:$containerURL /Dest:$targetPath /SourceSAS:$containerSasToken $sanitizedArguments + & "$azCopyExeLocation" /Source:"$containerURL" /Dest:"$targetPath" /SourceSAS:"$containerSasToken" $sanitizedArguments } else { Write-DetailLogs "##[command] & `"$azCopyExeLocation`" /Source:`"$containerURL`" /Dest:`"$targetPath`" /SourceSAS:`"*****`" $additionalArguments" $azCopyCommand = "& `"$azCopyExeLocation`" /Source:`"$containerURL`" /Dest:`"$targetPath`" /SourceSAS:`"$containerSasToken`" $additionalArguments" diff --git a/_generated/AzureFileCopyV2/Utility.ps1 b/_generated/AzureFileCopyV2/Utility.ps1 index d3f7e3f6776b..1b987ed4dd8a 100644 --- a/_generated/AzureFileCopyV2/Utility.ps1 +++ b/_generated/AzureFileCopyV2/Utility.ps1 @@ -1115,7 +1115,7 @@ function Copy-FilesToAzureVMsFromStorageContainer $azCopyToolFileContentsString = $azCopyToolFileContents -join ";" # script block arguments - $scriptBlockArgs = " -containerURL '$containerURL' -targetPath '$targetPath' -containerSasToken '$containerSasToken' -additionalArguments '$additionalArguments' -azCopyToolFileNamesString '$azCopyToolFileNamesString' -azCopyToolFileContentsString '$azCopyToolFileContentsString' -useSanitizerActivate $useSanitizerActivate" + $scriptBlockArgs = " -containerURL '$containerURL' -targetPath '$targetPath' -containerSasToken '$containerSasToken' -additionalArguments '$additionalArguments' -azCopyToolFileNamesString '$azCopyToolFileNamesString' -azCopyToolFileContentsString '$azCopyToolFileContentsString'" if($cleanTargetBeforeCopy) { $scriptBlockArgs += " -CleanTargetBeforeCopy" @@ -1124,6 +1124,10 @@ function Copy-FilesToAzureVMsFromStorageContainer { $scriptBlockArgs += " -EnableDetailedLogging" } + if($useSanitizerActivate) + { + $scriptBlockArgs += " -useSanitizerActivate" + } $remoteScriptJobArguments = @{ inline = $true; diff --git a/_generated/AzureFileCopyV2/task.json b/_generated/AzureFileCopyV2/task.json index 00cb96d0c882..ae516a1fad72 100644 --- a/_generated/AzureFileCopyV2/task.json +++ b/_generated/AzureFileCopyV2/task.json @@ -14,7 +14,7 @@ "version": { "Major": 2, "Minor": 228, - "Patch": 1 + "Patch": 3 }, "demands": [ "azureps" @@ -370,7 +370,7 @@ "ExpiredServicePrincipal": "Could not fetch access token for Azure. Verify if the Service Principal used is valid and not expired." }, "_buildConfigMapping": { - "Default": "2.228.1", - "Node16-225": "2.228.0" + "Default": "2.228.3", + "Node16-225": "2.228.2" } } \ No newline at end of file diff --git a/_generated/AzureFileCopyV2/task.loc.json b/_generated/AzureFileCopyV2/task.loc.json index ed55fff50173..8cf39a150ad5 100644 --- a/_generated/AzureFileCopyV2/task.loc.json +++ b/_generated/AzureFileCopyV2/task.loc.json @@ -14,7 +14,7 @@ "version": { "Major": 2, "Minor": 228, - "Patch": 1 + "Patch": 3 }, "demands": [ "azureps" @@ -370,7 +370,7 @@ "ExpiredServicePrincipal": "ms-resource:loc.messages.ExpiredServicePrincipal" }, "_buildConfigMapping": { - "Default": "2.228.1", - "Node16-225": "2.228.0" + "Default": "2.228.3", + "Node16-225": "2.228.2" } } \ No newline at end of file diff --git a/_generated/AzureFileCopyV2_Node16/AzureFileCopyRemoteJob.ps1 b/_generated/AzureFileCopyV2_Node16/AzureFileCopyRemoteJob.ps1 index 38bb9d01aee1..67cbf4593c1c 100644 --- a/_generated/AzureFileCopyV2_Node16/AzureFileCopyRemoteJob.ps1 +++ b/_generated/AzureFileCopyV2_Node16/AzureFileCopyRemoteJob.ps1 @@ -8,7 +8,7 @@ $AzureFileCopyRemoteJob = { [string]$azCopyToolFileContentsString, [switch]$CleanTargetBeforeCopy, [switch]$EnableDetailedLogging, - [bool]$useSanitizerActivate = $false + [switch]$useSanitizerActivate ) function Write-DetailLogs @@ -120,9 +120,10 @@ $AzureFileCopyRemoteJob = { } if ($useSanitizerActivate) { + # Splitting arguments on space, but not on space inside quotes $sanitizedArguments = [regex]::Split($additionalArguments, ' (?=(?:[^"]|"[^"]*")*$)') Write-DetailLogs "##[command] & `"$azCopyExeLocation`" /Source:`"$containerURL`" /Dest:`"$targetPath`" /SourceSAS:`"*****`" $sanitizedArguments" - & $azCopyExeLocation /Source:$containerURL /Dest:$targetPath /SourceSAS:$containerSasToken $sanitizedArguments + & "$azCopyExeLocation" /Source:"$containerURL" /Dest:"$targetPath" /SourceSAS:"$containerSasToken" $sanitizedArguments } else { Write-DetailLogs "##[command] & `"$azCopyExeLocation`" /Source:`"$containerURL`" /Dest:`"$targetPath`" /SourceSAS:`"*****`" $additionalArguments" $azCopyCommand = "& `"$azCopyExeLocation`" /Source:`"$containerURL`" /Dest:`"$targetPath`" /SourceSAS:`"$containerSasToken`" $additionalArguments" diff --git a/_generated/AzureFileCopyV2_Node16/Utility.ps1 b/_generated/AzureFileCopyV2_Node16/Utility.ps1 index d3f7e3f6776b..1b987ed4dd8a 100644 --- a/_generated/AzureFileCopyV2_Node16/Utility.ps1 +++ b/_generated/AzureFileCopyV2_Node16/Utility.ps1 @@ -1115,7 +1115,7 @@ function Copy-FilesToAzureVMsFromStorageContainer $azCopyToolFileContentsString = $azCopyToolFileContents -join ";" # script block arguments - $scriptBlockArgs = " -containerURL '$containerURL' -targetPath '$targetPath' -containerSasToken '$containerSasToken' -additionalArguments '$additionalArguments' -azCopyToolFileNamesString '$azCopyToolFileNamesString' -azCopyToolFileContentsString '$azCopyToolFileContentsString' -useSanitizerActivate $useSanitizerActivate" + $scriptBlockArgs = " -containerURL '$containerURL' -targetPath '$targetPath' -containerSasToken '$containerSasToken' -additionalArguments '$additionalArguments' -azCopyToolFileNamesString '$azCopyToolFileNamesString' -azCopyToolFileContentsString '$azCopyToolFileContentsString'" if($cleanTargetBeforeCopy) { $scriptBlockArgs += " -CleanTargetBeforeCopy" @@ -1124,6 +1124,10 @@ function Copy-FilesToAzureVMsFromStorageContainer { $scriptBlockArgs += " -EnableDetailedLogging" } + if($useSanitizerActivate) + { + $scriptBlockArgs += " -useSanitizerActivate" + } $remoteScriptJobArguments = @{ inline = $true; diff --git a/_generated/AzureFileCopyV2_Node16/task.json b/_generated/AzureFileCopyV2_Node16/task.json index 871c5710ac50..79e27d267e5e 100644 --- a/_generated/AzureFileCopyV2_Node16/task.json +++ b/_generated/AzureFileCopyV2_Node16/task.json @@ -14,7 +14,7 @@ "version": { "Major": 2, "Minor": 228, - "Patch": 0 + "Patch": 2 }, "demands": [ "azureps" @@ -374,7 +374,7 @@ "ExpiredServicePrincipal": "Could not fetch access token for Azure. Verify if the Service Principal used is valid and not expired." }, "_buildConfigMapping": { - "Default": "2.228.1", - "Node16-225": "2.228.0" + "Default": "2.228.3", + "Node16-225": "2.228.2" } } \ No newline at end of file diff --git a/_generated/AzureFileCopyV2_Node16/task.loc.json b/_generated/AzureFileCopyV2_Node16/task.loc.json index c09fdbc15892..de25bf781e6c 100644 --- a/_generated/AzureFileCopyV2_Node16/task.loc.json +++ b/_generated/AzureFileCopyV2_Node16/task.loc.json @@ -14,7 +14,7 @@ "version": { "Major": 2, "Minor": 228, - "Patch": 0 + "Patch": 2 }, "demands": [ "azureps" @@ -374,7 +374,7 @@ "ExpiredServicePrincipal": "ms-resource:loc.messages.ExpiredServicePrincipal" }, "_buildConfigMapping": { - "Default": "2.228.1", - "Node16-225": "2.228.0" + "Default": "2.228.3", + "Node16-225": "2.228.2" } } \ No newline at end of file diff --git a/_generated/AzureFileCopyV3.versionmap.txt b/_generated/AzureFileCopyV3.versionmap.txt index b5d5e9d351cc..8836c45ae4b0 100644 --- a/_generated/AzureFileCopyV3.versionmap.txt +++ b/_generated/AzureFileCopyV3.versionmap.txt @@ -1,2 +1,2 @@ -Default|3.228.1 -Node16-225|3.228.0 +Default|3.228.3 +Node16-225|3.228.2 diff --git a/_generated/AzureFileCopyV3/AzureFileCopyRemoteJob.ps1 b/_generated/AzureFileCopyV3/AzureFileCopyRemoteJob.ps1 index 38bb9d01aee1..67cbf4593c1c 100644 --- a/_generated/AzureFileCopyV3/AzureFileCopyRemoteJob.ps1 +++ b/_generated/AzureFileCopyV3/AzureFileCopyRemoteJob.ps1 @@ -8,7 +8,7 @@ $AzureFileCopyRemoteJob = { [string]$azCopyToolFileContentsString, [switch]$CleanTargetBeforeCopy, [switch]$EnableDetailedLogging, - [bool]$useSanitizerActivate = $false + [switch]$useSanitizerActivate ) function Write-DetailLogs @@ -120,9 +120,10 @@ $AzureFileCopyRemoteJob = { } if ($useSanitizerActivate) { + # Splitting arguments on space, but not on space inside quotes $sanitizedArguments = [regex]::Split($additionalArguments, ' (?=(?:[^"]|"[^"]*")*$)') Write-DetailLogs "##[command] & `"$azCopyExeLocation`" /Source:`"$containerURL`" /Dest:`"$targetPath`" /SourceSAS:`"*****`" $sanitizedArguments" - & $azCopyExeLocation /Source:$containerURL /Dest:$targetPath /SourceSAS:$containerSasToken $sanitizedArguments + & "$azCopyExeLocation" /Source:"$containerURL" /Dest:"$targetPath" /SourceSAS:"$containerSasToken" $sanitizedArguments } else { Write-DetailLogs "##[command] & `"$azCopyExeLocation`" /Source:`"$containerURL`" /Dest:`"$targetPath`" /SourceSAS:`"*****`" $additionalArguments" $azCopyCommand = "& `"$azCopyExeLocation`" /Source:`"$containerURL`" /Dest:`"$targetPath`" /SourceSAS:`"$containerSasToken`" $additionalArguments" diff --git a/_generated/AzureFileCopyV3/Utility.ps1 b/_generated/AzureFileCopyV3/Utility.ps1 index 9f14113980a7..94ed422503ef 100644 --- a/_generated/AzureFileCopyV3/Utility.ps1 +++ b/_generated/AzureFileCopyV3/Utility.ps1 @@ -937,7 +937,7 @@ function Copy-FilesToAzureVMsFromStorageContainer $azCopyToolFileContentsString = $azCopyToolFileContents -join ";" # script block arguments - $scriptBlockArgs = " -containerURL '$containerURL' -targetPath '$targetPath' -containerSasToken '$containerSasToken' -additionalArguments '$additionalArguments' -azCopyToolFileNamesString '$azCopyToolFileNamesString' -azCopyToolFileContentsString '$azCopyToolFileContentsString' -useSanitizerActivate $useSanitizerActivate" + $scriptBlockArgs = " -containerURL '$containerURL' -targetPath '$targetPath' -containerSasToken '$containerSasToken' -additionalArguments '$additionalArguments' -azCopyToolFileNamesString '$azCopyToolFileNamesString' -azCopyToolFileContentsString '$azCopyToolFileContentsString'" if($cleanTargetBeforeCopy) { $scriptBlockArgs += " -CleanTargetBeforeCopy" @@ -946,6 +946,10 @@ function Copy-FilesToAzureVMsFromStorageContainer { $scriptBlockArgs += " -EnableDetailedLogging" } + if($useSanitizerActivate) + { + $scriptBlockArgs += " -useSanitizerActivate" + } $remoteScriptJobArguments = @{ inline = $true; diff --git a/_generated/AzureFileCopyV3/task.json b/_generated/AzureFileCopyV3/task.json index d7a12cdcfd22..ed8257cb1557 100644 --- a/_generated/AzureFileCopyV3/task.json +++ b/_generated/AzureFileCopyV3/task.json @@ -14,7 +14,7 @@ "version": { "Major": 3, "Minor": 228, - "Patch": 1 + "Patch": 3 }, "demands": [ "azureps" @@ -309,7 +309,7 @@ "ExpiredServicePrincipal": "Could not fetch access token for Azure. Verify if the Service Principal used is valid and not expired." }, "_buildConfigMapping": { - "Default": "3.228.1", - "Node16-225": "3.228.0" + "Default": "3.228.3", + "Node16-225": "3.228.2" } } \ No newline at end of file diff --git a/_generated/AzureFileCopyV3/task.loc.json b/_generated/AzureFileCopyV3/task.loc.json index 438e5ad09e7f..3855298e433c 100644 --- a/_generated/AzureFileCopyV3/task.loc.json +++ b/_generated/AzureFileCopyV3/task.loc.json @@ -14,7 +14,7 @@ "version": { "Major": 3, "Minor": 228, - "Patch": 1 + "Patch": 3 }, "demands": [ "azureps" @@ -309,7 +309,7 @@ "ExpiredServicePrincipal": "ms-resource:loc.messages.ExpiredServicePrincipal" }, "_buildConfigMapping": { - "Default": "3.228.1", - "Node16-225": "3.228.0" + "Default": "3.228.3", + "Node16-225": "3.228.2" } } \ No newline at end of file diff --git a/_generated/AzureFileCopyV3_Node16/AzureFileCopyRemoteJob.ps1 b/_generated/AzureFileCopyV3_Node16/AzureFileCopyRemoteJob.ps1 index 38bb9d01aee1..67cbf4593c1c 100644 --- a/_generated/AzureFileCopyV3_Node16/AzureFileCopyRemoteJob.ps1 +++ b/_generated/AzureFileCopyV3_Node16/AzureFileCopyRemoteJob.ps1 @@ -8,7 +8,7 @@ $AzureFileCopyRemoteJob = { [string]$azCopyToolFileContentsString, [switch]$CleanTargetBeforeCopy, [switch]$EnableDetailedLogging, - [bool]$useSanitizerActivate = $false + [switch]$useSanitizerActivate ) function Write-DetailLogs @@ -120,9 +120,10 @@ $AzureFileCopyRemoteJob = { } if ($useSanitizerActivate) { + # Splitting arguments on space, but not on space inside quotes $sanitizedArguments = [regex]::Split($additionalArguments, ' (?=(?:[^"]|"[^"]*")*$)') Write-DetailLogs "##[command] & `"$azCopyExeLocation`" /Source:`"$containerURL`" /Dest:`"$targetPath`" /SourceSAS:`"*****`" $sanitizedArguments" - & $azCopyExeLocation /Source:$containerURL /Dest:$targetPath /SourceSAS:$containerSasToken $sanitizedArguments + & "$azCopyExeLocation" /Source:"$containerURL" /Dest:"$targetPath" /SourceSAS:"$containerSasToken" $sanitizedArguments } else { Write-DetailLogs "##[command] & `"$azCopyExeLocation`" /Source:`"$containerURL`" /Dest:`"$targetPath`" /SourceSAS:`"*****`" $additionalArguments" $azCopyCommand = "& `"$azCopyExeLocation`" /Source:`"$containerURL`" /Dest:`"$targetPath`" /SourceSAS:`"$containerSasToken`" $additionalArguments" diff --git a/_generated/AzureFileCopyV3_Node16/Utility.ps1 b/_generated/AzureFileCopyV3_Node16/Utility.ps1 index 9f14113980a7..94ed422503ef 100644 --- a/_generated/AzureFileCopyV3_Node16/Utility.ps1 +++ b/_generated/AzureFileCopyV3_Node16/Utility.ps1 @@ -937,7 +937,7 @@ function Copy-FilesToAzureVMsFromStorageContainer $azCopyToolFileContentsString = $azCopyToolFileContents -join ";" # script block arguments - $scriptBlockArgs = " -containerURL '$containerURL' -targetPath '$targetPath' -containerSasToken '$containerSasToken' -additionalArguments '$additionalArguments' -azCopyToolFileNamesString '$azCopyToolFileNamesString' -azCopyToolFileContentsString '$azCopyToolFileContentsString' -useSanitizerActivate $useSanitizerActivate" + $scriptBlockArgs = " -containerURL '$containerURL' -targetPath '$targetPath' -containerSasToken '$containerSasToken' -additionalArguments '$additionalArguments' -azCopyToolFileNamesString '$azCopyToolFileNamesString' -azCopyToolFileContentsString '$azCopyToolFileContentsString'" if($cleanTargetBeforeCopy) { $scriptBlockArgs += " -CleanTargetBeforeCopy" @@ -946,6 +946,10 @@ function Copy-FilesToAzureVMsFromStorageContainer { $scriptBlockArgs += " -EnableDetailedLogging" } + if($useSanitizerActivate) + { + $scriptBlockArgs += " -useSanitizerActivate" + } $remoteScriptJobArguments = @{ inline = $true; diff --git a/_generated/AzureFileCopyV3_Node16/task.json b/_generated/AzureFileCopyV3_Node16/task.json index 3127624b5236..c9151e7f3298 100644 --- a/_generated/AzureFileCopyV3_Node16/task.json +++ b/_generated/AzureFileCopyV3_Node16/task.json @@ -14,7 +14,7 @@ "version": { "Major": 3, "Minor": 228, - "Patch": 0 + "Patch": 2 }, "demands": [ "azureps" @@ -313,7 +313,7 @@ "ExpiredServicePrincipal": "Could not fetch access token for Azure. Verify if the Service Principal used is valid and not expired." }, "_buildConfigMapping": { - "Default": "3.228.1", - "Node16-225": "3.228.0" + "Default": "3.228.3", + "Node16-225": "3.228.2" } } \ No newline at end of file diff --git a/_generated/AzureFileCopyV3_Node16/task.loc.json b/_generated/AzureFileCopyV3_Node16/task.loc.json index c80bd7b48107..7ba95f7af78e 100644 --- a/_generated/AzureFileCopyV3_Node16/task.loc.json +++ b/_generated/AzureFileCopyV3_Node16/task.loc.json @@ -14,7 +14,7 @@ "version": { "Major": 3, "Minor": 228, - "Patch": 0 + "Patch": 2 }, "demands": [ "azureps" @@ -313,7 +313,7 @@ "ExpiredServicePrincipal": "ms-resource:loc.messages.ExpiredServicePrincipal" }, "_buildConfigMapping": { - "Default": "3.228.1", - "Node16-225": "3.228.0" + "Default": "3.228.3", + "Node16-225": "3.228.2" } } \ No newline at end of file