Skip to content

feat(cli): add client-side preActivate/postActivate activation hooks#384

Open
n-hass wants to merge 1 commit into
serokell:masterfrom
enabledsolutions:feat/activation-hooks
Open

feat(cli): add client-side preActivate/postActivate activation hooks#384
n-hass wants to merge 1 commit into
serokell:masterfrom
enabledsolutions:feat/activation-hooks

Conversation

@n-hass

@n-hass n-hass commented Jul 6, 2026

Copy link
Copy Markdown

Add two optional, generic settings (per profile / node / top-level), preActivate and postActivate, that run a command on the deploying host around profile activation:

  • preActivate runs after the closure is pushed, before activation is started. A non-zero exit code aborts the deploy before activation.
  • postActivate runs after activation, on success OR failure

Both are skipped for --dry-activate. The command runs via sh -c with the deploy/SSH context exported as environment variables, so it can act on the target if required:

  • DEPLOY_RS_HOOK: Which hook is running. Values: pre-activate or post-activate.
  • DEPLOY_RS_SSH_ADDR: SSH target in user@host form ("{DEPLOY_RS_SSH_USER}@{DEPLOY_RS_HOSTNAME}"), eg root@server.example.com.
  • DEPLOY_RS_SSH_USER: The SSH user deploy-rs connects as (resolved from profile/node settings).
  • DEPLOY_RS_HOSTNAME: The host being deployed to. The --hostname CLI override if given, otherwise the node's configured hostname.
  • DEPLOY_RS_SSH_OPTS: Extra SSH options deploy-rs uses (merged ssh_opts joined by spaces; empty string if none).
  • DEPLOY_RS_SUDO: The sudo command prefix (eg sudo -u user), or empty string if sudo isn't used.
  • DEPLOY_RS_PROFILE_PATH: Nix store path of the profile being activated (/nix/store/...).
  • DEPLOY_RS_NODE: Name of the node being deployed from the deploy config.
  • DEPLOY_RS_PROFILE: Name of the profile being deployed from the deploy config.
  • DEPLOY_RS_BOOT: Whether this is a boot (--boot) deploy. 1 if boot mode, 0 otherwise.

Tool use disclosure:
This feature was implemented using Claude Code. I understand the changes being made and present them as my own work.

Add two optional, generic settings (per profile / node / top-level),
`preActivate` and `postActivate`, that run a command on the deploying
host
around profile activation:

  * preActivate runs after the closure is pushed, before activation; a
    non-zero exit aborts the deploy before anything is activated.
  * postActivate runs after activation, on success OR failure

Both are skipped for --dry-activate. The command runs via `sh -c` with
the
deploy/SSH context exported as environment variables, so it can act on
the
target over the same connection deploy-rs uses:

  DEPLOY_RS_HOOK, DEPLOY_RS_SSH_ADDR, DEPLOY_RS_SSH_USER,
DEPLOY_RS_HOSTNAME,
  DEPLOY_RS_SSH_OPTS, DEPLOY_RS_SUDO, DEPLOY_RS_PROFILE_PATH,
DEPLOY_RS_NODE,
  DEPLOY_RS_PROFILE, DEPLOY_RS_BOOT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant