agent icon indicating copy to clipboard operation
agent copied to clipboard

Add a bool env var for when job times out

Open jumbosushi opened this issue 1 month ago • 3 comments

Is your feature request related to a problem? Please describe. During the post-command hook, I would like a way to determine if the job timeout (from the job-level timeout, not a command-specific timeout). One use case is changing the build annotation content based on job termination reason which isn't too clear based on exit codes.

Describe the solution you'd like Ideally it would be something like BUILDKITE_JOB_TIMED_OUT. Would love to see something like #3213

jumbosushi avatar Nov 21 '25 22:11 jumbosushi

Hi @jumbosushi, thank you raising this feature request to us. May we understand a bit deeper about your use case?

Is your end goal to make the timeout state more visible on Buildkite UI?

Would using buildkite job metadata to record job start time a viable workaround for your use case?

zhming0 avatar Nov 26 '25 04:11 zhming0

Yes, our end goal is to change the post-hook behavior based on the job end state (failed, cancelled, or timed out). In this case for updating annotation content

Using job metadata might work, but we would still need to do some arithmetics ((start_time - current_time) > time_limit) to determine if it timed out or not. Figured if we have BUILDKITE_JOB_<state> env var like BUILDKITE_JOB_CANCELLED , it would be nice to have BUILDKITE_JOB_TIMED_OUT

jumbosushi avatar Dec 02 '25 20:12 jumbosushi

@jumbosushi we have tracked this as a feature request internally. It's closing EoY, people are on leaves, so it's unlikely that we will get to it soon. Please kindly give us a nudge in the new year should you feel strongly about this feature request. 🙏🏿

zhming0 avatar Dec 08 '25 02:12 zhming0