Skip to content

Mixing labels and resource locking #961

@Morgensol

Description

@Morgensol

Jenkins and plugins versions report

I am seeing that if i try to lock multiple resources with the "extra" parameter, and i have entries of both "resource" and "label" they trigger this line from the LockableResourceManager: "Extra filter tries to allocate pre-reserved resources."

The comment in the file describes perfectly what im trying to do:

Resource1 has label LABEL_A
Resource2 also has LABEL_A

If i try and do:

Lock( 
    extra: [
        {resource:'Resource1'},
        {label: 'LABEL_A'}
    ])

It will sometimes try and aquire the label first which has a chance of aquiring the lock for the named required resource. Would it be possible to update this to first lock all named required resources and then lock by label? I believe this might fix the issue

What Operating System are you using (both controller, and any agents involved in the problem)?

Linux Debian(Trixie) using docker containers

Reproduction steps

  1. Create 2 resources sharing the same label
  2. Try and lock by both label and name

Expected Results

Aquiring both locks

Actual Results

Aquires only 1 lock

Anything else?

No response

Are you interested in contributing a fix?

To whichever capacity i can help with (im not fluent in java)

Metadata

Metadata

Assignees

No one assigned

    Labels

    TriageNeed to clarify, remove, close or whatever to clean up open issues / PRs

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions