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 個月前

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

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

回答問題指南