本文整理汇总了TypeScript中webdeployment-common/utility.js.default.generateTemporaryFolderForDeployment方法的典型用法代码示例。如果您正苦于以下问题:TypeScript js.default.generateTemporaryFolderForDeployment方法的具体用法?TypeScript js.default.generateTemporaryFolderForDeployment怎么用?TypeScript js.default.generateTemporaryFolderForDeployment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类webdeployment-common/utility.js.default
的用法示例。
在下文中一共展示了js.default.generateTemporaryFolderForDeployment方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: run
async function run()
{
try
{
tl.setResourcePath(path.join( __dirname, 'task.json'));
var webSiteName: string = tl.getInput('WebSiteName', true);
var virtualApplication: string = tl.getInput('VirtualApplication', false);
var webDeployPkg: string = tl.getPathInput('Package', true);
var setParametersFile: string = tl.getPathInput('SetParametersFile', false);
var removeAdditionalFilesFlag: boolean = tl.getBoolInput('RemoveAdditionalFilesFlag', false);
var excludeFilesFromAppDataFlag: boolean = tl.getBoolInput('ExcludeFilesFromAppDataFlag', false);
var takeAppOfflineFlag: boolean = tl.getBoolInput('TakeAppOfflineFlag', false);
var additionalArguments: string = tl.getInput('AdditionalArguments', false);
var xmlTransformation: boolean = tl.getBoolInput('XmlTransformation', false);
var JSONFiles = tl.getDelimitedInput('JSONFiles', '\n', false);
var xmlVariableSubstitution: boolean = tl.getBoolInput('XmlVariableSubstitution', false);
var availableWebPackages = utility.findfiles(webDeployPkg);
var tempPackagePath = null;
if(availableWebPackages.length == 0)
{
throw new Error(tl.loc('Nopackagefoundwithspecifiedpattern'));
}
if(availableWebPackages.length > 1)
{
throw new Error(tl.loc('MorethanonepackagematchedwithspecifiedpatternPleaserestrainthesearchpattern'));
}
webDeployPkg = availableWebPackages[0];
var isFolderBasedDeployment = await utility.isInputPkgIsFolder(webDeployPkg);
if ( JSONFiles.length != 0 || xmlTransformation || xmlVariableSubstitution ) {
var folderPath = await utility.generateTemporaryFolderForDeployment(isFolderBasedDeployment, webDeployPkg);
var isMSBuildPackage = !isFolderBasedDeployment && await utility.isMSDeployPackage(webDeployPkg);
fileTransformationsUtility.fileTransformations(isFolderBasedDeployment, JSONFiles, xmlTransformation, xmlVariableSubstitution, folderPath, isMSBuildPackage);
var output = await utility.archiveFolderForDeployment(isFolderBasedDeployment, folderPath);
tempPackagePath = output.tempPackagePath;
webDeployPkg = output.webDeployPkg;
}
await msDeploy.DeployUsingMSDeploy(webDeployPkg, webSiteName, null, removeAdditionalFilesFlag,
excludeFilesFromAppDataFlag, takeAppOfflineFlag, virtualApplication, setParametersFile,
additionalArguments, isFolderBasedDeployment, true);
}
catch(error)
{
tl.setResult(tl.TaskResult.Failed,error);
}
}
示例2: main
async function main() {
tl.setResourcePath(path.join( __dirname, 'task.json'));
let webPackage = new Package(tl.getPathInput('folderPath', true));
let packagePath = webPackage.getPath();
let fileType = tl.getInput("fileType", false);
let targetFiles = tl.getDelimitedInput('targetFiles', '\n', false);
let xmlTransformation = tl.getBoolInput('enableXmlTransform', false);
let xmlTransformationRules = tl.getDelimitedInput('xmlTransformationRules', '\n', false);
let applyFileTransformFlag = fileType || xmlTransformation;
if (applyFileTransformFlag) {
let isFolderBasedDeployment: boolean = tl.stats(packagePath).isDirectory();
if(!isFolderBasedDeployment) {
var folderPath = await deployUtility.generateTemporaryFolderForDeployment(isFolderBasedDeployment, packagePath, webPackage.getPackageType());
fileTransformationsUtility.advancedFileTransformations(isFolderBasedDeployment, targetFiles, xmlTransformation, fileType, folderPath, xmlTransformationRules);
await zipUtility.archiveFolder(folderPath, path.dirname(packagePath), path.basename(packagePath));
}
else {
fileTransformationsUtility.advancedFileTransformations(isFolderBasedDeployment, targetFiles, xmlTransformation, fileType, packagePath, xmlTransformationRules);
}
}
else {
tl.debug('File Tranformation not enabled');
}
}
示例3: run
async function run() {
try {
tl.setResourcePath(path.join( __dirname, 'task.json'));
var connectedServiceName = tl.getInput('ConnectedServiceName', true);
var webAppName: string = tl.getInput('WebAppName', true);
var deployToSlotFlag: boolean = tl.getBoolInput('DeployToSlotFlag', false);
var resourceGroupName: string = tl.getInput('ResourceGroupName', false);
var slotName: string = tl.getInput('SlotName', false);
var webDeployPkg: string = tl.getPathInput('Package', true);
var virtualApplication: string = tl.getInput('VirtualApplication', false);
var useWebDeploy: boolean = tl.getBoolInput('UseWebDeploy', false);
var setParametersFile: string = tl.getPathInput('SetParametersFile', false);
var removeAdditionalFilesFlag: boolean = tl.getBoolInput('RemoveAdditionalFilesFlag', false);
var excludeFilesFromAppDataFlag: boolean = tl.getBoolInput('ExcludeFilesFromAppDataFlag', false);
var takeAppOfflineFlag: boolean = tl.getBoolInput('TakeAppOfflineFlag', false);
var renameFilesFlag: boolean = tl.getBoolInput('RenameFilesFlag', false);
var additionalArguments: string = tl.getInput('AdditionalArguments', false);
var webAppUri:string = tl.getInput('WebAppUri', false);
var xmlTransformation: boolean = tl.getBoolInput('XmlTransformation', false);
var JSONFiles = tl.getDelimitedInput('JSONFiles', '\n', false);
var xmlVariableSubstitution: boolean = tl.getBoolInput('XmlVariableSubstitution', false);
var scriptType: string = tl.getInput('ScriptType', false);
var inlineScript: string = tl.getInput('InlineScript', false);
var scriptPath: string = tl.getPathInput('ScriptPath', false);
var generateWebConfig = tl.getBoolInput('GenerateWebConfig', false);
var webConfigParametersStr = tl.getInput('WebConfigParameters', false);
var webAppKind = tl.getInput('WebAppKind', false);
var dockerNamespace = tl.getInput('DockerNamespace', false);
var isDeploymentSuccess: boolean = true;
var tempPackagePath = null;
var endPoint = new Array();
endPoint["servicePrincipalClientID"] = tl.getEndpointAuthorizationParameter(connectedServiceName, 'serviceprincipalid', false);
endPoint["servicePrincipalKey"] = tl.getEndpointAuthorizationParameter(connectedServiceName, 'serviceprincipalkey', false);
endPoint["tenantID"] = tl.getEndpointAuthorizationParameter(connectedServiceName, 'tenantid', false);
endPoint["subscriptionId"] = tl.getEndpointDataParameter(connectedServiceName, 'subscriptionid', true);
endPoint["envAuthUrl"] = tl.getEndpointDataParameter(connectedServiceName, 'environmentAuthorityUrl', true);
endPoint["url"] = tl.getEndpointUrl(connectedServiceName, true);
if(webAppKind && webAppKind === "linux") {
deployToSlotFlag = false;
}
if(deployToSlotFlag) {
if (slotName.toLowerCase() === "production") {
deployToSlotFlag = false;
}
}
else {
resourceGroupName = await azureRESTUtility.getResourceGroupName(endPoint, webAppName);
}
var publishingProfile = await azureRESTUtility.getAzureRMWebAppPublishProfile(endPoint, webAppName, resourceGroupName, deployToSlotFlag, slotName);
console.log(tl.loc('GotconnectiondetailsforazureRMWebApp0', webAppName));
// For container based linux deployment
if(webAppKind && webAppKind === "linux" && dockerNamespace)
{
tl.debug("Performing container based deployment.");
await deployWebAppImage(endPoint, resourceGroupName, webAppName);
}
else
{
tl.debug("Performing the deployment of webapp.");
var availableWebPackages = deployUtility.findfiles(webDeployPkg);
if(availableWebPackages.length == 0) {
throw new Error(tl.loc('Nopackagefoundwithspecifiedpattern'));
}
if(availableWebPackages.length > 1) {
throw new Error(tl.loc('MorethanonepackagematchedwithspecifiedpatternPleaserestrainthesearchpattern'));
}
webDeployPkg = availableWebPackages[0];
var azureWebAppDetails = null;
var virtualApplicationPhysicalPath = null;
if(virtualApplication) {
virtualApplication = (virtualApplication.startsWith("/")) ? virtualApplication.substr(1) : virtualApplication;
azureWebAppDetails = await azureRESTUtility.getAzureRMWebAppConfigDetails(endPoint, webAppName, resourceGroupName, deployToSlotFlag, slotName);
var virtualApplicationMappings = azureWebAppDetails.properties.virtualApplications;
var pathMappings = kuduUtility.getVirtualAndPhysicalPaths(virtualApplication, virtualApplicationMappings);
if(pathMappings[1] != null) {
virtualApplicationPhysicalPath = pathMappings[1];
await kuduUtility.ensurePhysicalPathExists(publishingProfile, pathMappings[1]);
}
else {
throw Error(tl.loc("VirtualApplicationDoesNotExist", virtualApplication));
}
}
var isFolderBasedDeployment = deployUtility.isInputPkgIsFolder(webDeployPkg);
var applyFileTransformFlag = JSONFiles.length != 0 || xmlTransformation || xmlVariableSubstitution;
if (applyFileTransformFlag || generateWebConfig) {
var folderPath = await deployUtility.generateTemporaryFolderForDeployment(isFolderBasedDeployment, webDeployPkg);
if (generateWebConfig) {
tl.debug('parsing web.config parameters');
//.........这里部分代码省略.........
示例4: DeployWebAppStep
public async DeployWebAppStep() {
tl.debug('Performing Linux built-in package deployment');
var isNewValueUpdated: boolean = false;
if(this.taskParams.isFunctionApp) {
var linuxFunctionRuntimeSetting = "";
if(this.taskParams.RuntimeStack){
linuxFunctionRuntimeSetting = linuxFunctionRuntimeSettingName + linuxFunctionRuntimeSettingValue.get(this.taskParams.RuntimeStack);
}
var linuxFunctionAppSetting = linuxFunctionRuntimeSetting + linuxFunctionStorageSetting;
var customApplicationSetting = ParameterParser.parse(linuxFunctionAppSetting);
isNewValueUpdated = await this.appServiceUtility.updateAndMonitorAppSettings(customApplicationSetting);
}
if(!isNewValueUpdated) {
await this.kuduServiceUtility.warmpUp();
}
switch(this.taskParams.Package.getPackageType()){
case PackageType.folder:
let tempPackagePath = deployUtility.generateTemporaryFolderOrZipPath(tl.getVariable('AGENT.TEMPDIRECTORY'), false);
let archivedWebPackage = await zipUtility.archiveFolder(this.taskParams.Package.getPath(), "", tempPackagePath);
tl.debug("Compressed folder into zip " + archivedWebPackage);
this.zipDeploymentID = await this.kuduServiceUtility.deployUsingZipDeploy(archivedWebPackage, this.taskParams.TakeAppOfflineFlag,
{ slotName: this.appService.getSlot() });
break;
case PackageType.zip:
this.zipDeploymentID = await this.kuduServiceUtility.deployUsingZipDeploy(this.taskParams.Package.getPath(), this.taskParams.TakeAppOfflineFlag,
{ slotName: this.appService.getSlot() });
break;
case PackageType.jar:
tl.debug("Initiated deployment via kudu service for webapp jar package : "+ this.taskParams.Package.getPath());
var folderPath = await webCommonUtility.generateTemporaryFolderForDeployment(false, this.taskParams.Package.getPath(), PackageType.jar);
var jarName = webCommonUtility.getFileNameFromPath(this.taskParams.Package.getPath(), ".jar");
var destRootPath = "/home/site/wwwroot/";
var script = 'java -jar "' + destRootPath + jarName + '.jar' + '" --server.port=80';
var initScriptFileName = "startupscript_" + jarName + ".sh";
var initScriptFile = path.join(folderPath, initScriptFileName);
var destInitScriptPath = destRootPath + initScriptFileName;
if(!this.taskParams.AppSettings) {
this.taskParams.AppSettings = "-INIT_SCRIPT " + destInitScriptPath;
}
if(this.taskParams.AppSettings.indexOf("-INIT_SCRIPT") < 0) {
this.taskParams.AppSettings += " -INIT_SCRIPT " + destInitScriptPath;
}
this.taskParams.AppSettings = this.taskParams.AppSettings.trim();
tl.writeFile(initScriptFile, script, { encoding: 'utf8' });
var output = await webCommonUtility.archiveFolderForDeployment(false, folderPath);
var webPackage = output.webDeployPkg;
tl.debug("Initiated deployment via kudu service for webapp jar package : "+ webPackage);
this.zipDeploymentID = await this.kuduServiceUtility.deployUsingZipDeploy(webPackage, this.taskParams.TakeAppOfflineFlag,
{ slotName: this.appService.getSlot() });
break;
case PackageType.war:
tl.debug("Initiated deployment via kudu service for webapp war package : "+ this.taskParams.Package.getPath());
var warName = webCommonUtility.getFileNameFromPath(this.taskParams.Package.getPath(), ".war");
this.zipDeploymentID = await this.kuduServiceUtility.deployUsingWarDeploy(this.taskParams.Package.getPath(),
{ slotName: this.appService.getSlot() }, warName);
break;
default:
throw new Error(tl.loc('Invalidwebapppackageorfolderpathprovided', this.taskParams.Package.getPath()));
}
await this.appServiceUtility.updateStartupCommandAndRuntimeStack(this.taskParams.RuntimeStack, this.taskParams.StartupCommand);
await this.PostDeploymentStep();
}