Creating custom deployment policies

If the built-in deployment policies included in Continuous Delivery for PE don't align with the way your organization works with Puppet Enterprise, you can write a custom deployment policy tailored to your needs.

CAUTION: Custom deployment policies are a beta feature. As such, they may not be fully documented or work as expected; please explore them at your own risk.
In a custom deployment policy, you declare the steps that need to happen in order to deploy your Puppet code changes. Because custom deployment policies leverage Bolt plans, you can configure your policies to automate the processes that make up your current deployment workflow. This means your custom policies can include:
  • Git processes in your source control provider of choice
  • Changes to your node groups with Puppet orchestrator
  • Bolt tasks and plans
  • Automatic notifications via the third-party services you use daily, such as Slack and ServiceNow

The puppetlabs-cd4pe_deployments module is built into Continuous Delivery for PE, so you don't need to download or install anything in order to use custom deployment policies. To see the full list of what's available for inclusion in your custom deployment policy, see the documentation for the puppetlabs-cd4pe_deployments module.

If you need some inspiration, see how the deployment policies built into Continuous Delivery for PE look when written in custom deployment policy format.

Custom deployment policy prerequisites and cautions

  • In order for your custom deployment policies to be available for use in the web UI, you must have webhooks enabled between Continuous Delivery for PE and your source control system.
  • Do not include sensitive parameters in your custom deployment policy if you use the custom deployment policy in a pipeline managed with code.

Add a custom deployment policy to your control repo

Each custom deployment policy file you create must be stored in a module named deployments in the control repo that will utilize the policy.

Before you begin
Decide which branch in your control repo will house your custom deployment policies. By default, Continuous Delivery for PE looks for custom deployment policies on the production branch.

If your control repo doesn't have a production branch, or if you prefer to store custom deployment policies on a different branch, tell Continuous Delivery for PE where to look for your custom deployment policies by using the deployment_policy_branch setting of the config section of .cd4pe.yaml file. For details, see Structuring a .cd4pe.yaml file.

Important: If you don't store your custom deployment policies on the production branch, you must manage your control repo's pipelines with a .cd4pe.yaml file in order to use them.
  1. In your control repo, on the production branch (or the branch you've set as the deployment_policy_branch in your .cd4pe.yaml file), create a new Puppet module named deployments.
    In order for Continuous Delivery for PE to find and run your custom deployment policies correctly, this module must live in the /modules, /site, or /site-modules directory of your control repo.
  2. Add your custom deployment policy file to the /plans directory in the deployments module.