Skip to content

Commit eec1459

Browse files
authored
Releases/v2 | Delete release archive folder before deployment for php apps (#475)
* Releases/v2 add changes to delete release archive folder * add node modules
1 parent 735efb0 commit eec1459

File tree

5,332 files changed

+605892
-609159
lines changed

Some content is hidden

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

5,332 files changed

+605892
-609159
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ FakesAssemblies/
261261

262262
# Node.js Tools for Visual Studio
263263
.ntvs_analysis.dat
264-
node_modules/
264+
# node_modules/
265265

266266
# Visual Studio 6 build log
267267
*.plg

lib/ActionInputValidator/Validations.js

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
1515
}) : function(o, v) {
1616
o["default"] = v;
1717
});
18-
var __importStar = (this && this.__importStar) || function (mod) {
19-
if (mod && mod.__esModule) return mod;
20-
var result = {};
21-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22-
__setModuleDefault(result, mod);
23-
return result;
24-
};
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+
})();
2535
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2636
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
2737
return new (P || (P = Promise))(function (resolve, reject) {
@@ -32,7 +42,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
3242
});
3343
};
3444
Object.defineProperty(exports, "__esModule", { value: true });
35-
exports.validatePackageInput = exports.validateContainerInputs = exports.validateSingleContainerInputs = exports.multiContainerNotAllowed = exports.packageNotAllowed = exports.startupCommandNotAllowed = exports.validateAppDetails = exports.containerInputsNotAllowed = exports.appNameIsRequired = void 0;
45+
exports.appNameIsRequired = appNameIsRequired;
46+
exports.containerInputsNotAllowed = containerInputsNotAllowed;
47+
exports.validateAppDetails = validateAppDetails;
48+
exports.startupCommandNotAllowed = startupCommandNotAllowed;
49+
exports.packageNotAllowed = packageNotAllowed;
50+
exports.multiContainerNotAllowed = multiContainerNotAllowed;
51+
exports.validateSingleContainerInputs = validateSingleContainerInputs;
52+
exports.validateContainerInputs = validateContainerInputs;
53+
exports.validatePackageInput = validatePackageInput;
3654
const core = __importStar(require("@actions/core"));
3755
const packageUtility_1 = require("azure-actions-utility/packageUtility");
3856
const PublishProfile_1 = require("../Utilities/PublishProfile");
@@ -44,14 +62,12 @@ function appNameIsRequired(appname) {
4462
throw new Error("app-name is a required input.");
4563
}
4664
}
47-
exports.appNameIsRequired = appNameIsRequired;
4865
// Error if image info is provided
4966
function containerInputsNotAllowed(images, configFile, isPublishProfile = false) {
5067
if (!!images || !!configFile) {
5168
throw new Error(`This is not a container web app. Please remove inputs like images and configuration-file which are only relevant for container deployment.`);
5269
}
5370
}
54-
exports.containerInputsNotAllowed = containerInputsNotAllowed;
5571
// Cross-validate provided app name and slot is same as that in publish profile
5672
function validateAppDetails() {
5773
let actionParams = actionparameters_1.ActionParameters.getActionParams();
@@ -66,36 +82,31 @@ function validateAppDetails() {
6682
}
6783
}
6884
}
69-
exports.validateAppDetails = validateAppDetails;
7085
// Error is startup command is provided
7186
function startupCommandNotAllowed(startupCommand) {
7287
if (!!startupCommand) {
7388
throw new Error("startup-command is not a valid input for Windows web app or with publish-profile auth scheme.");
7489
}
7590
}
76-
exports.startupCommandNotAllowed = startupCommandNotAllowed;
7791
// Error if package input is provided
7892
function packageNotAllowed(apppackage) {
7993
if (!!apppackage && apppackage !== '.') {
8094
throw new Error("package is not a valid input for container web app.");
8195
}
8296
}
83-
exports.packageNotAllowed = packageNotAllowed;
8497
// Error if multi container config file is provided
8598
function multiContainerNotAllowed(configFile) {
8699
if (!!configFile) {
87100
throw new Error("Multi container support is not available for windows containerized web app or with publish profile.");
88101
}
89102
}
90-
exports.multiContainerNotAllowed = multiContainerNotAllowed;
91103
// Error if image name is not provided
92104
function validateSingleContainerInputs() {
93105
const actionParams = actionparameters_1.ActionParameters.getActionParams();
94106
if (!actionParams.images) {
95107
throw new Error("Image name not provided for container. Provide a valid image name");
96108
}
97109
}
98-
exports.validateSingleContainerInputs = validateSingleContainerInputs;
99110
// Validate container inputs
100111
function validateContainerInputs() {
101112
let actionParams = actionparameters_1.ActionParameters.getActionParams();
@@ -123,7 +134,6 @@ function validateContainerInputs() {
123134
throw new Error("Multiple images indicate multi-container deployment type, but Docker-compose file is absent.");
124135
}
125136
}
126-
exports.validateContainerInputs = validateContainerInputs;
127137
// validate package input
128138
function validatePackageInput() {
129139
return __awaiter(this, void 0, void 0, function* () {
@@ -136,4 +146,3 @@ function validatePackageInput() {
136146
}
137147
});
138148
}
139-
exports.validatePackageInput = validatePackageInput;

