Skip to content

Commit 657f070

Browse files
authored
Releases/v3 final release for Sitecontainers (#487)
* Add changes for Sitecontainers deployment (#461) * Add changes for Sitecontainers deployment * Adding changes using single comit * resolved conflicts * Fixed test cases * resolving comments * resolving comments * resolve comments * Release/v3 Sitecontainers Changes * testing changes * test changes * test * test * test * test * update package app service rest * test * nit fix * test * updating design for sidecar * testing new changes * fix validator * fix validator
1 parent 32c5005 commit 657f070

File tree

700 files changed

+1268
-827
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

700 files changed

+1268
-827
lines changed

__tests__/ActionInputValidator/ValidatorFactory.test.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ describe('Test Validator Factory', () => {
2626
jest.spyOn(PublishProfile, 'getPublishProfile').mockImplementation(() => PublishProfile.prototype);
2727
jest.spyOn(PublishProfile.prototype, 'getAppOS').mockImplementation(async() => 'unix');
2828

29-
let validator = await ValidatorFactory.getValidator(type);
30-
expect(validator).toBeInstanceOf(PublishProfileWebAppValidator);
29+
let validators = await ValidatorFactory.getValidator(type);
30+
expect(validators[0]).toBeInstanceOf(PublishProfileWebAppValidator);
3131
});
3232

3333
it("Get Container Validator for Publish Profile auth flow", async() => {
@@ -42,8 +42,8 @@ describe('Test Validator Factory', () => {
4242
jest.spyOn(PublishProfile, 'getPublishProfile').mockImplementation(() => PublishProfile.prototype);
4343
jest.spyOn(PublishProfile.prototype, 'getAppOS').mockImplementation(async() => 'unix');
4444

45-
let validator = await ValidatorFactory.getValidator(type);
46-
expect(validator).toBeInstanceOf(PublishProfileContainerWebAppValidator);
45+
let validators = await ValidatorFactory.getValidator(type);
46+
expect(validators[0]).toBeInstanceOf(PublishProfileContainerWebAppValidator);
4747
});
4848

4949
});
@@ -70,8 +70,8 @@ describe('Test Validator Factory', () => {
7070
};
7171
});
7272

73-
let validator = await ValidatorFactory.getValidator(type);
74-
expect(validator).toBeInstanceOf(SpnLinuxContainerWebAppValidator);
73+
let validators = await ValidatorFactory.getValidator(type);
74+
expect(validators[0]).toBeInstanceOf(SpnLinuxContainerWebAppValidator);
7575
});
7676

7777
it("Get Linux/Kube Code Validator for SPN auth flow", async() => {
@@ -90,8 +90,8 @@ describe('Test Validator Factory', () => {
9090
};
9191
});
9292

93-
let validator = await ValidatorFactory.getValidator(type);
94-
expect(validator).toBeInstanceOf(SpnLinuxWebAppValidator);
93+
let validators = await ValidatorFactory.getValidator(type);
94+
expect(validators[0]).toBeInstanceOf(SpnLinuxWebAppValidator);
9595
});
9696

9797
it("Get Windows Container Validator for SPN auth flow", async() => {
@@ -111,8 +111,8 @@ describe('Test Validator Factory', () => {
111111
};
112112
});
113113

114-
let validator = await ValidatorFactory.getValidator(type);
115-
expect(validator).toBeInstanceOf(SpnWindowsContainerWebAppValidator);
114+
let validators = await ValidatorFactory.getValidator(type);
115+
expect(validators[0]).toBeInstanceOf(SpnWindowsContainerWebAppValidator);
116116
});
117117

118118
it("Get Windows Code Validator for SPN auth flow", async() => {
@@ -131,8 +131,8 @@ describe('Test Validator Factory', () => {
131131
};
132132
});
133133

134-
let validator = await ValidatorFactory.getValidator(type);
135-
expect(validator).toBeInstanceOf(SpnWindowsWebAppValidator);
134+
let validators = await ValidatorFactory.getValidator(type);
135+
expect(validators[0]).toBeInstanceOf(SpnWindowsWebAppValidator);
136136
});
137137

138138
});

