public static async runMain()

in azurecontainerapps.ts [13:66]


    public static async runMain(): Promise<void> {
        this.initializeHelpers();

        try {
            // Validate that the arguments provided can be used for one of the supported scenarios
            this.validateSupportedScenarioArguments();

            // Set up the Azure CLI to be used for this task
            await this.setupAzureCli();

            // Set up the resources required to deploy a Container App
            await this.setupResources();

            // If a Container Registry URL was provided, try to authenticate against it
            if (!this.util.isNullOrEmpty(this.registryUrl)) {
                await this.authenticateContainerRegistryAsync();
            }

            // If an Azure Container Registry name was provided, try to authenticate against it
            if (!this.util.isNullOrEmpty(this.acrName)) {
                await this.authenticateAzureContainerRegistryAsync();
            }

            // Set up property to determine if the internal registry should be used
            this.useInternalRegistry = this.util.isNullOrEmpty(this.registryUrl);

            // If the application source was provided, build a runnable application image from it
            if (!this.useInternalRegistry && !this.util.isNullOrEmpty(this.appSourcePath)) {
                await this.buildAndPushImageAsync();
            }

            // If no application source was provided, set up the scenario for deploying an existing image
            if (this.util.isNullOrEmpty(this.appSourcePath)) {
                this.setupExistingImageScenario();
            }

            // If no YAML configuration file was provided, set up the Container App properties
            if (this.util.isNullOrEmpty(this.yamlConfigPath)) {
                this.setupContainerAppProperties();
            }

            // Create/update the Container App
            await this.createOrUpdateContainerApp();

            // If telemetry is enabled, log that the task completed successfully
            this.telemetryHelper.setSuccessfulResult();
        } catch (err) {
            this.toolHelper.setFailed(err.message);
            this.telemetryHelper.setFailedResult(err.message);
        } finally {
            // If telemetry is enabled, will log metadata for this task run
            await this.telemetryHelper.sendLogs();
        }
    }