Build timeout to start after build is run, not during wait time

I am using jenkins scripted pipeline with timeout as 30 minutes
timeout(time: 30, unit: 'MINUTES')
This times starts when the build is in queue and aborts the build halfway due to this timeout if it has been waiting for some time in queue. Is there a way that I can have this timer start after my build starts to run?

I assume you use declarative pipeline and have this in the global options.
you should use the timeout then not as a global option but maybe only on a specific stage

pipeline {
  stages {
    stage('') {
      steps {
        // One or more steps need to be included within the steps block.
      }
      options {
        timeout(30)
      }
    }
  }
}
1 Like