Skip to content

Commit 97229a4

Browse files
authored
Merge pull request #87551 from dlepow/acrgitpull
[ACR] Tasks update for PR trigger
2 parents 25a1de3 + 9e5d836 commit 97229a4

File tree

1 file changed

+44
-17
lines changed

1 file changed

+44
-17
lines changed

articles/container-registry/container-registry-tasks-overview.md

Lines changed: 44 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ manager: gwallace
77

88
ms.service: container-registry
99
ms.topic: article
10-
ms.date: 06/12/2019
10+
ms.date: 09/05/2019
1111
ms.author: danlep
1212
---
1313

@@ -17,14 +17,22 @@ Containers provide new levels of virtualization, isolating application and devel
1717

1818
## What is ACR Tasks?
1919

20-
**ACR Tasks** is a suite of features within Azure Container Registry. It provides cloud-based container image building for Linux, Windows, and ARM, and can automate [OS and framework patching](#automate-os-and-framework-patching) for your Docker containers. ACR Tasks not only extends your "inner-loop" development cycle to the cloud with on-demand container image builds, but also enables automated builds on source code commit or when a container's base image is updated. With base image update triggers, you can automate your OS and application framework patching workflow, maintaining secure environments while adhering to the principals of immutable containers.
20+
**ACR Tasks** is a suite of features within Azure Container Registry. It provides cloud-based container image building for [platforms](#image-platforms) including Linux, Windows, and ARM, and can automate [OS and framework patching](#automate-os-and-framework-patching) for your Docker containers. ACR Tasks not only extends your "inner-loop" development cycle to the cloud with on-demand container image builds, but also enables automated builds triggered by source code updates, updates to a container's base image, or timers. For example, with base image update triggers, you can automate your OS and application framework patching workflow, maintaining secure environments while adhering to the principles of immutable containers.
2121

22-
Build and test container images with ACR Tasks in four ways:
22+
## Task scenarios
2323

24-
* [Quick task](#quick-task): Build and push container images on-demand, in Azure, without needing a local Docker Engine installation. Think `docker build`, `docker push` in the cloud. Build from local source code or a Git repository.
25-
* [Build on source code commit](#automatic-build-on-source-code-commit): Trigger a container image build automatically when code is committed to a Git repository.
26-
* [Build on base image update](#automate-os-and-framework-patching): Trigger a container image build when that image's base image has been updated.
27-
* [Multi-step tasks](#multi-step-tasks): Define multi-step tasks that build images, run containers as commands, and push images to a registry. This feature of ACR Tasks supports on-demand task execution and parallel image build, test, and push operations.
24+
ACR Tasks supports several scenarios to build and maintain container images and other artifacts. See the following sections in this article for details.
25+
26+
* **[Quick task](#quick-task)** - Build and push a single container image to a container registry on-demand, in Azure, without needing a local Docker Engine installation. Think `docker build`, `docker push` in the cloud.
27+
* **Automatically triggered tasks** - Enable one or more *triggers* to build an image:
28+
* **[Trigger on source code update](#trigger-task-on-source-code-update)**
29+
* **[Trigger on base image update](#automate-os-and-framework-patching)**
30+
* **[Trigger on a schedule](#schedule-a-task)**
31+
* **[Multi-step task](#multi-step-tasks)** - Extend the single image build-and-push capability of ACR Tasks with multi-step, multi-container-based workflows.
32+
33+
Each ACR Task has an associated [source code context](#context-locations) - the location of a set of source files used to build a container image or other artifact. Example contexts include a Git repository or a local filesystem.
34+
35+
Tasks can also take advantage of [run variables](container-registry-tasks-reference-yaml.md#run-variables), so you can reuse task definitions and standardize tags for images and artifacts.
2836

2937
## Quick task
3038

@@ -40,12 +48,21 @@ ACR Tasks is designed as a container lifecycle primitive. For example, integrate
4048

4149
Learn how to use quick tasks in the first ACR Tasks tutorial, [Build container images in the cloud with Azure Container Registry Tasks](container-registry-tutorial-quick-task.md).
4250

43-
## Automatic build on source code commit
51+
> [!TIP]
52+
> If you want to build and push an image directly from source code, without a Dockerfile, Azure Container Registry provides the [az acr pack build][az-acr-pack-build] command (preview). This tool builds and pushes an image from application source code using [Cloud Native Buildpacks](https://buildpacks.io/).
53+
54+
## Trigger task on source code update
55+
56+
Trigger a container image build or multi-step task when code is committed, or a pull request is made or updated, to a Git repository in GitHub or Azure DevOps. For example, configure a build task with the Azure CLI command [az acr task create][az-acr-task-create] by specifying a Git repository and optionally a branch and Dockerfile. When your team updates code in the repository, an ACR Tasks-created webhook triggers a build of the container image defined in the repo.
4457

45-
Use ACR Tasks to automatically trigger a container image build when code is committed to a Git repository in GitHub or Azure DevOps. Build tasks, configurable with the Azure CLI command [az acr task][az-acr-task], allow you to specify a Git repository and optionally a branch and Dockerfile. When your team commits code to the repository, an ACR Tasks-created webhook triggers a build of the container image defined in the repo.
58+
ACR Tasks supports the following triggers when you set a Git repo as the task's context:
4659

47-
> [!IMPORTANT]
48-
> If you previously created tasks during the preview with the `az acr build-task` command, those tasks need to be re-created using the [az acr task][az-acr-task] command.
60+
| Trigger | Enabled by default |
61+
| ------- | ------------------ |
62+
| Commit | Yes |
63+
| Pull request | No |
64+
65+
To configure the trigger, you provide the task a personal access token (PAT) to set the webhook in the GitHub or Azure DevOps repo.
4966

5067
Learn how to trigger builds on source code commit in the second ACR Tasks tutorial, [Automate container image builds with Azure Container Registry Tasks](container-registry-tutorial-build-task.md).
5168

@@ -59,25 +76,33 @@ When an OS or app framework image is updated by the upstream maintainer, for exa
5976

6077
Because ACR Tasks dynamically discovers base image dependencies when it builds a container image, it can detect when an application image's base image is updated. With one preconfigured [build task](container-registry-tutorial-base-image-update.md#create-a-task), ACR Tasks then **automatically rebuilds every application image** for you. With this automatic detection and rebuilding, ACR Tasks saves you the time and effort normally required to manually track and update each and every application image referencing your updated base image.
6178

62-
An ACR task tracks a base image update when the base image is in one of the following locations:
79+
For image builds from a Dockerfile, an ACR task tracks a base image update when the base image is in one of the following locations:
6380

6481
* The same Azure container registry where the task runs
6582
* Another Azure container registry in the same region
6683
* A public repo in Docker Hub
6784
* A public repo in Microsoft Container Registry
6885

86+
> [!NOTE]
87+
> * The base image update trigger is enabled by default in an ACR task.
88+
> * Currently, ACR Tasks only tracks base image updates for application (*runtime*) images. ACR Tasks doesn't track base image updates for intermediate (*buildtime*) images used in multi-stage Dockerfiles.
89+
6990
Learn more about OS and framework patching in the third ACR Tasks tutorial, [Automate image builds on base image update with Azure Container Registry Tasks](container-registry-tutorial-base-image-update.md).
7091

92+
## Schedule a task
93+
94+
Optionally schedule a task by setting up one or more *timer triggers* when you create or update the task. Scheduling a task is useful for running container workloads on a defined schedule, or running maintenance operations or tests on images pushed regularly to your registry. For details, see [Run an ACR task on a defined schedule](container-registry-tasks-scheduled.md).
95+
7196
## Multi-step tasks
7297

73-
Multi-step tasks provide step-based task definition and execution for building, testing, and patching container images in the cloud. Task steps define individual container image build and push operations. They can also define the execution of one or more containers, with each step using the container as its execution environment.
98+
Multi-step tasks provide step-based task definition and execution for building, testing, and patching container images in the cloud. Task steps defined in a [YAML file](container-registry-tasks-reference-yaml.md) specify individual build and push operations for container images or other artifacts. They can also define the execution of one or more containers, with each step using the container as its execution environment.
7499

75100
For example, you can create a multi-step task that automates the following:
76101

77102
1. Build a web application image
78103
1. Run the web application container
79104
1. Build a web application test image
80-
1. Run the web application test container which performs tests against the running application container
105+
1. Run the web application test container, which performs tests against the running application container
81106
1. If the tests pass, build a Helm chart archive package
82107
1. Perform a `helm upgrade` using the new Helm chart archive package
83108

@@ -110,15 +135,15 @@ By default, ACR Tasks builds images for the Linux OS and the amd64 architecture.
110135

111136
Each task run generates log output that you can inspect to determine whether the task steps ran successfully. If you use the [az acr build](/cli/azure/acr#az-acr-build), [az acr run](/cli/azure/acr#az-acr-run), or [az acr task run](/cli/azure/acr/task#az-acr-task-run) command to trigger the task, log output for the task run is streamed to the console and also stored for later retrieval. When a task is automatically triggered, for example by a source code commit or a base image update, task logs are only stored. View the logs for a task run in the Azure portal, or use the [az acr task logs](/cli/azure/acr/task#az-acr-task-logs) command.
112137

113-
Starting in July 2019, data and logs for task runs in a registry will be retained by default for 30 days and then automatically purged. If you want to archive the data for a task run, enable archiving using the [az acr task update-run](/cli/azure/acr/task#az-acr-task-update-run) command. The following example enables archiving for the task run *cf11* in registry *myregistry*.
138+
By default, data and logs for task runs in a registry are retained for 30 days and then automatically purged. If you want to archive the data for a task run, enable archiving using the [az acr task update-run](/cli/azure/acr/task#az-acr-task-update-run) command. The following example enables archiving for the task run *cf11* in registry *myregistry*.
114139

115140
```azurecli
116141
az acr task update-run --registry myregistry --run-id cf11 --no-archive false
117142
```
118143

119144
## Next steps
120145

121-
When you're ready to automate OS and framework patching by building your container images in the cloud, check out the three-part [ACR Tasks tutorial series](container-registry-tutorial-quick-task.md).
146+
When you're ready to automate container image builds and maintenance in the cloud, check out the [ACR Tasks tutorial series](container-registry-tutorial-quick-task.md).
122147

123148
Optionally install the [Docker Extension for Visual Studio Code](https://code.visualstudio.com/docs/azure/docker) and the [Azure Account](https://marketplace.visualstudio.com/items?itemName=ms-vscode.azure-account) extension to work with your Azure container registries. Pull and push images to an Azure container registry, or run ACR Tasks, all within Visual Studio Code.
124149

@@ -133,7 +158,9 @@ Optionally install the [Docker Extension for Visual Studio Code](https://code.vi
133158
<!-- LINKS - Internal -->
134159
[azure-cli]: /cli/azure/install-azure-cli
135160
[az-acr-build]: /cli/azure/acr#az-acr-build
136-
[az-acr-task]: /cli/azure/acr
161+
[az-acr-pack-build]: /cli/azure/acr/pack#az-acr-pack-build
162+
[az-acr-task]: /cli/azure/acr/task
163+
[az-acr-task-create]: /cli/azure/acr/task#az-acr-task-create
137164
[az-login]: /cli/azure/reference-index#az-login
138165
[az-login-service-principal]: /cli/azure/authenticate-azure-cli
139166

0 commit comments

Comments
 (0)