DocsSchema ReferenceWebhooks Configuration

Webhooks Configuration

Schema reference for configuring webhooks to automate actions on deployment events

Webhooks allow you to trigger automated actions when an environment reaches certain states. They are configured under environment.webhooks in your lifecycle.yaml.

For detailed use cases, examples, and execution behavior, see the Webhooks guide.

Common Fields

All webhook types share these common fields:

FieldTypeRequiredDescription
namestringNoHuman-readable name for the webhook
descriptionstringNoDescription of what the webhook does
statestringYesTrigger state: deployed, error, or torn_down
typestringYesWebhook type: codefresh, docker, or command
envobjectYesEnvironment variables passed to the webhook

Trigger States

StateDescription
deployedAll services successfully deployed and running
errorBuild or deployment failed
torn_downEnvironment has been destroyed

Webhook Types

codefresh

Triggers an existing Codefresh pipeline.

FieldTypeRequiredDescription
pipelineIdstringYesCodefresh pipeline ID
triggerstringNoPipeline trigger name

docker

Runs a Docker image as a Kubernetes job.

FieldTypeRequiredDescription
docker.imagestringYesDocker image to execute
docker.commandarrayNoOverride entrypoint command
docker.argsarrayNoArguments to pass to the command
docker.timeoutnumberNoMax execution time in seconds (default: 1800)

command

Runs a shell script in a specified Docker image.

FieldTypeRequiredDescription
command.imagestringYesDocker image to run the script in
command.scriptstringYesShell script to execute
command.timeoutnumberNoMax execution time in seconds (default: 1800)

Template Variables

You can use template variables like {{api_publicUrl}} in the env section to reference dynamic values from your services.

See the Template Variables guide for the complete list of available variables.