Interview Prep/CI/CD/Jenkins Pipelines and Agents

Developers want to run the exact same pipeline steps locally before pushing. How do you design for that?

IntermediateScenarioJenkins Pipelines and Agents
Answer

Situation read → Logic buried in Groovy cannot be run on a laptop.

What I'd do →

  1. Put build, test and package logic in scripts or a Makefile/task/Gradle/Maven wrapper (make test, ./mvnw verify).
  2. Keep the Jenkinsfile a thin orchestrator that calls those commands in the same container image developers use.
  3. Use the Jenkins command-line declarative-linter to validate syntax before pushing.

Why → One definition of "build", fewer "works in CI but not locally" gaps, and the CI vendor is easier to swap.

Interview tip → Portability of build logic is a design principle, not a nice-to-have.

All CI/CD questions

More on Jenkins Pipelines and Agents