0

We have jenkin's jobs start with some prefix, some times execution getting too long. We want to stop all those jobs, how can we do it?

Kpras
  • 163
  • 2
  • 2
  • 10
  • Does it solved your problem? https://stackoverflow.com/questions/12305244/cancel-queued-builds-and-aborting-executing-builds-using-groovy-for-jenkins – k0chan Dec 06 '19 at 18:32
  • @k0chan Please provide more specific details. That scripting looks to be included in job. But I need it for entire view. – Kpras Dec 06 '19 at 18:44

1 Answers1

0

You can add timeouts to the stages which are taking more time than expected.

Example stage:

stage("Long-Process") {
        steps {
            timeout(time: 20, unit: 'MINUTES') {
                sh "......"
            }
        }
    }

The Pipleine gets aborted if this stage takes more than 20 minutes. Hope this helps.