Jenkins pipeline sh fail with “cannot run program nohup” on windows

From a very quick search, it looks like your error is related to the following issue : JENKINS-33708 The main cause looks like the sh step is not supported on the Windows. You may use bat or install Cygwin for instance. Nevertheless two solutions were proposed in the previous link, suggesting you to do the … 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

If using jenkins The user jenkins needs to be added to the group docker: sudo usermod -a -G docker jenkins Then restart Jenkins. Otherwise 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 … Read more