How do I make a Jenkins job start after multiple simultaneous upstream jobs succeed?

Pipeline plugin You can use the Pipeline Plugin (formerly workflow-plugin). It comes with many examples, and you can follow this tutorial. e.g. // build stage ‘build’ … // deploy stage ‘deploy’ … // run tests in parallel stage ‘test’ parallel ‘functional’: { … }, ‘performance’: { … } // promote artifacts stage ‘promote’ … Build … Read more

Show a Jenkins pipeline stage as failed without failing the whole job

This is now possible, even with declarative pipelines: pipeline { agent any stages { stage(‘1’) { steps { sh ‘exit 0’ } } stage(‘2’) { steps { catchError(buildResult: ‘SUCCESS’, stageResult: ‘FAILURE’) { sh “exit 1” } } } stage(‘3’) { steps { sh ‘exit 0’ } } } } In the example above, all stages … Read more

How can I trigger another job from a jenkins pipeline (jenkinsfile) with GitHub Org Plugin?

In addition to the above mentioned answers: I wanted to start a job with a simple parameter passed to a second pipeline and found the answer on http://web.archive.org/web/20160209062101/https://dzone.com/refcardz/continuous-delivery-with-jenkins-workflow So i used: stage (‘Starting ART job’) { build job: ‘RunArtInTest’, parameters: [[$class: ‘StringParameterValue’, name: ‘systemname’, value: systemname]] }

Jenkins Pipeline NotSerializableException: groovy.json.internal.LazyMap

Use JsonSlurperClassic instead. Since Groovy 2.3 (note: Jenkins 2.7.1 uses Groovy 2.4.7) JsonSlurper returns LazyMap instead of HashMap. This makes new implementation of JsonSlurper not thread safe and not serializable. This makes it unusable outside of @NonDSL functions in pipeline DSL scripts. However you can fall-back to groovy.json.JsonSlurperClassic which supports old behavior and could be … Read more

How do you load a groovy file and execute it

If your Jenkinsfile and groovy file in one repository and Jenkinsfile is loaded from SCM you have to do: Example.Groovy def exampleMethod() { //do something } def otherExampleMethod() { //do something else } return this JenkinsFile node { def rootDir = pwd() def exampleModule = load “${rootDir}@script/Example.Groovy ” exampleModule.exampleMethod() exampleModule.otherExampleMethod() }

Docker: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock

The user jenkins needs to be added to the group docker: sudo usermod -a -G docker jenkins Then restart Jenkins. Edit If you arrive to this question of stack overflow because you receive this message from docker, but you don’t use jenkins, most probably the error is the same: your unprivileged user does not belong … Read more