Skip to content

Commit

Permalink
[Do Not Merge] Snehapar/app spaces env deletion test (#107)
Browse files Browse the repository at this point in the history
* Remove cli install

* Comment cli install

* Test-if envs are propgated

* Uncomment cli installation

* Update index file

* don't use up for cloud build

* comment out cli installation

* Remove comments

* Address comments

* Update index.js
  • Loading branch information
snehapar9 authored May 15, 2024
1 parent 02d0451 commit 5f5f4c5
Show file tree
Hide file tree
Showing 2 changed files with 129 additions and 154 deletions.
14 changes: 2 additions & 12 deletions azurecontainerapps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ export class azurecontainerapps {
// Set up property to determine if the internal registry should be used
this.useInternalRegistry = this.util.isNullOrEmpty(this.registryUrl);

// Set up property to trigger cloud build with 'up' command
this.shouldCreateOrUpdateContainerAppWithUp = !this.util.isNullOrEmpty(this.appSourcePath) && this.useInternalRegistry;

// If the application source was provided, build a runnable application image from it
if (!this.useInternalRegistry && !this.util.isNullOrEmpty(this.appSourcePath)) {
await this.buildAndPushImageAsync();
Expand Down Expand Up @@ -109,7 +106,6 @@ export class azurecontainerapps {
private static buildArguments: string;
private static noIngressUpdate: boolean;
private static useInternalRegistry: boolean;
private static shouldCreateOrUpdateContainerAppWithUp: boolean;

/**
* Initializes the helpers used by this task.
Expand Down Expand Up @@ -621,11 +617,9 @@ export class azurecontainerapps {
// Ensure '-i' argument and '--source' argument are not both provided
if (!this.util.isNullOrEmpty(this.imageToDeploy)) {
this.commandLineArgs.push(`-i ${this.imageToDeploy}`);
} else if (this.shouldCreateOrUpdateContainerAppWithUp) {
} else if (!this.util.isNullOrEmpty(this.appSourcePath) && this.useInternalRegistry) {
this.commandLineArgs.push(`--source ${this.appSourcePath}`);
this.commandLineArgs.push(`-l ${this.location}`);
}

}

/**
Expand All @@ -636,8 +630,6 @@ export class azurecontainerapps {
if (!this.util.isNullOrEmpty(this.yamlConfigPath)) {
// Create the Container App from the YAML configuration file
await this.appHelper.createContainerAppFromYaml(this.containerAppName, this.resourceGroup, this.yamlConfigPath);
} else if (this.shouldCreateOrUpdateContainerAppWithUp) {
await this.appHelper.createOrUpdateContainerAppWithUp(this.containerAppName, this.resourceGroup, this.commandLineArgs);
} else {
// Create the Container App from command line arguments
await this.appHelper.createContainerApp(this.containerAppName, this.resourceGroup, this.containerAppEnvironment, this.commandLineArgs);
Expand All @@ -653,16 +645,14 @@ export class azurecontainerapps {
return;
}

if (this.noIngressUpdate && !this.shouldCreateOrUpdateContainerAppWithUp) {
if (this.noIngressUpdate) {
// Update the Container Registry details on the existing Container App, if provided as an input
if (!this.util.isNullOrEmpty(this.registryUrl) && !this.util.isNullOrEmpty(this.registryUsername) && !this.util.isNullOrEmpty(this.registryPassword)) {
await this.appHelper.updateContainerAppRegistryDetails(this.containerAppName, this.resourceGroup, this.registryUrl, this.registryUsername, this.registryPassword);
}

// Update the Container App using the 'update' command
await this.appHelper.updateContainerApp(this.containerAppName, this.resourceGroup, this.commandLineArgs);
} else if (this.shouldCreateOrUpdateContainerAppWithUp) {
await this.appHelper.createOrUpdateContainerAppWithUp(this.containerAppName, this.resourceGroup, this.commandLineArgs);
} else if (this.adminCredentialsProvided && !this.noIngressUpdate) {
// Update the Container App with `up` command when admin credentials are provided and ingress is manually provided.
await this.appHelper.updateContainerAppWithUp(this.containerAppName, this.resourceGroup, this.commandLineArgs, this.ingress, this.targetPort);
Expand Down
Loading

0 comments on commit 5f5f4c5

Please sign in to comment.