-
Notifications
You must be signed in to change notification settings - Fork 199
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Users/balaga gayatri/multi container master (#171)
* added multicontainer support for linux * resolve conflicts * Update PublishProfileWebAppValidator.js * Update SpnLinuxContainerWebAppValidator.js * Update SpnWindowsContainerWebAppValidator.js * Update SpnWindowsWebAppValidator.js * Update WebAppContainerDeployment.js * Update Validations.js * Update Validations.js * Update PublishProfileWebAppContainerDeploymentProvider.js * Update PublishProfileContainerWebAppValidator.js * added necessary conditions
- Loading branch information
1 parent
676ed2b
commit 493beb3
Showing
4 changed files
with
117 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,84 +1,84 @@ | ||
"use strict"; | ||
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) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const actionparameters_1 = require("../actionparameters"); | ||
const AzureResourceFilterUtility_1 = require("azure-actions-appservice-rest/Utilities/AzureResourceFilterUtility"); | ||
const BaseWebAppDeploymentProvider_1 = require("../DeploymentProvider/Providers/BaseWebAppDeploymentProvider"); | ||
const PublishProfileWebAppValidator_1 = require("./ActionValidators/PublishProfileWebAppValidator"); | ||
const PublishProfileContainerWebAppValidator_1 = require("./ActionValidators/PublishProfileContainerWebAppValidator"); | ||
const SpnLinuxContainerWebAppValidator_1 = require("./ActionValidators/SpnLinuxContainerWebAppValidator"); | ||
const SpnLinuxWebAppValidator_1 = require("./ActionValidators/SpnLinuxWebAppValidator"); | ||
const SpnWindowsContainerWebAppValidator_1 = require("./ActionValidators/SpnWindowsContainerWebAppValidator"); | ||
const SpnWindowsWebAppValidator_1 = require("./ActionValidators/SpnWindowsWebAppValidator"); | ||
const Validations_1 = require("./Validations"); | ||
const PublishProfile_1 = require("../Utilities/PublishProfile"); | ||
const RuntimeConstants_1 = __importDefault(require("../RuntimeConstants")); | ||
class ValidatorFactory { | ||
static getValidator(type) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
let actionParams = actionparameters_1.ActionParameters.getActionParams(); | ||
if (type === BaseWebAppDeploymentProvider_1.DEPLOYMENT_PROVIDER_TYPES.PUBLISHPROFILE) { | ||
if (!!actionParams.images) { | ||
yield this.setResourceDetails(actionParams); | ||
return new PublishProfileContainerWebAppValidator_1.PublishProfileContainerWebAppValidator(); | ||
} | ||
else { | ||
return new PublishProfileWebAppValidator_1.PublishProfileWebAppValidator(); | ||
} | ||
} | ||
else if (type == BaseWebAppDeploymentProvider_1.DEPLOYMENT_PROVIDER_TYPES.SPN) { | ||
// app-name is required to get resource details | ||
Validations_1.appNameIsRequired(actionParams.appName); | ||
yield this.getResourceDetails(actionParams); | ||
if (!!actionParams.isLinux) { | ||
if (!!actionParams.images) { | ||
return new SpnLinuxContainerWebAppValidator_1.SpnLinuxContainerWebAppValidator(); | ||
} | ||
else { | ||
return new SpnLinuxWebAppValidator_1.SpnLinuxWebAppValidator(); | ||
} | ||
} | ||
else { | ||
if (!!actionParams.images) { | ||
return new SpnWindowsContainerWebAppValidator_1.SpnWindowsContainerWebAppValidator(); | ||
} | ||
else { | ||
return new SpnWindowsWebAppValidator_1.SpnWindowsWebAppValidator(); | ||
} | ||
} | ||
} | ||
else { | ||
throw new Error("Valid credentails are not available. Add Azure Login action before this action or provide publish-profile input."); | ||
} | ||
}); | ||
} | ||
static getResourceDetails(params) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
let appDetails = yield AzureResourceFilterUtility_1.AzureResourceFilterUtility.getAppDetails(params.endpoint, params.appName); | ||
params.resourceGroupName = appDetails["resourceGroupName"]; | ||
params.realKind = appDetails["kind"]; | ||
params.kind = actionparameters_1.appKindMap.get(params.realKind); | ||
//app kind linux and kubeapp is supported only on linux environment currently | ||
params.isLinux = params.realKind.indexOf("linux") > -1 || params.realKind.indexOf("kubeapp") > -1; | ||
}); | ||
} | ||
static setResourceDetails(actionParams) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const publishProfile = PublishProfile_1.PublishProfile.getPublishProfile(actionParams.publishProfileContent); | ||
const appOS = yield publishProfile.getAppOS(); | ||
actionParams.isLinux = appOS.includes(RuntimeConstants_1.default.Unix) || appOS.includes(RuntimeConstants_1.default.Unix.toLowerCase()); | ||
}); | ||
} | ||
} | ||
exports.ValidatorFactory = ValidatorFactory; | ||
"use strict"; | ||
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) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const actionparameters_1 = require("../actionparameters"); | ||
const AzureResourceFilterUtility_1 = require("azure-actions-appservice-rest/Utilities/AzureResourceFilterUtility"); | ||
const BaseWebAppDeploymentProvider_1 = require("../DeploymentProvider/Providers/BaseWebAppDeploymentProvider"); | ||
const PublishProfileWebAppValidator_1 = require("./ActionValidators/PublishProfileWebAppValidator"); | ||
const PublishProfileContainerWebAppValidator_1 = require("./ActionValidators/PublishProfileContainerWebAppValidator"); | ||
const SpnLinuxContainerWebAppValidator_1 = require("./ActionValidators/SpnLinuxContainerWebAppValidator"); | ||
const SpnLinuxWebAppValidator_1 = require("./ActionValidators/SpnLinuxWebAppValidator"); | ||
const SpnWindowsContainerWebAppValidator_1 = require("./ActionValidators/SpnWindowsContainerWebAppValidator"); | ||
const SpnWindowsWebAppValidator_1 = require("./ActionValidators/SpnWindowsWebAppValidator"); | ||
const Validations_1 = require("./Validations"); | ||
const PublishProfile_1 = require("../Utilities/PublishProfile"); | ||
const RuntimeConstants_1 = __importDefault(require("../RuntimeConstants")); | ||
class ValidatorFactory { | ||
static getValidator(type) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
let actionParams = actionparameters_1.ActionParameters.getActionParams(); | ||
if (type === BaseWebAppDeploymentProvider_1.DEPLOYMENT_PROVIDER_TYPES.PUBLISHPROFILE) { | ||
if (!!actionParams.images) { | ||
yield this.setResourceDetails(actionParams); | ||
return new PublishProfileContainerWebAppValidator_1.PublishProfileContainerWebAppValidator(); | ||
} | ||
else { | ||
return new PublishProfileWebAppValidator_1.PublishProfileWebAppValidator(); | ||
} | ||
} | ||
else if (type == BaseWebAppDeploymentProvider_1.DEPLOYMENT_PROVIDER_TYPES.SPN) { | ||
// app-name is required to get resource details | ||
Validations_1.appNameIsRequired(actionParams.appName); | ||
yield this.getResourceDetails(actionParams); | ||
if (!!actionParams.isLinux) { | ||
if (!!actionParams.images || !!actionParams.multiContainerConfigFile) { | ||
return new SpnLinuxContainerWebAppValidator_1.SpnLinuxContainerWebAppValidator(); | ||
} | ||
else { | ||
return new SpnLinuxWebAppValidator_1.SpnLinuxWebAppValidator(); | ||
} | ||
} | ||
else { | ||
if (!!actionParams.images) { | ||
return new SpnWindowsContainerWebAppValidator_1.SpnWindowsContainerWebAppValidator(); | ||
} | ||
else { | ||
return new SpnWindowsWebAppValidator_1.SpnWindowsWebAppValidator(); | ||
} | ||
} | ||
} | ||
else { | ||
throw new Error("Valid credentials are not available. Add Azure Login action before this action or provide publish-profile input."); | ||
} | ||
}); | ||
} | ||
static getResourceDetails(params) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
let appDetails = yield AzureResourceFilterUtility_1.AzureResourceFilterUtility.getAppDetails(params.endpoint, params.appName); | ||
params.resourceGroupName = appDetails["resourceGroupName"]; | ||
params.realKind = appDetails["kind"]; | ||
params.kind = actionparameters_1.appKindMap.get(params.realKind); | ||
//app kind linux and kubeapp is supported only on linux environment currently | ||
params.isLinux = params.realKind.indexOf("linux") > -1 || params.realKind.indexOf("kubeapp") > -1; | ||
}); | ||
} | ||
static setResourceDetails(actionParams) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const publishProfile = PublishProfile_1.PublishProfile.getPublishProfile(actionParams.publishProfileContent); | ||
const appOS = yield publishProfile.getAppOS(); | ||
actionParams.isLinux = appOS.includes(RuntimeConstants_1.default.Unix) || appOS.includes(RuntimeConstants_1.default.Unix.toLowerCase()); | ||
}); | ||
} | ||
} | ||
exports.ValidatorFactory = ValidatorFactory; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,31 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const actionparameters_1 = require("../actionparameters"); | ||
const BaseWebAppDeploymentProvider_1 = require("./Providers/BaseWebAppDeploymentProvider"); | ||
const WebAppContainerDeployment_1 = require("./Providers/WebAppContainerDeployment"); | ||
const WebAppDeploymentProvider_1 = require("./Providers/WebAppDeploymentProvider"); | ||
const PublishProfileWebAppContainerDeploymentProvider_1 = require("./Providers/PublishProfileWebAppContainerDeploymentProvider"); | ||
class DeploymentProviderFactory { | ||
static getDeploymentProvider(type) { | ||
if (type === BaseWebAppDeploymentProvider_1.DEPLOYMENT_PROVIDER_TYPES.PUBLISHPROFILE) { | ||
if (!!actionparameters_1.ActionParameters.getActionParams().images) { | ||
return new PublishProfileWebAppContainerDeploymentProvider_1.PublishProfileWebAppContainerDeploymentProvider(type); | ||
} | ||
else { | ||
return new WebAppDeploymentProvider_1.WebAppDeploymentProvider(type); | ||
} | ||
} | ||
else if (type == BaseWebAppDeploymentProvider_1.DEPLOYMENT_PROVIDER_TYPES.SPN) { | ||
if (!!actionparameters_1.ActionParameters.getActionParams().images) { | ||
return new WebAppContainerDeployment_1.WebAppContainerDeploymentProvider(type); | ||
} | ||
else { | ||
return new WebAppDeploymentProvider_1.WebAppDeploymentProvider(type); | ||
} | ||
} | ||
else { | ||
throw new Error("Invalid deployment provider type."); | ||
} | ||
} | ||
} | ||
exports.DeploymentProviderFactory = DeploymentProviderFactory; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const actionparameters_1 = require("../actionparameters"); | ||
const BaseWebAppDeploymentProvider_1 = require("./Providers/BaseWebAppDeploymentProvider"); | ||
const WebAppContainerDeployment_1 = require("./Providers/WebAppContainerDeployment"); | ||
const WebAppDeploymentProvider_1 = require("./Providers/WebAppDeploymentProvider"); | ||
const PublishProfileWebAppContainerDeploymentProvider_1 = require("./Providers/PublishProfileWebAppContainerDeploymentProvider"); | ||
class DeploymentProviderFactory { | ||
static getDeploymentProvider(type) { | ||
if (type === BaseWebAppDeploymentProvider_1.DEPLOYMENT_PROVIDER_TYPES.PUBLISHPROFILE) { | ||
if (!!actionparameters_1.ActionParameters.getActionParams().images) { | ||
return new PublishProfileWebAppContainerDeploymentProvider_1.PublishProfileWebAppContainerDeploymentProvider(type); | ||
} | ||
else { | ||
return new WebAppDeploymentProvider_1.WebAppDeploymentProvider(type); | ||
} | ||
} | ||
else if (type == BaseWebAppDeploymentProvider_1.DEPLOYMENT_PROVIDER_TYPES.SPN) { | ||
if (!!actionparameters_1.ActionParameters.getActionParams().images || (!!actionparameters_1.ActionParameters.getActionParams().isLinux && !!actionparameters_1.ActionParameters.getActionParams().multiContainerConfigFile)) { | ||
return new WebAppContainerDeployment_1.WebAppContainerDeploymentProvider(type); | ||
} | ||
else { | ||
return new WebAppDeploymentProvider_1.WebAppDeploymentProvider(type); | ||
} | ||
} | ||
else { | ||
throw new Error("Invalid deployment provider type."); | ||
} | ||
} | ||
} | ||
exports.DeploymentProviderFactory = DeploymentProviderFactory; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters