The behavior I am seeing is a known bug.
https://issues.jenkins-ci.org/browse/JENKINS-34433
"pipeline lock does not retry"
Ron
On Sunday, September 4, 2016 at 9:44:25 PM UTC-4, Ron Dagostino wrote:
>
> 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, [email protected] 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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-users/118ba0ed-eee8-4e0a-92a2-d6ea0dec7e84%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.