Skip to content

Commit

Permalink
v1.4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
patelchandni committed Aug 24, 2021
1 parent 615e485 commit 3e3ebc3
Show file tree
Hide file tree
Showing 8,147 changed files with 1,700,246 additions and 0 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
8 changes: 8 additions & 0 deletions lib/constants/authentication_type.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.AuthenticationType = void 0;
var AuthenticationType;
(function (AuthenticationType) {
AuthenticationType[AuthenticationType["Rbac"] = 1] = "Rbac";
AuthenticationType[AuthenticationType["Scm"] = 2] = "Scm";
})(AuthenticationType = exports.AuthenticationType || (exports.AuthenticationType = {}));
24 changes: 24 additions & 0 deletions lib/constants/configuration.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ConfigurationConstant = void 0;
class ConfigurationConstant {
}
exports.ConfigurationConstant = ConfigurationConstant;
ConfigurationConstant.ParamInAppName = 'app-name';
ConfigurationConstant.ParamInPackagePath = 'package';
ConfigurationConstant.ParamInSlot = 'slot-name';
ConfigurationConstant.ParamInPublishProfile = 'publish-profile';
ConfigurationConstant.ParamInRespectPomXml = 'respect-pom-xml';
ConfigurationConstant.ParamInRespectFuncignore = 'respect-funcignore';
ConfigurationConstant.ParamInEnableOryxBuild = 'enable-oryx-build';
ConfigurationConstant.ParamInScmDoBuildDuringDeployment = 'scm-do-build-during-deployment';
ConfigurationConstant.ParamOutResultName = 'app-url';
ConfigurationConstant.ActionName = 'DeployFunctionAppToAzure';
ConfigurationConstant.BlobContainerName = 'github-actions-deploy';
ConfigurationConstant.BlobNamePrefix = 'Functionapp';
ConfigurationConstant.BlobServiceTimeoutMs = 3 * 1000;
ConfigurationConstant.BlobUploadTimeoutMs = 30 * 60 * 1000;
ConfigurationConstant.BlobUploadBlockSizeByte = 4 * 1024 * 1024;
ConfigurationConstant.BlobUplaodBlockParallel = 4;
ConfigurationConstant.BlobPermission = 'r';
ConfigurationConstant.ProductionSlotName = 'production';
35 changes: 35 additions & 0 deletions lib/constants/enable_oryx_build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.EnableOryxBuildUtil = exports.EnableOryxBuildConstant = void 0;
const exceptions_1 = require("../exceptions");
const parser_1 = require("../utils/parser");
var EnableOryxBuildConstant;
(function (EnableOryxBuildConstant) {
EnableOryxBuildConstant[EnableOryxBuildConstant["NotSet"] = 0] = "NotSet";
EnableOryxBuildConstant[EnableOryxBuildConstant["Enabled"] = 1] = "Enabled";
EnableOryxBuildConstant[EnableOryxBuildConstant["Disabled"] = 2] = "Disabled";
})(EnableOryxBuildConstant = exports.EnableOryxBuildConstant || (exports.EnableOryxBuildConstant = {}));
class EnableOryxBuildUtil {
static FromString(setting) {
if (setting.trim() === '') {
return EnableOryxBuildConstant.NotSet;
}
if (parser_1.Parser.IsTrueLike(setting)) {
return EnableOryxBuildConstant.Enabled;
}
if (parser_1.Parser.IsFalseLike(setting)) {
return EnableOryxBuildConstant.Disabled;
}
throw new exceptions_1.UnexpectedConversion("EnableOryxBuild", setting);
}
static ToString(setting) {
if (setting === EnableOryxBuildConstant.Enabled) {
return 'true';
}
if (setting === EnableOryxBuildConstant.Disabled) {
return 'false';
}
return undefined;
}
}
exports.EnableOryxBuildUtil = EnableOryxBuildUtil;
32 changes: 32 additions & 0 deletions lib/constants/function_runtime.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.FunctionRuntimeUtil = exports.FunctionRuntimeConstant = void 0;
const exceptions_1 = require("../exceptions");
var FunctionRuntimeConstant;
(function (FunctionRuntimeConstant) {
FunctionRuntimeConstant[FunctionRuntimeConstant["None"] = 1] = "None";
FunctionRuntimeConstant[FunctionRuntimeConstant["Dotnet"] = 2] = "Dotnet";
FunctionRuntimeConstant[FunctionRuntimeConstant["DotnetIsolated"] = 3] = "DotnetIsolated";
FunctionRuntimeConstant[FunctionRuntimeConstant["Node"] = 4] = "Node";
FunctionRuntimeConstant[FunctionRuntimeConstant["Powershell"] = 5] = "Powershell";
FunctionRuntimeConstant[FunctionRuntimeConstant["Java"] = 6] = "Java";
FunctionRuntimeConstant[FunctionRuntimeConstant["Python"] = 7] = "Python";
FunctionRuntimeConstant[FunctionRuntimeConstant["Custom"] = 8] = "Custom";
})(FunctionRuntimeConstant = exports.FunctionRuntimeConstant || (exports.FunctionRuntimeConstant = {}));
class FunctionRuntimeUtil {
static FromString(language) {
if (language === undefined) {
return FunctionRuntimeConstant.None;
}
let key = "";
language.split('-').forEach(element => {
key += element.charAt(0).toUpperCase() + element.toLowerCase().slice(1);
});
const result = FunctionRuntimeConstant[key];
if (result === undefined) {
throw new exceptions_1.UnexpectedConversion('FunctionRuntimeConstant', language);
}
return result;
}
}
exports.FunctionRuntimeUtil = FunctionRuntimeUtil;
22 changes: 22 additions & 0 deletions lib/constants/function_sku.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.FunctionSkuUtil = exports.FunctionSkuConstant = void 0;
var FunctionSkuConstant;
(function (FunctionSkuConstant) {
FunctionSkuConstant[FunctionSkuConstant["Consumption"] = 1] = "Consumption";
FunctionSkuConstant[FunctionSkuConstant["Dedicated"] = 2] = "Dedicated";
FunctionSkuConstant[FunctionSkuConstant["ElasticPremium"] = 3] = "ElasticPremium";
})(FunctionSkuConstant = exports.FunctionSkuConstant || (exports.FunctionSkuConstant = {}));
class FunctionSkuUtil {
static FromString(sku) {
const skuLowercasedString = sku.trim().toLowerCase();
if (skuLowercasedString.startsWith('dynamic')) {
return FunctionSkuConstant.Consumption;
}
if (skuLowercasedString.startsWith('elasticpremium')) {
return FunctionSkuConstant.ElasticPremium;
}
return FunctionSkuConstant.Dedicated;
}
}
exports.FunctionSkuUtil = FunctionSkuUtil;
11 changes: 11 additions & 0 deletions lib/constants/log_level.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.LogLevelConstant = void 0;
var LogLevelConstant;
(function (LogLevelConstant) {
LogLevelConstant[LogLevelConstant["Debug"] = 1] = "Debug";
LogLevelConstant[LogLevelConstant["Info"] = 2] = "Info";
LogLevelConstant[LogLevelConstant["Warning"] = 3] = "Warning";
LogLevelConstant[LogLevelConstant["Error"] = 4] = "Error";
LogLevelConstant[LogLevelConstant["Off"] = 5] = "Off";
})(LogLevelConstant = exports.LogLevelConstant || (exports.LogLevelConstant = {}));
10 changes: 10 additions & 0 deletions lib/constants/publish_method.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PublishMethodConstant = void 0;
var PublishMethodConstant;
(function (PublishMethodConstant) {
// Using api/zipdeploy endpoint in scm site
PublishMethodConstant[PublishMethodConstant["ZipDeploy"] = 1] = "ZipDeploy";
// Setting WEBSITE_RUN_FROM_PACKAGE app setting
PublishMethodConstant[PublishMethodConstant["WebsiteRunFromPackageDeploy"] = 2] = "WebsiteRunFromPackageDeploy";
})(PublishMethodConstant = exports.PublishMethodConstant || (exports.PublishMethodConstant = {}));
24 changes: 24 additions & 0 deletions lib/constants/runtime_stack.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.RuntimeStackUtil = exports.RuntimeStackConstant = void 0;
const exceptions_1 = require("../exceptions");
var RuntimeStackConstant;
(function (RuntimeStackConstant) {
RuntimeStackConstant[RuntimeStackConstant["Unknown"] = 0] = "Unknown";
RuntimeStackConstant[RuntimeStackConstant["Windows"] = 1] = "Windows";
RuntimeStackConstant[RuntimeStackConstant["Linux"] = 2] = "Linux";
})(RuntimeStackConstant = exports.RuntimeStackConstant || (exports.RuntimeStackConstant = {}));
class RuntimeStackUtil {
static FromString(osType) {
if (!osType) {
return RuntimeStackConstant.Unknown;
}
const key = osType.charAt(0).toUpperCase() + osType.toLowerCase().slice(1);
const result = RuntimeStackConstant[key];
if (result === undefined) {
throw new exceptions_1.UnexpectedConversion("RuntimeStackConstant", osType);
}
return result;
}
}
exports.RuntimeStackUtil = RuntimeStackUtil;
35 changes: 35 additions & 0 deletions lib/constants/scm_build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ScmBuildUtil = exports.ScmBuildConstant = void 0;
const exceptions_1 = require("../exceptions");
const parser_1 = require("../utils/parser");
var ScmBuildConstant;
(function (ScmBuildConstant) {
ScmBuildConstant[ScmBuildConstant["NotSet"] = 0] = "NotSet";
ScmBuildConstant[ScmBuildConstant["Enabled"] = 1] = "Enabled";
ScmBuildConstant[ScmBuildConstant["Disabled"] = 2] = "Disabled";
})(ScmBuildConstant = exports.ScmBuildConstant || (exports.ScmBuildConstant = {}));
class ScmBuildUtil {
static FromString(setting) {
if (setting.trim() === '') {
return ScmBuildConstant.NotSet;
}
if (parser_1.Parser.IsTrueLike(setting)) {
return ScmBuildConstant.Enabled;
}
if (parser_1.Parser.IsFalseLike(setting)) {
return ScmBuildConstant.Disabled;
}
throw new exceptions_1.UnexpectedConversion("ScmDoBuildDuringDeployment", setting);
}
static ToString(setting) {
if (setting === ScmBuildConstant.Enabled) {
return 'true';
}
if (setting === ScmBuildConstant.Disabled) {
return 'false';
}
return undefined;
}
}
exports.ScmBuildUtil = ScmBuildUtil;
22 changes: 22 additions & 0 deletions lib/constants/state.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.StateConstant = void 0;
var StateConstant;
(function (StateConstant) {
// State when initialize Github Action
StateConstant[StateConstant["Initialize"] = 1] = "Initialize";
// Get & Check the parameter from action.yml
StateConstant[StateConstant["ValidateParameter"] = 2] = "ValidateParameter";
// Get & Check if the resources does exist
StateConstant[StateConstant["ValidateAzureResource"] = 3] = "ValidateAzureResource";
// Zip content and choose the proper deployment method
StateConstant[StateConstant["PreparePublishContent"] = 4] = "PreparePublishContent";
// Publish content to Azure Functionapps
StateConstant[StateConstant["PublishContent"] = 5] = "PublishContent";
// Validate if the content has been published successfully
StateConstant[StateConstant["ValidatePublishedContent"] = 6] = "ValidatePublishedContent";
// End state with success
StateConstant[StateConstant["Succeeded"] = 7] = "Succeeded";
// End state with failure
StateConstant[StateConstant["Failed"] = 8] = "Failed";
})(StateConstant = exports.StateConstant || (exports.StateConstant = {}));
105 changes: 105 additions & 0 deletions lib/exceptions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.AzureResourceError = exports.WebRequestError = exports.FileIOError = exports.ValidationError = exports.ChangeContextException = exports.ChangeParamsException = exports.InvocationException = exports.ExecutionException = exports.UnexpectedConversion = exports.UnexpectedExitException = exports.NotImplementedException = exports.BaseException = void 0;
const state_1 = require("./constants/state");
class BaseException extends Error {
constructor(message = undefined, innerException = undefined) {
super();
this._innerException = innerException ? innerException : undefined;
this.message = message ? message : "";
}
GetInnerException() {
return this._innerException;
}
GetTraceback() {
let errorMessages = [this.message];
let innerException = this._innerException;
while (innerException !== undefined && innerException instanceof BaseException) {
errorMessages.push(innerException.message);
innerException = innerException._innerException;
}
if (innerException !== undefined && innerException instanceof Error) {
errorMessages.push(innerException.message);
errorMessages.push(innerException.stack);
}
else if (innerException !== undefined) {
errorMessages.push(String(innerException));
}
return errorMessages;
}
PrintTraceback(printer) {
const traceback = this.GetTraceback();
for (let i = 0; i < traceback.length; i++) {
const prefix = " ".repeat(i * 2);
printer(`${prefix}${traceback[i]}`);
}
}
}
exports.BaseException = BaseException;
class NotImplementedException extends BaseException {
}
exports.NotImplementedException = NotImplementedException;
class UnexpectedExitException extends BaseException {
constructor(state = state_1.StateConstant.Failed) {
super(state_1.StateConstant[state]);
}
}
exports.UnexpectedExitException = UnexpectedExitException;
class UnexpectedConversion extends BaseException {
constructor(constantField, value) {
super(`Failed to convert ${value} to ${constantField}`);
}
}
exports.UnexpectedConversion = UnexpectedConversion;
class ExecutionException extends BaseException {
constructor(state, executionStage, innerException) {
let errorMessage = `Execution Exception (state: ${state_1.StateConstant[state]})`;
if (executionStage !== undefined) {
errorMessage += ` (step: ${executionStage})`;
}
super(errorMessage, innerException);
}
}
exports.ExecutionException = ExecutionException;
class InvocationException extends ExecutionException {
constructor(state, innerException) {
super(state, "Invocation", innerException);
}
}
exports.InvocationException = InvocationException;
class ChangeParamsException extends ExecutionException {
constructor(state, innerException) {
super(state, "ChangeParams", innerException);
}
}
exports.ChangeParamsException = ChangeParamsException;
class ChangeContextException extends ExecutionException {
constructor(state, innerException) {
super(state, "ChangeContext", innerException);
}
}
exports.ChangeContextException = ChangeContextException;
class ValidationError extends BaseException {
constructor(state, field, expectation, innerException) {
super(`At ${state_1.StateConstant[state]}, ${field} : ${expectation}.`, innerException);
}
}
exports.ValidationError = ValidationError;
class FileIOError extends BaseException {
constructor(state, action, message, innerException) {
super(`When performing file operation at ${state_1.StateConstant[state]}, ${action} : ${message}`, innerException);
}
}
exports.FileIOError = FileIOError;
class WebRequestError extends BaseException {
constructor(url, verb, message, innerException) {
super(`When [${verb}] ${url}, error: ${message}`, innerException);
}
}
exports.WebRequestError = WebRequestError;
class AzureResourceError extends BaseException {
constructor(state, action, message, innerException) {
super(`When request Azure resource at ${state_1.StateConstant[state]}, ${action} : ${message}`, innerException);
}
}
exports.AzureResourceError = AzureResourceError;
Loading

0 comments on commit 3e3ebc3

Please sign in to comment.