Skip to content

Commit 93a10ac

Browse files
authored
Adding Feature Flag to RoboCopy in WindowsMachineFileCopyV2 (#20746)
* Adding Feature Flag to RoboCopy in WindowsMachineFileCopyV2 * updating task version
1 parent f7d65f3 commit 93a10ac

File tree

3 files changed

+20
-5
lines changed

3 files changed

+20
-5
lines changed

Tasks/WindowsMachineFileCopyV2/RoboCopyJob.ps1

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
$CopyJob = {
1+
$featureFlags = @{
2+
ModifyNumberOfRetriesInRobocopy = [System.Convert]::ToBoolean($env:MODIFY_NUMBER_OF_RETRIES_IN_ROBOCOPY)
3+
}
4+
$ModifyRoboCopyRetries= $featureFlags.ModifyNumberOfRetriesInRobocopy
5+
6+
$CopyJob = {
27
param (
38
[string]$fqdn,
49
[string]$sourcePath,
@@ -101,7 +106,12 @@ param (
101106

102107
function Clean-Target
103108
{
104-
$cleanupArgument = "/NOCOPY /E /PURGE"
109+
if(-not $ModifyRoboCopyRetries){
110+
$cleanupArgument = "/NOCOPY /E /PURGE"
111+
}
112+
else{
113+
$cleanupArgument = "/NOCOPY /E /PURGE /R:3 "
114+
}
105115
$guid = [GUID]::NewGuid()
106116
$tempDirectory = "$scriptRoot\temp$guid"
107117
New-Item -ItemType Directory -Force -Path $tempDirectory
@@ -128,7 +138,12 @@ param (
128138
[switch]$fileCopy
129139
)
130140
{
131-
$robocopyParameters = "/COPY:DAT "
141+
if(-not $ModifyRoboCopyRetries){
142+
$robocopyParameters = "/COPY:DAT "
143+
}
144+
else{
145+
$robocopyParameters = "/COPY:DAT /R:3 "
146+
}
132147

133148
if(-not $fileCopy.IsPresent)
134149
{

Tasks/WindowsMachineFileCopyV2/task.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"author": "Microsoft Corporation",
1414
"version": {
1515
"Major": 2,
16-
"Minor": 242,
16+
"Minor": 251,
1717
"Patch": 0
1818
},
1919
"releaseNotes": "What's new in Version 2.0: <br/>&nbsp;&nbsp;Proxy support is being added. <br/>&nbsp;&nbsp; Removed support of legacy DTL machines.",

Tasks/WindowsMachineFileCopyV2/task.loc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"author": "Microsoft Corporation",
1414
"version": {
1515
"Major": 2,
16-
"Minor": 242,
16+
"Minor": 251,
1717
"Patch": 0
1818
},
1919
"releaseNotes": "ms-resource:loc.releaseNotes",

0 commit comments

Comments
 (0)