Skip to content

Commit

Permalink
Adding Feature Flag to RoboCopy in WindowsMachineFileCopyV2 (#20746)
Browse files Browse the repository at this point in the history
* Adding Feature Flag to RoboCopy in WindowsMachineFileCopyV2

* updating task version
  • Loading branch information
EshitaD authored Dec 31, 2024
1 parent f7d65f3 commit 93a10ac
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
21 changes: 18 additions & 3 deletions Tasks/WindowsMachineFileCopyV2/RoboCopyJob.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
$CopyJob = {
$featureFlags = @{
ModifyNumberOfRetriesInRobocopy = [System.Convert]::ToBoolean($env:MODIFY_NUMBER_OF_RETRIES_IN_ROBOCOPY)
}
$ModifyRoboCopyRetries= $featureFlags.ModifyNumberOfRetriesInRobocopy

$CopyJob = {
param (
[string]$fqdn,
[string]$sourcePath,
Expand Down Expand Up @@ -101,7 +106,12 @@ param (

function Clean-Target
{
$cleanupArgument = "/NOCOPY /E /PURGE"
if(-not $ModifyRoboCopyRetries){
$cleanupArgument = "/NOCOPY /E /PURGE"
}
else{
$cleanupArgument = "/NOCOPY /E /PURGE /R:3 "
}
$guid = [GUID]::NewGuid()
$tempDirectory = "$scriptRoot\temp$guid"
New-Item -ItemType Directory -Force -Path $tempDirectory
Expand All @@ -128,7 +138,12 @@ param (
[switch]$fileCopy
)
{
$robocopyParameters = "/COPY:DAT "
if(-not $ModifyRoboCopyRetries){
$robocopyParameters = "/COPY:DAT "
}
else{
$robocopyParameters = "/COPY:DAT /R:3 "
}

if(-not $fileCopy.IsPresent)
{
Expand Down
2 changes: 1 addition & 1 deletion Tasks/WindowsMachineFileCopyV2/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"author": "Microsoft Corporation",
"version": {
"Major": 2,
"Minor": 242,
"Minor": 251,
"Patch": 0
},
"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.",
Expand Down
2 changes: 1 addition & 1 deletion Tasks/WindowsMachineFileCopyV2/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"author": "Microsoft Corporation",
"version": {
"Major": 2,
"Minor": 242,
"Minor": 251,
"Patch": 0
},
"releaseNotes": "ms-resource:loc.releaseNotes",
Expand Down

0 comments on commit 93a10ac

Please sign in to comment.