<p>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. </p>

<p><strong>Nature Of Application</strong></p>

<p>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.</p>

<p><strong>My Requirement</strong></p>

<p>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.</p>

<p>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</p>

<p><strong>My Analysis</strong></p>

<p>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.</p>

<p><strong>My Confusion</strong></p>

<p>Here my confusion is that, </p>

<ol>
<li>Can I add multiple pipeline job from same code repository using Jenkins?</li>
<li>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?</li>
</ol>

Mr.DevEng
<p>You seem to be going about it a bit wrong.</p>

<p>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.</p>

<p>So, your changes in your repository will trigger <strong>one</strong> Jenkins build and produce <strong>one</strong> 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.</p>

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

<ol>
<li>You can create multiple pipelines from same repository in Jenkins. (Select <code>New item &gt; pipeline</code> multiple times).</li>
<li>You can keep a list of tenants and just loop through OR run all deployments in parallel in a single pipeline stage.</li>
</ol>
