This is a repository of simple Jenkins examples.
Most examples at present use the Jenkins pipeline feature introduced around Jenkins 1.6, so keep the following docs handy:
You should have a Jenkins instance to try this out on. The easiest way is to download it for your operating system but you can also run a Jenkins Docker container..
Each hello-world-*
folder contains a Jenkinsfile
which demonstrates a basic Pipeline concept. To try out each example, read the README
file located in each folder.
What order should you follow?
And other hello-world-*
examples sequentially.
You might encounter an error similar to the following when executing a pipeline:
java.lang.NullPointerException: Cannot invoke method getRandom() on null object
at org.codehaus.groovy.runtime.NullObject.invokeMethod(NullObject.java:91)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:48)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
One situation where this error is encountered, is when
- you load a groovy script from your
Jenkinsfile
but - that script has not been terminated with
return this
.