Skip to content

Commit e8d44d2

Browse files
authored
Releases/v2 set isLinux param for publish profile (#478)
* set resources details for publish profile * changing log level * change log level
1 parent 2545bea commit e8d44d2

File tree

4 files changed

+64
-19
lines changed

4 files changed

+64
-19
lines changed

lib/ActionInputValidator/ValidatorFactory.js

Lines changed: 40 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) {
@@ -13,6 +46,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
1346
};
1447
Object.defineProperty(exports, "__esModule", { value: true });
1548
exports.ValidatorFactory = void 0;
49+
const core = __importStar(require("@actions/core"));
1650
const actionparameters_1 = require("../actionparameters");
1751
const AzureResourceFilterUtility_1 = require("azure-actions-appservice-rest/Utilities/AzureResourceFilterUtility");
1852
const BaseWebAppDeploymentProvider_1 = require("../DeploymentProvider/Providers/BaseWebAppDeploymentProvider");
@@ -35,6 +69,12 @@ class ValidatorFactory {
3569
return new PublishProfileContainerWebAppValidator_1.PublishProfileContainerWebAppValidator();
3670
}
3771
else {
72+
try {
73+
yield this.setResourceDetails(actionParams);
74+
}
75+
catch (error) {
76+
core.warning(`Failed to set resource details: ${error.message}`);
77+
}
3878
return new PublishProfileWebAppValidator_1.PublishProfileWebAppValidator();
3979
}
4080
}

lib/DeploymentProvider/Providers/WebAppDeploymentProvider.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -123,24 +123,24 @@ class WebAppDeploymentProvider extends BaseWebAppDeploymentProvider_1.BaseWebApp
123123
return __awaiter(this, void 0, void 0, function* () {
124124
// Ignore if the app is not a Linux app or if release.zip does not exist
125125
if (!this.actionParams.isLinux) {
126-
core.info(`It's not a Linux app, skipping deletion of release.zip`);
126+
core.debug(`It's not a Linux app, skipping deletion of release.zip`);
127127
return;
128128
}
129129
const releaseZipPath = path_1.default.join(webPackage, 'release.zip');
130130
if (!fs_1.default.existsSync(releaseZipPath)) {
131-
core.info(`release.zip does not exist, skipping deletion: ${releaseZipPath}`);
131+
core.debug(`release.zip does not exist, skipping deletion: ${releaseZipPath}`);
132132
return;
133133
}
134134
let isPhpApp = yield this.checkIfTheAppIsPhpApp(webPackage);
135135
// No need to delete release.zip for non-PHP apps
136136
if (!isPhpApp) {
137-
core.info(`Not a PHP app, skipping deletion of release.zip: ${releaseZipPath}`);
137+
core.debug(`Not a PHP app, skipping deletion of release.zip: ${releaseZipPath}`);
138138
return;
139139
}
140140
// Delete release.zip if it exists
141141
try {
142142
yield fs_1.default.promises.unlink(releaseZipPath);
143-
core.info(`Deleted release.zip`);
143+
core.debug(`Deleted release.zip`);
144144
}
145145
catch (error) {
146146
core.debug(`Error while deleting release.zip for Linux PHP app: ${error}`);
@@ -153,22 +153,22 @@ class WebAppDeploymentProvider extends BaseWebAppDeploymentProvider_1.BaseWebApp
153153
// Check if the webPackage folder contains a composer.json file
154154
const composerFile = 'composer.json';
155155
if (fs_1.default.existsSync(path_1.default.join(webPackage, composerFile))) {
156-
core.info(`Detected PHP app by presence of ${composerFile}`);
156+
core.debug(`Detected PHP app by presence of ${composerFile}`);
157157
return true;
158158
}
159159
// Check if the webPackage folder contains a .php file
160-
core.info(`Checking for .php files in the web package directory: ${webPackage}`);
160+
core.debug(`Checking for .php files in the web package directory: ${webPackage}`);
161161
const hasPhpFiles = fs_1.default.readdirSync(webPackage, { withFileTypes: true, recursive: true }).some(file => file.isFile() && file.name.endsWith('.php'));
162162
if (hasPhpFiles) {
163-
core.info(`Detected PHP app by presence of .php files`);
163+
core.debug(`Detected PHP app by presence of .php files`);
164164
}
165165
else {
166-
core.info(`No .php files found in the web package directory.`);
166+
core.debug(`No .php files found in the web package directory.`);
167167
}
168168
return hasPhpFiles;
169169
}
170170
catch (error) {
171-
core.info(`Error while checking if the app is PHP: ${error}`);
171+
core.debug(`Error while checking if the app is PHP: ${error}`);
172172
}
173173
return false;
174174
});

