lockable-resources-plugin icon indicating copy to clipboard operation
lockable-resources-plugin copied to clipboard

Add 'reason' field in the lock() step.

Open mPokornyETM opened this issue 2 years ago • 8 comments

What feature do you want to see added?

It will be very helpful, when we the lock() step allow to set the reason. At the moment we can see that the resource is locked by some job. But when you have parallel stages it is hard to see which stage / node ... lock the resource. In this case shall be this text shown in extra column in the table (or append to the STATE as well) The text shall be pure String. No markUp or html format is necessary.

My first think was to use note as well, but this will leads to misunderstandings.

Upstream changes

No response

mPokornyETM avatar Dec 07 '22 10:12 mPokornyETM

see also JENKINS-68225

mPokornyETM avatar Dec 07 '22 19:12 mPokornyETM

It will be fine when user can type the reason also on reserve action in the overview page. And maybe we can use the same field from config page. There is reserved by field, but you can type anything there.

mPokornyETM avatar Dec 07 '22 21:12 mPokornyETM

Hii @mPokornyETM! Are this feature still needed? I would love to work on that

Massakera avatar Jun 07 '23 12:06 Massakera

@Massakera Hi, all open issues / PRs with the milestone https://github.com/jenkinsci/lockable-resources-plugin/milestone/5 are planned and 'needed' It will be grat, when somebody (maybe you ;-) ) will implemented this request. PS: any contributions are welcome. See also https://github.com/jenkinsci/lockable-resources-plugin/labels/good%20first%20issue

mPokornyETM avatar Jun 12 '23 06:06 mPokornyETM

I think I've added the reason field, but still I can't see it the field when adding a lockable resource when I run Jenkins locally with mvn hpi:run. Can you see if I'm doing in the right way? https://github.com/Massakera/lockable-resources-plugin/commit/d76c533140938b0065af6c1310f7bc5c53917ad0

Massakera avatar Jun 12 '23 13:06 Massakera

Yu need also to extend:

  • https://github.com/Massakera/lockable-resources-plugin/blob/d76c533140938b0065af6c1310f7bc5c53917ad0/src/main/resources/org/jenkins/plugins/lockableresources/LockableResource/config.jelly (you will see it in /manage page)

  • https://github.com/Massakera/lockable-resources-plugin/blob/d76c533140938b0065af6c1310f7bc5c53917ad0/src/main/resources/org/jenkins/plugins/lockableresources/actions/LockableResourcesRootAction/tableResources/table.jelly (to see the reason)

  • https://github.com/Massakera/lockable-resources-plugin/blob/d76c533140938b0065af6c1310f7bc5c53917ad0/src/main/resources/org/jenkins/plugins/lockableresources/LockStep/config.jelly (for pipeine syntax creator)

  • and pretty sure extend this class https://github.com/Massakera/lockable-resources-plugin/blob/d76c533140938b0065af6c1310f7bc5c53917ad0/src/main/java/org/jenkins/plugins/lockableresources/LockStep.java

  • something like this https://github.com/Massakera/lockable-resources-plugin/blob/d76c533140938b0065af6c1310f7bc5c53917ad0/src/main/resources/org/jenkins/plugins/lockableresources/actions/LockableResourcesRootAction/noteForm.jelly used in https://github.com/Massakera/lockable-resources-plugin/blob/d76c533140938b0065af6c1310f7bc5c53917ad0/src/main/webapp/js/lockable-resources.js

  • it will be fine also this one https://github.com/Massakera/lockable-resources-plugin/blob/d76c533140938b0065af6c1310f7bc5c53917ad0/src/main/resources/org/jenkins/plugins/lockableresources/actions/LockableResourcesRootAction/tableQueue/table.jelly

do not scary, try it in the order as described and you will see it goes straigth forwards

mPokornyETM avatar Jun 12 '23 14:06 mPokornyETM

image

So, I was able to made the changes and I can put the reason field when setting up the Lockable resource in Settings page, but for some reason the labels shifts to Reason column when I get to the Lockable Resources page and I don't know why.

This is my tableResources/table.jelly

Massakera avatar Jun 13 '23 15:06 Massakera

please create a draft PR, that I can see your changes. thx

mPokornyETM avatar Jun 13 '23 15:06 mPokornyETM