Skip to content

Commit 793630b

Browse files
committed
review comments, edits
1 parent 9adaaea commit 793630b

File tree

1 file changed

+34
-31
lines changed

1 file changed

+34
-31
lines changed

articles/container-instances/container-instances-github-action.md

Lines changed: 34 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,27 @@
11
---
2-
title: Trigger container group by GitHub action
2+
title: Deploy container instance by GitHub action
33
description: Configure a GitHub action that automates steps to build, push, and deploy a container image to Azure Container Instances
44
ms.topic: article
5-
ms.date: 03/17/2020
5+
ms.date: 03/18/2020
66
ms.custom:
77
---
88

9-
# Configure a GitHub action to create a container group
9+
# Configure a GitHub action to create a container instance
1010

1111
[GitHub Actions](https://help.github.com/actions/getting-started-with-github-actions/about-github-actions) is a suite of features in GitHub to automate your software development workflows in the same place you store code and collaborate on pull requests and issues.
1212

13-
Use GitHub actions to automate deployment of a container image to Azure Container Instances. This article shows you how to set up a workflow in a GitHub repo triggered by push of a code commit that performs the following actions:
13+
Use the [Deploy to Azure Container Instances](https://github.com/azure/aci-deploy) GitHub action to automate deployment of a container to Azure Container Instances. The action allows you to set properties for a container instance similar to those in the [az container create][az-container-create] command.
14+
15+
This article shows how to set up a workflow in a GitHub repo that performs the following actions:
1416

1517
* Build an image from a Dockerfile
1618
* Push the image to an Azure container registry
17-
* Deploy the container image to Azure Container Instances
19+
* Deploy the container image to an Azure container instance
1820

19-
This article shows two methods to set up the workflow:
21+
This article shows two ways to set up the workflow:
2022

21-
* Configure a workflow in a GitHub repo that uses the [Deploy to Azure Container Instances](https://github.com/azure/aci-deploy-action) action
22-
* Use the `az container app up` command in the [Deploy to Azure](https://github.com/Azure/deploy-to-azure-cli-extension) extension in the Azure CLI. This command streamlines creation of the GitHub workflow and deployment steps
23+
* Configure a workflow yourself in a GitHub repo using the Deploy to Azure Container Instances action and other actions.
24+
* Use the `az container app up` command in the [Deploy to Azure](https://github.com/Azure/deploy-to-azure-cli-extension) extension in the Azure CLI. This command streamlines creation of the GitHub workflow and deployment steps.
2325

2426
> [!IMPORTANT]
2527
> The GitHub action for Azure Container Instances is currently in preview. Previews are made available to you on the condition that you agree to the [supplemental terms of use][terms-of-use]. Some aspects of this feature may change prior to general availability (GA).
@@ -30,13 +32,11 @@ This article shows two methods to set up the workflow:
3032
* **Azure CLI** - You can use the Azure Cloud Shell or a local installation of the Azure CLI to complete the Azure CLI steps. If you need to install or upgrade, see [Install Azure CLI][azure-cli-install].
3133
* **Azure container registry** - If you don't have one, create an Azure container registry in the Basic tier using the [Azure CLI](../container-registry/container-registry-get-started-azure-cli.md), [Azure portal](../container-registry/container-registry-get-started-portal.md), or other methods. Take note of the resource group used for the deployment, which is used for the GitHub workflow.
3234

33-
## Workflow setup
34-
35-
### Fork sample repo
35+
## Set up repo
3636

3737
* For the examples in this article, use GitHub to fork the following repository: https://github.com/Azure-Samples/acr-build-helloworld-node
3838

39-
This repo contains a Dockerfile to create a container image of a small web app.
39+
This repo contains a Dockerfile and source files to create a container image of a small web app.
4040

4141
![Screenshot of the Fork button (highlighted) in GitHub](../container-registry/media/container-registry-tutorial-quick-build/quick-build-01-fork.png)
4242

@@ -86,7 +86,7 @@ Save the JSON output because it is used in a later step. Also, take note of the
8686

8787
### Update service principal for registry authentication
8888

89-
Update the Azure service principal credentials to allow push and pull permissions on your container registry. This step allows you the GitHub workflow to us the service principal to [authenticate with your container registry](../container-registry/container-registry-auth-service-principal.md).
89+
Update the Azure service principal credentials to allow push and pull permissions on your container registry. This step allows the GitHub workflow to use the service principal to [authenticate with your container registry](../container-registry/container-registry-auth-service-principal.md).
9090

9191
Get the resource ID of your container registry. Substitute the name of your registry in the following [az acr show][az-acr-show] command:
9292

@@ -154,7 +154,7 @@ jobs:
154154
docker push ${{ secrets.REGISTRY_LOGIN_SERVER }}/sampleapp:${{ github.sha }}
155155
156156
- name: 'Deploy to Azure Container Instances'
157-
uses: 'azure/aci-deploy-action@v1'
157+
uses: 'azure/aci-deploy@v1'
158158
with:
159159
resource-group: ${{ secrets.RESOURCE_GROUP }}
160160
dns-name-label: ${{ secrets.RESOURCE_GROUP }}${{ github.run_number }}
@@ -168,10 +168,12 @@ jobs:
168168
169169
### Validate workflow
170170
171-
After you commit the workflow file, the workflow is triggered. To review workflow progress, navigate to **Actions** > **Workflows**. See [Managing a workflow run](https://help.github.com/actions/configuring-and-managing-workflows/managing-a-workflow-run) for information about viewing the status and results of each step in your workflow.
171+
After you commit the workflow file, the workflow is triggered. To review workflow progress, navigate to **Actions** > **Workflows**.
172172
173173
![View workflow progress](./media/container-instances-github-action/github-action-progress.png)
174174
175+
See [Managing a workflow run](https://help.github.com/actions/configuring-and-managing-workflows/managing-a-workflow-run) for information about viewing the status and results of each step in your workflow.
176+
175177
When the workflow completes, get information about the container instance named *aci-sampleapp* by running the [az container show][az-container-show] command. Substitute the name of your resource group:
176178
177179
```azurecli
@@ -196,30 +198,28 @@ After the instance is provisioned, navigate to the container's FQDN in your brow
196198

197199
## Use Deploy to Azure extension
198200

199-
Alternatively, use the [Deploy to Azure extension](https://github.com/Azure/deploy-to-azure-cli-extension) in the Azure CLI to configure the workflow. The `az container app up` command in the extension takes minimal input parameters from you to set up a workflow to deploy to Azure Container Instances.
201+
Alternatively, use the [Deploy to Azure extension](https://github.com/Azure/deploy-to-azure-cli-extension) in the Azure CLI to configure the workflow. The `az container app up` command in the extension takes input parameters from you to set up a workflow to deploy to Azure Container Instances.
200202

201203
The workflow created by the Azure CLI is similar to the workflow you can [create manually using GitHub](#configure-github-workflow).
202204

203-
### Additional prerequisites
205+
### Additional prerequisite
204206

205-
In addition to the [prerequisites](#prerequisites) and [workflow setup](#workflow-setup) for this scenario, you need to install the **Deploy to Azure extension** for the Azure CLI.
207+
In addition to the [prerequisites](#prerequisites) and [repo setup](#set-up-repo) for this scenario, you need to install the **Deploy to Azure extension** for the Azure CLI.
206208

207209
Run the [az extension add][az-extension-add] command to install the extension:
208210

209-
<TODO: Link to prod extension?>
210-
211211
```azurecli
212212
az extension add \
213-
--source https://github.com/Azure/deploy-to-azure-cli-extension/releases/download/20200311.2/deploy_to_azure-0.1.0-py2.py3-none-any.whl
213+
--name deploy-to-azure
214214
```
215215

216216
For information about finding, installing, and managing extensions, see [Use extensions with Azure CLI](/cli/azure/azure-cli-extensions-overview).
217217

218-
### Deploy to Azure Container Instances
218+
### Run `az container up`
219219

220220
To run the [az container app up][az-container-app-up] command, provide at minimum:
221221

222-
* The name of your Azure container registry, for example, *myrewgistry*
222+
* The name of your Azure container registry, for example, *myregistry*
223223
* The URL to your GitHub repo, for example, `https://github.com/<your-GitHub-Id>/acr-build-helloworld-node`
224224

225225
Sample command:
@@ -230,15 +230,18 @@ az container app up \
230230
--repository https://github.com/myID/acr-build-helloworld-node
231231
```
232232

233-
When prompted, provide your GitHub credentials. The command then creates a personal access token (PAT) to authenticate with your registry. The token has *repo* and *user* scopes on the repo. Alternatively, [create your own PAT](https://help.github.com/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line) with those scopes and supply the PAT when prompted.
233+
### Command progress
234234

235-
The command creates:
235+
* When prompted, provide your GitHub credentials or provide a [GitHub personal access token](https://help.github.com/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line) (PAT) that has *repo* and *user* scopes to authenticate with your registry. If you provide GitHub credentials, the command creates a PAT for you.
236236

237-
* Service principal credentials for the workflow
238-
* Credentials to access the Azure container registry
239-
* A YAML file to define the GitHub workflow. Accept the default filename `main.yml`, or provide a filename you choose.
237+
* The command creates repo secrets for the workflow:
240238

241-
After you commit the workflow file to your repo, the workflow is triggered. Output is similar to:
239+
* Service principal credentials for the Azure CLI
240+
* Credentials to access the Azure container registry
241+
242+
* After the command commits the workflow file to your repo, the workflow is triggered.
243+
244+
Output is similar to:
242245

243246
```console
244247
[...]
@@ -252,7 +255,7 @@ Your app is deployed at: http://acr-build-helloworld-node.eastus.azurecontainer
252255

253256
### Validate workflow
254257

255-
The workflow deploys an Azure container instance with the base name of your GitHub repo, in this case, *acr-build-helloworld-node*. In your browser, you can browse to the link provided to view the running web app.
258+
The workflow deploys an Azure container instance with the base name of your GitHub repo, in this case, *acr-build-helloworld-node*. In your browser, you can browse to the link provided to view the running web app. If your app listens on a port other than 8080, specify that in the URL instead.
256259

257260
To view the workflow status and results of each step in the GitHub UI, see [Managing a workflow run](https://help.github.com/actions/configuring-and-managing-workflows/managing-a-workflow-run).
258261

@@ -288,7 +291,7 @@ Browse the [GitHub Marketplace](https://github.com/marketplace?type=actions) for
288291
[az-group-delete]: /cli/azure/group#az-group-delete
289292
[az-ad-sp-create-for-rbac]: /cli/azure/ad/sp#az-ad-sp-create-for-rbac
290293
[az-role-assignment-create]: /cli/azure/role/assignment#az-role-assignment-create
291-
[az-container-logs]: /cli/azure/container#az-container-logs
294+
[az-container-create]: /cli/azure/container#az-container-create
292295
[az-acr-show]: /cli/azure/acr#az-acr-show
293296
[az-container-show]: /cli/azure/container#az-container-show
294297
[az-container-delete]: /cli/azure/container#az-container-delete

0 commit comments

Comments
 (0)