src/ActionInputValidator/ValidatorFactory.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import * as core from "@actions/core";
12
import { ActionParameters, WebAppKind, appKindMap } from "../actionparameters";
23

34
import { AzureResourceFilterUtility } from "azure-actions-appservice-rest/Utilities/AzureResourceFilterUtility";
@@ -22,6 +23,11 @@ export class ValidatorFactory {
2223
return new PublishProfileContainerWebAppValidator();
2324
}
2425
else {
26+
try {
27+
await this.setResourceDetails(actionParams);
28+
} catch (error) {
29+
core.warning(`Failed to set resource details: ${error.message}`);
30+
}
2531
return new PublishProfileWebAppValidator();
2632
}
2733
}

src/DeploymentProvider/Providers/WebAppDeploymentProvider.ts

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import { addAnnotation } from 'azure-actions-appservice-rest/Utilities/Annotatio
99

1010
import fs from 'fs';
1111
import path from 'path';
12-
import { dir } from 'console';
1312

1413
export class WebAppDeploymentProvider extends BaseWebAppDeploymentProvider {
1514

@@ -90,29 +89,29 @@ export class WebAppDeploymentProvider extends BaseWebAppDeploymentProvider {
9089

9190
// Ignore if the app is not a Linux app or if release.zip does not exist
9291
if (!this.actionParams.isLinux) {
93-
core.info(`It's not a Linux app, skipping deletion of release.zip`);
92+
core.debug(`It's not a Linux app, skipping deletion of release.zip`);
9493
return;
9594
}
9695

9796
const releaseZipPath = path.join(webPackage, 'release.zip');
9897

9998
if (!fs.existsSync(releaseZipPath)) {
100-
core.info(`release.zip does not exist, skipping deletion: ${releaseZipPath}`);
99+
core.debug(`release.zip does not exist, skipping deletion: ${releaseZipPath}`);
101100
return;
102101
}
103102

104103
let isPhpApp = await this.checkIfTheAppIsPhpApp(webPackage);
105104

106105
// No need to delete release.zip for non-PHP apps
107106
if (!isPhpApp) {
108-
core.info(`Not a PHP app, skipping deletion of release.zip: ${releaseZipPath}`);
107+
core.debug(`Not a PHP app, skipping deletion of release.zip: ${releaseZipPath}`);
109108
return;
110109
}
111110

112111
// Delete release.zip if it exists
113112
try {
114113
await fs.promises.unlink(releaseZipPath);
115-
core.info(`Deleted release.zip`);
114+
core.debug(`Deleted release.zip`);
116115
} catch (error) {
117116
core.debug(`Error while deleting release.zip for Linux PHP app: ${error}`);
118117
}
@@ -124,23 +123,23 @@ export class WebAppDeploymentProvider extends BaseWebAppDeploymentProvider {
124123
// Check if the webPackage folder contains a composer.json file
125124
const composerFile = 'composer.json';
126125
if (fs.existsSync(path.join(webPackage, composerFile))) {
127-
core.info(`Detected PHP app by presence of ${composerFile}`);
126+
core.debug(`Detected PHP app by presence of ${composerFile}`);
128127
return true;
129128
}
130129

131130
// Check if the webPackage folder contains a .php file
132-
core.info(`Checking for .php files in the web package directory: ${webPackage}`);
131+
core.debug(`Checking for .php files in the web package directory: ${webPackage}`);
133132
const hasPhpFiles = fs.readdirSync(webPackage, {withFileTypes: true, recursive: true}).some(file => file.isFile() && file.name.endsWith('.php'));
134133

135134
if (hasPhpFiles) {
136-
core.info(`Detected PHP app by presence of .php files`);
135+
core.debug(`Detected PHP app by presence of .php files`);
137136
} else {
138-
core.info(`No .php files found in the web package directory.`);
137+
core.debug(`No .php files found in the web package directory.`);
139138
}
140139

141140
return hasPhpFiles;
142141
} catch (error) {
143-
core.info(`Error while checking if the app is PHP: ${error}`);
142+
core.debug(`Error while checking if the app is PHP: ${error}`);
144143
}
145144

146145
return false;

0 commit comments

Comments
 (0)