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

Use create/update to create or update container apps in source to cloud scenarios #107

Merged
merged 10 commits into from
May 15, 2024
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
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}`);
pauld-msft marked this conversation as resolved.
Show resolved Hide resolved
}

}

/**
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);
pauld-msft marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
Loading
Loading