Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Module Hooks

Define and execute hooks at specific phases of module deployment. Hooks enable tasks to be executed before or after deployment steps, depending on the application’s needs.

Official Documentation

Examples

Hooks for standard (non-blue-green) deployment. Phases available:

  • deploy.application.before-stop

  • deploy.application.after-stop

  • deploy.application.before-start

Hooks for blue-green deployment. Phases available for both idle and live application variants:

  • blue-green.application.before-stop.idle / .live

  • blue-green.application.after-stop.idle / .live

  • blue-green.application.before-unmap-routes.live

  • blue-green.application.before-start.idle / .live

Advanced feature: use phases-config with target-app to redirect hook execution to a specific application variant (idle or live), overriding the default.

Activation

  • Use _schema-version with major version 3, for instance 3.3.0

  • Add a hooks section to the module

modules:
  - name: my-app
    type: application
    path: "appBits.zip"
    hooks:
      - name: my-hook
        type: task
        phases:
          - deploy.application.before-start
        parameters:
          command: "echo 'Hello from hook'"

Hooks and Extension Descriptors

You can extend module hooks through extension descriptors.

What can be done

  • Parameters section can be modified (name, command, memory, disk quota)

What cannot be done

  • Phases of the hooks cannot be modified via extension descriptors

  • Type of the hook cannot be modified

  • Required dependencies cannot be modified

  • New hooks cannot be added

ID: a.cf.app
_schema-version: 3.3
extends: foo

modules:
  - name: cf-app-with-hooks
    hooks:
      - name: test-hook-1
        parameters:
          name: foo-task-1
          command: "echo Hello"