Best way to deploy microservices using codepipeline

0

Hello, I have a single repository in codecommit holding 5 microservices(separate projects in solution). I build the AWS code pipeline Taking codecommit as source and then build(using Jenkins build) the image and push to ECR. Later the oodedeploy pull the image and deploy using revised task defination.

The problem here is if developer do changes in any one of the service, the pipeline builds the image and deploying to all services. I am not sure how to identify the commit happens to specific service.
Is there any way to identify this at time of Build ?

질문됨 5년 전582회 조회
1개 답변
0
수락된 답변

Hello!

Sorry for taking so long to reply.

I don't think there's a reasonable way to do this. Even if you could figure it out in a CodeBuild step, how would you stop the pipeline? Mark the build as failed? That would make it hard to figure out if the build actually failed or it just failed to stop the pipeline.

If you're using event based pipelines (and you should be) you might be able to use something in the Cloudwatch event (https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/EventTypes.html#codecommit_event_type) used by your Cloudwatch Event rule to cause your pipeline to start. For example, you could put each service on a different branch, or have a git tag for each service. More information is here: https://docs.aws.amazon.com/codepipeline/latest/userguide/triggering.html

However, I would recommend putting each micro-service in a different repository. That way you won't have to solve this problem. I think you might be doing this because you have some shared libraries used across multiple micro-services. I would recommend putting those in their own repositories too, and combining the micro-service package with the library packages using CodePipeline and CodeBuild.

So for example, in micro-service A's pipeline, you'd have a source action for micro-service-a-repo, and a source action for shared-library-1-repo, and have them both as a input artifacts for CodeBuild step that would build them into a single output artifact.

Let me know if you have any more questions!

Matthew

답변함 5년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