• Jenkins controller
  • Nodes … machines on which build agents run
    • specify which nodes should execute a job with labels
    • Permanent Agents … dedicated Servers for runnings jobs
    • Cloud Agents … Dynamic Agents spun up on demand (docker, K8s)
  • Executors … A slot for execution tasks


  • Declarative Pipeline (recommended)
    • start with that. Then add shared libraries.
  • Scripted Pipeline (old)
    • can be more complex
  • Runs Jenkinsfile written in the Jenkins DSL
  • Access Parameters with params.MY_PARAM_NAME
  • Multi-branch Pipelines are a folder of Pipeline jobs, created for each branch matching the criteria defined

Environment Variables

  • BUILD_ID The current build ID, identical to BUILD_NUMBER for builds created in Jenkins versions 1.597+
  • BUILD_NUMBER The current build number, such as “153”
  • BUILD_TAG String of jenkins-{BUILD_NUMBER}. Convenient to put into a resource file, a jar file, etc for easier identification
  • BUILD_URL The URL where the results of this build can be found (for example http://buildserver/jenkins/job/MyJobName/17/ )
  • EXECUTOR_NUMBER The unique number that identifies the current executor (among executors of the same machine) performing this build. This is the number you see in the “build executor status”, except that the number starts from 0, not 1
  • JAVA_HOME If your job is configured to use a specific JDK, this variable is set to the JAVA_HOME of the specified JDK. When this variable is set, PATH is also updated to include the bin subdirectory of JAVA_HOME
  • JENKINS_URL Full URL of Jenkins, such as (NOTE: only available if Jenkins URL set in “System Configuration”)
  • JOB_NAME Name of the project of this build, such as “foo” or “foo/bar”.
  • NODE_NAME The name of the node the current build is running on. Set to ‘master’ for the Jenkins controller.
  • WORKSPACE - The absolute path of the workspace

Getting Started

# start jenkins
docker run -it --name jenkin --rm -p 8080:8080 jenkins/jenkins