lib/DeploymentProvider/Providers/BaseWebAppDeploymentProvider.js

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
1515
}) : function(o, v) {
1616
o["default"] = v;
1717
});
18-
var __importStar = (this && this.__importStar) || function (mod) {
19-
if (mod && mod.__esModule) return mod;
20-
var result = {};
21-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22-
__setModuleDefault(result, mod);
23-
return result;
24-
};
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+
})();
2535
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2636
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
2737
return new (P || (P = Promise))(function (resolve, reject) {

lib/DeploymentProvider/Providers/WebAppDeploymentProvider.js

Lines changed: 64 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
1515
}) : function(o, v) {
1616
o["default"] = v;
1717
});
18-
var __importStar = (this && this.__importStar) || function (mod) {
19-
if (mod && mod.__esModule) return mod;
20-
var result = {};
21-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22-
__setModuleDefault(result, mod);
23-
return result;
24-
};
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+
})();
2535
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2636
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
2737
return new (P || (P = Promise))(function (resolve, reject) {
@@ -31,6 +41,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
3141
step((generator = generator.apply(thisArg, _arguments || [])).next());
3242
});
3343
};
44+
var __importDefault = (this && this.__importDefault) || function (mod) {
45+
return (mod && mod.__esModule) ? mod : { "default": mod };
46+
};
3447
Object.defineProperty(exports, "__esModule", { value: true });
3548
exports.WebAppDeploymentProvider = void 0;
3649
const core = __importStar(require("@actions/core"));
@@ -39,6 +52,8 @@ const zipUtility = __importStar(require("azure-actions-utility/ziputility.js"));
3952
const packageUtility_1 = require("azure-actions-utility/packageUtility");
4053
const BaseWebAppDeploymentProvider_1 = require("./BaseWebAppDeploymentProvider");
4154
const AnnotationUtility_1 = require("azure-actions-appservice-rest/Utilities/AnnotationUtility");
55+
const fs_1 = __importDefault(require("fs"));
56+
const path_1 = __importDefault(require("path"));
4257
class WebAppDeploymentProvider extends BaseWebAppDeploymentProvider_1.BaseWebAppDeploymentProvider {
4358
DeployWebAppStep() {
4459
return __awaiter(this, void 0, void 0, function* () {
@@ -62,6 +77,8 @@ class WebAppDeploymentProvider extends BaseWebAppDeploymentProvider_1.BaseWebApp
6277
break;
6378
case packageUtility_1.PackageType.folder:
6479
let tempPackagePath = utility.generateTemporaryFolderOrZipPath(`${process.env.RUNNER_TEMP}`, false);
80+
// excluding release.zip while creating zip for deployment if it's a Linux PHP app
81+
yield this.deleteReleaseZipForLinuxPhpApps(webPackage);
6582
webPackage = (yield zipUtility.archiveFolder(webPackage, "", tempPackagePath));
6683
core.debug("Compressed folder into zip " + webPackage);
6784
core.debug("Initiated deployment via kudu service for webapp package : " + webPackage);
@@ -102,5 +119,45 @@ class WebAppDeploymentProvider extends BaseWebAppDeploymentProvider_1.BaseWebApp
102119
core.setOutput('webapp-url', this.applicationURL);
103120
});
104121
}
122+
deleteReleaseZipForLinuxPhpApps(webPackage) {
123+
return __awaiter(this, void 0, void 0, function* () {
124+
const releaseZipPath = path_1.default.join(webPackage, 'release.zip');
125+
// Ignore if the app is not a Linux app or if release.zip does not exist
126+
if (!this.actionParams.isLinux || !fs_1.default.existsSync(releaseZipPath)) {
127+
return;
128+
}
129+
let isPhpApp = yield this.checkIfTheAppIsPhpApp(webPackage);
130+
// No need to delete release.zip for non-PHP apps
131+
if (!isPhpApp) {
132+
return;
133+
}
134+
// Delete release.zip if it exists
135+
try {
136+
yield fs_1.default.promises.unlink(releaseZipPath);
137+
core.debug(`Deleted release.zip`);
138+
}
139+
catch (error) {
140+
core.debug(`Error while deleting release.zip for Linux PHP app: ${error}`);
141+
}
142+
});
143+
}
144+
checkIfTheAppIsPhpApp(webPackage) {
145+
return __awaiter(this, void 0, void 0, function* () {
146+
try {
147+
// Check if the webPackage folder contains a composer.json file
148+
const composerFile = 'composer.json';
149+
if (fs_1.default.existsSync(path_1.default.join(webPackage, composerFile))) {
150+
return true;
151+
}
152+
// Check if the webPackage folder contains a .php file
153+
const hasPhpFiles = fs_1.default.readdirSync(webPackage).some(file => file.endsWith('.php'));
154+
return hasPhpFiles;
155+
}
156+
catch (error) {
157+
core.debug(`Error while checking if the app is PHP: ${error}`);
158+
}
159+
return false;
160+
});
161+
}
105162
}
106163
exports.WebAppDeploymentProvider = WebAppDeploymentProvider;

