This is not working as I expected, and I am wondering if I am doing 
something wrong/operating under an incorrect assumption or if I am 
encountering a bug.  I have this in my Jenkinsfile:

node('some_non_master_node') {
    stage('Upload/Trigger') {
        timeout(time: 2, unit: 'MINUTES') {
            lock(env.JOB_NAME) {

When I run the job in isolation it works fine:

Trying to acquire lock on [Testing/testrepo1/master]
Lock acquired on [Testing/testrepo1/master]

...

Lock released on resource [Testing/testrepo1/master]
Finished: SUCCESS


Likewise, if I go to https://mymaster.mycompany.com/lockable-resources/ and 
manually reserve the resource before starting the job, I see the timeout as 
expected:

Trying to acquire lock on [Testing/testrepo1/master]
[Testing/testrepo1/master] is locked, waiting...
Timeout has been exceeded
Finished: ABORTED

The unexpected behavior occurs if I manually reserve the resource before 
the job starts and then immediately free the resource once the 
"[Testing/testrepo1/master] 
is locked, waiting..." message appears.  The job times out instead of 
detecting that the resource has become available.

Am I doing something wrong/operating under a wrong assumption, or is this a 
bug?

Ron

On Friday, September 2, 2016 at 9:06:35 AM UTC-4, Daniel Beck wrote:
>
>
> > On 02.09.2016, at 14:45, jer...@bodycad.com <javascript:> wrote: 
> > 
> > ok, great thanks it now have a scope of operation, that was not clear 
> with the error message (at first I was under the impression I needed to 
> give it an argument of some sort: 
>
> Well, you do. It's just that you place the block outside the parentheses 
> to make it look nicer. 
>
> http://groovy-lang.org/style-guide.html#_omitting_parentheses 
>
> > When a closure is the last parameter of a method call, like when using 
> Groovy’s each{} iteration mechanism, you can put the closure outside the 
> closing parentheses, and even omit the parentheses: 
>

-- 
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-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/dec9f6f8-b80a-4b98-bba4-81fae771de3b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to