New build with higher priority

7 views
Skip to first unread message

Fabian Cenedese

unread,
May 26, 2023, 5:45:26 AM5/26/23
to jenkins...@googlegroups.com
Hello

I have a job where a new build should be able to cancel an
already running build of the same job. The cancelling already
works. What I have a problem with now is, when the build
queue is so full (with other jobs) that the new build is not
even looked at before the queue has been worked off. If I
could give the new build a higher priority or lower the priority
of the running build then the cancelling would jump in.

I'm already using the priority sorter plugin but that only
allows to configure a priority, not to change it, and it's also
per job, not per build.

Is there a way to achieve this in Jenkins? If not we'd have
to resort to an external solution that would read the queued
and running jobs and then issue a cancel on the running
build if a new build is in the queue.

Thanks

bye Fabi

Eric Pyle

unread,
May 26, 2023, 11:53:25 AM5/26/23
to jenkins...@googlegroups.com

I have a colleague who does something like this by editing the configuratio= n of a job, using the REST API. I have seen that when I manually update the=  priority of a job in the queue and seen it take effect immediately. Once t= he job starts running you can again edit to set the priority back to its us= ual value. As long as there is only one instance of the job in the queue (t= he one you want to prioritize) it seems like this could work.

 

A similar idea would be to have a copy of the job with higher priority (cou= ld be created on the fly) which would be triggered after cancelling the reg= ular job.

 

Of course, if you are comfortable with Groovy, you could implement the "ext= ernal" solution you mention in a job; maybe even as an optional build step = in the job itself. I've done a similar thing to cancel jobs which have been=  in the queue more than a specified time limit.

 

Regards,

Eric


--
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/535c7b9078e6fcc7dbc9a5838eb83c6a%40indel.ch.


--
Eric Pyle

Siemens Digital Industries Software
Simulation and Test Solutions, Product Development
Lebanon, New Hampshire
eric...@siemens.com
http://www.sw.siemens.com 
Reply all
Reply to author
Forward
0 new messages