Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updating users/amkawade/kubeapp with master (#169) #170

Merged
merged 6 commits into from
Jun 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/ActionInputValidator/Validations.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ exports.containerInputsNotAllowed = containerInputsNotAllowed;
// Cross-validate provided app name and slot is same as that in publish profile
function validateAppDetails() {
let actionParams = actionparameters_1.ActionParameters.getActionParams();
if (!!actionParams.appName || (!!actionParams.slotName && actionParams.slotName !== 'production')) {
if (!!actionParams.appName || (!!actionParams.slotName && actionParams.slotName.toLowerCase() !== 'production')) {
let creds = PublishProfile_1.PublishProfile.getPublishProfile(actionParams.publishProfileContent).creds;
//for kubeapps in publishsettings file username doesn't start with $, for all other apps it starts with $
let splitUsername = creds.username.startsWith("$") ? creds.username.toUpperCase().substring(1).split("__") : creds.username.toUpperCase().split("__");
let appNameMatch = !actionParams.appName || actionParams.appName.toUpperCase() === splitUsername[0];
let slotNameMatch = actionParams.slotName === 'production' || actionParams.slotName.toUpperCase() === splitUsername[1];
let slotNameMatch = actionParams.slotName.toLowerCase() === 'production' || actionParams.slotName.toUpperCase() === splitUsername[1];
if (!appNameMatch || !slotNameMatch) {
throw new Error("Publish profile is invalid for app-name and slot-name provided. Provide correct publish profile credentials for app.");
}
Expand All @@ -71,7 +71,7 @@ exports.packageNotAllowed = packageNotAllowed;
// Error if multi container config file is provided
function multiContainerNotAllowed(configFile) {
if (!!configFile) {
throw new Error("Multi container support is not available for windows containerized web app.");
throw new Error("Multi container support is not available for windows containerized web app or with publish profile.");
}
}
exports.multiContainerNotAllowed = multiContainerNotAllowed;
Expand Down
3 changes: 1 addition & 2 deletions lib/ActionInputValidator/ValidatorFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class ValidatorFactory {
}
}
else {
throw new Error("Valid credentails are not available. Add Azure Login action before this action or provide publish-profile input.");
throw new Error("Valid credentials are not available. Add Azure Login action before this action or provide publish-profile input.");
}
});
}
Expand All @@ -82,4 +82,3 @@ class ValidatorFactory {
}
}
exports.ValidatorFactory = ValidatorFactory;

16 changes: 13 additions & 3 deletions lib/DeploymentProvider/Providers/WebAppDeploymentProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const utility = __importStar(require("azure-actions-utility/utility.js"));
const zipUtility = __importStar(require("azure-actions-utility/ziputility.js"));
const packageUtility_1 = require("azure-actions-utility/packageUtility");
const BaseWebAppDeploymentProvider_1 = require("./BaseWebAppDeploymentProvider");
const AnnotationUtility_1 = require("azure-actions-appservice-rest/Utilities/AnnotationUtility");
class WebAppDeploymentProvider extends BaseWebAppDeploymentProvider_1.BaseWebAppDeploymentProvider {
DeployWebAppStep() {
return __awaiter(this, void 0, void 0, function* () {
Expand All @@ -40,18 +41,18 @@ class WebAppDeploymentProvider extends BaseWebAppDeploymentProvider_1.BaseWebApp
let folderPath = yield utility.generateTemporaryFolderForDeployment(false, webPackage, packageUtility_1.PackageType.jar);
let output = yield utility.archiveFolderForDeployment(false, folderPath);
webPackage = output.webDeployPkg;
this.deploymentID = yield this.kuduServiceUtility.deployUsingZipDeploy(webPackage);
this.deploymentID = yield this.kuduServiceUtility.deployUsingZipDeploy(webPackage, { slotName: this.actionParams.slotName });
break;
case packageUtility_1.PackageType.folder:
let tempPackagePath = utility.generateTemporaryFolderOrZipPath(`${process.env.RUNNER_TEMP}`, false);
webPackage = (yield zipUtility.archiveFolder(webPackage, "", tempPackagePath));
core.debug("Compressed folder into zip " + webPackage);
core.debug("Initiated deployment via kudu service for webapp package : " + webPackage);
this.deploymentID = yield this.kuduServiceUtility.deployUsingZipDeploy(webPackage);
this.deploymentID = yield this.kuduServiceUtility.deployUsingZipDeploy(webPackage, { slotName: this.actionParams.slotName });
break;
case packageUtility_1.PackageType.zip:
core.debug("Initiated deployment via kudu service for webapp package : " + webPackage);
this.deploymentID = yield this.kuduServiceUtility.deployUsingZipDeploy(webPackage);
this.deploymentID = yield this.kuduServiceUtility.deployUsingZipDeploy(webPackage, { slotName: this.actionParams.slotName });
break;
default:
throw new Error('Invalid App Service package or folder path provided: ' + webPackage);
Expand All @@ -75,5 +76,14 @@ class WebAppDeploymentProvider extends BaseWebAppDeploymentProvider_1.BaseWebApp
}
});
}
UpdateDeploymentStatus(isDeploymentSuccess) {
return __awaiter(this, void 0, void 0, function* () {
if (!!this.appService) {
yield AnnotationUtility_1.addAnnotation(this.actionParams.endpoint, this.appService, isDeploymentSuccess);
}
console.log('App Service Application URL: ' + this.applicationURL);
core.setOutput('webapp-url', this.applicationURL);
});
}
}
exports.WebAppDeploymentProvider = WebAppDeploymentProvider;
Loading