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....

已提問 1 年前檢視次數 493 次
3 個答案
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
已回答 1 年前
  • 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.

專家
已回答 1 年前
0

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

已回答 1 年前
  • Please note that you should post clarifying questions as comments, not as answers.

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南