Skip to content

feat(cli): add --provisioner-log-debug option #14558

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 4, 2024
Merged

feat(cli): add --provisioner-log-debug option #14558

merged 2 commits into from
Sep 4, 2024

Conversation

johnstcn
Copy link
Member

@johnstcn johnstcn commented Sep 4, 2024

Allows starting a build in debug mode from the CLI without having to have the build fail first by adding --provisioner-log-debug.

cli/parameter.go Outdated
provisioner bool
}

func (bdf *buildDebugFlags) cliOptions() []serpent.Option {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we instead hook into the CODER_VERBOSE setting?
I'm curious why we need a new setting.

Copy link
Member Author

@johnstcn johnstcn Sep 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Enabling provisioner debug logs is only allowed if --enable-terraform-debug-mode is set. Hooking into CODER_VERBOSE would potentially make unrelated stuff fail if this was not set.

If we did want to re-use this flag, we would need to first fetch the deployment config and check.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not a fan of piggy-backing on verbose either, it essentially changes the behavior of a build, not just the output of the CLI.

Copy link
Member

@mafredri mafredri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the flag naming could be a bit better, but otherwise LGTM.

cli/parameter.go Outdated
func (bdf *buildDebugFlags) cliOptions() []serpent.Option {
return []serpent.Option{
{
Flag: "debug-provisioner",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're not so much debugging the provisioner as we're debugging the build via increased provisioner logs. I think we can do a bit better on the naming but I don't have any great ideas. Maybe --debug-build?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could just straight-up make it --provisioner-log-debug? WDYT?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That still sounds like provisioner debugging IMO, not build debugging 😅

@@ -8,6 +8,11 @@ USAGE:
Aliases: rm

OPTIONS:
--debug-provisioner bool
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we keep this flag hidden? I believe this is only for template admins as it may leak some secrets in the TF verbose mode.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm happy to hide it 👍

Copy link
Member

@mtojek mtojek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stamp 👍

@johnstcn johnstcn changed the title feat(cli): add --debug-provisioner argument feat(cli): add --provisioner-log-debug option Sep 4, 2024
@johnstcn johnstcn merged commit bcf9bc3 into main Sep 4, 2024
32 checks passed
@johnstcn johnstcn deleted the cj/build-debug branch September 4, 2024 13:39
@github-actions github-actions bot locked and limited conversation to collaborators Sep 4, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants