Skip to content

Commit 3b9f9d0

Browse files
localconstOzan Aydin
andauthored
WI 2048209 (RM) (#18749)
* Update telemetry for sanitizer * Add error in case of enabled feature * Update WindowsMachineFileCopyV* tasks * Update AzureFileCopyV* tasks * Add node 16 build configs * Update sanitization message * Remove unused message * - node16 files are cleared * - version fix * - message is restored, conditions are updated * - new structure for sanitizer ff * - logic order has changed * Fix telemetry --------- Co-authored-by: Ozan Aydin <[email protected]>
1 parent b4464c5 commit 3b9f9d0

32 files changed

+214
-104
lines changed

Tasks/AzureFileCopyV1/AzureFileCopyJob.ps1

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,15 @@ param (
5151
$blobStorageURI = $blobStorageEndpoint+$containerName+"/"+$blobPrefix
5252
}
5353

54-
$useSanitizer = [System.Convert]::ToBoolean($env:AZP_75787_ENABLE_NEW_LOGIC)
55-
Write-Verbose "Feature flag AZP_75787_ENABLE_NEW_LOGIC state: $useSanitizer"
54+
$useSanitizerCall = Get-SanitizerCallStatus
55+
$useSanitizerActivate = Get-SanitizerActivateStatus
5656

57-
if ($useSanitizer) {
58-
$arguments = Protect-ScriptArguments -InputArgs $additionalArguments -TaskName "AzureFileCopyV1"
59-
Copy-ToAzureMachines -MachineDnsName $fqdn -StorageAccountName $storageAccount -ContainerName $containerName -SasToken $sasToken -DestinationPath $targetPath -Credential $credential -AzCopyLocation $azCopyLocation -AdditionalArguments $arguments -BlobStorageURI $blobStorageURI -WinRMPort $winRMPort $cleanTargetPathOption $skipCACheckOption $httpProtocolOption $enableDetailedLoggingOption
57+
if ($useSanitizerCall) {
58+
$sanitizedArguments = Protect-ScriptArguments -InputArgs $additionalArguments -TaskName "AzureFileCopyV1"
59+
}
60+
61+
if ($useSanitizerActivate) {
62+
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
6063
} else {
6164
[String]$copyToAzureMachinesBlockString = [string]::Empty
6265
if([string]::IsNullOrWhiteSpace($additionalArguments))

Tasks/AzureFileCopyV1/Utility.ps1

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -279,11 +279,15 @@ function Upload-FilesToAzureContainer
279279
$blobStorageURI = $blobStorageEndpoint+$containerName+"/"+$blobPrefix
280280
}
281281

282-
$useSanitizer = [System.Convert]::ToBoolean($env:AZP_75787_ENABLE_NEW_LOGIC)
283-
Write-Verbose "Feature flag AZP_75787_ENABLE_NEW_LOGIC state: $useSanitizer"
282+
$useSanitizerCall = Get-SanitizerCallStatus
283+
$useSanitizerActivate = Get-SanitizerActivateStatus
284284

285-
if ($useSanitizer) {
286-
$additionalArguments = Protect-ScriptArguments -InputArgs $additionalArguments -TaskName "AzureFileCopyV1"
285+
if ($useSanitizerCall) {
286+
$sanitizedAdditionalArguments = Protect-ScriptArguments -InputArgs $additionalArguments -TaskName "AzureFileCopyV1"
287+
}
288+
289+
if ($useSanitizerActivate) {
290+
$additionalArguments = $sanitizedAdditionalArguments
287291
}
288292

289293
Copy-FilesToAzureBlob -SourcePathLocation $sourcePath -StorageAccountName $storageAccountName -ContainerName $containerName -BlobPrefix $blobPrefix -StorageAccountKey $storageKey -AzCopyLocation $azCopyLocation -AdditionalArguments $additionalArguments -BlobStorageURI $blobStorageURI

Tasks/AzureFileCopyV1/task.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"version": {
1515
"Major": 1,
1616
"Minor": 226,
17-
"Patch": 1
17+
"Patch": 2
1818
},
1919
"demands": [
2020
"azureps"

Tasks/AzureFileCopyV1/task.loc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"version": {
1515
"Major": 1,
1616
"Minor": 226,
17-
"Patch": 1
17+
"Patch": 2
1818
},
1919
"demands": [
2020
"azureps"

Tasks/AzureFileCopyV2/AzureFileCopyRemoteJob.ps1

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,13 +118,16 @@ $AzureFileCopyRemoteJob = {
118118
$additionalArguments = "/Z:`"$azCopyDestinationPath`" /V:`"$logFilePath`" /S /Y"
119119
}
120120

121-
$useSanitizer = [System.Convert]::ToBoolean($env:AZP_75787_ENABLE_NEW_LOGIC)
122-
Write-Verbose "Feature flag AZP_75787_ENABLE_NEW_LOGIC state: $useSanitizer"
121+
$useSanitizerCall = Get-SanitizerCallStatus
122+
$useSanitizerActivate = Get-SanitizerActivateStatus
123123

124-
if ($useSanitizer) {
125-
$arguments = Protect-ScriptArguments -InputArgs $additionalArguments -TaskName "AzureFileCopyV2"
126-
Write-DetailLogs "##[command] & `"$azCopyExeLocation`" /Source:`"$containerURL`" /Dest:`"$targetPath`" /SourceSAS:`"*****`" $arguments"
127-
& $azCopyExeLocation /Source:$containerURL /Dest:$targetPath /SourceSAS:$containerSasToken $arguments
124+
if ($useSanitizerCall) {
125+
$sanitizedArguments = Protect-ScriptArguments -InputArgs $additionalArguments -TaskName "AzureFileCopyV2"
126+
}
127+
128+
if ($useSanitizerActivate) {
129+
Write-DetailLogs "##[command] & `"$azCopyExeLocation`" /Source:`"$containerURL`" /Dest:`"$targetPath`" /SourceSAS:`"*****`" $sanitizedArguments"
130+
& $azCopyExeLocation /Source:$containerURL /Dest:$targetPath /SourceSAS:$containerSasToken $sanitizedArguments
128131
} else {
129132
Write-DetailLogs "##[command] & `"$azCopyExeLocation`" /Source:`"$containerURL`" /Dest:`"$targetPath`" /SourceSAS:`"*****`" $additionalArguments"
130133
$azCopyCommand = "& `"$azCopyExeLocation`" /Source:`"$containerURL`" /Dest:`"$targetPath`" /SourceSAS:`"$containerSasToken`" $additionalArguments"

Tasks/AzureFileCopyV2/Utility.ps1

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -277,13 +277,16 @@ function Upload-FilesToAzureContainer
277277
)
278278
}
279279

280-
$useSanitizer = [System.Convert]::ToBoolean($env:AZP_75787_ENABLE_NEW_LOGIC)
281-
Write-Verbose "Feature flag AZP_75787_ENABLE_NEW_LOGIC state: $useSanitizer"
280+
$useSanitizerCall = Get-SanitizerCallStatus
281+
$useSanitizerActivate = Get-SanitizerActivateStatus
282282

283-
if ($useSanitizer) {
284-
$arguments = Protect-ScriptArguments -InputArgs $additionalArguments -TaskName "AzureFileCopyV2"
285-
Write-Output "##[command] & `"$azCopyExeLocation`" /Source:`"$resolvedSourcePath`" /Dest:`"$containerURL`" /@:`"$responseFile`" $arguments"
286-
& $azCopyExeLocation /Source:$resolvedSourcePath /Dest:$containerURL /@:$responseFile $arguments
283+
if ($useSanitizerCall) {
284+
$sanitizedArguments = Protect-ScriptArguments -InputArgs $additionalArguments -TaskName "AzureFileCopyV2"
285+
}
286+
287+
if ($useSanitizerActivate) {
288+
Write-Output "##[command] & `"$azCopyExeLocation`" /Source:`"$resolvedSourcePath`" /Dest:`"$containerURL`" /@:`"$responseFile`" $sanitizedArguments"
289+
& $azCopyExeLocation /Source:$resolvedSourcePath /Dest:$containerURL /@:$responseFile $sanitizedArguments
287290
} else {
288291
Write-Output "##[command] & `"$azCopyExeLocation`" /Source:`"$resolvedSourcePath`" /Dest:`"$containerURL`" /@:`"$responseFile`" $additionalArguments"
289292
$uploadToBlobCommand = "& `"$azCopyExeLocation`" /Source:`"$resolvedSourcePath`" /Dest:`"$containerURL`" /@:`"$responseFile`" $additionalArguments"

Tasks/AzureFileCopyV2/task.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"version": {
1515
"Major": 2,
1616
"Minor": 226,
17-
"Patch": 1
17+
"Patch": 2
1818
},
1919
"demands": [
2020
"azureps"

Tasks/AzureFileCopyV2/task.loc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"version": {
1515
"Major": 2,
1616
"Minor": 226,
17-
"Patch": 1
17+
"Patch": 2
1818
},
1919
"demands": [
2020
"azureps"

Tasks/AzureFileCopyV3/AzureFileCopyRemoteJob.ps1

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,13 +118,16 @@ $AzureFileCopyRemoteJob = {
118118
$additionalArguments = "/Z:`"$azCopyDestinationPath`" /V:`"$logFilePath`" /S /Y"
119119
}
120120

121-
$useSanitizer = [System.Convert]::ToBoolean($env:AZP_75787_ENABLE_NEW_LOGIC)
122-
Write-Verbose "Feature flag AZP_75787_ENABLE_NEW_LOGIC state: $useSanitizer"
121+
$useSanitizerCall = Get-SanitizerCallStatus
122+
$useSanitizerActivate = Get-SanitizerActivateStatus
123123

124-
if ($useSanitizer) {
125-
$arguments = Protect-ScriptArguments -InputArgs $additionalArguments -TaskName "AzureFileCopyV3"
126-
Write-DetailLogs "##[command] & `"$azCopyExeLocation`" /Source:`"$containerURL`" /Dest:`"$targetPath`" /SourceSAS:`"*****`" $arguments"
127-
& $azCopyExeLocation /Source:$containerURL /Dest:$targetPath /SourceSAS:$containerSasToken $arguments
124+
if ($useSanitizerCall){
125+
$sanitizedArguments = Protect-ScriptArguments -InputArgs $additionalArguments -TaskName "AzureFileCopyV3"
126+
}
127+
128+
if ($useSanitizerActivate) {
129+
Write-DetailLogs "##[command] & `"$azCopyExeLocation`" /Source:`"$containerURL`" /Dest:`"$targetPath`" /SourceSAS:`"*****`" $sanitizedArguments"
130+
& $azCopyExeLocation /Source:$containerURL /Dest:$targetPath /SourceSAS:$containerSasToken $sanitizedArguments
128131
} else {
129132
Write-DetailLogs "##[command] & `"$azCopyExeLocation`" /Source:`"$containerURL`" /Dest:`"$targetPath`" /SourceSAS:`"*****`" $additionalArguments"
130133
$azCopyCommand = "& `"$azCopyExeLocation`" /Source:`"$containerURL`" /Dest:`"$targetPath`" /SourceSAS:`"$containerSasToken`" $additionalArguments"

Tasks/AzureFileCopyV3/Utility.ps1

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -160,13 +160,16 @@ function Upload-FilesToAzureContainer
160160
)
161161
}
162162

163-
$useSanitizer = [System.Convert]::ToBoolean($env:AZP_75787_ENABLE_NEW_LOGIC)
164-
Write-Verbose "Feature flag AZP_75787_ENABLE_NEW_LOGIC state: $useSanitizer"
163+
$useSanitizerCall = Get-SanitizerCallStatus
164+
$useSanitizerActivate = Get-SanitizerActivateStatus
165165

166-
if ($useSanitizer) {
167-
$arguments = Protect-ScriptArguments -InputArgs $additionalArguments -TaskName "AzureFileCopyV3"
168-
Write-Output "##[command] & azcopy /Source:`"$resolvedSourcePath`" /Dest:`"$containerURL`" /@:`"$responseFile`" $arguments"
169-
& $azCopyExeLocation /Source:$resolvedSourcePath /Dest:$containerURL /@:$responseFile $arguments
166+
if ($useSanitizerCall) {
167+
$sanitizedArguments = Protect-ScriptArguments -InputArgs $additionalArguments -TaskName "AzureFileCopyV3"
168+
}
169+
170+
if ($useSanitizerActivate) {
171+
Write-Output "##[command] & azcopy /Source:`"$resolvedSourcePath`" /Dest:`"$containerURL`" /@:`"$responseFile`" $sanitizedArguments"
172+
& $azCopyExeLocation /Source:$resolvedSourcePath /Dest:$containerURL /@:$responseFile $sanitizedArguments
170173
} else {
171174
Write-Output "##[command] & `"$azCopyExeLocation`" /Source:`"$resolvedSourcePath`" /Dest:`"$containerURL`" /@:`"$responseFile`" $additionalArguments"
172175
$uploadToBlobCommand = "& `"$azCopyExeLocation`" /Source:`"$resolvedSourcePath`" /Dest:`"$containerURL`" /@:`"$responseFile`" $additionalArguments"

0 commit comments

Comments
 (0)