Skip to content
This repository was archived by the owner on Feb 10, 2026. It is now read-only.

Commit 5f40034

Browse files
committed
update Datical fork from jenkinsci fork
1 parent 4648352 commit 5f40034

39 files changed

Lines changed: 3964 additions & 3587 deletions

.editorconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
root = true
2+
3+
[*]
4+
end_of_line = lf
5+
insert_final_newline = true
6+
trim_trailing_whitespace = true
7+
charset = utf-8
8+
9+
[*.{html,java,jelly,xml}]
10+
indent_style = space
11+
indent_size = 2

.github/release-drafter.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
_extends: .github
2+
tag-template: lockable-resources-$NEXT_MINOR_VERSION

.gitignore

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
target/
2-
bin/
3-
work/
4-
.*
5-
.idea
6-
*.iml
1+
/*.iml
2+
/.idea/
3+
/target/
4+
/work/

.mvn/extensions.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<extensions xmlns="http://maven.apache.org/EXTENSIONS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/EXTENSIONS/1.0.0 http://maven.apache.org/xsd/core-extensions-1.0.0.xsd">
2+
<extension>
3+
<groupId>io.jenkins.tools.incrementals</groupId>
4+
<artifactId>git-changelist-maven-extension</artifactId>
5+
<version>1.0-beta-7</version>
6+
</extension>
7+
</extensions>

.mvn/maven.config

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
-Pconsume-incrementals
2+
-Pmight-produce-incrementals

CHANGELOG.old.md

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# Old Changelog
2+
3+
This is the old changelog, see
4+
[GitHub Releases](https://github.com/jenkinsci/lockable-resources-plugin/releases)
5+
for recent versions.
6+
7+
## Release 2.5 (2019-03-25)
8+
9+
- [Fix security issue](https://jenkins.io/security/advisory/2019-03-25/)
10+
11+
## Release 2.4 (2019-01-18)
12+
13+
- [JENKINS-46555](https://issues.jenkins-ci.org/browse/JENKINS-46555) - Fix NPE
14+
on invalid entries.
15+
16+
## Release 2.3 (2018-06-26)
17+
18+
- [JENKINS-34433](https://issues.jenkins-ci.org/browse/JENKINS-34433) - Signal
19+
queued Pipeline tasks on unreserve
20+
21+
- Allow locking multiple resources in Pipeline
22+
23+
## Release 2.2 (2018-03-06)
24+
25+
- [JENKINS-40997](https://issues.jenkins-ci.org/browse/JENKINS-40997) - New
26+
configuration option to get the name of the locked resource inside the lock
27+
block (Pipeline).
28+
29+
- [JENKINS-49734](https://issues.jenkins-ci.org/browse/JENKINS-49734) -
30+
Add a PauseAction to the build when waiting for locking, so Pipeline
31+
representations in the UI are correctly shown.
32+
- [JENKINS-43574](https://issues.jenkins-ci.org/browse/JENKINS-43574) - Fixed
33+
the "empty" resources lock (message: "acquired lock on \[\]")
34+
35+
## Release 2.1 (2017-11-13)
36+
37+
- [JENKINS-47235](https://issues.jenkins-ci.org/browse/JENKINS-47235) -
38+
Trim whitespace from resource names.
39+
- [JENKINS-47754](https://issues.jenkins-ci.org/browse/JENKINS-47754) -
40+
Fix broken Freestyle behavior.
41+
42+
## Release 1.11.2 (2017-03-15)
43+
44+
- [JENKINS-40368](https://issues.jenkins-ci.org/browse/JENKINS-40368) - Locked
45+
resources are not always freed up on Pipeline hard kill when there
46+
are other pipelines waiting on the Resource
47+
48+
## Release 1.11.1 (2017-02-20)
49+
50+
- [JENKINS-40879](https://issues.jenkins-ci.org/browse/JENKINS-40879) - Locked
51+
areas are executed multiple times in parallel
52+
53+
## Release 1.11 (2016-12-19)
54+
55+
- [JENKINS-34268](https://issues.jenkins-ci.org/browse/JENKINS-34268) -
56+
lock multiple resources concurrently
57+
- [JENKINS-34273](https://issues.jenkins-ci.org/browse/JENKINS-34273) -
58+
add the number of resources to lock from a given label
59+
60+
## Release 1.10 (2016-07-12)
61+
62+
- [JENKINS-36479](https://issues.jenkins-ci.org/browse/JENKINS-36479) -
63+
properly clean up resources locked by hard-killed or deleted while
64+
in progress Pipeline builds.
65+
66+
## Release 1.9 (2016-06-01)
67+
68+
- Reserved resources parameter visibility in environment (related to
69+
SECURITY-170)
70+
71+
## Release 1.8 (2016-04-14)
72+
73+
- Pipeline compatibility: lock step
74+
75+
## Release 1.2 (2014-02-05)
76+
77+
- Manual reservation/un-reservation of resources now require specific
78+
permissions
79+
80+
## Release 1.1 (2014-02-03)
81+
82+
- Allow jobs to require a subset of specified resources (the number of required
83+
resources is configurable)
84+
- Allow manual reservation/un-reservation of resources
85+
86+
## Release 1.0 (2013-12-12)
87+
88+
- Initial release

Jenkinsfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
buildPlugin()
1+
#!groovy
2+
buildPlugin(configurations: buildPlugin.recommendedConfigurations())
3+

LICENSE.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
The MIT License
22

3-
Copyright (c) 2013, 6WIND S.A. All rights reserved.
3+
Copyright 2013-2015, 6WIND S.A. All rights reserved.
4+
Copyright 2016-2018, Antonio Muñiz
5+
Copyright 2019, TobiX
46

57
Permission is hereby granted, free of charge, to any person obtaining a copy
68
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 139 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,141 @@
11
# Jenkins Lockable Resources Plugin
22

3-
This plugins allows to define "lockable resources" in the global configuration.
4-
These resources can then be "required" by jobs. If a job requires a resource
5-
which is already locked, it will be put in queue until the resource is released.
3+
[![Jenkins Plugin](https://img.shields.io/jenkins/plugin/v/lockable-resources.svg)](https://plugins.jenkins.io/lockable-resources)
4+
[![GitHub release](https://img.shields.io/github/release/jenkinsci/lockable-resources-plugin.svg?label=release)](https://github.com/jenkinsci/lockable-resources-plugin/releases/latest)
5+
[![Jenkins Plugin Installs](https://img.shields.io/jenkins/plugin/i/lockable-resources.svg?color=blue)](https://plugins.jenkins.io/lockable-resources)
6+
[![Build Status](https://ci.jenkins.io/buildStatus/icon?job=Plugins%2Flockable-resources-plugin%2Fmaster)](https://ci.jenkins.io/job/Plugins/job/lockable-resources-plugin/job/master/)
7+
[![GitHub license](https://img.shields.io/github/license/jenkinsci/lockable-resources-plugin.svg)](https://github.com/jenkinsci/lockable-resources-plugin/blob/master/LICENSE.txt)
8+
[![Maintenance](https://img.shields.io/maintenance/yes/2020.svg)](https://github.com/jenkinsci/lockable-resources-plugin)
9+
10+
This plugin allows defining lockable resources (such as printers, phones,
11+
computers, etc.) that can be used by builds. If a build requires a resource
12+
which is already locked, it will wait for the resource to be free.
13+
14+
## Usage
15+
16+
### Adding lockable resources
17+
18+
1. In *Manage Jenkins* > *Configure System* go to **Lockable Resources
19+
Manager**
20+
2. Select *Add Lockable Resource*
21+
22+
Each lockable resource has the following properties:
23+
24+
- **Name** - A name (not containing spaces!) for this particular resource, i.e.
25+
`DK_Printer_ColorA3_2342`
26+
- **Description** - A verbose description of this particular resource,
27+
i.e. ` Printers in the Danish Office`
28+
- **Labels** - Space-delimited list of Labels (Not containing spaces) used to
29+
identify a pool of resources. i.e. `DK_Printers_Office`,
30+
`DK_Printer_Production`, `DK_Printer_Engineering`
31+
- **Reserved by** - If non-empty, the resource will be unavailable for jobs.
32+
i.e. `All printers are currently not available due to maintenance.`
33+
34+
### Using a resource in a freestyle job
35+
36+
When configuring the job, select **This build requires lockable resources**.
37+
Please see the help item for each field for details.
38+
39+
### Using a resource in a pipeline job
40+
41+
When the `lock` step is used in a Pipeline, if the resource to be locked isn't
42+
already defined in the Jenkins global configuration, an ephemeral resource is
43+
used: These resources only exist as long as any running build is referencing
44+
them.
45+
46+
Examples:
47+
48+
```groovy
49+
echo 'Starting'
50+
lock('my-resource-name') {
51+
echo 'Do something here that requires unique access to the resource'
52+
// any other build will wait until the one locking the resource leaves this block
53+
}
54+
echo 'Finish'
55+
```
56+
57+
```groovy
58+
lock(resource: 'staging-server', inversePrecedence: true) {
59+
node {
60+
servers.deploy 'staging'
61+
}
62+
input message: "Does ${jettyUrl}staging/ look good?"
63+
}
64+
```
65+
66+
```groovy
67+
lock(label: 'some_resource', variable: 'LOCKED_RESOURCE') {
68+
echo env.LOCKED_RESOURCE
69+
}
70+
```
71+
72+
Detailed documentation can be found as part of the
73+
[Pipeline Steps](https://jenkins.io/doc/pipeline/steps/lockable-resources/)
74+
documentation.
75+
76+
## Configuration as Code
77+
78+
This plugin can be configured via
79+
[Configuration-as-Code](https://github.com/jenkinsci/configuration-as-code-plugin).
80+
81+
### Example configuration
82+
83+
```
84+
unclassified:
85+
lockableResourcesManager:
86+
declaredResources:
87+
- name: "Resource_A"
88+
description: "Description_A"
89+
labels: "Label_A"
90+
reservedBy: "Reserved_A"
91+
```
92+
93+
## Changelog
94+
95+
* See [GitHub Releases](https://github.com/jenkinsci/lockable-resources-plugin/releases)
96+
for recent versions.
97+
* See the [old changelog](CHANGELOG.old.md) for versions 2.5 and older.
98+
99+
## Contributing
100+
101+
If you want to contribute to this plugin, you probably will need a Jenkins plugin development
102+
environment. This basically means a current version of Java (Java 8 should probably be okay for now)
103+
and [Apache Maven]. See the [Jenkins Plugin Tutorial] for details.
104+
105+
If you have the proper environment, typing:
106+
107+
$ mvn verify
108+
109+
should create a plugin as `target/*.hpi`, which you can install in your Jenkins instance. Running
110+
111+
$ mvn hpi:run -Djenkins.version=2.164.1
112+
113+
allows you to spin up a test Jenkins instance on [localhost] to test your
114+
local changes before committing.
115+
116+
[Apache Maven]: https://maven.apache.org/
117+
[Jenkins Plugin Tutorial]: https://jenkins.io/doc/developer/tutorial/prepare/
118+
[localhost]: http://localhost:8080/jenkins/
119+
120+
### Code Style
121+
122+
This plugin tries to migrate to [Google Java Code Style], please try to adhere to that style
123+
whenever adding new files or making big changes to existing files. If your IDE doesn't support
124+
this style, you can use the [fmt-maven-plugin], like this:
125+
126+
$ mvn fmt:format -DfilesNamePattern=ChangedFile\.java
127+
128+
to reformat Java code in the proper style.
129+
130+
[Google Java Code Style]: https://google.github.io/styleguide/javaguide.html
131+
[fmt-maven-plugin]: https://github.com/coveo/fmt-maven-plugin
132+
133+
## License
134+
135+
The MIT License (MIT)
136+
137+
- Copyright 2013-2015 6WIND
138+
- Copyright 2016-2018 Antonio Muñiz
139+
- Copyright 2019 TobiX
140+
141+
See [LICENSE](LICENSE.txt)

check_licenses.py

Lines changed: 0 additions & 85 deletions
This file was deleted.

0 commit comments

Comments
 (0)