Giter Club home page Giter Club logo

Comments (4)

mPokornyETM avatar mPokornyETM commented on August 14, 2024

"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.

royteeuwen avatar royteeuwen commented on August 14, 2024

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.

mPokornyETM avatar mPokornyETM commented on August 14, 2024

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.

royteeuwen avatar royteeuwen commented on August 14, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.