Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ inputs:
restart:
description: 'Restart the app service after deployment'
required: false
deployment-method:
description: 'Deployment method (OneDeploy, ZipDeploy)'
default: 'OneDeploy'
required: false

outputs:
webapp-url:
Expand Down
24 changes: 17 additions & 7 deletions lib/ActionInputValidator/Validations.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
Expand Down
8 changes: 8 additions & 0 deletions lib/DeploymentMethod.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DeploymentMethod = void 0;
var DeploymentMethod;
(function (DeploymentMethod) {
DeploymentMethod["OneDeploy"] = "OneDeploy";
DeploymentMethod["ZipDeploy"] = "ZipDeploy";
})(DeploymentMethod || (exports.DeploymentMethod = DeploymentMethod = {}));
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
Expand Down
40 changes: 31 additions & 9 deletions lib/DeploymentProvider/Providers/WebAppDeploymentProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
Expand All @@ -39,11 +49,16 @@ const zipUtility = __importStar(require("azure-actions-utility/ziputility.js"));
const packageUtility_1 = require("azure-actions-utility/packageUtility");
const BaseWebAppDeploymentProvider_1 = require("./BaseWebAppDeploymentProvider");
const AnnotationUtility_1 = require("azure-actions-appservice-rest/Utilities/AnnotationUtility");
const DeploymentMethod_1 = require("../../DeploymentMethod");
class WebAppDeploymentProvider extends BaseWebAppDeploymentProvider_1.BaseWebAppDeploymentProvider {
DeployWebAppStep() {
return __awaiter(this, void 0, void 0, function* () {
let appPackage = this.actionParams.package;
let webPackage = appPackage.getPath();
let packageType = appPackage.getPackageType();
if (this.actionParams.deploymentMethod === DeploymentMethod_1.DeploymentMethod.ZipDeploy && packageType !== packageUtility_1.PackageType.zip) {
core.error("ZipDeploy method can only be used with zip packages. Use OneDeploy deployment method for other package types.");
}
const validTypes = ["war", "jar", "ear", "zip", "static"];
// kudu warm up
yield this.kuduServiceUtility.warmpUp();
Expand All @@ -53,7 +68,6 @@ class WebAppDeploymentProvider extends BaseWebAppDeploymentProvider_1.BaseWebApp
}
else {
// Retains the old behavior of determining the package type from the file extension if valid type is not defined
let packageType = appPackage.getPackageType();
switch (packageType) {
case packageUtility_1.PackageType.war:
core.debug("Initiated deployment via kudu service for webapp war package : " + webPackage);
Expand All @@ -78,7 +92,15 @@ class WebAppDeploymentProvider extends BaseWebAppDeploymentProvider_1.BaseWebApp
throw new Error('Invalid App Service package: ' + webPackage + ' or type provided: ' + this.actionParams.type);
}
}
this.deploymentID = yield this.kuduServiceUtility.deployUsingOneDeploy(webPackage, { slotName: this.actionParams.slotName, commitMessage: this.actionParams.commitMessage }, this.actionParams.targetPath, this.actionParams.type, this.actionParams.clean, this.actionParams.restart);
switch (this.actionParams.deploymentMethod) {
case DeploymentMethod_1.DeploymentMethod.ZipDeploy:
core.info('Deploying using ZipDeploy method.');
this.deploymentID = yield this.kuduServiceUtility.deployUsingZipDeploy(webPackage, { slotName: this.actionParams.slotName, commitMessage: this.actionParams.commitMessage });
break;
default:
core.info('Deploying using OneDeploy method.');
this.deploymentID = yield this.kuduServiceUtility.deployUsingOneDeploy(webPackage, { slotName: this.actionParams.slotName, commitMessage: this.actionParams.commitMessage }, this.actionParams.targetPath, this.actionParams.type, this.actionParams.clean, this.actionParams.restart);
}
// updating startup command
if (!!this.actionParams.startupCommand) {
yield this.updateStartupCommand();
Expand Down
31 changes: 24 additions & 7 deletions lib/actionparameters.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.ActionParameters = exports.appKindMap = exports.WebAppKind = void 0;
const core = __importStar(require("@actions/core"));
Expand Down Expand Up @@ -51,6 +61,7 @@ class ActionParameters {
this._multiContainerConfigFile = core.getInput('configuration-file');
this._startupCommand = core.getInput('startup-command');
this._resourceGroupName = core.getInput('resource-group-name');
this._deploymentMethod = core.getInput('deployment-method');
/**
* Trimming the commit message because it is used as a param in uri of deployment api. And sometimes, it exceeds the max length of http URI.
*/
Expand Down Expand Up @@ -95,6 +106,12 @@ class ActionParameters {
set resourceGroupName(rg) {
this._resourceGroupName = rg;
}
get deploymentMethod() {
return this._deploymentMethod;
}
set deploymentMethod(deploymentMethod) {
this._deploymentMethod = deploymentMethod;
}
get kind() {
return this._kind;
}
Expand Down
24 changes: 17 additions & 7 deletions lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
Expand Down
Loading