Skip to content

Commit

Permalink
Updating App Service Rest Package version (#325)
Browse files Browse the repository at this point in the history
* Updating App Service Rest Package version

* fixed the build failure
  • Loading branch information
shpraka authored Apr 24, 2023
1 parent ea4bc8b commit 83fb340
Show file tree
Hide file tree
Showing 5 changed files with 265 additions and 615 deletions.
2 changes: 1 addition & 1 deletion lib/Utilities/PublishProfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class PublishProfile {
throw new Error("Publish profile does not contain kudu URL");
}
this._creds.uri = `https://${this._creds.uri}`;
this._kuduService = new azure_app_kudu_service_1.Kudu(this._creds.uri, this._creds.username, this._creds.password);
this._kuduService = new azure_app_kudu_service_1.Kudu(this._creds.uri, { username: this._creds.username, password: this._creds.password });
}
catch (error) {
core.error("Failed to fetch credentials from Publish Profile. For more details on how to set publish profile credentials refer https://aka.ms/create-secrets-for-GitHub-workflows");
Expand Down
150 changes: 75 additions & 75 deletions lib/main.js
Original file line number Diff line number Diff line change
@@ -1,77 +1,77 @@
"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 __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const core = __importStar(require("@actions/core"));
const crypto = __importStar(require("crypto"));
const actionparameters_1 = require("./actionparameters");
const AuthorizerFactory_1 = require("azure-actions-webclient/AuthorizerFactory");
const BaseWebAppDeploymentProvider_1 = require("./DeploymentProvider/Providers/BaseWebAppDeploymentProvider");
const DeploymentProviderFactory_1 = require("./DeploymentProvider/DeploymentProviderFactory");
const ValidatorFactory_1 = require("./ActionInputValidator/ValidatorFactory");
var prefix = !!process.env.AZURE_HTTP_USER_AGENT ? `${process.env.AZURE_HTTP_USER_AGENT}` : "";
function main() {
return __awaiter(this, void 0, void 0, function* () {
let isDeploymentSuccess = true;
try {
// Set user agent variable
let usrAgentRepo = crypto.createHash('sha256').update(`${process.env.GITHUB_REPOSITORY}`).digest('hex');
let actionName = 'DeployWebAppToAzure';
let userAgentString = (!!prefix ? `${prefix}+` : '') + `GITHUBACTIONS_${actionName}_${usrAgentRepo}`;
core.exportVariable('AZURE_HTTP_USER_AGENT', userAgentString);
// Initialize action inputs
let endpoint = !!core.getInput('publish-profile') ? null : yield AuthorizerFactory_1.AuthorizerFactory.getAuthorizer();
actionparameters_1.ActionParameters.getActionParams(endpoint);
let type = null;
if (!!endpoint) {
type = BaseWebAppDeploymentProvider_1.DEPLOYMENT_PROVIDER_TYPES.SPN;
}
else {
type = BaseWebAppDeploymentProvider_1.DEPLOYMENT_PROVIDER_TYPES.PUBLISHPROFILE;
}
// Validate action inputs
let validator = yield ValidatorFactory_1.ValidatorFactory.getValidator(type);
yield validator.validate();
var deploymentProvider = DeploymentProviderFactory_1.DeploymentProviderFactory.getDeploymentProvider(type);
core.debug("Predeployment Step Started");
yield deploymentProvider.PreDeploymentStep();
core.debug("Deployment Step Started");
yield deploymentProvider.DeployWebAppStep();
}
catch (error) {
isDeploymentSuccess = false;
if (error.statusCode == 403) {
"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 __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const core = __importStar(require("@actions/core"));
const crypto = __importStar(require("crypto"));
const actionparameters_1 = require("./actionparameters");
const AuthorizerFactory_1 = require("azure-actions-webclient/AuthorizerFactory");
const BaseWebAppDeploymentProvider_1 = require("./DeploymentProvider/Providers/BaseWebAppDeploymentProvider");
const DeploymentProviderFactory_1 = require("./DeploymentProvider/DeploymentProviderFactory");
const ValidatorFactory_1 = require("./ActionInputValidator/ValidatorFactory");
var prefix = !!process.env.AZURE_HTTP_USER_AGENT ? `${process.env.AZURE_HTTP_USER_AGENT}` : "";
function main() {
return __awaiter(this, void 0, void 0, function* () {
let isDeploymentSuccess = true;
try {
// Set user agent variable
let usrAgentRepo = crypto.createHash('sha256').update(`${process.env.GITHUB_REPOSITORY}`).digest('hex');
let actionName = 'DeployWebAppToAzure';
let userAgentString = (!!prefix ? `${prefix}+` : '') + `GITHUBACTIONS_${actionName}_${usrAgentRepo}`;
core.exportVariable('AZURE_HTTP_USER_AGENT', userAgentString);
// Initialize action inputs
let endpoint = !!core.getInput('publish-profile') ? null : yield AuthorizerFactory_1.AuthorizerFactory.getAuthorizer();
actionparameters_1.ActionParameters.getActionParams(endpoint);
let type = null;
if (!!endpoint) {
type = BaseWebAppDeploymentProvider_1.DEPLOYMENT_PROVIDER_TYPES.SPN;
}
else {
type = BaseWebAppDeploymentProvider_1.DEPLOYMENT_PROVIDER_TYPES.PUBLISHPROFILE;
}
// Validate action inputs
let validator = yield ValidatorFactory_1.ValidatorFactory.getValidator(type);
yield validator.validate();
var deploymentProvider = DeploymentProviderFactory_1.DeploymentProviderFactory.getDeploymentProvider(type);
core.debug("Predeployment Step Started");
yield deploymentProvider.PreDeploymentStep();
core.debug("Deployment Step Started");
yield deploymentProvider.DeployWebAppStep();
}
catch (error) {
isDeploymentSuccess = false;
if (error.statusCode == 403) {
core.setFailed("The deployment to your web app failed with HTTP status code 403. \
Your web app may have networking features enabled which are blocking access (such as Private Endpoints). \
For more information about deploying to virtual network integrated web apps, please follow https://aka.ms/gha/deploying-to-network-secured-sites");
}
else {
core.setFailed("Deployment Failed, " + error);
}
}
finally {
if (deploymentProvider != null) {
yield deploymentProvider.UpdateDeploymentStatus(isDeploymentSuccess);
}
// Reset AZURE_HTTP_USER_AGENT
core.exportVariable('AZURE_HTTP_USER_AGENT', prefix);
core.debug(isDeploymentSuccess ? "Deployment Succeeded" : "Deployment failed");
}
});
}
exports.main = main;
main();
For more information about deploying to virtual network integrated web apps, please follow https://aka.ms/gha/deploying-to-network-secured-sites");
}
else {
core.setFailed("Deployment Failed, " + error);
}
}
finally {
if (deploymentProvider != null) {
yield deploymentProvider.UpdateDeploymentStatus(isDeploymentSuccess);
}
// Reset AZURE_HTTP_USER_AGENT
core.exportVariable('AZURE_HTTP_USER_AGENT', prefix);
core.debug(isDeploymentSuccess ? "Deployment Succeeded" : "Deployment failed");
}
});
}
exports.main = main;
main();
Loading

0 comments on commit 83fb340

Please sign in to comment.