In Jenkins pipelines, what is the main benefit of using parallel stages?
Think about how running tasks simultaneously affects total time.
Parallel stages let Jenkins run multiple tasks at once, which speeds up the pipeline by reducing waiting time.
Given this Jenkins pipeline snippet, what will be the output of the sh step on the second run?
pipeline {
agent any
stages {
stage('Cache Example') {
steps {
cache(path: 'node_modules', key: 'npm-cache') {
sh 'npm install'
}
sh 'ls node_modules'
}
}
}
}Check if cache is a built-in Jenkins pipeline step.
Jenkins pipeline does not have a built-in cache step; caching requires plugins or custom steps.
You want to speed up your Jenkins pipeline by running tests simultaneously. Which pipeline snippet correctly achieves this?
Look for the correct syntax to run parallel tasks inside a stage.
Option C uses the parallel step inside a stage with multiple branches, which runs tests concurrently on the same agent.
A Jenkins pipeline uses parallel stages, but the total runtime is still very long. What is the most likely cause?
Consider how agent allocation affects parallel execution.
If parallel stages run on the same agent, they queue and run one after another, not in parallel, causing slow pipelines.
What is the best practice to cache dependencies like node_modules in Jenkins pipelines to keep builds fast and reliable?
Think about automated, reliable ways to reuse dependencies across builds.
Using caching plugins or external cache servers ensures dependencies are reused efficiently and reliably, speeding up builds.