Skip to content

Commit ce0fd0c

Browse files
daniv-msftcormacpaynekirill-ivlev
authored
Update AzureContainerAppsV0 with latest changes and Introduce AzureContainerAppsV1 task (#18055)
* Update AzureContainerAppsV0 with latest changes * Introduce AzureContainerAppsV1 task --------- Co-authored-by: Cormac McCarthy <[email protected]> Co-authored-by: Kirill Ivlev <[email protected]>
1 parent d4ffab2 commit ce0fd0c

File tree

54 files changed

+8610
-436
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+8610
-436
lines changed

.github/CODEOWNERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ Tasks/AzureCloudPowerShellDeploymentV1/ @vsebesta @rvairavelu @pipeline-e
2929

3030
Tasks/AzureContainerAppsV0/ @cormacpayne @daniv-msft
3131

32+
Tasks/AzureContainerAppsV1/ @cormacpayne @daniv-msft
33+
3234
Tasks/AzureFileCopyV1/ @vsebesta @rvairavelu @pipeline-environment-team
3335

3436
Tasks/AzureFileCopyV2/ @vsebesta @rvairavelu @pipeline-environment-team

Tasks/AzureContainerAppsV0/README.md

Lines changed: 80 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ with a call to `docker build` and the Container App will be created or updated b
1818
If a previously built image has already been pushed to the ACR instance and is provided to this task, no application
1919
source is required and the image will be used when creating or updating the Container App.
2020

21+
A YAML configuration file can also be provided to modify specific properties on the Container App that is created or
22+
updated; please see the section below on the `yamlConfigPath` argument.
23+
2124
## Running this task on Microsoft-hosted agents
2225

2326
If you are running this task on a
@@ -153,6 +156,41 @@ need to be provided in order for this task to successfully run using one of the
153156
| ------------------------- | -------- | ----------- |
154157
| `imageToDeploy` | Yes (for this scenario) | The name of the image that has already been pushed to a registry and will be deployed to the Container App by this task. If this image is found in an ACR instance that requires authentication to pull, the `acrName` argument, or the `acrUsername` and `acrPassword` arguments, can be provided to authenticate requests to the ACR instance. |
155158

159+
### Arguments required for using a YAML configuration file
160+
161+
| Argument name | Required | Description |
162+
| ------------------------- | -------- | ----------- |
163+
| `yamlConfigPath` | Yes (for this scenario) | Full path (on the executing Azure Pipelines agent) to the YAML file detailing the configuration of the Container App. |
164+
165+
#### Important notes on the YAML configuration file
166+
167+
The `resourceGroup` property in the YAML configuration file _will not_ be used; the value for this either comes from
168+
the `resourceGroup` argument provided to the task, or the default resource group name generated by the task. All other
169+
properties provided in the YAML configuration file will override the values provided as arguments to this task; for
170+
example, if the `containerAppName` argument is provided to the task, and the `name` property is set in the YAML
171+
configuration file, the `name` property in the YAML file will be used when creating or updating the Container App.
172+
173+
Image and application source arguments (_e.g._, `appSourcePath`, `imageToDeploy`) will still be used to first build
174+
and/or push an image that is used by the Container App; in this case, the provided YAML configuration file will need to
175+
reference the image specified by `imageToDeploy` (or `imageToBuild`, depending on your scenario).
176+
177+
When creating a new Container App, all properties listed in the YAML configuration file (except `resourceGroup` as
178+
mentioned above) will be set when the Container App is created. When updating an existing Container App, only the
179+
properties listed in the file will be updated on the Container App.
180+
181+
Currently, the YAML file does not support setting up managed identity authentication for the container registry used;
182+
for more information on this issue, please see
183+
[this GitHub issue](https://github.com/microsoft/azure-container-apps/issues/524).
184+
185+
In cases where the `yamlConfigPath` argument is provided, the YAML file will be passed through to the corresponding
186+
`az containerapp` command, either
187+
[`create`](https://learn.microsoft.com/en-us/cli/azure/containerapp?view=azure-cli-latest#az-containerapp-create) or
188+
[`update`](https://learn.microsoft.com/en-us/cli/azure/containerapp?view=azure-cli-latest#az-containerapp-update)
189+
depending on your scenario. For more information on the intended behavior when the YAML configuration file is provided,
190+
please see the documents linked for the corresponding commands.
191+
192+
For more information on the structure of the YAML configuration file, please visit [this site](https://aka.ms/azure-container-apps-yaml).
193+
156194
### Additional arguments
157195

158196
| Argument name | Required | Description |
@@ -161,14 +199,15 @@ need to be provided in order for this task to successfully run using one of the
161199
| `acrUsername` | No | The username used to authenticate push requests to the provided Azure Container Registry. If not provided, an access token will be generated via "az acr login" and provided to "docker login" to authenticate the requests. |
162200
| `acrPassword` | No | The password used to authenticate push requests to the provided Azure Container Registry. If not provided, an access token will be generated via "az acr login" and provided to "docker login" to authenticate the requests. |
163201
| `dockerfilePath` | No | Relative path (_without file prefixes, see example below_) to the Dockerfile in the provided application source that should be used to build the image that is then pushed to ACR and deployed to the Container App. If not provided, this task will check if there is a file named `Dockerfile` in the provided application source and use that to build the image. Otherwise, the Oryx++ Builder will be used to create the image. |
164-
| `imageToBuild` | No | The custom name of the image that is to be built, pushed to ACR and deployed to the Container App by this task. _Note_: this image name should include the ACR server; _e.g._, `<acr-name>.azurecr.io/<repo>:<tag>`. If this argument is not provided, a default image name will be constructed in the form `<acr-name>.azurecr.io/ado-task/container-app:<build-id>.<build-number>` |
202+
| `imageToBuild` | No | The custom name of the image that is to be built, pushed to ACR and deployed to the Container App by this task. _Note_: this image name should include the ACR server; _e.g._, `<acr-name>.azurecr.io/<repo>:<tag>`. If this argument is not provided, a default image name will be constructed in the form of `<acr-name>.azurecr.io/ado-task/container-app:<build-id>.<build-number>` |
165203
| `containerAppName` | No | The name of the Container App that will be created or updated. If not provided, this value will be `ado-task-app-<build-id>-<build-number>`. |
166-
| `resourceGroup` | No | The resource group that the Container App will be created in, or currently exists in. If not provided, this value will be `<container-app-name>-rg`. |
167-
| `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 `<container-app-name>-env`. |
168-
| `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 `<platform>:<version>`. 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. |
169-
| `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. |
204+
| `resourceGroup` | No | The existing resource group that the Azure Container App will be created in. If not provided, this value will be `<container-app-name>-rg` and its existence will first be checked before attempting to create it. |
205+
| `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 form of `<container-app-name>-env`. |
206+
| `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 form of `<platform>:<version>`. 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. |
207+
| `targetPort` | No | 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. |
170208
| `location` | No | The location that the Container App (and other created resources) will be deployed to. To view locations suitable for creating the Container App in, please run the following: `az provider show -n Microsoft.App --query "resourceTypes[?resourceType=='containerApps'].locations"` |
171209
| `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. |
210+
| `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. |
172211
| `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. |
173212

174213
## Usage
@@ -209,6 +248,42 @@ This will create a new Container App named `ado-task-app-<build-id>-<build-numbe
209248
`<container-app-name>-rg` where **no new image is built**, but an existing image named
210249
`mcr.microsoft.com/azuredocs/containerapps-helloworld:latest` will be used for the Container App.
211250

251+
### Minimal - Use YAML configuration file with previously published image for Container App
252+
253+
```yml
254+
steps:
255+
256+
- task: AzureContainerApps@0
257+
displayName: Build and deploy Container App
258+
inputs:
259+
yamlConfigPath: simple-image-container-app.yaml
260+
```
261+
262+
This will create a new Container App named `ado-task-app-<build-id>-<build-number>` in a new resource group named
263+
`<container-app-name>-rg` where **no new image is built**, but an existing image named
264+
`mcr.microsoft.com/azuredocs/containerapps-helloworld:latest` will be used for the Container App. Additional properties
265+
about the Container App will be pulled from the `simple-image-container-app.yaml` file and will override any additional
266+
values that would've been provided to the task as arguments **excluding `resourceGroup`**.
267+
268+
The `simple-image-container-app.yaml` file has the following structure:
269+
270+
```yml
271+
properties:
272+
managedEnvironmentId: /subscriptions/SUBSCRIPTION_ID/resourceGroup/RESOURCE_GROUP/providers/Microsoft.App/managedEnvironments/CONTAINER_APP_ENVIRONMENT
273+
configuration:
274+
ingress:
275+
external: true
276+
allowInsecure: false
277+
targetPort: 80
278+
template:
279+
containers:
280+
- image: mcr.microsoft.com/azuredocs/containerapps-helloworld:latest
281+
name: mysampleimagecontainer
282+
```
283+
284+
The values for `SUBSCRIPTION_ID`, `RESOURCE_GROUP` and `CONTAINER_APP_ENVIRONMENT` must be updated to point to the full
285+
resource ID of the **existing** Container App environment that the Container App will use.
286+
212287
### Using ACR credentials to authenticate
213288

214289
```yml
@@ -366,8 +441,5 @@ contact [[email protected]](mailto:[email protected]) with any additio
366441
For any issues and feedback for the _official_ `AzureContainerApps` task, please create a new issue
367442
[in the `azure-pipelines-tasks` repository](https://github.com/microsoft/azure-pipelines-tasks/issues).
368443

369-
For any issues and feedback for the _Release Candidate_ `AzureContainerAppsRC` task, please create a new issue
370-
[in this `container-apps-deploy-pipelines-task` repository](https://github.com/azure/container-apps-deploy-pipelines-task/issues).
371-
372444
Do you think there might be a security issue? Have you been phished or identified a security vulnerability? Please don't
373445
report it here - let us know by sending an email to [email protected].

0 commit comments

Comments
 (0)