-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Custom Script Feature for Azure App Service Deploy task (#3688)
- Loading branch information
1 parent
181ab89
commit c9a9cd3
Showing
8 changed files
with
378 additions
and
59 deletions.
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
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
83 changes: 83 additions & 0 deletions
83
Tasks/Common/webdeployment-common/Tests/L0RunPostDeploymentScript.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,83 @@ | ||
var mockery = require('mockery'); | ||
mockery.enable({ | ||
useCleanCache: true, | ||
warnOnReplace: false, | ||
warnOnUnregistered: false | ||
}); | ||
|
||
mockery.registerMock('vso-node-api/HttpClient', { | ||
HttpCallbackClient: function () { | ||
return { | ||
send: function (verb, url) { | ||
if(verb == 'POST' && url == 'https://mytestappKuduUrl/api/command') { | ||
console.log('POST:https://mytestappKuduUrl/api/command'); | ||
return; | ||
} | ||
throw Error('Unknown verb or URL - SEND'); | ||
}, | ||
sendStream: function (verb, url) { | ||
if(verb == 'PUT' && url == 'https://mytestappKuduUrl/api/vfs//site/wwwroot/kuduPostDeploymentScript.cmd') { | ||
console.log('PUT:https://mytestappKuduUrl/api/vfs//site/wwwroot/kuduPostDeploymentScript.cmd'); | ||
return; | ||
} | ||
throw Error('Unknown verb or URL - sendStream'); | ||
}, | ||
get: function(verb, url) { | ||
if(verb == 'DELETE' && url == 'https://mytestappKuduUrl/api/vfs//site/wwwroot/kuduPostDeploymentScript.cmd') { | ||
console.log("DELETED:https://mytestappKuduUrl/api/vfs//site/wwwroot/kuduPostDeploymentScript.cmd"); | ||
return; | ||
} | ||
throw Error('Unknown verb or URL - GET'); | ||
} | ||
}; | ||
} | ||
}); | ||
|
||
mockery.registerMock('vsts-task-lib/task', { | ||
exist: function() { | ||
return true; | ||
}, | ||
getVariable: function() { | ||
return 'workigDirectory'; | ||
}, | ||
debug: function(message) { | ||
console.log('##debug : ' + message); | ||
}, | ||
loc: function(message, argument) { | ||
console.log('##LOC: ' + message + ' : ' + argument); | ||
} | ||
|
||
}); | ||
mockery.registerMock('q', { | ||
'defer': function() { | ||
return { | ||
promise: 'promise' | ||
} | ||
} | ||
}); | ||
|
||
var fs = require('fs'); | ||
mockery.registerMock('fs', { | ||
'createReadStream': function() { | ||
return ''; | ||
}, | ||
statSync: fs.statSync, | ||
writeFileSync: fs.writeFileSync | ||
}) | ||
var mockPublishProfile = { | ||
profileName: 'mytestapp - Web Deploy', | ||
publishMethod: 'MSDeploy', | ||
publishUrl: 'mytestappKuduUrl', | ||
msdeploySite: 'mytestapp', | ||
userName: '$mytestapp', | ||
userPWD: 'mytestappPwd', | ||
destinationAppUrl: 'mytestappUrl', | ||
SQLServerDBConnectionString: '', | ||
mySQLDBConnectionString: '', | ||
hostingProviderForumLink: '', | ||
controlPanelLink: '', | ||
webSystem: 'WebSites' | ||
}; | ||
|
||
var kuduUtility = require('webdeployment-common/kuduutility.js'); | ||
kuduUtility.runPostDeploymentScript(mockPublishProfile, "File Path", null, 'myscript.cmd', false); |
Oops, something went wrong.