wallix / awless

A Mighty CLI for AWS
http://awless.io/
Apache License 2.0
4.98k stars 263 forks source link

Stack Events Tail timeout and automatic update cancel #156

Closed taraspos closed 6 years ago

taraspos commented 6 years ago

Use case: CloudFormation doesn't provide timeout mechanism for a stack update. For example, deployment of broken ECS task could result in endless retries of ECS task and never leave the CREATE_IN_PROGRESS state.

Other solution for this problem could be https://aws.amazon.com/ru/about-aws/whats-new/2017/08/aws-cloudformation-adds-rollback-triggers-feature/

But awless doesn't support rollback-triggers yet and looks like ECS doesn't have the proper CloudWatch metric to monitor.

taraspos commented 6 years ago

@simcap @fxaguessy

any feedback on this one? :)

simcap commented 6 years ago

Thanks for the implementation! The timeoutReached pattern is a bit unconventional, I would expect something more along the line of:

ticker := time.NewTicker(t.pollingFrequency)
defer ticker.Stop()

for {
 select {
  case ticker.C:
     t.displayRelevantEvents(cfn, tab); err != nil {
      .....
     }
   case <-time.After(t.timeout):
 }
}

... I might have not grasp all of what is needed, but if possible, basically putting the ticker in a for/select and using the After.

simcap commented 6 years ago

Thanks for the work @Trane9991 . Do not have time to test at full scale in a CI pipeline, so I hope it is working well for you. Merging in master. A release will follow by the end of the week.