Possible to set a maximum build time limit?

Using workflows (2.1), is it possible to specify a time limit for builds, after which CircleCI cancels/fails the build?

A recent bug in a build tool meant that a build job that normally would take 5 minutes to run was never completing. Essentially, the build script was stuck in an infinite loop.

I would like to specify a maximum execution time for build jobs, after which CircleCI kills the build. This would prevent getting charged for hours of CI time, when the job should have completed in a few minutes.


1 Like

Does this link https://www.tecmint.com/run-linux-command-with-time-limit-and-timeout/ help?

yes and no - I was hoping this could be done at the workflow level (this build pipeline should never take longer than 30 minutes, for example). While using timeout - we’d need to add it to each command in our build scripts.

1 Like

@MichaelMarner have you found a solution/workaround meanwhile?

I’ve recently noticed a build that was displayed as it was running over 30 h. I’m not sure if this was just a CIrcleCI UI glitch or not since I’ve read that there is a limit of 5 h. Anyway none of my build takes longer than 30 min. So I’d like to limit max build time to 1 or 2 h, too.