-
Notifications
You must be signed in to change notification settings - Fork 30
Avoid crashing update-redirects when CLI output is empty #1944
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
Conversation
_logger.LogInformation("Describing KeyValueStore"); | ||
try | ||
{ | ||
var json = CaptureMultiple("aws", "cloudfront", "describe-key-value-store", "--name", kvsName); |
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.
Can we have a retry mechanism here? It seems like this is a temporary error that only happens occasionally.
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.
Hmm... We have a retry mechanism on ExternalCommandExecutor, defaulting to 10 tries. Since we don't rethrow from it, It seems the mechanism is working. Is it worth it to have another? Each cycle can take up to 30s, accounting for the execution timeout.
I'll add individual error logging as well, that can be interesting 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.
I see.
Kinda unrelated.. but I'm starting to wonder how do we handle paging for describe-key-valiue-store?
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.
Paging is sort of handled partially by the AWS CLI itself. max-items
determines the amount of items the CLI will output in the end, and page-size
determines the internal paging in the CLI when communicating with AWS.
This means that if we had --max-items 50 --page-size 10
, the CLI would call AWS up to 5 times before giving us the answer. The eTag it gives us as part of the output determines where in the query we are, and if it is null we have reached the end.
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.
We are now logging as warnings when exceptions occur in an execution attempt loop. They shouldn't be errors since later attempts might be successful.
…op. Emit as a warning since later executions can be successful.
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.
So if I understand correctly, this will still exit with a non-zero code, right?
it will just error gracefully instead of throwing an exception?
Yep, if we can't reliably get the data from AWS even after all attempts, we still exit with non-zero, but cleanly. |
update-redirects
should verify the output at each stage - an empty string is not parsed as a valid empty JSON response. We should fail the workflow step, but not crash.