Commit 9a49376
authored
Add 'reason' parameter to lock() step (#982)
* Add updateLock pipeline step for resource management
This step allows pipelines to dynamically manage lockable resources:
- Create new resources (createResource: true)
- Delete existing resources (deleteResource: true)
- Modify labels (setLabels, addLabels, removeLabels)
- Set notes (setNote)
Based on the original design from PR #305 by @gaspardpetit.
Fixes #305
* Remove @SInCE TODO - not applicable for plugins
* Add updateLock step documentation to README
* Add 'reason' parameter to lock() step
Allows users to specify a reason when locking a resource, displayed in
the lockable resources UI while the resource is locked.
Usage:
lock(resource: 'my-resource', reason: 'Running integration tests') {
// ...
}
Features:
- New 'reason' parameter on lock() step
- Reason displayed in UI status column while locked
- Reason cleared automatically when resource is unlocked
- Works with label-based and resource-based locking
- Reason preserved when lock request is queued
- Environment variable 'resourceLockReason' available in groovy scripts
Fixes #520
* feat: Add reason parameter to reserve button
When a user reserves a resource via the Reserve button, they are now
prompted to provide a reason. The reason is:
- Stored in the lockReason field (shared with lock() step)
- Displayed in the resources table
- Cleared when the resource is unreserved
Changes:
- LockableResource: Add reserve(userName, reason) overload
- LockableResourcesManager: Add reserve(resources, userName, reason)
- doReserve: Read reason parameter from request
- table.jelly: Show reason for reserved resources, add i18n template
- lockable-resources.js: Prompt for reason on reserve action
- table.properties: Add dialog messages
* fix: consolidate i18n templates to avoid duplicate IDs
* feat: Enhance reservation logging and add authentication check
* refactor: improve logging format for resource reservation and user authentication (#1009)
* fix: include reason in toString(), steal action, and fix spotless formatting1 parent 8ce5140 commit 9a49376
24 files changed
Lines changed: 530 additions & 36 deletions
File tree
- src
- main
- java/org/jenkins/plugins/lockableresources
- actions
- queue
- resources/org/jenkins/plugins/lockableresources
- LockStepResource
- LockStep
- actions/LockableResourcesRootAction
- tableQueue
- tableResources
- webapp/js
- test/java/org/jenkins/plugins/lockableresources
- actions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
87 | 100 | | |
88 | 101 | | |
89 | 102 | | |
| |||
Lines changed: 14 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
45 | 50 | | |
46 | 51 | | |
47 | 52 | | |
| |||
117 | 122 | | |
118 | 123 | | |
119 | 124 | | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
120 | 132 | | |
121 | 133 | | |
122 | 134 | | |
| |||
230 | 242 | | |
231 | 243 | | |
232 | 244 | | |
233 | | - | |
| 245 | + | |
234 | 246 | | |
235 | 247 | | |
236 | 248 | | |
| |||
251 | 263 | | |
252 | 264 | | |
253 | 265 | | |
254 | | - | |
| 266 | + | |
255 | 267 | | |
256 | 268 | | |
257 | 269 | | |
| |||
Lines changed: 3 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
93 | | - | |
| 93 | + | |
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
| |||
156 | 156 | | |
157 | 157 | | |
158 | 158 | | |
159 | | - | |
| 159 | + | |
| 160 | + | |
160 | 161 | | |
161 | 162 | | |
162 | 163 | | |
| |||
Lines changed: 30 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
38 | 43 | | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
39 | 48 | | |
40 | 49 | | |
41 | 50 | | |
| 51 | + | |
42 | 52 | | |
43 | 53 | | |
44 | 54 | | |
| |||
56 | 66 | | |
57 | 67 | | |
58 | 68 | | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
59 | 74 | | |
60 | 75 | | |
61 | | - | |
| 76 | + | |
62 | 77 | | |
63 | 78 | | |
64 | 79 | | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
65 | 84 | | |
| 85 | + | |
66 | 86 | | |
| 87 | + | |
67 | 88 | | |
68 | | - | |
| 89 | + | |
69 | 90 | | |
70 | | - | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
71 | 95 | | |
72 | | - | |
73 | | - | |
74 | | - | |
| 96 | + | |
| 97 | + | |
75 | 98 | | |
76 | | - | |
| 99 | + | |
77 | 100 | | |
78 | 101 | | |
79 | 102 | | |
| |||
Lines changed: 36 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
75 | 81 | | |
76 | 82 | | |
77 | 83 | | |
| |||
255 | 261 | | |
256 | 262 | | |
257 | 263 | | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
258 | 284 | | |
259 | 285 | | |
260 | 286 | | |
| |||
422 | 448 | | |
423 | 449 | | |
424 | 450 | | |
| 451 | + | |
425 | 452 | | |
426 | 453 | | |
427 | 454 | | |
| |||
650 | 677 | | |
651 | 678 | | |
652 | 679 | | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
653 | 684 | | |
654 | 685 | | |
| 686 | + | |
655 | 687 | | |
656 | 688 | | |
657 | 689 | | |
658 | 690 | | |
659 | 691 | | |
| 692 | + | |
660 | 693 | | |
661 | 694 | | |
662 | 695 | | |
663 | 696 | | |
664 | 697 | | |
665 | 698 | | |
666 | 699 | | |
| 700 | + | |
667 | 701 | | |
668 | 702 | | |
669 | 703 | | |
| |||
678 | 712 | | |
679 | 713 | | |
680 | 714 | | |
| 715 | + | |
681 | 716 | | |
682 | 717 | | |
683 | 718 | | |
| |||
689 | 724 | | |
690 | 725 | | |
691 | 726 | | |
| 727 | + | |
692 | 728 | | |
693 | 729 | | |
694 | 730 | | |
| |||
Lines changed: 72 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
664 | 664 | | |
665 | 665 | | |
666 | 666 | | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
667 | 680 | | |
668 | | - | |
| 681 | + | |
669 | 682 | | |
670 | 683 | | |
671 | 684 | | |
| |||
681 | 694 | | |
682 | 695 | | |
683 | 696 | | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
684 | 700 | | |
685 | 701 | | |
686 | 702 | | |
| |||
710 | 726 | | |
711 | 727 | | |
712 | 728 | | |
| 729 | + | |
713 | 730 | | |
714 | 731 | | |
715 | 732 | | |
| |||
795 | 812 | | |
796 | 813 | | |
797 | 814 | | |
798 | | - | |
| 815 | + | |
799 | 816 | | |
800 | 817 | | |
801 | 818 | | |
| |||
994 | 1011 | | |
995 | 1012 | | |
996 | 1013 | | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + | |
| 1021 | + | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
997 | 1030 | | |
998 | 1031 | | |
999 | 1032 | | |
| 1033 | + | |
1000 | 1034 | | |
1001 | 1035 | | |
1002 | 1036 | | |
1003 | 1037 | | |
1004 | | - | |
| 1038 | + | |
1005 | 1039 | | |
1006 | 1040 | | |
1007 | 1041 | | |
| 1042 | + | |
1008 | 1043 | | |
1009 | 1044 | | |
1010 | 1045 | | |
| |||
1015 | 1050 | | |
1016 | 1051 | | |
1017 | 1052 | | |
| 1053 | + | |
| 1054 | + | |
| 1055 | + | |
| 1056 | + | |
| 1057 | + | |
| 1058 | + | |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
| 1062 | + | |
| 1063 | + | |
| 1064 | + | |
| 1065 | + | |
| 1066 | + | |
| 1067 | + | |
1018 | 1068 | | |
1019 | 1069 | | |
1020 | 1070 | | |
| |||
1024 | 1074 | | |
1025 | 1075 | | |
1026 | 1076 | | |
| 1077 | + | |
1027 | 1078 | | |
1028 | 1079 | | |
1029 | 1080 | | |
| |||
1407 | 1458 | | |
1408 | 1459 | | |
1409 | 1460 | | |
| 1461 | + | |
| 1462 | + | |
| 1463 | + | |
| 1464 | + | |
| 1465 | + | |
| 1466 | + | |
| 1467 | + | |
| 1468 | + | |
| 1469 | + | |
| 1470 | + | |
| 1471 | + | |
| 1472 | + | |
| 1473 | + | |
| 1474 | + | |
| 1475 | + | |
| 1476 | + | |
1410 | 1477 | | |
1411 | 1478 | | |
1412 | 1479 | | |
| |||
1416 | 1483 | | |
1417 | 1484 | | |
1418 | 1485 | | |
1419 | | - | |
1420 | | - | |
| 1486 | + | |
| 1487 | + | |
1421 | 1488 | | |
1422 | 1489 | | |
1423 | 1490 | | |
| |||
0 commit comments