Events

Reference documentation for Etcha’s Events

Etcha’s event system allows for users to trigger and chain Patterns dynamically. Etcha also uses this event system to extract information from Commands.

Triggering

All Events are triggered using Command onChange values–Events are specified here by prefixing their name with etcha::

{
  "always": true,
  "change": "echo hello event handler!",
  "id": "event issuer",
  "onChange": {
    "etcha:my_event"
  }
}

The config souce must be allowed to fire the event using eventsSend

Handling

Events are sent and received from sources. A Source specifies the events it can receive and send. Events will also set environment variables.

System Events

These are the event names Etcha already knows about and what they’re used for:

buildManifest

Firing this event during a build will add the output of the Command’s change to the JWT’s etchaBuildManifest property.

exit

Firing this event during a run will cause Etcha to cleanly exit. Any Sources that receive this event will fire first, and Etcha will save any JWTs to disk. This is mostly used to trigger clean restarts of Etcha from within a Pattern.

jwt

  • Firing this event during signingCommands will set the output of the Command’s change to be the entire JWT generated by build.
  • Firing this event during verifyCommands will have Etcha use the output of the Command’s change) for the JWT Token. Etcha will also not verify the token, as it assumes the verify commands have passed.

DO NOT TRIGGER THIS EVENT IF THE TOKEN IS NOT VERIFIED

pull

This event is fired after a pull is performed. The event will be fired even if the pull commands have errors. Useful for sending notifications after a pull is performed.

push

This event is fired after a push is performed from the push target. The event will be fired even if the Push commands have errors. Useful for sending notifications after a push is performed.

runVar_

Firing any event with this prefix during a build will add the output of the Command’s change to the JWT’s etchaRunVars property.

shell

This event is fired after a shell is started.

stdout

Firing this event will log the output of the Command’s change to stdout.

webhookBody

Firing this event during a Webhook will have Etcha use the output of the Command’s change for the webhook response.

webhookContentType

Firing this event during a Webhook will have Etcha use the output of the Command’s change for the webhook content-type header.