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 ?

gefragt vor 5 Jahren588 Aufrufe
1 Antwort
0
Akzeptierte Antwort

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

beantwortet vor 5 Jahren

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen