Skip to content

Commit 1193038

Browse files
Add schedule task with source code context
1 parent ad4d21a commit 1193038

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

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

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,33 @@ NAME PLATFORM STATUS SOURCE REPOSITORY TRIGGERS
7171
timertask linux Enabled BASE_IMAGE, TIMER
7272
```
7373

74+
75+
Also, a simple example, of the task running with source code context. The following task triggers running the `hello-world` image from Microsoft Container Registry every day at 21:00 UTC.
76+
77+
Follow the [Prerequisites](/azure/container-registry/container-registry-tutorial-quick-task#prerequisites) to build the source code context and then create a scheduled task with context.
78+
79+
```azurecli
80+
az acr task create \
81+
--name timertask \
82+
--registry $ACR_NAME \
83+
--context https://github.com/$GIT_USER/acr-build-helloworld-node.git#master \
84+
--file Dockerfile \
85+
--image timertask:{{.Run.ID}} \
86+
--git-access-token $GIT_PAT \
87+
--schedule "0 21 * * *"
88+
```
89+
90+
Run the [az acr task show][az-acr-task-show] command to see that the timer trigger is configured. By default, the base image update trigger is also enabled.
91+
92+
```azurecli
93+
az acr task show --name timertask --registry $ACR_NAME --output table
94+
```
95+
96+
Run the [az acr task run][az-acr-task-run ] command to trigger the task manually.
97+
```azurecli
98+
az acr task run --name timertask --registry $ACR_NAME
99+
```
100+
74101
## Trigger the task
75102

76103
Trigger the task manually with [az acr task run][az-acr-task-run] to ensure that it is set up properly:

0 commit comments

Comments
 (0)