Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Lambda function never succeeds in codepipeline

When I run my Lambda function in Codepipeline it ends properly and does what I want as I can see in logs, but it never succeeds in pipeline. It just shows In Progress when actually my Lambda function does its job in logs.

What am I missing? Maybe I need to send 'putJobSuccessResult' as shown here to CodePipeline? But if so then why if it's not a custom action?

And what are custom actions at all? What is the difference between them and non-custom actions?

like image 511
Ruslan Plastun Avatar asked Jan 02 '23 22:01

Ruslan Plastun


1 Answers

Maybe I need to send 'putJobSuccessResult' as shown here to CodePipeline?

Yes, you need to call putJobSuccessResult from your Lambda function.

But if so then why if it's not a custom action?

This tells CodePipeline that your Lambda function is finished, and what to do next.

CodePipeline has a feature where if you pass a 'continuation token' then CodePipeline will re-invoke your function and pass the state in the continuation token to the next invocation. This allows you to have actions running longer than the Lambda invocation timeout. You can pass this info when you call putJobSuccessResult.

Also, it separates "failing an action" from "failing the function". This allows you to fail the action without failing the lambda function. This is desirable because Lambda has a retry behavior if the function fails.

And what are custom actions at all?

With a custom action you need your own code to call PollForJobs, which typically runs on eg. a long running EC2 instance. The Lambda invoke action will call a Lambda function without you having to run your own instance / host.

like image 144
TimB Avatar answered Jan 05 '23 02:01

TimB