Category Archives: CI/CD Tools

TIL: Java code in Jenkins pipelines run on the Master

I was trying to read a file with in a Jenkins Groovy Scripted Pipeline on a non-master node. I kept getting an exception that the file was not found (

Turns out that Java code written in scripted pipelines (Groovy) runs on the master node: This is as-designed behavior, and accessing files in the workspace on a non-master node should use the readFile function in the Pipeline Basic Steps DSL

I’m thoroughly embarrassed at how many failed Jenkins jobs and alerts I’ve triggered while discovering this.