You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/container-registry/container-registry-tutorial-build-task.md
+15-60Lines changed: 15 additions & 60 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ author: dlepow
6
6
7
7
ms.service: container-registry
8
8
ms.topic: tutorial
9
-
ms.date: 09/24/2018
9
+
ms.date: 05/04/2019
10
10
ms.author: danlep
11
11
ms.custom: "seodec18, mvc"
12
12
# Customer intent: As a developer or devops engineer, I want to trigger
@@ -15,9 +15,11 @@ ms.custom: "seodec18, mvc"
15
15
16
16
# Tutorial: Automate container image builds in the cloud when you commit source code
17
17
18
-
In addition to a [quick task](container-registry-tutorial-quick-task.md), ACR Tasks supports automated Docker container image builds with the *build task*. In this tutorial, you use the Azure CLI to create a task that automatically triggers image builds in the cloud when you commit source code to a Git repository.
18
+
In addition to a [quick task](container-registry-tutorial-quick-task.md), ACR Tasks supports automated Docker container image builds in the cloud when you commit source code to a Git repository.
19
19
20
-
In this tutorial, part two in the series:
20
+
In this tutorial, your ACR task builds and pushes a single container image specified in a Dockerfile when you commit source code to a Git repo. To create a [multi-step task](container-registry-tasks-multi-step.md) that uses a YAML file to define steps to build, push, and optionally test multiple containers on code commit, see [Tutorial: Run a multi-step container workflow in the cloud when you commit source code](container-registry-tutorial-multistep-task.md). For an overview of ACR Tasks, see [Automate OS and framework patching with ACR Tasks](container-registry-tasks-overview.md)
21
+
22
+
In this tutorial:
21
23
22
24
> [!div class="checklist"]
23
25
> * Create a task
@@ -31,59 +33,21 @@ This tutorial assumes you've already completed the steps in the [previous tutori
31
33
32
34
If you'd like to use the Azure CLI locally, you must have Azure CLI version **2.0.46** or later installed and logged in with [az login][az-login]. Run `az --version` to find the version. If you need to install or upgrade the CLI, see [Install Azure CLI][azure-cli].
33
35
34
-
## Prerequisites
35
-
36
-
### Get sample code
37
-
38
-
This tutorial assumes you've already completed the steps in the [previous tutorial](container-registry-tutorial-quick-task.md), and have forked and cloned the sample repository. If you haven't already done so, complete the steps in the [Prerequisites](container-registry-tutorial-quick-task.md#prerequisites) section of the previous tutorial before proceeding.
39
-
40
-
### Container registry
41
-
42
-
You must have an Azure container registry in your Azure subscription to complete this tutorial. If you need a registry, see the [previous tutorial](container-registry-tutorial-quick-task.md), or [Quickstart: Create a container registry using the Azure CLI](container-registry-get-started-azure-cli.md).
43
-
44
-
## Overview of ACR Tasks
45
-
46
-
A task defines the properties of an automated build, including the location of the container image source code and the event that triggers the build. When an event defined in the task occurs, such as a commit to a Git repository, ACR Tasks initiates a container image build in the cloud. By default, it then pushes a successfully built image to the Azure container registry specified in the task.
47
-
48
-
ACR Tasks currently support the following triggers:
49
-
50
-
* Commit to a Git repository
51
-
* Base image update
52
-
53
-
In this tutorial, your ACR task builds and pushes a single container image specified in a Dockerfile. ACR Tasks can also run [multi-step tasks](container-registry-tasks-multi-step.md), using a YAML file to define steps to build, push, and optionally test multiple containers.
In this section, you first create a GitHub personal access token (PAT) for use with ACR Tasks. Then, you create a task that triggers a build when code is committed to your fork of the repository.
58
-
59
-
### Create a GitHub personal access token
60
-
61
-
To trigger a build on a commit to a Git repository, ACR Tasks need a personal access token (PAT) to access the repository. Follow these steps to generate a PAT in GitHub:
62
-
63
-
1. Navigate to the PAT creation page on GitHub at https://github.com/settings/tokens/new
64
-
1. Enter a short **description** for the token, for example, "ACR Tasks Demo"
65
-
1. Under **repo**, enable **repo:status** and **public_repo**
66
-
67
-
![Screenshot of the Personal Access Token generation page in GitHub][build-task-01-new-token]
68
-
69
-
1. Select the **Generate token** button (you may be asked to confirm your password)
70
-
1. Copy and save the generated token in a **secure location** (you use this token when you define a task in the following section)
71
-
72
-
![Screenshot of the generated Personal Access Token in GitHub][build-task-02-generated-token]
73
-
74
-
### Create the build task
38
+
## Create the build task
75
39
76
40
Now that you've completed the steps required to enable ACR Tasks to read commit status and create webhooks in a repository, you can create a task that triggers a container image build on commits to the repo.
77
41
78
-
First, populate these shell environment variables with values appropriate for your environment. This step isn't strictly required, but makes executing the multiline Azure CLI commands in this tutorial a bit easier. If you don't populate these environment variables, you must manually replace each value wherever they appear in the example commands.
42
+
First, populate these shell environment variables with values appropriate for your environment. This step isn't strictly required, but makes executing the multiline Azure CLI commands in this tutorial a bit easier. If you don't populate these environment variables, you must manually replace each value wherever it appears in the example commands.
79
43
80
44
```azurecli-interactive
81
45
ACR_NAME=<registry-name> # The name of your Azure container registry
82
46
GIT_USER=<github-username> # Your GitHub user account name
83
47
GIT_PAT=<personal-access-token> # The PAT you generated in the previous section
84
48
```
85
49
86
-
Now, create the task by executing following [az acr task create][az-acr-task-create] command:
50
+
Now, create the task by executing the following [az acr task create][az-acr-task-create] command:
87
51
88
52
```azurecli-interactive
89
53
az acr task create \
@@ -104,14 +68,6 @@ This task specifies that any time code is committed to the *master* branch in th
104
68
Output from a successful [az acr task create][az-acr-task-create] command is similar to the following:
0 commit comments