Skip to content

Commit ee0002e

Browse files
Add --kind parameter support to AzureContainerAppsV1 for Azure Functions (#21350)
* Initial plan * Add kind parameter support to AzureContainerAppsV1 for Azure Functions Co-authored-by: tarunramsinghani <[email protected]> * Update task version to 1.264.0 Co-authored-by: tarunramsinghani <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: tarunramsinghani <[email protected]>
1 parent d39e1fa commit ee0002e

File tree

5 files changed

+44
-2
lines changed

5 files changed

+44
-2
lines changed

Tasks/AzureContainerAppsV1/README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ For more information on the structure of the YAML configuration file, please vis
209209
| `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. |
210210
| `ingress` | No | Possible options: external, internal, disabled. If set to `external` (default value if not provided when creating a Container App), the Container App will be visible from the internet or a VNET, depending on the app environment endpoint configured. If set to `internal`, the Container App will be visible from within the app environment only. If set to `disabled`, ingress will be disabled for this Container App and will not have an HTTP or TCP endpoint. |
211211
| `disableTelemetry` | No | If set to `true`, no telemetry will be collected by this Azure DevOps Task. If set to `false`, or if this argument is not provided, telemetry will be sent to Microsoft about the Container App build and deploy scenario targeted by this Azure DevOps Task. |
212+
| `kind` | No | Specifies the type of Container App to create. Set to `functionapp` to deploy Azure Functions directly to Container Apps using the native Azure Functions runtime. Leave unset for standard Container Apps. This enables serverless Functions without requiring a separate Functions App resource. |
212213

213214
## Usage
214215

@@ -404,6 +405,22 @@ steps:
404405
dockerfilePath: 'test.Dockerfile'
405406
```
406407

408+
409+
### Native Azure Functions on Container Apps
410+
411+
```yml
412+
steps:
413+
414+
- task: AzureContainerApps@1
415+
displayName: Build and deploy Container App
416+
inputs:
417+
connectedServiceNameARM: 'azure-subscription-service-connection'
418+
appSourcePath: '$(System.DefaultWorkingDirectory)'
419+
acrName: 'mytestacr'
420+
containerAppEnvironment: 'my-test-container-app-env'
421+
kind: 'functionapp'
422+
```
423+
407424
This will create a new Container App named `ado-task-app-<build-id>-<build-number>` in a new resource group named
408425
`<container-app-name>-rg` where the runnable application image was created from the `test.Dockerfile` file found in the
409426
provided application source path directory.

Tasks/AzureContainerAppsV1/Strings/resources.resjson/en-US/resources.resjson

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
"loc.input.help.containerAppEnvironment": "The name of the Azure 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 form of `<container-app-name>-env`.",
3131
"loc.input.label.runtimeStack": "Application runtime stack",
3232
"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 `<platform>:<version>`. 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",
33+
"loc.input.label.kind": "Container App kind",
34+
"loc.input.help.kind": "Set to `functionapp` to get built in support and autoscaling to run Azure functions on Azure Container apps.",
3335
"loc.input.label.targetPort": "Application target port",
3436
"loc.input.help.targetPort": "The designated port for the application to run on. If no value is provided and the builder is used to build the runnable application image, the target port will be set to 80 for Python applications and 8080 for all other platform applications. If no value is provided when creating a Container App, the target port will default to 80. Note: when using this task to update a Container App, the target port may be updated if not provided based on changes to the ingress property.",
3537
"loc.input.label.location": "Location of the Container App",

Tasks/AzureContainerAppsV1/azurecontainerapps.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ export class azurecontainerapps {
103103
// Miscellaneous properties
104104
private static imageToBuild: string;
105105
private static runtimeStack: string;
106+
private static kind: string;
106107
private static ingress: string;
107108
private static targetPort: string;
108109
private static shouldUseUpdateCommand: boolean;
@@ -472,6 +473,14 @@ export class azurecontainerapps {
472473
this.commandLineArgs.push(`--ingress ${this.ingress}`);
473474
this.commandLineArgs.push(`--target-port ${this.targetPort}`);
474475
}
476+
477+
// Get the kind input
478+
this.kind = tl.getInput('kind', false);
479+
480+
// Set the value of kind if provided
481+
if (!util.isNullOrEmpty(this.kind)) {
482+
this.commandLineArgs.push(`--kind ${this.kind}`);
483+
}
475484
}
476485

477486
const environmentVariables: string = tl.getInput('environmentVariables', false);

Tasks/AzureContainerAppsV1/task.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
],
1919
"version": {
2020
"Major": 1,
21-
"Minor": 262,
21+
"Minor": 264,
2222
"Patch": 0
2323
},
2424
"minimumAgentVersion": "2.144.0",
@@ -127,6 +127,13 @@
127127
"required": false,
128128
"helpMarkDown": "The platform version stack that the application runs in when deployed to the Azure Container App. This should be provided in the form of `<platform>:<version>`. 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"
129129
},
130+
{
131+
"name": "kind",
132+
"type": "string",
133+
"label": "Container App kind",
134+
"required": false,
135+
"helpMarkDown": "Set to `functionapp` to get built in support and autoscaling to run Azure functions on Azure Container apps."
136+
},
130137
{
131138
"name": "targetPort",
132139
"type": "string",

Tasks/AzureContainerAppsV1/task.loc.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
],
1919
"version": {
2020
"Major": 1,
21-
"Minor": 262,
21+
"Minor": 264,
2222
"Patch": 0
2323
},
2424
"minimumAgentVersion": "2.144.0",
@@ -127,6 +127,13 @@
127127
"required": false,
128128
"helpMarkDown": "ms-resource:loc.input.help.runtimeStack"
129129
},
130+
{
131+
"name": "kind",
132+
"type": "string",
133+
"label": "ms-resource:loc.input.label.kind",
134+
"required": false,
135+
"helpMarkDown": "ms-resource:loc.input.help.kind"
136+
},
130137
{
131138
"name": "targetPort",
132139
"type": "string",

0 commit comments

Comments
 (0)