Comments (7)
I also wish there was also a REST API for this. In the meantime I created a python API to control lockable resources (reserve, unreserve, list etc).
https://pypi.org/project/jenkins-lockable-resources/
Hope that can help.
from lockable-resources-plugin.
FWIW, a PR to define an /api
endpoint was recently merged (with no further details at that time, just exposing whatever is properly marked in the codebase).
There is also JCasC support to pre-define resources, and a way to define "ephemeral" resources by just trying to lock a non-existing one.
Other than that, groovy code, scripted pipelines and Jenkins Shared Libraries are in position to import the LockableResourcesManager and/or LockableResource classes and call their methods for lower-level manipulations.
from lockable-resources-plugin.
I also would like some kind of REST API for this, so I could lock stuff in one Jenkins instance from a another Jenkins instance.
I can use the GET calls that the lockable resources frontend uses, but i don't think it was intended for that kind of usage:
https://jenkins/lockable-resources/reserve?resource=lockname
https://jenkins/lockable-resources/unreserve?resource=lockname
When I used the "reserve" endpoint it would always return with status code 302, even if the lock had already been locked by someone else.
The "unreserve" endpoint on the other side does fail with status code 403 if the lock is not currently locked or locked by someone else (the get call was performed with a none admin user).
from lockable-resources-plugin.
I also would like a REST API. We have a resource that can be used externally from outside Jenkins. E.g. I would like to lock the resource from outside Jenkins.
from lockable-resources-plugin.
@odin- For the time being , you can put all the logic in a groovy code (groovy code support locking functionality) in a scripted or a declarative pipeline and then call your job remotely using curl or from some other point.
from lockable-resources-plugin.
This was recently closed, but I'm also pushing for something similar in #305 with a updateLock
step. Yes the LockableResourcesManager
can be pulled into groovy, but using it directly is not a great experience. The updateLock
would either set attributes to an existing lock or create a new one (not ephemeral) if it doesn't exist. I'd be happy to hear feedback to make it work with your use cases as well.
from lockable-resources-plugin.
Is there any API documentation on what is supported?
from lockable-resources-plugin.
Related Issues (20)
- Name and value of properties are missing on api HOT 2
- ConcurrentModificationException when serializing LockedResourcesBuildAction#lockedResources HOT 5
- get lock by resource name result in NPE HOT 3
- Deadlock on Jenkins controller while using lockable resources HOT 13
- it.getQueue() in /lockable-resources/. Reason: java.lang.NullPointerException HOT 7
- Trim spaces from resource name, otherwise it will stuck HOT 1
- Throw excpetion when count of requiered resources is bigger then current count of resources HOT 1
- Unqueue all items contains the build, when the build has been canceled / killed (to improve performance) HOT 1
- Use of [] for extra to not lock is not working anymore with 1232.v512d6c434eb_d release HOT 7
- LRM lacks a method to remove a lockable resource from the list HOT 3
- Empty ressource is not allowed anymore HOT 11
- Lease Time HOT 1
- jenkins startup failure HOT 22
- Is there any API documentation on what is supported? Can this be used from command line outside of jenkins? HOT 10
- Missing permission Job/Configure for Administrator
- Adapt plugin for Data Table API 2.0.x HOT 6
- Set reserved timestamp when stealing lock
- manually unlock "globally locked" resource early
- ReservedTimeStamp leads to failure in Plugin:Configuration as Code Plugin during booting jenkins HOT 1
- Add feature to prevent creation of Ephemeral resources
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lockable-resources-plugin.