UFO Hooks
Hook Generator
To generator a starter hook:
$ ufo new hook ufo
create .ufo/config/hooks/ufo.rb
You can use hooks to run scripts at specific steps of the ufo lifecycle.
UFO Hooks
| Hook | Description |
|---|---|
| build | When ufo builds the Task Definition and CloudFormation template. Build is automatically run as part of ufo ship. You can also call ufo build. |
| destroy | When deletes the ECS resources. IE: ufo destroy |
| ship | When ufo deploys to ECS. IE: ufo ship. |
Examples
These lifecycle points at the ufo command level. Here’s are examples to help explain.
General Form
before(COMMAND_NAME, OPTIONS)
The command name corresponds to the ufo commands: build, push, etc.
Hook Options
| Name | Description |
|---|---|
| label | A human-friendly label so you can see what hooks is being run. |
| execute | The script or command to run. IE: path/to/some/script.sh |
| exit_on_fail | Whether or not to continue process if the script returns an failed exit code. |
Ruby Hooks
Instead of using a script for the hook execute option, you can also use a Ruby object. This provides some more control over the current process. See: Ruby Hooks