az acr build fails when using --build-arg, but works without it
- Dominant language
- Python
- Stars
- 4.6k
- Forks
- 3.5k
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 60
Description
### Describe the bug
I am using az acr build in a GitHub Actions workflow to build and push a Docker image to Azure Container Registry (ACR).
The following command works fine:
```shell
az acr build --image ${{ env.AZURE_CONTAINER_REGISTRY }}.azurecr.io/${{ env.CONTAINER_NAME }}:${{ github.sha }} \
--registry ${{ env.AZURE_CONTAINER_REGISTRY }} \
-g ${{ env.ACR_RESOURCE_GROUP }} \
-f ${{ env.DOCKER_FILE }} \
${{ env.BUILD_CONTEXT_PATH }}
```
### Related command
But this command gives us the error as shown in the screenshot
```shell
az acr build --image ${{ env.AZURE_CONTAINER_REGISTRY }}.azurecr.io/${{ env.CONTAINER_NAME }}:${{ github.sha }} \
--registry ${{ env.AZURE_CONTAINER_REGISTRY }} \
-g ${{ env.ACR_RESOURCE_GROUP }} \
-f ${{ env.DOCKER_FILE }} \
--build-arg AZURE_COMMUNICATION_SERVICES_CONNECTION_STRING=${{ secrets.AZURE_COMMUNICATION_SERVICES_CONNECTION_STRING }} \
--build-arg AZURE_COMMUNICATION_SENDER_EMAIL=${{ secrets.AZURE_COMMUNICATION_SENDER_EMAIL }} \
--build-arg AZURE_COMMUNICATION_RECIPIENT_EMAIL=${{ secrets.AZURE_COMMUNICATION_RECIPIENT_EMAIL }} \
${{ env.BUILD_CONTEXT_PATH }}
```

### Errors
However, when I add --build-arg options, the command fails with the error:
"the following arguments are required: "
### Expected behavior
Both versions of the command should work as expected. Adding --build-arg should not break the az acr build command.
Actual Behavior:
Adding --build-arg results in the following error:
`ERROR: the following arguments are required: `
### Additional context
I confirmed that the Dockerfile and build context exist
The same command works locally, but fails in GitHub Actions
Possible issue with how az acr build handles --build-arg in GitHub Actions?
Contributor guide
Assessment
This issue has not been assessed yet.