Job Types and Build Configuration
What this domain covers
Expect questions that ask you to pick the right job type for a requirement and to predict what a given configuration does - retention, parameters, concurrency, and environment variables.
Core rules
- Freestyle is the classic form-based job: SCM, triggers, build environment, build steps, post-build actions. It has one workspace per node and no restartable state.
- Pipeline runs a Jenkinsfile. Multibranch Pipeline scans a repository, creates one job per branch and change request that contains a Jenkinsfile, and removes jobs for deleted branches. Organization Folder scans a GitHub organization or Bitbucket team and creates a multibranch project per repository.
- Folder provides a namespace and an ACL boundary. Matrix (multi-configuration) builds the Cartesian product of axes, e.g. jdk {11,17} × os {linux,windows}. Maven project and External job are legacy types worth recognising by name.
- Parameters: string, boolean, choice, password, file, and run (build selector). Every value arrives as a string - a boolean parameter is the literal
true/false, and a choice parameter rejects values outside its list. - Agent allocation versus conditions. In a declarative pipeline a stage's
whenblock is evaluated after an agent is allocated unless you setbeforeAgent true. - Concurrency and quiet period. "Execute concurrent builds if necessary" lets two builds share one freestyle workspace, a classic corruption source. The quiet period (default 5s) batches SCM-triggered builds; SCM checkout retry count defaults to 3.
- Retention. "Discard old builds" offers days, count, and "Keep builds with artifacts"; without it
$JENKINS_HOME/jobs/*/buildsgrows without bound. - Environment variables injected by Jenkins include
BUILD_NUMBER,BUILD_ID,BUILD_URL,JOB_NAME,WORKSPACE,NODE_NAME, plus SCM-providedGIT_COMMIT,GIT_BRANCH, and, in multibranch,BRANCH_NAMEandCHANGE_ID.
Worked example
A nightly job must run only for release/* branches but must not hold an agent while waiting. Use a multibranch pipeline with triggers { cron('H 2 * * *') } and, inside each stage, when { allOf { branch 'release/*'; beforeAgent true } }. Reasoning: the cron lives at job level, the branch filter belongs in the stage condition, and beforeAgent stops an executor being reserved for a stage that will never execute.
Traps
Referencing a parameter without params. or $; echoing a password parameter into the console log; choosing a discarder that deletes artifacts a downstream job consumes; assuming a multibranch job builds pull requests by default when the branch source must first discover them.