Regarding two jenkins jobs

66 views
Skip to first unread message

Ashok Reddy

unread,
Aug 9, 2023, 9:54:11 PM8/9/23
to jenkins...@googlegroups.com
Hi All, 

How to configure jenkinsfile if one job is in one jenkins instance and another job is in another jenkins instance?

Kris Stern

unread,
Aug 9, 2023, 10:07:18 PM8/9/23
to jenkins...@googlegroups.com
Hi Ashok,

You may want to take a look at https://www.jenkins.io/doc/book/using/using-agents/

Best,
Kris

From: jenkins...@googlegroups.com <jenkins...@googlegroups.com> on behalf of Ashok Reddy <ashok...@gmail.com>
Sent: 10 August 2023 09:53
To: jenkins...@googlegroups.com <jenkins...@googlegroups.com>
Subject: Regarding two jenkins jobs
 
Hi All, 

How to configure jenkinsfile if one job is in one jenkins instance and another job is in another jenkins instance?

--
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-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAKRLcHg0snvxrSzxQjZgkrBfDM9ORrT7hneSza00k9_dSm%2Baew%40mail.gmail.com.

Ashok Reddy

unread,
Aug 9, 2023, 11:00:08 PM8/9/23
to jenkins...@googlegroups.com
Hi Kris,

Thanks and let me take a look. 

Björn Pedersen

unread,
Aug 10, 2023, 9:54:30 AM8/10/23
to Jenkins Users
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.


Ashok Reddy

unread,
Aug 10, 2023, 10:25:34 AM8/10/23
to jenkins...@googlegroups.com

Hi Kris, 

Yes , two jenkins instances
--
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-use...@googlegroups.com.

Kris Stern

unread,
Aug 10, 2023, 10:30:37 AM8/10/23
to jenkins...@googlegroups.com
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 


Sent: 10 August 2023 22:25
To: jenkins...@googlegroups.com <jenkins...@googlegroups.com>
Subject: Re: Regarding two jenkins jobs
 

Ashok Reddy

unread,
Aug 10, 2023, 8:52:16 PM8/10/23
to jenkins...@googlegroups.com
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.

Kris Stern

unread,
Aug 10, 2023, 9:31:15 PM8/10/23
to jenkins...@googlegroups.com
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


Sent: 11 August 2023 08:51

Ashok Reddy

unread,
Aug 10, 2023, 9:37:35 PM8/10/23
to jenkins...@googlegroups.com
Hi Kris, 

Thanks for your help and I will check with my team. I will provide you clear idea next time.

Reply all
Reply to author
Forward
0 new messages