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

How can I trigger build of another job from inside the Jenkinsfile? I assume that this job is another repository under the same github organization, one that already has its own Jenkins file. I also want to do this only if the branch name is master, as it doesn’t make sense to trigger downstream builds … Read more

Groovy Shell warning “Could not open/create prefs root node …”

I tried to open the Groovy Shell (groovysh) on Windows 8 and got the following output: java.util.prefs.WindowsPreferences <init> WARNING: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0x80000002. Windows RegCreateKeyEx(…) returned error code 5. After printing the above message the shell started as expected. 9 Answers 9

Groovy executing shell commands

Groovy adds the execute method to String to make executing shells fairly easy; println “ls”.execute().text but if an error happens, then there is no resulting output. Is there an easy way to get both the standard error and standard out? (other than creating a bunch of code to; create two threads to read both inputstreams, … Read more

Jenkins: Can comments be added to a Jenkinsfile?

Are comments possible in a Jenkinsfile? If so, what’s the syntax? I am using the declarative pipeline syntax. I want to comment out the “post” section below until my SMTP server is working. pipeline { agent { label ‘docker-build-slave’ } environment { IMAGE = ‘registry.gitlab.com/XXXXX/bible-server’ DOCKER_REGISTRY_CREDENTIALS = credentials(‘DOCKER_REGISTRY_CREDENTIALS’) } options { timeout(10) } stages { … Read more

Is there a null-coalescing (Elvis) operator or safe navigation operator in javascript?

I’ll explain by example: Elvis Operator (?: ) The “Elvis operator” is a shortening of Java’s ternary operator. One instance of where this is handy is for returning a ‘sensible default’ value if an expression resolves to false or null. A simple example might look like this: def gender = user.male ? “male” : “female” … Read more