Search code examples
jenkinstriggersjenkins-pipelinepipelinejobs

How to trigger a job when one job is finished


I used this:

  post {
      always {
          sh "echo Jenkins Job is Done"
          junit 'target/surefire-reports/*.xml'
          echo 'Run darkWeb Test pipeline!'
          build job: 'DarkWeb'
      }

and it works. The problem is that the original job continuing running while the second job (DarkWeb) is running too.

I want the 'DarkWeb' job to run only after the original job is completely finished


Solution

  • You can try the following syntax: build job: 'Darkweb', wait: false The wait: false token would allow the first job to finish without waiting for the completion of second job. Let me know if it works!