Can Codedeploy watch for CodeCommit by itself or it needs CodePipeline

1

I want to use codeDeploy to monitor for CodeCommit activities, if for example a new commit on the main branch, I want to inform EC2 that runs the current version of the app of a new change to the main branch, then from there I will pull the new changes, recompile and rerun the applications. I do wish to use CodePipeline for now. Any thoughts?

FSA
已提问 8 个月前265 查看次数
2 回答
7

Hello,

Yes, the best way to go about this will be to use CodePipeline. I would recommend reading this blog post, which discusses how through the use of CloudWatch Events, on how to trigger your CodePipeline to execute whenever there is a reference created or updated in your CodeCommit repository.

It also mentions some best practices when going about this such as having a manual approval action in your CodePipeline, how to avoid the pipeline from triggering when editing certain files (readme.md, .gitignore, etc), and other custom logic that can help verify if the pipeline should be ran or not.

Hope this helps!

Mark

AWS
已回答 8 个月前
3

Hi,

What would be the purpose of "informing" CodeDeploy about a change in CodeCommit if new version is not rebuilt? CodeDeploy cannot make use of new source code until it's recompiled to binary artefacts. So, you're right: the right way is to build a CodePipeline. This pipeline can start automatically on commits in CodeCommit. It will produce the new artefacts and those artefacts will be loaded into CodeArtefacts, from where they can be deployed to your EC2 machines.

And you're 100% right; full automation is the only sustainable way to proceed for the long-term to raise efficiency and quality. I always seek myself to reach this full automation. At the expense of some pains sometimes to find the right setup, but I am so much better off afterwards: things work without me and I can move to something else!

This blog post may be interest to get detail about a canonical architecture to achieve what you want: https://aws.amazon.com/blogs/devops/complete-ci-cd-with-aws-codecommit-aws-codebuild-aws-codedeploy-and-aws-codepipeline/

Good luck!

Didier

profile pictureAWS
专家
已回答 8 个月前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则