From 2d5adc178b3b370282e62d4f710acbe2669531a1 Mon Sep 17 00:00:00 2001 From: fujiwara Date: Fri, 13 Sep 2024 14:07:47 +0900 Subject: [PATCH] returns error if --watch-container is not found. refs #749 --- run.go | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/run.go b/run.go index ef64344b..b7d0b1bb 100644 --- a/run.go +++ b/run.go @@ -68,16 +68,21 @@ func (d *App) Run(ctx context.Context, opt RunOption) error { return err } d.Log("Task definition ARN: %s", tdArn) - if opt.DryRun { - d.Log("DRY RUN OK") - return nil - } + td, err := d.DescribeTaskDefinition(ctx, tdArn) if err != nil { return err } watchContainer := containerOf(td, &opt.WatchContainer) - d.Log("Watch container: %s", *watchContainer.Name) + if watchContainer == nil { + return fmt.Errorf("container %s not found in the task definition", opt.WatchContainer) + } + d.Log("Watch container: %s", aws.ToString(watchContainer.Name)) + + if opt.DryRun { + d.Log("DRY RUN OK") + return nil + } task, err := d.RunTask(ctx, tdArn, &ov, &opt) if err != nil {