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年前581ビュー
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年前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