本文整理汇总了TypeScript中webdeployment-common/utility.js.default.isMSDeployPackage方法的典型用法代码示例。如果您正苦于以下问题:TypeScript js.default.isMSDeployPackage方法的具体用法?TypeScript js.default.isMSDeployPackage怎么用?TypeScript js.default.isMSDeployPackage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类webdeployment-common/utility.js.default
的用法示例。
在下文中一共展示了js.default.isMSDeployPackage方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: DeployUsingKuduDeploy
/**
* Deploys website using Kudu REST API
*
* @param webDeployPkg Web deploy package
* @param webAppName Web App Name
* @param publishingProfile Azure RM Connection Details
* @param virtualApplication Virtual Application Name
* @param isFolderBasedDeployment Input is folder or not
*
*/
async function DeployUsingKuduDeploy(webDeployPkg, azureWebAppDetails, publishingProfile, virtualApplication, isFolderBasedDeployment, takeAppOfflineFlag) {
var tempPackagePath = null;
try {
var virtualApplicationMappings = azureWebAppDetails.properties.virtualApplications;
var webAppZipFile = webDeployPkg;
if(isFolderBasedDeployment) {
tempPackagePath = deployUtility.generateTemporaryFolderOrZipPath(tl.getVariable('System.DefaultWorkingDirectory'), false);
webAppZipFile = await zipUtility.archiveFolder(webDeployPkg, "", tempPackagePath);
tl.debug("Compressed folder " + webDeployPkg + " into zip : " + webAppZipFile);
} else {
if (await deployUtility.isMSDeployPackage(webAppZipFile)) {
throw new Error(tl.loc("MSDeploygeneratedpackageareonlysupportedforWindowsplatform"));
}
}
var physicalPath = "/site/wwwroot";
var virtualPath = "/";
if(virtualApplication) {
var pathMappings = kuduUtility.getVirtualAndPhysicalPaths(virtualApplication, virtualApplicationMappings);
if(pathMappings[1] != null) {
virtualPath = pathMappings[0];
physicalPath = pathMappings[1];
} else {
throw Error(tl.loc("VirtualApplicationDoesNotExist", virtualApplication));
}
}
await kuduUtility.deployWebAppPackage(webAppZipFile, publishingProfile, virtualPath, physicalPath, takeAppOfflineFlag);
console.log(tl.loc('PackageDeploymentSuccess'));
}
catch(error) {
tl.error(tl.loc('PackageDeploymentFailed'));
throw Error(error);
}
finally {
if(tempPackagePath) {
tl.rmRF(tempPackagePath, true);
}
}
}
示例3: run
//.........这里部分代码省略.........
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');
var webConfigParameters = ParameterParser.parse(webConfigParametersStr);
generateWebConfigUtil.addWebConfigFile(folderPath, webConfigParameters, virtualApplicationPhysicalPath);
}
if (applyFileTransformFlag) {
var isMSBuildPackage = !isFolderBasedDeployment && (await deployUtility.isMSDeployPackage(webDeployPkg));
fileTransformationsUtility.fileTransformations(isFolderBasedDeployment, JSONFiles, xmlTransformation, xmlVariableSubstitution, folderPath, isMSBuildPackage);
}
var output = await deployUtility.archiveFolderForDeployment(isFolderBasedDeployment, folderPath);
tempPackagePath = output.tempPackagePath;
webDeployPkg = output.webDeployPkg;
}
if(virtualApplication) {
publishingProfile.destinationAppUrl += "/" + virtualApplication;
}
if(webAppUri) {
tl.setVariable(webAppUri, publishingProfile.destinationAppUrl);
}
if(publishingProfile && publishingProfile.destinationAppUrl) {
try{
await azureRESTUtility.testAzureWebAppAvailability(publishingProfile.destinationAppUrl, 3000);
} catch (error) {
tl.debug("Failed to check availability of azure web app, error : " + error.message);
}
}
if(deployUtility.canUseWebDeploy(useWebDeploy)) {
if(!tl.osType().match(/^Win/)){
throw Error(tl.loc("PublishusingwebdeployoptionsaresupportedonlywhenusingWindowsagent"));
}
var appSettings = await azureRESTUtility.getWebAppAppSettings(endPoint, webAppName, resourceGroupName, deployToSlotFlag, slotName);
if(renameFilesFlag) {
if(appSettings.properties.MSDEPLOY_RENAME_LOCKED_FILES == undefined || appSettings.properties.MSDEPLOY_RENAME_LOCKED_FILES == '0'){