Skip to main content

Auto-attached Context Hooks Priority

Ordering the execution of hooks by the name of the context by which they were attached to a stack is arbitrary and leads to contorted context labels. It would be far better to assign an explicit priority to each hook, including auto-attached hooks. (Not all of the hooks auto-attached by a particular context should be run at the same priority.)

Status: ✅ Completed2 comments

Log in to comment and vote

Comments2

  • Black Breeze

    •

    May 10, 2025

    Appreciate the suggestion! Behind the scenes, hooks are executed in a consistent order, but we haven’t documented that order because it’s not meant to be user-facing or relied on. Ideally, hooks should be written to be order-independent.

    That said, we’re curious—what job are you doing where the order appears to matter? If something’s breaking, we’d love to dig in. If it’s just unpredictability that’s unsettling, we can consider surfacing or clarifying the current behavior.

    • Gold Orbit

      •

      Jul 31, 2025

      Hi @Marcin Wyszynski, consider our use-case as an example. We have common environment variables defined in “default“ context, but some of them need to be overwritten in “dev“ and “prod“ contexts. Currently we have to workaround it by prefixing contexts with the priorities as numbers in reverse order, e.g. “0-dev“. So it would be great to see this as a feature in Spacelift.