-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
views: add cloud view #35929
views: add cloud view #35929
Conversation
The cloud backend includes a retry hook that relies on a go-tfe implementation. Since these retry messages were not rendered through a view, the `-json` flag was not respected, leading to mixed (non-pure JSON) output in the terminal whenever retry messages were printed. Before passing the init view to the cloud backend, we ensure the retryLog hook is included in the init view. Signed-off-by: Bruno Schaatsbergen <git@bschaatsbergen.com>
Signed-off-by: Bruno Schaatsbergen <git@bschaatsbergen.com>
Signed-off-by: Bruno Schaatsbergen <git@bschaatsbergen.com>
f9d9df0
to
f979759
Compare
ecbb274
to
cb2d019
Compare
Signed-off-by: Bruno Schaatsbergen <git@bschaatsbergen.com>
cb2d019
to
a909304
Compare
The cloud view is responsible for rendering messages related to cloud operations, presenting them to the user in either a human-readable format or as JSON output in the terminal. Signed-off-by: Bruno Schaatsbergen <git@bschaatsbergen.com>
…based on view type. Signed-off-by: Bruno Schaatsbergen <git@bschaatsbergen.com>
Signed-off-by: Bruno Schaatsbergen <git@bschaatsbergen.com>
Signed-off-by: Bruno Schaatsbergen <git@bschaatsbergen.com>
Added a comment to explain the rationale behind the guard statement, which prevents potential nil errors during backend initialization and retryLogHook call. Signed-off-by: Bruno Schaatsbergen <git@bschaatsbergen.com>
Signed-off-by: Bruno Schaatsbergen <git@bschaatsbergen.com>
Signed-off-by: Bruno Schaatsbergen <git@bschaatsbergen.com>
Signed-off-by: Bruno Schaatsbergen <git@bschaatsbergen.com>
932541a
to
c71a1a7
Compare
Signed-off-by: Bruno Schaatsbergen <git@bschaatsbergen.com>
Signed-off-by: Bruno Schaatsbergen <git@bschaatsbergen.com>
fc57ccc
to
94c732b
Compare
Signed-off-by: Bruno Schaatsbergen <git@bschaatsbergen.com>
Signed-off-by: Bruno Schaatsbergen <git@bschaatsbergen.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you need to run make copyright-fix
to pass the code consistency checks!
t.RetryLogHook(attemptNum, resp, false), | ||
"type", json.MessageTestRetry, | ||
) | ||
t.Cloud.RetryLog(attemptNum, resp) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could get rid of the TFCRetryHook
function entirely now, and just call the RetryLog
function directly from wherever this was being called before.
Signed-off-by: Bruno Schaatsbergen <git@bschaatsbergen.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes look great 😄. I suppose an open question, of which I don't have a strong opinion, is whether we want to suppress these messages unless a log level is set by TF_LOG
. I personally prefer verbose output, but it may introduce more noise than some people would prefer.
Some optional 💅 suggestions below
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! Probably good to wait for Sebastian's approval too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀 Nice work!
Reminder for the merging maintainer: if this is a user-visible change, please update the changelog on the appropriate release branch. |
Closes #35159
The cloud backend implements a retry mechanism for its client, go-tfe. Currently, retry messages from this logic were not rendered through a view, so the
-json
flag was not respected. This resulted in mixed (non-pure JSON) output in the terminal whenever retry messages were printed.This PR introduces a new view:
cloud
, which handles rendering output in human-readable or machine-readable format (JSON) from cloud-specific operations.The PR works around the current lack of native support for views in the backends. To work around this limitation, we expose the
ViewType
andView
to the CLI options, which we pass down to the cloud backend.