Interview Prep/CI/CD/Jenkins Pipelines and Agents

A Jenkins build takes 40 minutes because unit tests, linting and security scans run one after another. How do you speed it up?

BeginnerScenarioJenkins Pipelines and Agents
Answer

Situation read → Independent stages are serialized, so total time is the sum instead of the maximum.

What I'd do →

  1. Wrap independent stages in parallel:
stage('Checks') {
  parallel {
    stage('Unit')  { steps { sh 'mvn -q test' } }
    stage('Lint')  { steps { sh 'npm run lint' } }
    stage('SAST')  { steps { sh 'semgrep ci' } }
  }
}
  1. Set failFast true on the parallel block so one failure stops the rest.
  2. Make sure each branch lands on its own executor.

Why → Wall-clock time drops to the slowest branch, and failures are reported sooner.

Interview tip → Mention that parallelism needs enough executors, otherwise branches just queue.

All CI/CD questions

More on Jenkins Pipelines and Agents