Configuring post-environment hooks
Post-environment hooks can trigger custom actions after deploying an environment.
To configure a list of hooks to run after Code Manager deploys
code to an environment, specify the post_environment_hook parameter in
Hiera. This parameter accepts an array of hashes with
the url and use-client-ssl keys.
The url key specifies an HTTPS URL to send a POST request to. The request includes a JSON-formatted body
containing information about the environment deployment, such
as:
{
"deploy-signature":"482f8d3adc76b5197306c5d4c8aa32aa8315694b",
"file-sync":{
"environment-commit":"6939889b679fdb1449545c44f26aa06174d25c21",
"code-commit":"ce5f7158615759151f77391c7b2b8b497aaebce1"},
"environment":"production",
"id":3,
"status":"complete"
}
The use-client-ssl key is a Boolean specifying whether to
use the client's SSL configuration for HTTPS connections.
By default, use-client-ssl is set to false, which means that when the HTTP client makes a
request, it uses certificates from the Puppet Enterprise Java trust store file, which is located at:
/opt/puppetlabs/server/apps/java/lib/jvm/java/jre/lib/security/cacerts)
Set use-client-ssl to true only if the url destination is a
server that uses the Puppet certificate
authority.
For example, the following settings instruct Code Manager to update classes in the console after deploying code to environments:
puppet_enterprise::master::code_manager::post_environment_hooks:
- url: 'https://console.example.com:4433/classifier-api/v1/update-classes'
use-client-ssl: true
If you wanted to configure multiple post-environment hooks, you would add more hashes to the array.






