-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Recursive Copy Fix & MSdeploy Changes #3618
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
0e9854d
Recursive Copy Fix * MSdeploy Changes
vincent1173 38b89f4
Resolve Merge Conflicts
vincent1173 7b50407
resolve merge conflict - 1
vincent1173 0762e92
copy dir added !
vincent1173 0e3495f
task version updated !
vincent1173 27d9588
changed copy files logic
vincent1173 31d20e9
make dir if not exist
vincent1173 154f7db
L0 Test added
vincent1173 84e917d
L0 test for IIS App Deployment
vincent1173 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
Tasks/Common/webdeployment-common/Tests/L0CopyDirectory.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
var mockery = require('mockery'); | ||
mockery.enable({ | ||
useCleanCache: true, | ||
warnOnReplace: false, | ||
warnOnUnregistered: false | ||
}); | ||
|
||
var fileList = ["C:/vinca/path", "C:/vinca/path/myfile.txt", | ||
"C:/vinca/path/New Folder", "C:/vinca/path/New Folder/Another New Folder", | ||
"C:/vinca/New Folder/anotherfile.py", "C:/vinca/New Folder/Another New Folder/mynewfile.txt"]; | ||
|
||
var mkdirPCount = 0; | ||
var cpfilesCount = 0; | ||
mockery.registerMock('vsts-task-lib/task', { | ||
exist: function (path) { | ||
console.log("exist : " + path); | ||
}, | ||
find: function (path) { | ||
console.log("find : " + path); | ||
return fileList; | ||
}, | ||
mkdirP: function (path) { | ||
mkdirPCount += 1; | ||
console.log("mkdirp : " + path); | ||
}, | ||
cp: function (source, dest, options, continueOnError) { | ||
if(fileList.indexOf(source)!= -1) { | ||
cpfilesCount += 1; | ||
console.log('cp ' + source + ' to ' + dest); | ||
} | ||
}, | ||
stats: function (path) { | ||
return { | ||
isDirectory: function() { | ||
if(path.endsWith('.py') || path.endsWith('.txt')) { | ||
return false; | ||
} | ||
return true; | ||
} | ||
}; | ||
}, | ||
debug: function(message) { | ||
console.log(message); | ||
} | ||
}); | ||
var utility = require('webdeployment-common/utility.js'); | ||
utility.copyDirectory('C:/vinca/path', 'C:/vinca/path/destFolder'); | ||
|
||
if(cpfilesCount === 3) { | ||
console.log('## Copy Files Successful ##'); | ||
} | ||
/** | ||
* 7 dir to be created including dest dir | ||
* Hash is not created to check already created dir, for testing purpose | ||
*/ | ||
if(mkdirPCount === 7) { | ||
console.log('## mkdir Successful ##'); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -153,4 +153,25 @@ export async function isMSDeployPackage(webAppPackage: string ) { | |
} | ||
tl.debug("Is the package an msdeploy package : " + isParamFilePresent); | ||
return isParamFilePresent; | ||
} | ||
|
||
export function copyDirectory(sourceDirectory: string, destDirectory: string) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As discussed, can you add L0 for this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. L0 Test added. |
||
if(!tl.exist(destDirectory)) { | ||
tl.mkdirP(destDirectory); | ||
} | ||
var listSrcDirectory = tl.find(sourceDirectory); | ||
for(var srcDirPath of listSrcDirectory) { | ||
var relativePath = srcDirPath.substring(sourceDirectory.length); | ||
var destinationPath = path.join(destDirectory, relativePath); | ||
if(tl.stats(srcDirPath).isDirectory()) { | ||
tl.mkdirP(destinationPath); | ||
} | ||
else { | ||
if(!tl.exist(path.dirname(destinationPath))) { | ||
tl.mkdirP(path.dirname(destinationPath)); | ||
} | ||
tl.debug('copy file from: ' + srcDirPath + ' to: ' + destinationPath); | ||
tl.cp(srcDirPath, destinationPath, '-f', false); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add the same test in IISWebAppDeploymentOnMachineGroup task as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added L0 Test for IIS App Deploy