Deploy module code
You can use a Continuous Delivery for Puppet Enterprise (PE) module pipeline to deploy
new module code to your Puppet environments. To do this, you
must add a
:branch => :control_branch declaration to the module's entry
in your control repo's Puppetfile.
Continuous Delivery for PE uses the Eventual consistency policy to deploy module code to your Puppet environments. When you trigger a module code
deployment, Continuous Delivery for PE creates a new branch in your module
repository with the same name as your target Puppet
environment. This new branch contains the module code you want to deploy. Then, Continuous Delivery for PE triggers Code Manager.
Code Manager reads the module's
:control_branch declaration in the control repo's Puppetfile and adds the new module code to the
control repo. The new module code is delivered to each node in the specified Puppet environment during each node's next scheduled
Open the Puppetfile that includes the module you
want to deploy. Add a
:branch => :control_branchdeclaration to the module's section of the Puppetfile. For example:
To learn more about the
mod 'apache', :git => 'https://github.com/puppetlabs/puppetlabs-apache', :branch => :control_branch, :default_branch => 'main'
:branch => :control_branchdeclaration, refer to Declare content from a relative control repo branch in PE's Code Manager documentation.
If you are running PE version 2019.0.z or
earlier: You must make two additional changes to the Puppetfile.
Add the following code to the top of the Puppetfile:
def default_branch(default) begin match = /(.+)_(cdpe|cdpe_ia)_\d+$/.match(@librarian.environment.name) match ? match:default rescue default end end
Add the following
:default_branchentries to the module's entry in the Puppetfile:
:branch => :control_branch, :default_branch => default_branch('main')
- Add the following code to the top of the Puppetfile:
- In the Continuous Delivery for PE web UI, go to Modules and select the module you want deploy.
- If you haven't already done so, Create a pipeline for your module.
- Click Add stage and select Deployment.
- Select your PE instance and choose the Puppet environment where you want to deploy the module code.
- Click Add deployment.