Comments (4)
"seeing as Jenkins does not allow parallel in parallel, I cant switch it to:"
it is not true, it is allowed, and it also works, but there are no plugins (even core) which can show it correctly
I am not pretty sure, wha you need, but in scripted pipeline you can use lock() in lock()
stage('Init') {
echo 'hello world'
}
def stages = [:]
stages['suite1'] {
node('windows') {
doTest('TC-1');
doTest('TC-2');
doTest('TC-3');
}
}
stages['suite2'] {
node('debian') {
doTest('TC-1');
doTest('TC-2');
doTest('TC-3');
}
}
stages['suite2'] {
node('RHEL') {
doTest('TC-1');
doTest('TC-2');
doTest('TC-3');
}
}
stage('Testing') {
parallel stages;
}
void doTest(final String testCase) {
lock('test-infra-' + testCase) {
echo 'execute test case: ' + testCase
sleep 60
lock('Publish results') {
sh 'echo "I am done ' + testCase + ' on node ' + env.NODE_NAME + '" >> /mnt/some/shared/file.txt'
}
}
}
- you are sure test cases are siolated (does not matter which nodes win)
- and updating the file '/mnt/some/shared/file.txt' will be synchronized (locked) over all jobs. That means only one node has access at the same time
When it is not what are you @royteeuwen looking for, pls paste here some diagram (UML) or somthing like that, to explain, what you want to reached.
from lockable-resources-plugin.
I indeed figured out in the meantime that scripted does allow parallel in parallel, it just doesnt visualise (correctly), which is a shame to be honest, it shouldn’t be difficult to visualise it correctly.
doing this approach does indeed achieve what I want, but just out of curiosity, it wasn’t an actual answar to what I was looking for, my question was rather, can i do the following in any way (scripted or not):
stage {
lock(‘label’)
do stuff
}
stage(2) {
do sture
unlock(‘label’)
}
from lockable-resources-plugin.
The answer is easy. Currently no.
In the meaintime, there was few questions to do that like you propose, but in all cases we provide just an other working example and it was unnecessary.
Why I dont like it. It is danguerous.
- When you forgot for some reason to unlock the resource (job hard killed ...) it might happens, that it will be locked for ever.
- You can unlock a resource currently used by other build ...
in your shart example will this works
lock(‘label’) {
stage {
do stuff
}
stage(2) {
do sture
}
}
But I don`t think, this is waht you want
from lockable-resources-plugin.
OK, I can definitely understand why it isn't ideal to do it!
In the meantime I already decided to rewrite it to parallel in parallel, meaning that I had to drop the declarative pipeline and replace it with scripted, plus blue ocean doesn't render it correctly anymore. But puristically it's more logical for it to be parallel in parallel, so very sad Jenkins doesn't support it correctly in declarative
Thanks for the help!
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.