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.
What does this change
This fixes the bundle output when a bundle is run in debug mode with --debug. It initializes RuntimeConfig.DebugMode (used by the mixins) with the value of the PORTER_DEBUG environment variable. It also configures a logger and puts it on the go context, so that when mixins use tracing.StartSpan or tracing.LoggerFromContext it gets a configured logger that understands the verbosity that was set on the Porter client side.
We are now setting PORTER_VERBOSITY on the bundle's invocation image when run so that --verbosity set on the client is also used in the bundle. When the bundle is run in debug mode (i.e. porter install --debug), we also pass PORTER_VERBOSITY=debug so that a dev can see everything that is happening.
What issue does it fix
Closes #2358
Notes for the reviewer
I am copy/pasting a lot of boilerplate code from porter's main into the exec mixin. In order for the other mixins to get debug mode and verbosity working, they too will need to do this. Long term I would like to use the pkg/cli package to share a common main implementation but @VinozzZ and I agreed this was the more conservative fix since we are in a release candidate.
Checklist
Reviewer Checklist