diff --git a/Tasks/AzureContainerAppsV0/README.md b/Tasks/AzureContainerAppsV0/README.md index 1f46eb1b0c88..85c3ef9ffd6c 100644 --- a/Tasks/AzureContainerAppsV0/README.md +++ b/Tasks/AzureContainerAppsV0/README.md @@ -86,6 +86,7 @@ Below are the arguments that can be provided to this task. | `containerAppEnvironment` | No | The name of the Container App environment to use with the application. If not provided, an existing environment in the resource group of the Container App will be used, otherwise, an environment will be created in the formation `-env`. | | `runtimeStack` | No | The platform version stack used in the final runnable application image that is deployed to the Container App. The value should be provided in the formation `:`. If not provided, this value is determined by Oryx based on the contents of the provided application. Please refer to [this document](https://github.com/microsoft/Oryx/blob/main/doc/supportedRuntimeVersions.md) for more information on supported runtime stacks for Oryx. | | `targetPort` | No | The target port that the Container App will listen on. If not provided, this value will be "80" for Python applications and "8080" for all other supported platforms. | +| `environmentVariables` | No | A list of environment variable(s) for the container. Space-separated values in 'key=value' format. Empty string to clear existing values. Prefix value with 'secretref:' to reference a secret. | ## Usage diff --git a/Tasks/AzureContainerAppsV0/Strings/resources.resjson/en-US/resources.resjson b/Tasks/AzureContainerAppsV0/Strings/resources.resjson/en-US/resources.resjson index e111cec5db1c..5e6ad2734b27 100644 --- a/Tasks/AzureContainerAppsV0/Strings/resources.resjson/en-US/resources.resjson +++ b/Tasks/AzureContainerAppsV0/Strings/resources.resjson/en-US/resources.resjson @@ -32,6 +32,8 @@ "loc.input.help.runtimeStack": "The platform version stack that the application runs in when deployed to the Azure Container App. This should be provided in the form of :. If not provided, this value is determined by Oryx based on the contents of the provided application. Please view the following document for more information on the supported runtime stacks for Oryx: https://github.com/microsoft/Oryx/blob/main/doc/supportedRuntimeVersions.md", "loc.input.label.targetPort": "Application target port", "loc.input.help.targetPort": "The designated port for the application to run on. If not provided, this value is 80 for Python applications, and 8080 for all other supposed platforms.", + "loc.input.label.environmentVariables": "Environment variables", + "loc.input.help.environmentVariables": "A list of environment variable(s) for the container. Space-separated values in 'key=value' format. Empty string to clear existing values. Prefix value with 'secretref:' to reference a secret.", "loc.messages.AcrAccessTokenAuthFailed": "Unable to authenticate against ACR instance '%s.azurecr.io' with access token.", "loc.messages.AcrAccessTokenLoginMessage": "Logging in to Azure Container Registry using access token to be generated via Azure CLI.", "loc.messages.AcrUsernamePasswordAuthFailed": "Unable to authenticate against ACR instance '%s.azurecr.io' with username/password.", diff --git a/Tasks/AzureContainerAppsV0/azurecontainerapps.ts b/Tasks/AzureContainerAppsV0/azurecontainerapps.ts index 15f2760bf7a0..97b4576aa5d7 100644 --- a/Tasks/AzureContainerAppsV0/azurecontainerapps.ts +++ b/Tasks/AzureContainerAppsV0/azurecontainerapps.ts @@ -137,6 +137,13 @@ export class azurecontainerapps { if (!!targetPort) { optionalCmdArgs.push(`--target-port ${targetPort}`); } + + // Add user specified environment variables + const environmentVariables: string = tl.getInput('environmentVariables', false); + if (!!environmentVariables) { + console.log(tl.loc('DefaultEnvironmentVariablesMessage', environmentVariables)); + optionalCmdArgs.push(`--env-vars ${environmentVariables}`); + } // If using the Oryx++ Builder to produce an image, create a runnable application image if (!dockerfilePath && shouldBuildAndPushImage) { diff --git a/Tasks/AzureContainerAppsV0/task.json b/Tasks/AzureContainerAppsV0/task.json index 71642832aac3..f504b20a5791 100644 --- a/Tasks/AzureContainerAppsV0/task.json +++ b/Tasks/AzureContainerAppsV0/task.json @@ -18,7 +18,7 @@ ], "version": { "Major": 0, - "Minor": 215, + "Minor": 217, "Patch": 0 }, "preview": true, @@ -134,6 +134,13 @@ "label": "Application target port", "required": false, "helpMarkDown": "The designated port for the application to run on. If not provided, this value is 80 for Python applications, and 8080 for all other supposed platforms." + }, + { + "name": "environmentVariables", + "type": "string", + "label": "Environment variables", + "required": false, + "helpMarkDown": "A list of environment variable(s) for the container. Space-separated values in 'key=value' format. Empty string to clear existing values. Prefix value with 'secretref:' to reference a secret." } ], "execution": { diff --git a/Tasks/AzureContainerAppsV0/task.loc.json b/Tasks/AzureContainerAppsV0/task.loc.json index 6c24b465ae08..98f9df55ea8e 100644 --- a/Tasks/AzureContainerAppsV0/task.loc.json +++ b/Tasks/AzureContainerAppsV0/task.loc.json @@ -18,7 +18,7 @@ ], "version": { "Major": 0, - "Minor": 215, + "Minor": 217, "Patch": 0 }, "preview": true, @@ -134,6 +134,13 @@ "label": "ms-resource:loc.input.label.targetPort", "required": false, "helpMarkDown": "ms-resource:loc.input.help.targetPort" + }, + { + "name": "environmentVariables", + "type": "string", + "label": "ms-resource:loc.input.label.environmentVariables", + "required": false, + "helpMarkDown": "ms-resource:loc.input.help.environmentVariables" } ], "execution": {