You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using a shell provisioner which writes a lot of output to stdout.
Most of the times, this output just spams my build log and I do not need, but occasionally I want to have a look at it for debugging purposes.
What I would like, is to have an extra option for the shell-provisioner to specify a local file (on the build host) where all output from my script gets redirected to.
The text was updated successfully, but these errors were encountered:
Hi @mtausig thanks for reaching out. I totally understand where you are coming from. The option you are looking for here is not something that we will build into the provisioner but I could see the option of allowing Packer to write its output to some file without having to manually redirect the output. At this time this can only be done when running in debug log mode.
Packer has support for redirecting a full debug log to some file on the build host by setting the PACKER_LOG=1 and PACKER_LOG_PATH environment variables. For example PACKER_LOG=1 PACKER_LOG_PATH=build.log packer build .
By setting PACKER_LOG=1 it will enable debug log mode, which can then be written to the file defined in the PACKER_LOG_PATH environment variable. Since this is debug logging there will be more noise but you can filter down to each of the provisioners as they are named within the log.
If you have multiple shell provisioners that you need to distigush in the logs without looking at the scripts or inline commands they are running you can give each provisioner a unique name which you can then use to jump to a specific provisioner in the log.
provisioner "shell-local" {
name = "set-sentive-values"
inline = ["echo ${source.name} and ${source.type}, the sensitive var: ${var.sensitive}, ${local.bip}, ${var.number}"]
}
Here's an example that would make this useful: You can execute goss infrastructure tests remotely and capture JUnit formatted results for report collection in Jenkins.
And later collect local-results.xml after the packer baking completes. In the above case, stdout is a particular format (XML) and so simply outputting it to a mixed debug log is no good because it would be invalid output for the desired result.
The above command is trivial using just SSH but ideally it would be nice to have the provisioner behave like
I am using a shell provisioner which writes a lot of output to stdout.
Most of the times, this output just spams my build log and I do not need, but occasionally I want to have a look at it for debugging purposes.
What I would like, is to have an extra option for the shell-provisioner to specify a local file (on the build host) where all output from my script gets redirected to.
The text was updated successfully, but these errors were encountered: