Interview Prep/CI/CD/Jenkins Pipelines and Agents

Your team still builds jobs by clicking through Freestyle jobs in the Jenkins UI. A new service is starting. What do you set up instead?

BeginnerScenarioJenkins Pipelines and Agents
Answer

Situation read → Click-configured jobs are not versioned, not reviewable and cannot be recreated if the controller dies.

What I'd do →

  1. Add a Jenkinsfile to the repo root and create a Multibranch Pipeline (or GitHub/Bitbucket Organization folder) job pointing at it.
  2. Use Declarative syntax: pipeline { agent ... stages { ... } post { ... } }.
  3. Configure the job itself with Job DSL or JCasC so even the job definition lives in Git.

Why → The pipeline gets code review, history, branch-specific behaviour and automatic jobs for every branch and PR.

Interview tip → Say "pipeline as code" and "job as code" - they are two different layers.

All CI/CD questions

More on Jenkins Pipelines and Agents