本文整理汇总了TypeScript中webdeployment-common/ziputility.js.default类的典型用法代码示例。如果您正苦于以下问题:TypeScript js.default类的具体用法?TypeScript js.default怎么用?TypeScript js.default使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了js.default类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: Error
export async function fileTransformations(isFolderBasedDeployment: boolean, JSONFiles: any, xmlTransformation: boolean, xmlVariableSubstitution: boolean, webDeployPkg: string) {
var tempPackagePath;
var folderPath = utility.generateTemporaryFolderOrZipPath(tl.getVariable('System.DefaultWorkingDirectory'), true);
if(isFolderBasedDeployment) {
tl.cp(path.join(webDeployPkg, '/*'), folderPath, '-rf', false);
}
else {
await zipUtility.unzip(webDeployPkg, folderPath);
}
if(xmlTransformation) {
var environmentName = tl.getVariable('Release.EnvironmentName');
if(tl.osType().match(/^Win/)) {
var transformConfigs = ["Release.config"];
if(environmentName) {
transformConfigs.push(environmentName + ".config");
}
xdtTransformationUtility.basicXdtTransformation(folderPath, transformConfigs);
console.log(tl.loc("XDTTransformationsappliedsuccessfully"));
}
else {
throw new Error(tl.loc("CannotPerformXdtTransformationOnNonWindowsPlatform"));
}
}
if(xmlVariableSubstitution) {
await xmlSubstitutionUtility.substituteAppSettingsVariables(folderPath);
console.log(tl.loc('XMLvariablesubstitutionappliedsuccessfully'));
}
if(JSONFiles.length != 0) {
jsonSubstitutionUtility.jsonVariableSubstitution(folderPath, JSONFiles);
console.log(tl.loc('JSONvariablesubstitutionappliedsuccessfully'));
}
if(isFolderBasedDeployment) {
tempPackagePath = folderPath;
webDeployPkg = folderPath;
}
else {
var tempWebPackageZip = utility.generateTemporaryFolderOrZipPath(tl.getVariable('System.DefaultWorkingDirectory'), false);
webDeployPkg = await zipUtility.archiveFolder(folderPath, "", tempWebPackageZip);
tempPackagePath = webDeployPkg;
tl.rmRF(folderPath, true);
}
return {
"webDeployPkg": webDeployPkg,
"tempPackagePath": tempPackagePath
};
}
示例2: deployWebPackage
public async deployWebPackage(packagePath: string, physicalPath: string, virtualPath: string, appOffline?: boolean): Promise<void> {
physicalPath = physicalPath ? physicalPath : physicalRootPath;
try {
if(appOffline) {
await this._appOfflineKuduService(physicalPath, true);
tl.debug('Wait for 10 seconds for app_offline to take effect');
await webClient.sleepFor(10);
}
if(tl.stats(packagePath).isDirectory()) {
let tempPackagePath = deployUtility.generateTemporaryFolderOrZipPath(tl.getVariable('AGENT.TEMPDIRECTORY'), false);
packagePath = await zipUtility.archiveFolder(packagePath, "", tempPackagePath);
tl.debug("Compressed folder " + packagePath + " into zip : " + packagePath);
}
else if(packagePath.toLowerCase().endsWith('.war')) {
physicalPath = await this._warFileDeployment(packagePath, physicalPath, virtualPath);
}
await this._appServiceKuduService.extractZIP(packagePath, physicalPath);
if(appOffline) {
await this._appOfflineKuduService(physicalPath, false);
}
console.log(tl.loc("Successfullydeployedpackageusingkuduserviceat", packagePath, physicalPath));
}
catch(error) {
tl.error(tl.loc('PackageDeploymentFailed'));
throw Error(error);
}
}
示例3: containsParamFile
export async function containsParamFile(webAppPackage: string ) {
var isParamFilePresent = false;
var pacakgeComponent = await zipUtility.getArchivedEntries(webAppPackage);
if ((pacakgeComponent["entries"].indexOf("parameters.xml") > -1) || (pacakgeComponent["entries"].indexOf("Parameters.xml") > -1)) {
isParamFilePresent = true;
}
tl.debug(tl.loc("Isparameterfilepresentinwebpackage0", isParamFilePresent));
return isParamFilePresent;
}
示例4: isMSDeployPackage
export async function isMSDeployPackage(webAppPackage: string ) {
var isParamFilePresent = false;
var pacakgeComponent = await zipUtility.getArchivedEntries(webAppPackage);
if (((pacakgeComponent["entries"].indexOf("parameters.xml") > -1) || (pacakgeComponent["entries"].indexOf("Parameters.xml") > -1)) &&
((pacakgeComponent["entries"].indexOf("systemInfo.xml") > -1) || (pacakgeComponent["entries"].indexOf("systeminfo.xml") > -1) || (pacakgeComponent["entries"].indexOf("SystemInfo.xml") > -1))) {
isParamFilePresent = true;
}
tl.debug("Is the package an msdeploy package : " + isParamFilePresent);
return isParamFilePresent;
}
示例5: generateTemporaryFolderForDeployment
export async function generateTemporaryFolderForDeployment(isFolderBasedDeployment: boolean, webDeployPkg: string) {
var folderPath = generateTemporaryFolderOrZipPath(tl.getVariable('System.DefaultWorkingDirectory'), true);
if(isFolderBasedDeployment) {
tl.debug('Copying Web Packge: ' + webDeployPkg + ' to temporary location: ' + folderPath);
copyDirectory(webDeployPkg, folderPath);
tl.debug('Copied Web Package: ' + webDeployPkg + ' to temporary location: ' + folderPath + ' successfully.');
}
else {
await zipUtility.unzip(webDeployPkg, folderPath);
}
return folderPath;
}
示例6: zipDeploy
public async zipDeploy(packagePath: string, appOffline?: boolean, customMessage?: any): Promise<string> {
try {
console.log(tl.loc('PackageDeploymentInitiated'));
await this._preZipDeployOperation();
if(tl.stats(packagePath).isDirectory()) {
let tempPackagePath = deployUtility.generateTemporaryFolderOrZipPath(tl.getVariable('AGENT.TEMPDIRECTORY'), false);
packagePath = await zipUtility.archiveFolder(packagePath, "", tempPackagePath);
tl.debug("Compressed folder " + packagePath + " into zip : " + packagePath);
}
if(appOffline) {
await this._appOfflineKuduService(physicalRootPath, true);
tl.debug('Wait for 10 seconds for app_offline to take effect');
await webClient.sleepFor(10);
}
let queryParameters: Array<string> = [
'isAsync=true',
'deployer=' + VSTS_ZIP_DEPLOY
];
let deploymentDetails = await this._appServiceKuduService.zipDeploy(packagePath, queryParameters);
try {
var kuduDeploymentDetails = await this._appServiceKuduService.getDeploymentDetails(deploymentDetails.id);
tl.debug(`logs from ZIP deploy: ${kuduDeploymentDetails.log_url}`);
await this._printZipDeployLogs(kuduDeploymentDetails.log_url);
}
catch(error) {
tl.debug(`Unable to fetch logs for kudu ZIP Deploy: ${JSON.stringify(error)}`)
}
if(deploymentDetails.status == KUDU_DEPLOYMENT_CONSTANTS.FAILED) {
throw tl.loc('PackageDeploymentUsingZipDeployFailed');
}
if(appOffline) {
await this._appOfflineKuduService(physicalRootPath, false);
}
console.log(tl.loc('PackageDeploymentSuccess'));
return deploymentDetails.id;
}
catch(error) {
tl.error(tl.loc('PackageDeploymentFailed'));
throw Error(error);
}
}
示例7: archiveFolderForDeployment
export async function archiveFolderForDeployment(isFolderBasedDeployment: boolean, folderPath: string) {
var webDeployPkg;
if(isFolderBasedDeployment) {
webDeployPkg = folderPath;
}
else {
var tempWebPackageZip = generateTemporaryFolderOrZipPath(tl.getVariable('System.DefaultWorkingDirectory'), false);
webDeployPkg = await zipUtility.archiveFolder(folderPath, "", tempWebPackageZip);
}
return {
"webDeployPkg": webDeployPkg,
"tempPackagePath": webDeployPkg
};
}
示例8: isMSBuildPackage
public async isMSBuildPackage(): Promise<boolean> {
if(this._isMSBuildPackage == undefined) {
this._isMSBuildPackage = false;
if(this.getPackageType() != PackageType.folder) {
var pacakgeComponent = await zipUtility.getArchivedEntries(this._path);
if (((pacakgeComponent["entries"].indexOf("parameters.xml") > -1) || (pacakgeComponent["entries"].indexOf("Parameters.xml") > -1)) &&
((pacakgeComponent["entries"].indexOf("systemInfo.xml") > -1) || (pacakgeComponent["entries"].indexOf("systeminfo.xml") > -1)
|| (pacakgeComponent["entries"].indexOf("SystemInfo.xml") > -1))) {
this._isMSBuildPackage = true;
}
}
tl.debug("Is the package an msdeploy package : " + this._isMSBuildPackage);
}
return this._isMSBuildPackage;
}
示例9: DeployWebAppStep
public async DeployWebAppStep() {
let deploymentMethodtelemetry = '{"deploymentMethod":"Zip Deploy"}';
console.log("##vso[telemetry.publish area=TaskDeploymentMethod;feature=AzureWebAppDeployment]" + deploymentMethodtelemetry);
var webPackage = await FileTransformsUtility.applyTransformations(this.taskParams.Package.getPath(), this.taskParams);
if(this.taskParams.UseWebDeploy && this.taskParams.DeploymentType === DeploymentType.zipDeploy) {
var _isMSBuildPackage = await this.taskParams.Package.isMSBuildPackage();
if(_isMSBuildPackage) {
throw Error(tl.loc("Publishusingzipdeploynotsupportedformsbuildpackage"));
}
else if(this.taskParams.VirtualApplication) {
throw Error(tl.loc("Publishusingzipdeploynotsupportedforvirtualapplication"));
}
else if(this.taskParams.Package.getPackageType() === PackageType.war) {
throw Error(tl.loc("Publishusingzipdeploydoesnotsupportwarfile"));
}
}
if(tl.stats(webPackage).isDirectory()) {
let tempPackagePath = deployUtility.generateTemporaryFolderOrZipPath(tl.getVariable('AGENT.TEMPDIRECTORY'), false);
webPackage = await zipUtility.archiveFolder(webPackage, "", tempPackagePath);
tl.debug("Compressed folder into zip " + webPackage);
}
tl.debug("Initiated deployment via kudu service for webapp package : ");
var updateApplicationSetting = ParameterParser.parse(removeRunFromZipAppSetting)
var deleteApplicationSetting = ParameterParser.parse(deleteOldRunFromZipAppSetting)
var isNewValueUpdated: boolean = await this.appServiceUtility.updateAndMonitorAppSettings(updateApplicationSetting, deleteApplicationSetting);
if(!isNewValueUpdated) {
await this.kuduServiceUtility.warmpUp();
}
this.zipDeploymentID = await this.kuduServiceUtility.deployUsingZipDeploy(webPackage, this.taskParams.TakeAppOfflineFlag,
{ slotName: this.appService.getSlot() });
await this.PostDeploymentStep();
}
示例10: 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);
}
}
}