__tests__/DeploymentProvider/DeploymentProviderFactory.test.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ describe('Test Deployment Provider Factory', () => {
1919
it("Get Code Deployment Provider for Publish Profile auth flow", async() => {
2020
let type: DEPLOYMENT_PROVIDER_TYPES = DEPLOYMENT_PROVIDER_TYPES.PUBLISHPROFILE;
2121

22-
let provider = await DeploymentProviderFactory.getDeploymentProvider(type);
23-
expect(provider).toBeInstanceOf(WebAppDeploymentProvider);
22+
let providers = await DeploymentProviderFactory.getDeploymentProvider(type);
23+
expect(providers[0]).toBeInstanceOf(WebAppDeploymentProvider);
2424
});
2525

2626
it("Get Container Deployment Provider for Publish Profile auth flow", async() => {
@@ -32,8 +32,8 @@ describe('Test Deployment Provider Factory', () => {
3232

3333
let type: DEPLOYMENT_PROVIDER_TYPES = DEPLOYMENT_PROVIDER_TYPES.PUBLISHPROFILE;
3434

35-
let provider = await DeploymentProviderFactory.getDeploymentProvider(type);
36-
expect(provider).toBeInstanceOf(PublishProfileWebAppContainerDeploymentProvider);
35+
let providers = await DeploymentProviderFactory.getDeploymentProvider(type);
36+
expect(providers[0]).toBeInstanceOf(PublishProfileWebAppContainerDeploymentProvider);
3737
});
3838

3939
});
@@ -48,8 +48,8 @@ describe('Test Deployment Provider Factory', () => {
4848

4949
let type: DEPLOYMENT_PROVIDER_TYPES = DEPLOYMENT_PROVIDER_TYPES.SPN;
5050

51-
let provider = await DeploymentProviderFactory.getDeploymentProvider(type);
52-
expect(provider).toBeInstanceOf(WebAppDeploymentProvider);
51+
let providers = await DeploymentProviderFactory.getDeploymentProvider(type);
52+
expect(providers[0]).toBeInstanceOf(WebAppDeploymentProvider);
5353
});
5454

5555
it("Get Container Deployment Provider for SPN auth flow", async() => {
@@ -61,8 +61,8 @@ describe('Test Deployment Provider Factory', () => {
6161

6262
let type: DEPLOYMENT_PROVIDER_TYPES = DEPLOYMENT_PROVIDER_TYPES.SPN;
6363

64-
let provider = await DeploymentProviderFactory.getDeploymentProvider(type);
65-
expect(provider).toBeInstanceOf(WebAppContainerDeploymentProvider);
64+
let providers = await DeploymentProviderFactory.getDeploymentProvider(type);
65+
expect(providers[0]).toBeInstanceOf(WebAppContainerDeploymentProvider);
6666
});
6767

6868
});

__tests__/main.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ describe('Test azure-webapps-deploy', () => {
3535
}
3636
return '';
3737
});
38-
let getValidatorFactorySpy = jest.spyOn(ValidatorFactory, 'getValidator').mockImplementation(async _type => new PublishProfileWebAppValidator());
38+
let getValidatorFactorySpy = jest.spyOn(ValidatorFactory, 'getValidator').mockImplementation(async _type => [new PublishProfileWebAppValidator()]);
3939
let ValidatorFactoryValidateSpy = jest.spyOn(PublishProfileWebAppValidator.prototype, 'validate');
40-
let getDeploymentProviderSpy = jest.spyOn(DeploymentProviderFactory, 'getDeploymentProvider').mockImplementation(type => new WebAppDeploymentProvider(type));
40+
let getDeploymentProviderSpy = jest.spyOn(DeploymentProviderFactory, 'getDeploymentProvider').mockImplementation(type => [new WebAppDeploymentProvider(type)]);
4141
let deployWebAppStepSpy = jest.spyOn(WebAppDeploymentProvider.prototype, 'DeployWebAppStep');
4242
let updateDeploymentStatusSpy = jest.spyOn(WebAppDeploymentProvider.prototype, 'UpdateDeploymentStatus');
4343

action.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,10 @@ inputs:
4040
restart:
4141
description: 'Restart the app service after deployment'
4242
required: false
43-
43+
sitecontainers-config:
44+
description: 'Applies to Sitecontainers, containes a list of siteContainer specs'
45+
required: false
46+
4447
outputs:
4548
webapp-url:
4649
description: 'URL to work with your webapp'

lib/ActionInputValidator/ActionValidators/PublishProfileContainerWebAppValidator.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ class PublishProfileContainerWebAppValidator {
1919
(0, Validations_1.packageNotAllowed)(actionParams.packageInput);
2020
(0, Validations_1.multiContainerNotAllowed)(actionParams.multiContainerConfigFile);
2121
(0, Validations_1.startupCommandNotAllowed)(actionParams.startupCommand);
22+
(0, Validations_1.siteContainersConfigNotAllowed)(actionParams.siteContainers);
2223
(0, Validations_1.validateAppDetails)();
2324
(0, Validations_1.validateSingleContainerInputs)();
2425
});
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
"use strict";
2+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4+
return new (P || (P = Promise))(function (resolve, reject) {
5+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8+
step((generator = generator.apply(thisArg, _arguments || [])).next());
9+
});
10+
};
11+
Object.defineProperty(exports, "__esModule", { value: true });
12+
exports.PublishProfileWebAppSiteContainersValidator = void 0;
13+
class PublishProfileWebAppSiteContainersValidator {
14+
validate() {
15+
return __awaiter(this, void 0, void 0, function* () {
16+
throw new Error("publish-profile is not supported for Site Containers scenario");
17+
});
18+
}
19+
}
20+
exports.PublishProfileWebAppSiteContainersValidator = PublishProfileWebAppSiteContainersValidator;

lib/ActionInputValidator/ActionValidators/PublishProfileWebAppValidator.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ class PublishProfileWebAppValidator {
1919
(0, Validations_1.containerInputsNotAllowed)(actionParams.images, actionParams.multiContainerConfigFile, true);
2020
(0, Validations_1.validateAppDetails)();
2121
(0, Validations_1.startupCommandNotAllowed)(actionParams.startupCommand);
22+
(0, Validations_1.siteContainersConfigNotAllowed)(actionParams.siteContainers);
2223
yield (0, Validations_1.validatePackageInput)();
2324
});
2425
}

lib/ActionInputValidator/ActionValidators/SpnLinuxWebAppValidator.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,37 @@
11
"use strict";
2+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3+
if (k2 === undefined) k2 = k;
4+
var desc = Object.getOwnPropertyDescriptor(m, k);
5+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6+
desc = { enumerable: true, get: function() { return m[k]; } };
7+
}
8+
Object.defineProperty(o, k2, desc);
9+
}) : (function(o, m, k, k2) {
10+
if (k2 === undefined) k2 = k;
11+
o[k2] = m[k];
12+
}));
13+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14+
Object.defineProperty(o, "default", { enumerable: true, value: v });
15+
}) : function(o, v) {
16+
o["default"] = v;
17+
});
18+
var __importStar = (this && this.__importStar) || (function () {
19+
var ownKeys = function(o) {
20+
ownKeys = Object.getOwnPropertyNames || function (o) {
21+
var ar = [];
22+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23+
return ar;
24+
};
25+
return ownKeys(o);
26+
};
27+
return function (mod) {
28+
if (mod && mod.__esModule) return mod;
29+
var result = {};
30+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31+
__setModuleDefault(result, mod);
32+
return result;
33+
};
34+
})();
235
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
336
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
437
return new (P || (P = Promise))(function (resolve, reject) {
@@ -10,11 +43,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
1043
};
1144
Object.defineProperty(exports, "__esModule", { value: true });
1245
exports.SpnLinuxWebAppValidator = void 0;
46+
const core = __importStar(require("@actions/core"));
1347
const Validations_1 = require("../Validations");
1448
const actionparameters_1 = require("../../actionparameters");
1549
class SpnLinuxWebAppValidator {
1650
validate() {
1751
return __awaiter(this, void 0, void 0, function* () {
52+
core.info("Validating SPN Linux Web App inputs...");
1853
let actionParams = actionparameters_1.ActionParameters.getActionParams();
1954
(0, Validations_1.containerInputsNotAllowed)(actionParams.images, actionParams.multiContainerConfigFile);
2055
yield (0, Validations_1.validatePackageInput)();
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
"use strict";
2+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3+
if (k2 === undefined) k2 = k;
4+
var desc = Object.getOwnPropertyDescriptor(m, k);
5+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6+
desc = { enumerable: true, get: function() { return m[k]; } };
7+
}
8+
Object.defineProperty(o, k2, desc);
9+
}) : (function(o, m, k, k2) {
10+
if (k2 === undefined) k2 = k;
11+
o[k2] = m[k];
12+
}));
13+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14+
Object.defineProperty(o, "default", { enumerable: true, value: v });
15+
}) : function(o, v) {
16+
o["default"] = v;
17+
});
18+
var __importStar = (this && this.__importStar) || (function () {
19+
var ownKeys = function(o) {
20+
ownKeys = Object.getOwnPropertyNames || function (o) {
21+
var ar = [];
22+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23+
return ar;
24+
};
25+
return ownKeys(o);
26+
};
27+
return function (mod) {
28+
if (mod && mod.__esModule) return mod;
29+
var result = {};
30+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31+
__setModuleDefault(result, mod);
32+
return result;
33+
};
34+
})();
35+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
36+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
37+
return new (P || (P = Promise))(function (resolve, reject) {
38+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
39+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
40+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
41+
step((generator = generator.apply(thisArg, _arguments || [])).next());
42+
});
43+
};
44+
Object.defineProperty(exports, "__esModule", { value: true });
45+
exports.SpnWebAppSiteContainersValidator = void 0;
46+
const core = __importStar(require("@actions/core"));
47+
const Validations_1 = require("../Validations");
48+
const SpnLinuxWebAppValidator_1 = require("./SpnLinuxWebAppValidator");
49+
const actionparameters_1 = require("../../actionparameters");
50+
class SpnWebAppSiteContainersValidator extends SpnLinuxWebAppValidator_1.SpnLinuxWebAppValidator {
51+
validate() {
52+
const _super = Object.create(null, {
53+
validate: { get: () => super.validate }
54+
});
55+
return __awaiter(this, void 0, void 0, function* () {
56+
let actionParams = actionparameters_1.ActionParameters.getActionParams();
57+
if (!!actionParams.blessedAppSitecontainers) {
58+
core.info("Blessed site containers detected, using SpnLinuxWebAppValidator for validation.");
59+
yield _super.validate.call(this);
60+
}
61+
core.info("Validating SPN Web App Site Containers inputs...");
62+
(0, Validations_1.validateSiteContainersInputs)();
63+
});
64+
}
65+
}
66+
exports.SpnWebAppSiteContainersValidator = SpnWebAppSiteContainersValidator;

