Codebuild build status to Lambda function

0

Hey, I have a codebuild project what i want is when codebuild buid complete we can get the completion notification on lambda so through lambda i can start and stop the ECS fargate task. So is there any way to we can get codebuild build status ?

Thanks in advance....

3 Answers
1

You can integrate AWS CodeBuild with many AWS services.

This blog post shows you an example how to set up automated testing of pull requests using AWS CodeCommit, AWS CodeBuild, and AWS Lambda. In addition, it shows you how to set up a pipeline to automatically build your tested, approved, and merged code changes using AWS CodePipeline.

Also refer to this GitHub repository mentioned in the blog post. There, you can find an example how to connect a CodeBuild project to a Lambda function to process the CodeBuild build state changes.

Diagram

profile pictureAWS
answered a year ago
  • Hi, I am using CloudWatch event to get the codebuild events to Lambda function. I am successfully getting the code build events in Lambda function. But now I want to start/stop ECS Fargate service task from lambda function only. For this I am using python boto3 library and able to get ECS services and task. So now I have ECS services & task and code build project name. So on what basis I start/stop particular ECS Fargate task of a particular codebuild project. Can I get ECS Fargate service from codebuild itself ? If this is possible then it's so easy to implement. Thanks in advance

1

Yes you can create notifications to SNS (see https://docs.aws.amazon.com/codebuild/latest/userguide/notification-rule-create.html) then subscribe a Lambda function to process them.

Note there's some common notifications management across all of the developer tools (CodeCommit, CodeBuild etc) in the Developer Tools Console. It has some "Code*" / "CodeStar" branding in the underlying APIs.

EXPERT
answered a year ago
0

Is there any blog or post on that . So it will help me in doing the process

answered a year ago
  • Please note that you should post clarifying questions as comments, not as answers.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions