added &> /dev/null to azdo dockerfile #1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Purpose
I faced an issue when calling this script in Terraform using the local-exec provisioner where some of the output of the 4th step could not be parsed due to a missing encoding setting in Terraform.
The only thing i changed is redirecting the output of this step to /dev/null. As such, the output of the 4th step when calling this in a script does not go trough terraform (or anything really) so no parsing issues can occur.
Does this introduce a breaking change?
Pull Request Type
What kind of change does this Pull Request introduce?
How to Test
Get the code
Test the code
Run the following command
az acr build --registry "{registery_name}" --image "azure-pipelines-agent:1.0" --file "Dockerfile.azure-pipelines" "https://github.com/Azure-Samples/container-apps-ci-cd-runner-tutorial.git"
What to Check
No output from the 4the step
Other Information
Below you can find the way I call the dockerfile in Terraform. It invokes the command but the output is going trough Terraform which causes the following error.
UnicodeEncodeError: 'charmap' codec can't encode character '\u2192' in position 3169: character maps to
As you can see, there is a parsing error due to the nature of the output from the dockerfile. Thats why supressing the output of the buildstep is a quick fix for this issue.
Another way to fix this would be to add the encoding="utf-8" in the function that is being used to invoke this command. But that would be on a change on the Terraform side.
Feel free to provide feedback or discuss this further.
resource "null_resource" "create_image" {
for_each = { for k, v in var.container_registries : k => v }
provisioner "local-exec" {
command = "az acr build --no-format --registry ${module.container_registry[each.key].data.name} --image azure-pipelines-agent:1.0 --file Dockerfile.azure-pipelines https://github.com/Azure-Samples/container-apps-ci-cd-runner-tutorial.git"
}
}