Hi Ashok, According to Björn's suggestion, he is suggesting you not to use a single Jenkinsfile if you would like to run two jobs on two instances of Jenkins on the same server. However, if you are using the two instances on the same server to say for example run a frontend and a backend for a web app, you can probably achieve this with multiple Docker containers using a single Jenkinsfile for a Pipeline by following the suggested instructions at https://www.jenkins.io/doc/book/pipeline/docker/#using-multiple-containers.
However, if you really want more tailored suggestions the community can offer, you will need to provide us with more information about your setup, as well as what is your use case for. Otherwise we can only guess and throw (perhaps not 100% relevant) ideas at you. Since you are using Jenkins for a work project, I think it may be a good idea to ask around to see how this is usually set up at your company from someone who has done it before, or from some documentation. This will help make sure that you are following. the best practices established at your company. Best, Kris ________________________________ From: jenkinsci-users@googlegroups.com <jenkinsci-users@googlegroups.com> on behalf of Ashok Reddy <ashokrd...@gmail.com> Sent: 11 August 2023 08:51 To: jenkinsci-users@googlegroups.com <jenkinsci-users@googlegroups.com> Subject: Re: Regarding two jenkins jobs Hi Kris, Thank for your help but, I am expecting to configure two jenkins instances in one jenkinsfile. As Doneer suggested, it would be good to implement but in my org, they have already implemented. Not sure how did they implement it. On Thu, 10 Aug 2023 at 10:30 PM, Kris Stern <krisst...@outlook.com<mailto:krisst...@outlook.com>> wrote: Hi Ashok, I am guessing you are looking for the following, but am not sure... You can try something like the below: java -DJENKINS_HOME=/path-to-jenkins1 -jar jenkins.war --httpPort=8080 java -DJENKINS_HOME=/path-to-jenkins2 -jar jenkins.war --httpPort=8081 Something like this, so one instance can be reached at port 8080 and the other one at port 8081. Best, Kris ________________________________ From: jenkinsci-users@googlegroups.com<mailto:jenkinsci-users@googlegroups.com> <jenkinsci-users@googlegroups.com<mailto:jenkinsci-users@googlegroups.com>> on behalf of Ashok Reddy <ashokrd...@gmail.com<mailto:ashokrd...@gmail.com>> Sent: 10 August 2023 22:25 To: jenkinsci-users@googlegroups.com<mailto:jenkinsci-users@googlegroups.com> <jenkinsci-users@googlegroups.com<mailto:jenkinsci-users@googlegroups.com>> Subject: Re: Regarding two jenkins jobs Hi Kris, Yes , two jenkins instances On Thu, 10 Aug 2023 at 9:54 PM, 'Björn Pedersen' via Jenkins Users <jenkinsci-users@googlegroups.com<mailto:jenkinsci-users@googlegroups.com>> wrote: ashok...@gmail.com<mailto:ashok...@gmail.com> schrieb am Donnerstag, 10. August 2023 um 03:54:11 UTC+2: Hi All, How to configure jenkinsfile if one job is in one jenkins instance and another job is in another jenkins instance? I you really mean 2 jenkins instances (not different agents): * don't use a single Jenkinsfile, instead configure the jobs (at least on one instance) to use another name (e.g. jenkinsfile.host). * or switch execution based on the HUDSON_URL variable (this gives the main jenkins URL), although this most likely will make the jenkinsfile quite unreadable. -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscr...@googlegroups.com<mailto:jenkinsci-users+unsubscr...@googlegroups.com>. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/7c6eee8d-3526-41cf-a758-f0f32523dd8an%40googlegroups.com<https://groups.google.com/d/msgid/jenkinsci-users/7c6eee8d-3526-41cf-a758-f0f32523dd8an%40googlegroups.com?utm_medium=email&utm_source=footer>. -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscr...@googlegroups.com<mailto:jenkinsci-users+unsubscr...@googlegroups.com>. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAKRLcHhxb4uK2uAwkuUKqPG7N%3DpBzsyHkg3nLEMOFtQxJMZfxQ%40mail.gmail.com<https://groups.google.com/d/msgid/jenkinsci-users/CAKRLcHhxb4uK2uAwkuUKqPG7N%3DpBzsyHkg3nLEMOFtQxJMZfxQ%40mail.gmail.com?utm_medium=email&utm_source=footer>. -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscr...@googlegroups.com<mailto:jenkinsci-users+unsubscr...@googlegroups.com>. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/OS3P286MB1431FE7694ADADDC290132ADA113A%40OS3P286MB1431.JPNP286.PROD.OUTLOOK.COM<https://groups.google.com/d/msgid/jenkinsci-users/OS3P286MB1431FE7694ADADDC290132ADA113A%40OS3P286MB1431.JPNP286.PROD.OUTLOOK.COM?utm_medium=email&utm_source=footer>. -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscr...@googlegroups.com<mailto:jenkinsci-users+unsubscr...@googlegroups.com>. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAKRLcHhVuoe4aV8%3Dj4O25q%2BEpdvUeaYtvfWN2VMvaSGQJn5h0Q%40mail.gmail.com<https://groups.google.com/d/msgid/jenkinsci-users/CAKRLcHhVuoe4aV8%3Dj4O25q%2BEpdvUeaYtvfWN2VMvaSGQJn5h0Q%40mail.gmail.com?utm_medium=email&utm_source=footer>. -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/OS3P286MB14310B24AA478503B53C398BA110A%40OS3P286MB1431.JPNP286.PROD.OUTLOOK.COM.