Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit cf69717

Browse files
committedAug 16, 2018
[ACR] images and all section drafts
1 parent 67e75da commit cf69717

File tree

5 files changed

+83
-4
lines changed

5 files changed

+83
-4
lines changed
 

‎articles/container-registry/container-registry-event-grid-quickstart.md

Lines changed: 82 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Azure Event Grid is a fully managed event routing service that provides uniform
2020

2121
After you complete the steps in this article, you can view events sent from your container registry to Event Grid in the sample web app:
2222

23-
IMAGE HERE
23+
![Web browser rendering the sample web application with three received events][sample-app-01]
2424

2525
The Azure CLI commands in this article are formatted for the Bash shell. If you're using a different shell like PowerShell or Command Prompt, you may need to adjust line continuation characters or variable assignment lines accordingly. This article uses environment variables to minimize the amount of editing you need to do in commands in later sections.
2626

@@ -89,11 +89,11 @@ az group deployment create \
8989

9090
Once the deployment has succeeded (it might take a few minutes), navigate to your web app to make sure it's running. In your favorite web browser, navigate to:
9191

92-
`https://<your-site-name>.azurewebsites.net`
92+
`http://<your-site-name>.azurewebsites.net`
9393

9494
You should see the sample app rendered with no event messages displayed:
9595

96-
IMAGE HERE
96+
![Web browser showing sample web app with no events displayed][sample-app-02]
9797

9898
[!INCLUDE [event-grid-register-provider-cli.md](../../includes/event-grid-register-provider-cli.md)]
9999

@@ -113,20 +113,99 @@ az eventgrid event-subscription create \
113113

114114
## Trigger registry events
115115

116+
Now that the sample app is up and running and you've subscribed to your registry with Event Grid, you're ready to generate some events. In this section, you use ACR Build to build and push a container image to your registry. ACR Build is a feature of Azure Container Registry that allows you to build container images in the cloud, without needing the Docker Engine installed on your local machine.
117+
118+
### Build and push image
119+
120+
Execute the following Azure CLI command to build a container image from the contents of a GitHub repository. By default, ACR Build automatically pushes a successfully built image to your registry, which generates an `ImagePushed` event.
121+
122+
```azurecli-interactive
123+
az acr build --registry $ACR_NAME --image myimage:v1 https://github.com/Azure-Samples/acr-build-helloworld-node.git
124+
```
125+
126+
You should see output similar to the following while ACR Build builds and then pushes your image. The following sample output has been truncated for brevity.
127+
128+
```console
129+
$ az acr build -r $ACR_NAME --image myimage:v1 https://github.com/Azure-Samples/acr-build-helloworld-node.git
130+
Sending build context to ACR...
131+
Queued a build with build ID: aa2
132+
Waiting for build agent...
133+
2018/08/16 22:19:38 Using acb_vol_27a2afa6-27dc-4ae4-9e52-6d6c8b7455b2 as the home volume
134+
2018/08/16 22:19:38 Setting up Docker configuration...
135+
2018/08/16 22:19:39 Successfully set up Docker configuration
136+
2018/08/16 22:19:39 Logging in to registry: myregistry.azurecr.io
137+
2018/08/16 22:19:55 Successfully logged in
138+
Sending build context to Docker daemon 94.72kB
139+
Step 1/5 : FROM node:9-alpine
140+
...
141+
```
142+
143+
To verify that the built image is in your registry, execute the following command to view the tags in the "myimage" repository:
144+
145+
```azurecli-interactive
146+
az acr repository show-tags --name $ACR_NAME --repository myimage
147+
```
148+
149+
The "v1" tag of the image you built should appear in the output, similar to the following:
150+
151+
```console
152+
$ az acr repository show-tags --name $ACR_NAME --repository myimage
153+
[
154+
"v1"
155+
]
156+
```
157+
158+
### Delete the image
159+
160+
Now, generate an `ImageDeleted` event by deleting the image with the [az acr repository delete][az-acr-repository-delete] command.
161+
162+
```azurecli-interactive
163+
az acr repository delete --name $ACR_NAME --image myimage:v1
164+
```
165+
166+
You should see output similar to the following, asking for confirmation to delete the manifest and its images:
167+
168+
```console
169+
$ az acr repository delete --name $ACR_NAME --image myimage:v1
170+
This operation will delete the manifest 'sha256:f15fa9d0a69081ba93eee308b0e475a54fac9c682196721e294b2bc20ab23a1b' and all the following images: 'myimage:v1'.
171+
Are you sure you want to continue? (y/n): y
172+
```
173+
116174
## View registry events
117175

176+
You've now push an image to your registry and then deleted it. Navigate to your Event Grid Viewer web app, and you should see several events. One is the subscription event generated by executing the command in the [Subscribe to registry events](#subscribe-to-registry-events) section. There should also be both an `ImageDeleted` event and an `ImagePushed` event.
177+
178+
The following screenshot shows the sample app with the three events, and the `ImageDeleted` event is expanded to show its details.
179+
180+
![Web browser showing the sample app with ImagePushed and ImageDeleted events][sample-app-03]
181+
182+
Congratulations! You've deployed a container registry, built an image with ACR Build, deleted it, and have consumed your registry's events from Event Grid with a sample application.
183+
184+
## Clean up resources
185+
186+
Once you're done with the resources you created in this quickstart, you can delete them all with the following Azure CLI command. When you delete a resource group, all of the resources it contains are permanently deleted.
187+
188+
**WARNING**:This operation is irreversible, so be sure you no longer need any of these resources before running the command.
189+
190+
```azurecli-interactive
191+
az group delete $RESOURCE_GROUP_NAME
192+
```
193+
118194
## Next steps
119195

120196
For more information about image storage in Azure Container Registry see [Container image storage in Azure Container Registry](container-registry-storage.md).
121197

122198
<!-- IMAGES -->
123199
[sample-app-01]: ./media/container-registry-event-grid-quickstart/sample-app-01.png
200+
[sample-app-02]: ./media/container-registry-event-grid-quickstart/sample-app-02-no-events.png
201+
[sample-app-03]: ./media/container-registry-event-grid-quickstart/sample-app-03-with-events.png
124202

125203
<!-- LINKS - External -->
126204
[azure-account]: https://azure.microsoft.com/free/?WT.mc_id=A261C142F
127205
[sample-app]: https://github.com/dbarkol/azure-event-grid-viewer
128206

129207
<!-- LINKS - Internal -->
130208
[az-acr-create]: /cli/azure/acr/repository#az-acr-create
209+
[az-acr-repository-delete]: /cli/azure/acr/repository#az-acr-repository-delete
131210
[az-eventgrid-event-subscription-create]: /cli/azure/eventgrid/event-subscription#az-eventgrid-event-subscription-create
132211
[az-group-create]: /cli/azure/group#az-group-create
Loading

‎includes/event-grid-register-provider-cli.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ az provider register --namespace Microsoft.EventGrid
2121
It may take a moment for the registration to finish. To check the status, run:
2222

2323
```azurecli-interactive
24-
az provider show -n Microsoft.EventGrid --query "registrationState"
24+
az provider show --namespace Microsoft.EventGrid --query "registrationState"
2525
```
2626

2727
When `registrationState` is `Registered`, you're ready to continue.

0 commit comments

Comments
 (0)
Please sign in to comment.