Jenkins - agents wait for another agent to finish

I am new to Jenkins and I am trying to set up a project that will use several build executives. The flow should be as follows:

  • two labeled assembly executors webservicereturn their IP addresses and wait for the third assembly executor to complete their work.
  • a third labeled assembly executor testercollects these IP addresses and does some sort of long task (ex sends HTTP requests to web services deployed on these two agents)

How to achieve this behavior in Jenkins?

I found that when an assembly executor finishes his work, he is immediately released, and I do not know how to make him wait until other assembly executors finish their tasks.

Edit

I forgot to mention that I want the assembly executors with the label to webservicebe reserved (not available for other tasks) until the assembly executor with the label testercompletes their long-term task.

Also, all of these assembly performers must be on separate slaves each. This means that each slave has only one assembly executor.

+2
source share
3 answers

I managed to do this using the Pipeline and below script:

node('webservice') {
    def firstHostname = getHostname()
    node('webservice') {
        def secondHostname = getHostname()
        node('tester') {
            println 'Running tests against ' + firstHostname + ' and ' + secondHostname
            // ...
        }
    }
}

def getHostname() {
    sh 'hostname > output'
    readFile('output').trim()
}

He acquires two assembly performers with a tag webservice. I get their hostnames (I use them instead of IP addresses) and pass them to the assembly executor with a label tester. Finally, testerperforms several lengthy tests.

webservice , tester , .

+3

, .

, IP- , - .

, Jenkins , , , . Multijob , .

. , .

0

Source: https://habr.com/ru/post/1524181/


All Articles