Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,12 @@ func main() {
Usage: "The function's X-Ray tracing configuration.",
EnvVars: []string{"PLUGIN_TRACING_MODE", "TRACING_MODE", "INPUT_TRACING_MODE"},
},
&cli.IntFlag{
Name: "max-attempts",
Usage: "the maximum number of times the waiter should attempt to check the resource for the target state",
EnvVars: []string{"PLUGIN_MAX_ATTEMPTS", "MAX_ATTEMPTS", "INPUT_MAX_ATTEMPTS"},
Value: 200,
},
}

if err := app.Run(os.Args); err != nil {
Expand Down Expand Up @@ -216,6 +222,7 @@ func run(c *cli.Context) error {
Description: c.String("description"),
SessionToken: c.String("session-token"),
TracingMode: c.String("tracing-mode"),
MaxAttempts: c.Int("max-attempts"),
},
Commit: Commit{
Sha: c.String("commit.sha"),
Expand Down
12 changes: 9 additions & 3 deletions plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/lambda"
"github.com/gookit/goutil/dump"
Expand Down Expand Up @@ -46,6 +47,7 @@ type (
Layers []string
SessionToken string
TracingMode string
MaxAttempts int
}

// Commit information.
Expand Down Expand Up @@ -224,9 +226,13 @@ func (p Plugin) Exec() error {
svc := lambda.New(sess, config)

if isUpdateConfig {
if err := svc.WaitUntilFunctionUpdated(&lambda.GetFunctionConfigurationInput{
FunctionName: aws.String(p.Config.FunctionName),
}); err != nil {
if err := svc.WaitUntilFunctionUpdatedWithContext(
aws.BackgroundContext(),
&lambda.GetFunctionConfigurationInput{
FunctionName: aws.String(p.Config.FunctionName),
},
request.WithWaiterMaxAttempts(p.Config.MaxAttempts),
); err != nil {
log.Println(err.Error())
return err
}
Expand Down