Skip to content
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

add `wait` subcommand and add `--no-wait` option to `deploy`, `create` and `rollback` subcommands #38

Merged
merged 3 commits into from Sep 11, 2019
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

Next

add boilerplate for wait subcommand

  • Loading branch information...
Songmu committed Sep 11, 2019
commit a13556e4e678576ea58f73da9397c502bdb2f7bf
@@ -42,7 +42,7 @@ func _main() int {

rollback := kingpin.Command("rollback", "rollback service")
rollbackOption := ecspresso.RollbackOption{
DryRun: rollback.Flag("dry-run", "dry-run").Bool(),
DryRun: rollback.Flag("dry-run", "dry-run").Bool(),
DeregisterTaskDefinition: rollback.Flag("deregister-task-definition", "deregister rolled back task definition").Bool(),
}

@@ -62,6 +62,11 @@ func _main() int {
Count: run.Flag("count", "the number of tasks (max 10)").Default("1").Int64(),
}

wait := kingpin.Command("wait", "wait until service stable")
waitOption := ecspresso.WaitOption{
DesiredCount: wait.Flag("tasks", "desired count of tasks").Default("-1").Int64(),
}

sub := kingpin.Parse()
if sub == "version" {
fmt.Println("ecspresso", Version)
@@ -93,6 +98,8 @@ func _main() int {
err = app.Delete(deleteOption)
case "run":
err = app.Run(runOption)
case "wait":
err = app.Wait(waitOption)
default:
kingpin.Usage()
return 1
@@ -472,6 +472,14 @@ func (d *App) Rollback(opt RollbackOption) error {
return nil
}

func (d *App) Wait(opt WaitOption) error {
ctx, cancel := d.Start()
defer cancel()
_ = ctx

return nil
}

func (d *App) FindRollbackTarget(ctx context.Context, taskDefinitionArn string) (string, error) {
var found bool
var nextToken *string
@@ -34,3 +34,7 @@ type RunOption struct {
SkipTaskDefinition *bool
Count *int64
}

type WaitOption struct {
DesiredCount *int64
}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.