Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Feature Flag to RoboCopy in WindowsMachineFileCopyV2 #20746

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 "
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here: it will be great to have an opportunity to pass number of retries from the backend (for ex, $env:CUSTOM_NUMBER_OF_RETRIES_IN_ROBOCOPY)

}
$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": 250,
"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": 250,
"Patch": 0
},
"releaseNotes": "ms-resource:loc.releaseNotes",
Expand Down