Intercepting the "label" in node and changing in a plugin?

25 views
Skip to first unread message

Michael Carter

unread,
May 29, 2023, 11:29:46 AM5/29/23
to Jenkins Developers
What I'm trying to do is redirect the label someone (well few 100 actually) has encoded in their pipeline when conditions are met.

Without getting into too much detail on the reasons, can't change the pipeline code, and the logic is going to be more OS/DB driven outside Jenkins so want to do via a plugin.

Which extension point listener can/should I tie into and how would I override what label is going to be executed on?   I only need to worry about pipeline code, freestyle jobs will not be affected.


Mark Waite

unread,
May 29, 2023, 6:46:13 PM5/29/23
to Jenkins Developers
On Monday, May 29, 2023 at 9:29:46 AM UTC-6 you wrote:
What I'm trying to do is redirect the label someone (well few 100 actually) has encoded in their pipeline when conditions are met.


The implied labels plugin allows the administrator to define new labels based on existing labels.  If the "redirect" happens all the time, then an implied label might be enough.

if there is more logic in the redirect, then the implied labels plugin won't help.

Mark Waite

Michael Carter

unread,
May 30, 2023, 9:46:21 AM5/30/23
to Jenkins Developers
That plugin leads me to a few ideas... https://javadoc.jenkins.io/jenkins/model/labels/LabelValidator.html  being one area.

Basically, the situation is we have one group that is crashing our docker slave so I've set them up with an isolated node.  But getting them to change node("docker") to node("docker-isolated") in their pipeline script is a logistics nightmare, so looking for a way to control it in a custom plugin.

Blocking them is one option, redirecting them auto-magicly is the better one.  

Winter, Markus

unread,
May 30, 2023, 11:25:45 AM5/30/23
to jenkin...@googlegroups.com

I don’t think LabelValidator is what you need.

You might want to check on QueueTaskDispatcher and override canTake(Node, Queue.BuildableItem)

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/830e1c0b-3cd7-4347-90dc-739ca9415278n%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages