Hi Baptiste,
Thank you for your awnser,
I've tried something like that, but no luck :
node(){
stage "test"
allocate('test')
sleep time: 15, unit: 'MINUTES'
sh "echo 'yes'" }
@NonCPSdef allocate(String resource){
throttle = new hudson.plugins.throttleconcurrents.ThrottleJobProperty(
maxConcurrentPerNode=1,
maxConcurrentTotal=1,
categories = [resource],
throttleEnabled=true,
throttleOption="category",
matrixOptions=null
)
throttle.setOwner()
throttle = null
return true}
It has no effect on the Throttle plugin,
(I had to set 'throttle' to null otherwise I would get no Serializable
errors even if its a NonCPS method ...)
If you have any Ideas ?
Thanks for your help.
Le vendredi 11 mars 2016 09:22:37 UTC+1, Baptiste Mathus a écrit :
>
> Gonna probably require twiddling with the API, but it should be possible
> to use one of the lock plugins (throttle one e.g.).
>
> * On the non pipeline one: use it normally
> * On the pipeline one: wrap the required groovy code in a @NonCPS function
> to attack the plugin API and acquire the lock.
>
> My 2 cents
> Le 10 mars 2016 9:09 AM, "Pierre Lerouge" <[email protected]
> <javascript:>> a écrit :
>
>> Hey,
>> Nobody had this need with the pipeline plugin ?
>>
>> Le lundi 7 mars 2016 16:53:56 UTC+1, Pierre Lerouge a écrit :
>>>
>>> Hi,
>>>
>>> I'm trying to block some job when a pipeline is running.
>>> More precisely I'm trying to find a wrapper around certain stages which
>>> could prevent other job to run while this stage is running.
>>>
>>> My main problem is the following:
>>> My workflow plugin launch a maven:release at some point, which create
>>> events in the SCM, wich run a standard build job that destroy my
>>> integration platform.
>>>
>>> I don't know if it's clear.
>>> I usually use the Exclusion plugin :
>>> https://wiki.jenkins-ci.org/display/JENKINS/Exclusion-Plugin
>>> To prevent a job running when there is already another one using this
>>> resource.
>>> I've seen that there are some commits that allow this plugin to be run
>>> within a pipeline :
>>> https://github.com/jenkinsci/exclusion-plugin/pull/5
>>> But I really don't know how to implement this.
>>>
>>> Have anybody already set up this kind of thing ?
>>> Thank you for your help.
>>>
>>> --
>> 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 [email protected] <javascript:>.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/jenkinsci-users/be92093a-baa1-4f2a-86e2-8904b7834516%40googlegroups.com
>>
>> <https://groups.google.com/d/msgid/jenkinsci-users/be92093a-baa1-4f2a-86e2-8904b7834516%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-users/69cf4648-1441-4f0b-92c7-844a726e43b6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.