-
-
Notifications
You must be signed in to change notification settings - Fork 991
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
Errors block #3584
Errors block #3584
Conversation
options/options.go
Outdated
Ignore map[string]*IgnoreConfig | ||
} | ||
|
||
// RetryConfig represents the configuration for retrying specific errors |
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.
// RetryConfig represents the configuration for retrying specific errors | |
// RetryConfig represents the configuration for retrying specific errors. |
strict-list complains about a comment without a dot at the end.
options/options.go
Outdated
) | ||
|
||
// Sleep before retry | ||
time.Sleep(time.Duration(action.RetrySleepSecs) * time.Second) |
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.
time.Sleep(time.Duration(action.RetrySleepSecs) * time.Second) | |
select { | |
case <-time.After(time.Duration(action.RetrySleepSecs) * time.Second): | |
// try again | |
case <-ctx.Done(): | |
return errors.New(ctx.Err()) | |
} | |
Let's imagine that if an user sets RetrySleepSecs to say 60 seconds and RetryAttempts to 4 times and then wants to terminate the application by pressing ctrl-c, nothing will happen for 240 seconds. To prevent this, we need to listen to the context in case it was cancelled.
- `message` (Optional): A warning message displayed when an error is ignored. | ||
- Example: `"Ignoring safe-to-ignore errors"`. | ||
- `signals` (Optional): Key-value pairs used to emit signals to external systems. | ||
- Example: `safe_to_revert = true` indicates it is safe to revert the operation if it fails. |
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 we should add a note here indicating what this does.
e.g.
Populating values into the `signals` attribute results in a JSON file named `error-signals.json` being emitted on failure. This file can be useful to inspect in CI/CD systems to determine what the recommended course of action is to address the failure.
In this example, an error has occurred, the author of the unit has signaled that it is safe to revert adjustments to this unit. A CI/CD system could have a standard process of finding all units with files named `error-signals.json`, then checkout the previous commit and apply those units in that state, reverting their updates.
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.
Updated docs
Description
Implementation of
errors
block:errors
block from HCLRFC: #3134
TODOs
Read the Gruntwork contribution guidelines.
Release Notes (draft)
Added / Removed / Updated [X].
Migration Guide