Skip to content

Commit

Permalink
Merge branch 'snehapar/container-apps-deploy-action-javascript' into …
Browse files Browse the repository at this point in the history
…snehapar/container-apps-deploy-action-typescript
  • Loading branch information
snehapar9 committed Sep 23, 2023
2 parents 86c1f41 + 9c829f2 commit 60dc205
Show file tree
Hide file tree
Showing 8 changed files with 395 additions and 650 deletions.
17 changes: 7 additions & 10 deletions azurecontainerapps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ export class azurecontainerapps {
}
}

// Azure DevOps build properties
private static buildId: string = process.env.GITHUB_RUN_ID;
private static buildNumber = process.env.GITHUB_RUN_NUMBER;
// GitHub Action properties
private static githubRunId: string = process.env.GITHUB_RUN_ID;
private static githubRunNumber = process.env.GITHUB_RUN_NUMBER;

// Supported scenario properties
private static appSourcePath: string;
Expand All @@ -85,7 +85,6 @@ export class azurecontainerapps {

// Helper properties
private static telemetryHelper: TelemetryHelper;
//private static authHelper: AzureAuthenticationHelper;
private static appHelper: ContainerAppHelper;
private static registryHelper: ContainerRegistryHelper;

Expand All @@ -104,9 +103,6 @@ export class azurecontainerapps {
// Set up TelemetryHelper for managing telemetry calls
this.telemetryHelper = new TelemetryHelper(disableTelemetry);

// Set up AzureAuthenticationHelper for managing logging in and out of Azure CLI using provided service connection
// this.authHelper = new AzureAuthenticationHelper();

// Set up ContainerAppHelper for managing calls around the Container App
this.appHelper = new ContainerAppHelper(disableTelemetry);

Expand Down Expand Up @@ -141,6 +137,7 @@ export class azurecontainerapps {
// Ensure that one of appSourcePath, imageToDeploy, or yamlConfigPath is provided
if (util.isNullOrEmpty(this.appSourcePath) && util.isNullOrEmpty(this.imageToDeploy) && util.isNullOrEmpty(this.yamlConfigPath)) {
core.error(`One of the following arguments must be provided: 'appSourcePath', 'imageToDeploy', or 'yamlConfigPath'.`);
throw Error(`One of the following arguments must be provided: 'appSourcePath', 'imageToDeploy', or 'yamlConfigPath'.`);
}
}

Expand Down Expand Up @@ -181,13 +178,13 @@ export class azurecontainerapps {

/**
* Gets the name of the Container App to use for the task. If the 'containerAppName' argument is not provided,
* then a default name will be generated in the form 'ado-task-app-<buildId>-<buildNumber>'.
* then a default name will be generated in the form 'gh-action-app-<githubRunId>-<githubRunNumber>'.
* @returns The name of the Container App to use for the task.
*/
private static getContainerAppName(): string {
let containerAppName: string = core.getInput('containerAppName', { required: false });
if (util.isNullOrEmpty(containerAppName)) {
containerAppName = `app-${this.buildId}-${this.buildNumber}`;
containerAppName = `gh-action-app-${this.githubRunId}-${this.githubRunNumber}`;

// Replace all '.' characters with '-' characters in the Container App name
containerAppName = containerAppName.replace(/\./gi, "-");
Expand Down Expand Up @@ -312,7 +309,7 @@ export class azurecontainerapps {
// Get the name of the image to build if it was provided, or generate it from build variables
this.imageToBuild = core.getInput('imageToBuild', { required: false });
if (util.isNullOrEmpty(this.imageToBuild)) {
this.imageToBuild = `${this.acrName}.azurecr.io/gh-action/container-app:${this.buildId}.${this.buildNumber}`;
this.imageToBuild = `${this.acrName}.azurecr.io/gh-action/container-app:${this.githubRunId}.${this.githubRunNumber}`;
core.info(`Default image to build: ${this.imageToBuild}`);
}

Expand Down
797 changes: 316 additions & 481 deletions dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "container-apps-deploy-action",
"version": "1.0.0",
"description": "This action allows users to easily deploy their application source to an\r [Azure Container App](https://azure.microsoft.com/en-us/services/container-apps/) in their GitHub workflow by either\r providing a previously built image, a Dockerfile that an image can be built from, or using a builder to create a\r runnable application image for the user.",
"description": "This action allows users to easily deploy their application source to an [Azure Container App](https://azure.microsoft.com/en-us/services/container-apps/) in their GitHub workflow by either providing a previously built image, a Dockerfile that an image can be built from, or using a builder to create a runnable application image for the user.",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
Expand Down
89 changes: 0 additions & 89 deletions src/CommandHelper.ts

This file was deleted.

Loading

0 comments on commit 60dc205

Please sign in to comment.