Skip to content

Commit

Permalink
Test validation pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
snehapar9 committed Nov 6, 2023
1 parent eae94cc commit b24e0bd
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion azurecontainerapps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ export class azurecontainerapps {
await this.appHelper.createContainerAppFromYaml(this.containerAppName, this.resourceGroup, this.yamlConfigPath);
} else if (this.useCliToBuildAndPushImage && !this.util.isNullOrEmpty(this.appSourcePath)) {
// Create the Container App from the command line arguments
await this.appHelper.createOrUpdateContainerAppWithUp(this.containerAppName, this.resourceGroup, this.imageToDeploy, this.commandLineArgs, this.ingress, this.targetPort);
await this.appHelper.createOrUpdateContainerAppWithUp(this.containerAppName, this.resourceGroup, this.imageToDeploy, this.commandLineArgs, this.ingress, this.targetPort, this.appSourcePath);
} else {
// Create the Container App from command line arguments
await this.appHelper.createContainerApp(this.containerAppName, this.resourceGroup, this.containerAppEnvironment, this.imageToDeploy, this.commandLineArgs);
Expand Down
8 changes: 6 additions & 2 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@ var azurecontainerapps = /** @class */ (function () {
case 2:
if (!(this.useCliToBuildAndPushImage && !this.util.isNullOrEmpty(this.appSourcePath))) return [3 /*break*/, 4];
// Create the Container App from the command line arguments
return [4 /*yield*/, this.appHelper.createOrUpdateContainerAppWithUp(this.containerAppName, this.resourceGroup, this.imageToDeploy, this.commandLineArgs, this.ingress, this.targetPort)];
return [4 /*yield*/, this.appHelper.createOrUpdateContainerAppWithUp(this.containerAppName, this.resourceGroup, this.imageToDeploy, this.commandLineArgs, this.ingress, this.targetPort, this.appSourcePath)];
case 3:
// Create the Container App from the command line arguments
_a.sent();
Expand Down Expand Up @@ -4810,8 +4810,9 @@ var ContainerAppHelper = /** @class */ (function () {
* @param optionalCmdArgs - a set of optional command line arguments
* @param ingress - the ingress that the Container App will be exposed on
* @param targetPort - the target port that the Container App will be exposed on
* @param appSourcePath - the path to the application source on the machine
*/
ContainerAppHelper.prototype.createOrUpdateContainerAppWithUp = function (containerAppName, resourceGroup, imageToDeploy, optionalCmdArgs, ingress, targetPort) {
ContainerAppHelper.prototype.createOrUpdateContainerAppWithUp = function (containerAppName, resourceGroup, imageToDeploy, optionalCmdArgs, ingress, targetPort, appSourcePath) {
return __awaiter(this, void 0, void 0, function () {
var command_3, err_4;
return __generator(this, function (_a) {
Expand All @@ -4831,6 +4832,9 @@ var ContainerAppHelper = /** @class */ (function () {
if (!util.isNullOrEmpty(targetPort)) {
command_3 += " --target-port " + targetPort;
}
if (!util.isNullOrEmpty(appSourcePath)) {
command_3 += " --source " + appSourcePath;
}
return [4 /*yield*/, util.execute(command_3)];
case 2:
_a.sent();
Expand Down
8 changes: 7 additions & 1 deletion src/ContainerAppHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,16 @@ export class ContainerAppHelper {
* @param optionalCmdArgs - a set of optional command line arguments
* @param ingress - the ingress that the Container App will be exposed on
* @param targetPort - the target port that the Container App will be exposed on
* @param appSourcePath - the path to the application source on the machine
*/
public async createOrUpdateContainerAppWithUp(
containerAppName: string,
resourceGroup: string,
imageToDeploy: string,
optionalCmdArgs: string[],
ingress?: string,
targetPort?: string) {
targetPort?: string,
appSourcePath?: string) {
toolHelper.writeDebug(`Attempting to update Container App with name "${containerAppName}" in resource group "${resourceGroup}" based from image "${imageToDeploy}"`);
try {
let command = `az containerapp up -n ${containerAppName} -g ${resourceGroup} -i ${imageToDeploy}`;
Expand All @@ -120,6 +122,10 @@ export class ContainerAppHelper {
if (!util.isNullOrEmpty(targetPort)) {
command += ` --target-port ${targetPort}`;
}

if(!util.isNullOrEmpty(appSourcePath)) {
command += ` --source ${appSourcePath}`;
}
await util.execute(command);
} catch (err) {
toolHelper.writeError(err.message);
Expand Down

0 comments on commit b24e0bd

Please sign in to comment.