-
Notifications
You must be signed in to change notification settings - Fork 264
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
Tail CloudFormation events #146
Conversation
aws/tailers/stack_event.go
Outdated
|
||
type stackEvents []*cloudformation.StackEvent | ||
|
||
func coloredResourceStatus(str string) string { |
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.
A detail but, helpers/boilerplates code should go at the end of the file. We should prefer strong public/business logic at the top of the file.
aws/tailers/stack_event.go
Outdated
|
||
} | ||
|
||
func (e stackEvents) printReverse(w io.Writer) error { |
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.
Same for this method (and again detail) that can go at the end of file to avoid cognitive effort on non interesting method each time we open this file.
aws/tailers/stack_event.go
Outdated
} | ||
|
||
func (e stackEvents) printReverse(w io.Writer) error { | ||
tab := tabwriter.NewWriter(w, 35, 8, 0, '\t', 0) |
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.
Seems the space between data when displaying in the console is wide. If done on purpose, fine, otherwise let's minimize it.
Great, thanks! Looks good. We are testing it locally and I am just reviewing some minor details. |
aws/tailers/stack_event.go
Outdated
ticker := time.NewTicker(t.refreshFrequency) | ||
defer ticker.Stop() | ||
for range ticker.C { | ||
if t.watchDeployment { |
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.
Not fully seeing the value of the watchDeployment
. Couldn't we always have the if clause (i.e. see if the deployment is finished) so that we can always exit and just print to Std.out to let know the user before exiting the CLI. The existing --follow
on its own could then express the fact that we are watching the deployment
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.
Make sense.
How do you see follow
behave if no deployment running? I would like to still throw an error since I don't see the point of following if nothing happens, this makes sense in terms of usage with the CI.
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.
Yes. Good idea. An explicit friendly error. You can use the exitOn(myerr) method for that.
Our first tailer code was not ideal! So i did some minor corrections in our first tailer in master that you can mimic. See commit 0b03168 (ex: notably not using the term |
Also, could you please have a look at https://goo.gl/forms/1lQFPEIxdt37aDn43 (very short form), it's always interesting for us to know the real life usage of |
small refactoring
@simcap done |
This implements PR #143.
New command added:
awless tail stack-events
By default shows last N (10 default) events.
Flag
--follow
allow following events with refresh interval N seconds (10 default).Local flag
--watch-deployment
allow following events of current in progress deployment and exits when deployment finishes., if no running deployment exits with an error.