- Use parallel stages for independent tasks — total time equals the slowest branch
- Use stash/unstash to pass artifacts between stages on different agents — stash only what is needed
- Cache dependencies: mount persistent volumes for ~/.m2, ~/.npm, ~/.gradle
- Set options { skipDefaultCheckout() } and use explicit checkout scm only where needed
- Clean workspaces in post { always { cleanWs() } } at the end, not between stages
- Use parallel stages: parallel { stage('Tests') {} stage('Lint') {} } — time equals slowest branch
- Use stash/unstash for small artifacts between stages — avoid stashing over 100MB
- Cache dependency directories: persistent volumes for ~/.m2, ~/.npm, ~/.gradle
- Use Artifactory or Nexus to resolve dependencies from binary repository
- Set options { skipDefaultCheckout() } — explicit checkout only where needed
- Shallow clone: shallow: true, depth: 1 — reduces clone time for large repos
- Allocate agents efficiently: large for builds, small for notifications
- Docker agents with cached volumes: args '-v maven-cache:/root/.m2'
- Split test suites across parallel shards: --shard=1/4
- Use milestone() to abort older builds when newer commits trigger
- Clean workspaces in post { always { cleanWs() } }
- Monitor with Pipeline Stage View to identify bottleneck stages