# Conditional Delay Step

**URL:** <https://forum.buildkite.community/t/conditional-delay-step/1926>\
**Category:** Features Requests\
**Created:** [February 24, 2022, 11:49pm UTC](https://forum.buildkite.community/t/conditional-delay-step/1926 "2022-02-24T23:49:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ianwremmel](https://avatars.discourse-cdn.com/v4/letter/i/839c29/32.png) [@ianwremmel](https://forum.buildkite.community/u/ianwremmel)\
**Post date:** [February 24, 2022, 11:49pm UTC](https://forum.buildkite.community/t/conditional-delay-step/1926/1 "2022-02-24T23:49:04Z")

</div>

As part of my testing process, I deploy a cloud formation stack, run a bunch of test jobs against it, and then delete that stack. In the happy path, everything is fine, but if a test job fails, I can’t retry it because the delete job runs immediately (or, i could configure it to not run on failure, but then I’d end up with a whole bunch of rogue infra).

For a while, I had a job in place which would emit a block step if tests failed so delete wouldn’t run until I unblocked it, but this has the same problem as above: it’s too hard to keep track of which jobs to unblock.

In my ideal scenario, I’d want the delete job to run automatically, say, an hour after a test failed. That would give me time to retry but wouldn’t require me to remember to unblock everything. Also, it would be helpful to be able to mark certain jobs as not do-not-cancel-if-another-build-starts. I always want the delete job to run, even if the build gets cancelled because another commit got pushed.

---

<div class="post-metadata">

**Author:** ![paula](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.buildkite.community/paula/32/954_2.png) [@paula](https://forum.buildkite.community/u/paula)\
**Post date:** [February 25, 2022, 3:36am UTC](https://forum.buildkite.community/t/conditional-delay-step/1926/2 "2022-02-25T03:36:37Z")

</div>

Hi @ianwremmel are you suggesting we have a delayed step type of thing? Something that doesn’t run until after some timeout? I can add a feature suggestion internally for that if you like.

As a workaround for now though, you could configure a scheduled build that can use the API to [find builds](https://buildkite.com/docs/apis/rest-api/builds) in the specific state and could [unblock them via the API](https://buildkite.com/docs/apis/rest-api/jobs#unblock-a-job) as well - as a way to automate this daily or something similar.

---

<div class="post-metadata">

**Author:** ![ianwremmel](https://avatars.discourse-cdn.com/v4/letter/i/839c29/32.png) [@ianwremmel](https://forum.buildkite.community/u/ianwremmel)\
**Post date:** [February 25, 2022, 4:51am UTC](https://forum.buildkite.community/t/conditional-delay-step/1926/3 "2022-02-25T04:51:22Z")

</div>

yea, or maybe a property on `block` that unblocks after a timeout?

If a build fails with not-yet-run blocked steps, will its state be `blocked` or `failed`?

---

<div class="post-metadata">

**Author:** ![paula](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.buildkite.community/paula/32/954_2.png) [@paula](https://forum.buildkite.community/u/paula)\
**Post date:** [February 25, 2022, 5:30am UTC](https://forum.buildkite.community/t/conditional-delay-step/1926/4 "2022-02-25T05:30:32Z")

</div>

No worries. I’ll raise that with the team 👍

You can configure the `blocked_state` of block steps: [Block step | Buildkite Documentation](https://buildkite.com/docs/pipelines/block-step#block-step-attributes)
