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.
-
SAP Help Portal: Module Hooks
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.
-
Use
_schema-versionwith major version3, for instance3.3.0 -
Add a
hookssection 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'"You can extend module hooks through extension descriptors.
-
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"