pipeline select agent depending on avaliability

33 views
Skip to first unread message

Rita Morgan

unread,
Aug 17, 2022, 1:37:06 PM8/17/22
to Jenkins Users
Using a Jenkinsfile, I have 2 agents (master, nodeA). 

I prefer my job to run on nodeA. If its not available (its a ec2 instance), i want it to run on master. 

Is there a way to declare this in a pipeline? I know there is a feature to prefer an agent or explicity set it as a label but I really want the logic to be in a pipeline. 

Yamuna

unread,
Aug 20, 2022, 10:43:41 AM8/20/22
to jenkins...@googlegroups.com
Hi 

   Can you try checking it’s online or not and then try again.

Ex: Jenkins.instance.getNode('my-node').toComputer().isOnline()

I am not sure. Just a suggestion. 

--
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/ec7bccba-4698-4ce3-9c07-4cb19100d156n%40googlegroups.com.
--
Thanks & Regards
Yamuna Devi
Reply all
Reply to author
Forward
0 new messages