Skip to content

Deploy Hooks

Deploy hooks let you run commands before or after a deployment.

Pre-Deploy Hook

Run a command before applying manifests:

hooks:
  pre_deploy:
    image: myapp:latest
    command: ["python", "manage.py", "migrate"]

Post-Deploy Hook

Run a command after all resources are applied:

hooks:
  post_deploy:
    image: myapp:latest
    command: ["python", "manage.py", "collectstatic", "--noinput"]

Python

from helm_me import App, hook

class Deploy(App):
    name = "my-app"

    hooks = {
        "pre_deploy": hook(
            image="myapp:latest",
            command=["python", "manage.py", "migrate"],
        ),
    }

Note

Hooks run as Kubernetes Jobs and must complete successfully for the deployment to continue.