1

I'm using drone 0.8.1. I have some UI tests that run as steps and sometimes they get stuck and can hang for up to an hour. I'd rather kill the entire drone build after a step takes longer than a set amount of time (say, 5 minutes since I know that each step should only take ~30 seconds to complete) rather than waiting an hour to find out that my drone build was cancelled.

Essentially, I just want a way to say "Is this drone step taking more than X minutes? Then kill the entire build".

I'm not seeing anyway to do this in the docs but wondering if someone has finagled a way to do this? Much appreciated!

Steph M
  • 2,152
  • 1
  • 12
  • 11

1 Answers1

1

You should be able to achieve this with the timeout command.

This command allows you to limit the time for a command. Add it to your image and prefix every command with it.

Since it also exits with a non-zero code if the time limit is exceeded, your step will automatically fail.

Example usage:

commands:
    - timeout 30s doSomethingLong.sh
kalehmann
  • 4,821
  • 6
  • 26
  • 36
  • This answer works flawlessly and the time it saved us on our builds contributed to my promotion! TY! – Steph M Jun 11 '20 at 01:22