0
votes

I am trying to implement CI/CD pipeline for my Spring Boot micro service deployment. I am planned to use Jenkins and Kubernetes for Making CI/CD pipeline. And I have one SVN code repository for version control.

Nature Of Application

Nature of my application is, one microservice need to deploy for multiple tenant. Actually code is same but database configuration is different for different tenant. And I am managing the configuration using Spring cloud config server.

My Requirement

My requirement is that, when I am committing code into my SVN code repository, then Jenkins need to pull my code, build project (Maven), And need to create Docker Image for multiple tenant. And need to deploy.

Here the thing is that, commit to one code repository need to build multiple docker image from same code repo. Means one code repo - multiple docker image building process. Actually, Dockerfile containing different config for different docker image ie. for different tenant. So here my requirement is that I need to build multiple docker images for different tenant with different configuration added in Dockerfile from one code repo by using Jenkins

My Analysis

I am currently planning to do this by adding multiple Jenkins pipeline job connect to same code repo. And within Jenkins pipeline job, I can add different configuration. Because Image name for different tenant need to keepdifferent and need to push image into Dockerhub.

My Confusion

Here my confusion is that,

  1. Can I add multiple pipeline job from same code repository using Jenkins?
  2. If I can add multiple pipeline job from same code repo, How I can deploy image for every tenant to kubernetes ? Do I need to add jobs for deployment? Or one single job is enough to deploy?
1
Pro tip: your questions are a bit chatty, and in my opinion (for what it is worth!) are not the kind of technical writing we ideally seek here. You have 70 questions containing a phrase of the form "Can anyone please help me to clarify my confusions about X please". The answer is invariably "yes" - not useful in itself - but it is also rather vague. If you have set out what you are specifically stuck on, then the chatty material can just be removed. Further reading: Why is β€œCan someone help me?” not an actual question? – halfer
It's worth noting that language can affect how a question is received on Stack Overflow. Confident phraseology is generally received well, pleading and deference not so much. On that theme, this discussion may be of interest: How can we encourage (new) authors to ask confident questions? – halfer

1 Answers

2
votes

You seem to be going about it a bit wrong.

Since your code is same for all the tenants and only difference is config, you should better create a single docker image and deploy it along with tenant specific configuration when deploying to Kubernetes.

So, your changes in your repository will trigger one Jenkins build and produce one docker image. Then you can have either multiple Jenkins jobs or multiple steps in pipeline which deploy the docker image with tenant specific config to Kubernetes.

If you don't want to heed to above, here are the answers to your questions:

  1. You can create multiple pipelines from same repository in Jenkins. (Select New item > pipeline multiple times).
  2. You can keep a list of tenants and just loop through OR run all deployments in parallel in a single pipeline stage.