lib/ActionInputValidator/Validations.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ exports.multiContainerNotAllowed = multiContainerNotAllowed;
5151
exports.validateSingleContainerInputs = validateSingleContainerInputs;
5252
exports.validateContainerInputs = validateContainerInputs;
5353
exports.validatePackageInput = validatePackageInput;
54+
exports.siteContainersConfigNotAllowed = siteContainersConfigNotAllowed;
55+
exports.validateSiteContainersInputs = validateSiteContainersInputs;
5456
const core = __importStar(require("@actions/core"));
5557
const packageUtility_1 = require("azure-actions-utility/packageUtility");
5658
const PublishProfile_1 = require("../Utilities/PublishProfile");
@@ -146,3 +148,16 @@ function validatePackageInput() {
146148
}
147149
});
148150
}
151+
// Error if Sitecontainers configuration is provided
152+
function siteContainersConfigNotAllowed(siteContainers) {
153+
if (!!siteContainers) {
154+
throw new Error("SiteContainers not valid input for this web app.");
155+
}
156+
}
157+
// validate Sitecontainers inputs
158+
function validateSiteContainersInputs() {
159+
const actionParams = actionparameters_1.ActionParameters.getActionParams();
160+
if (!actionParams.siteContainers || actionParams.siteContainers.length === 0) {
161+
throw new Error("Site containers not provided.");
162+
}
163+
}

0 commit comments

Comments
 (0)