feat(hooks): run custom step types as lifecycle hooks (kind: step) @osterman (#2658)
## what- Add a new
kind: stepcomponent-lifecycle hook that delegates to the workflow/custom-command step registry, making every registered step type (container,http,toast,log,markdown, …) runnable on terraform lifecycle events — name a steptype:and pass its parameters underwith:. - Plumb the operation outcome to hooks: user hooks now fire on the failure path (not just success), a new
when: success|failure|alwaysselector (defaultsuccess) controls outcome-based firing, and{{ .status }}/{{ .exit_code }}/{{ .error }}template context plusATMOS_HOOK_*env vars (alongside component/stack) let a hook announce exactly what happened. - Tighten the
hooksJSON schema into a structured per-hook envelope (kindenum incl.step,events,on_failure,when,type,with,retry) across all three schema copies, kept non-breaking (additionalProperties: true). - Add docs (hooks reference + new sections), a PRD, a changelog blog post, and a roadmap milestone; unit tests cover routing, nested
with:decode,whenfiltering, outcome template/env exposure, retry, andon_failure.
why
- The hook system previously hard-coded a small kind list (
store,command,infracost,checkov,kics,trivy,git); every new capability meant a new kind. Reusing the existing, well-tested step registry lets the whole step library work as hooks without forking the abstraction. - A key use case — "the VPC component in the foobar stack failed" — was impossible:
after-*hooks fired only on success (cobra skipsPostRunEon error) and the outcome reached only CI hooks, never user hooks. Firing user hooks on failure withwhen+ outcome context closes that gap while defaulting to success-only so existing hooks (e.g.store) keep their behavior.
references
- PRD:
docs/prd/hooks-step-types.md - Docs:
/stacks/hooks#kind-step-run-a-step-typeand#reacting-to-success-or-failure - The
httpstep type used in the Slack example lands in a separate PR; the bridge works today with every registered step type.
Summary by CodeRabbit
- New Features
- Added composable declarative
whenconditions for workflow steps, hooks, and structured custom-command steps (including predicate logic and workflow-styleretry). - Introduced
kind: stephooks to run any registered workflow/custom-command step type viatype,with,retry,env, andon_failure. - Hook lifecycle outcomes are now exposed to hook templates and available as
ATMOS_HOOK_STATUS,ATMOS_HOOK_EXIT_CODE, andATMOS_HOOK_ERROR.
- Added composable declarative
- Bug Fixes
- Steps/hooks now correctly skip when conditions don’t match, and verification respects both outcome status and CI gating.
- Documentation
- Updated docs/schemas/examples, and standardized Terraform lifecycle hook event names to dotted format.
- Tests
- Added/updated coverage for conditional execution, schema validation, and the step hook engine.
Skip fork autofix and refresh setup-go pins @osterman (#2659)
## what- Skip the
atmos.ciautofixjob when a pull request comes from a fork. - Keep the existing
atmos-pro[bot]loop guard and same-repo PR autofix behavior. - Refresh eight
actions/setup-gov6SHA pins to match the current upstreamv6tag.
why
- Fork PRs do not receive OIDC, repo variables, or writable credentials, so
atmos pro commitcannot authenticate or push fixes. - Skipping the job avoids guaranteed red checks for external contributors while preserving formatting automation for internal PRs.
- The
verifyworkflow checks that SHA-pinned actions match their tag comments; the previoussetup-gopins pointed atv6.4.0while labeled asv6.
references
- Validated with workflow YAML parsing, upstream tag checks for
actions/setup-go, and commit hookcheck yaml.
Summary by CodeRabbit
- Chores
- Updated multiple CI/E2E workflows to pin the Go setup action (
actions/setup-go@v6) to newer immutable revisions for more consistent build and test runs. - Improved the automation logic to avoid running the auto-fix job on fork-originated pull requests where commit/push authentication isn’t supported.
- Added inline documentation in the automation workflow explaining the fork/OIDC limitation.
- Updated multiple CI/E2E workflows to pin the Go setup action (