jenkinsci / jenkinsci/lockable-resources-plugin

[JENKINS-65604] The resources do not persist reservation when reload JCasC configuration

Open
#936 0 comments 0 reactions 0 assignees View on GitHub
component:lockable-resources-plugin imported-jira-issue priority:major resolution:unresolved Triage
Dominant language
Java
Stars
99
Forks
205
Avg merge
2d 13h
Merged PRs (30d)
8

Description

Hello,

I hit an issue with Lockable resources plugin (2.8) together with JCasC configuration (Jenkins 2.277.2).

We define our resources in JCasC and then some of our jobs are locking and releasing these statically defined resources.

unclassified:

  lockableResourcesManager:
    declaredResources:
      - description: "My resource 1"
        labels: res1
        name: res1
# I omit the reservedBy field on the purpose in the hope that jcasc will not re-configure it

Unfortunately every time the JCasC configuration is reloaded it resets/release all reservations of resources. I don't set the reservedBy field in our JCasC, in that way I was hoping that it will not touch that value, but that is not a case.

I also tried to set reservedBy to null, if it helps but unfortunately it doesn't.

unclassified:

  lockableResourcesManager:
    declaredResources:
      - description: "My resource 1"
        labels: res1
        name: res1
        reservedBy: null

Maybe I am doing something wrong. What can I do to persist current status of reserved resources?

---
Originally reported by lukas_bednar, imported from: The resources do not persist reservation when reload JCasC configuration


  • status: Open
  • priority: Major
  • component(s): lockable-resources-plugin
  • label(s): plugin
  • resolution: Unresolved
  • votes: 1
  • watchers: 3
  • imported: 20251217-081411

Raw content of original issue

Hello,

I hit an issue with Lockable resources plugin (2.8) together with JCasC configuration (Jenkins 2.277.2).

We define our resources in JCasC and then some of our jobs are locking and releasing these statically defined resources.



unclassified:

  lockableResourcesManager:
    declaredResources:
      - description: "My resource 1"
        labels: res1
        name: res1
# I omit the reservedBy field on the purpose in the hope that jcasc will not re-configure it


Unfortunately every time the JCasC configuration is reloaded it resets/release all reservations of resources. I don't set the reservedBy field in our JCasC, in that way I was hoping that it will not touch that value, but that is not a case.

I also tried to set reservedBy to null, if it helps but unfortunately it doesn't.



unclassified:

  lockableResourcesManager:
    declaredResources:
      - description: "My resource 1"
        labels: res1
        name: res1
        reservedBy: null

Maybe I am doing something wrong. What can I do to persist current status of reserved resources?

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue in the lockable-resources-plugin using the JCasC configuration shown and reload the configuration while a resource is reserved. Then trace the plugin's JCasC handling for declaredResources; done means existing reservations remain intact after reload, with a regression test covering the behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
ci-cd
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.