How to Run Sequentially on Jenkins

Asked

Viewed 305 times

0

Good afternoon,

I have a project where there are 10 Jobs and I would like to know how to execute all in sequence ( I run the first and even if there is an error, it continues the execution until I have finished all Jobs )

I found that there are some plugins but as I do not know very well, I would like the help of someone here in the community.

Thank you

1 answer

0

Jenkins has the option of pipelines, which is what you are looking for. In the example below that I extracted from the documentation, this pipeline has 3 stages: build, test and deploy. But you can add as many stages as you want:

pipeline {
    agent any

    stages {
        stage('JobA') {
            steps {
                echo 'Comandos relacionado com o job a'
            }
        }
        stage('JobB') {
            steps {
                echo 'Comandos relacionado com o job b'
            }
        }
        stage('JobC') {
            steps {
                echo 'Comandos relacionado com o job c'
            }
        }
    }
}
  • Hi Marabesi, thanks for your help. I’m sorry but I’m kind of new in this hahaha medium.

  • Marabesi could explain to me how this code + or - with the name of the Jobs ? example "Joba", "Jobb" etc..

  • I edited the answer to try to illustrate better

  • Just to complement... on github there are some nice examples that can give you a hint: https://github.com/jenkinsci/pipeline-examples

  • Hi Marabesi good morning, thank you. In this line of echo, do not know which command would be used to start the job

  • can use command build 'Job1' // nome do job, to find out the name of the job you want to call, tell the correct path, access the job, and copy the full name of the project.

Show 1 more comment

Browser other questions tagged

You are not signed in. Login or sign up in order to post.