Interview Prep/Jenkins/Jenkinsfile syntax, Groovy & CPS errors

The build is aborted with `Cancelling nested steps due to timeout` during a test stage that normally takes 5 minutes.

IntermediateTroubleshootingJenkinsfile syntax, Groovy & CPS errors
Answer

Likely causes → Stage timeout hit because tests hung (waiting on a network resource, deadlock) or because the timeout includes waiting for the agent pod to start.

Diagnose → Check timestamps (timestamps()), when the agent became available, and the last log lines before the timeout; take a thread dump in the test container if reproducible.

Fix → Fix the hang (add test-level timeouts, mock external calls). Put timeout inside the stage steps (not stage options) if pod startup time should not count.

Prevent → Test framework timeouts plus pipeline timeouts as a backstop.

All Jenkins questions Roadmap: Jenkins

More on Jenkinsfile syntax, Groovy & CPS errors