lib/actionparameters.js

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
1515
}) : function(o, v) {
1616
o["default"] = v;
1717
});
18-
var __importStar = (this && this.__importStar) || function (mod) {
19-
if (mod && mod.__esModule) return mod;
20-
var result = {};
21-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22-
__setModuleDefault(result, mod);
23-
return result;
24-
};
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+
})();
2535
Object.defineProperty(exports, "__esModule", { value: true });
2636
exports.ActionParameters = exports.appKindMap = exports.WebAppKind = void 0;
2737
const core = __importStar(require("@actions/core"));

lib/main.js

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
1515
}) : function(o, v) {
1616
o["default"] = v;
1717
});
18-
var __importStar = (this && this.__importStar) || function (mod) {
19-
if (mod && mod.__esModule) return mod;
20-
var result = {};
21-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22-
__setModuleDefault(result, mod);
23-
return result;
24-
};
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+
})();
2535
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2636
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
2737
return new (P || (P = Promise))(function (resolve, reject) {
@@ -32,7 +42,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
3242
});
3343
};
3444
Object.defineProperty(exports, "__esModule", { value: true });
35-
exports.main = void 0;
45+
exports.main = main;
3646
const core = __importStar(require("@actions/core"));
3747
const crypto = __importStar(require("crypto"));
3848
const actionparameters_1 = require("./actionparameters");
@@ -90,5 +100,4 @@ function main() {
90100
}
91101
});
92102
}
93-
exports.main = main;
94103
main();

node_modules/.bin/acorn

Lines changed: 7 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/.bin/acorn.cmd

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)