-
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
Draft
bschaatsbergen
wants to merge
15
commits into
hashicorp:main
Choose a base branch
from
bschaatsbergen:b/fix-retry-messages-in-cloud-backend-json
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
views: add cloud view #35929
bschaatsbergen
wants to merge
15
commits into
hashicorp:main
from
bschaatsbergen:b/fix-retry-messages-in-cloud-backend-json
+451
−33
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 <[email protected]>
Signed-off-by: Bruno Schaatsbergen <[email protected]>
Signed-off-by: Bruno Schaatsbergen <[email protected]>
bschaatsbergen
force-pushed
the
b/fix-retry-messages-in-cloud-backend-json
branch
from
November 1, 2024 10:44
f9d9df0
to
f979759
Compare
bschaatsbergen
force-pushed
the
b/fix-retry-messages-in-cloud-backend-json
branch
from
November 1, 2024 11:38
ecbb274
to
cb2d019
Compare
Signed-off-by: Bruno Schaatsbergen <[email protected]>
bschaatsbergen
force-pushed
the
b/fix-retry-messages-in-cloud-backend-json
branch
from
November 1, 2024 11:45
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 <[email protected]>
…based on view type. Signed-off-by: Bruno Schaatsbergen <[email protected]>
Signed-off-by: Bruno Schaatsbergen <[email protected]>
Signed-off-by: Bruno Schaatsbergen <[email protected]>
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 <[email protected]>
Signed-off-by: Bruno Schaatsbergen <[email protected]>
Signed-off-by: Bruno Schaatsbergen <[email protected]>
bschaatsbergen
changed the title
views: move retryLog hook to init view
views: add cloud view
Nov 5, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
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 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 have introduced a
ViewType
field in the CLI options, which we are now passing down the to the cloud backend.