rtyler/jenkins

We should always seek a forge module when building new software, so I'm going to reach for rtyler/jenkins on the forge. This module will cover our basic needs for installing our Jenkins LTS server, installing our Jenkins plugins, and each package we'll need to run our builds. 

In larger infrastructures, we wouldn't run builds on our Jenkins server, we'd run it on the Jenkins agents attached to it. Because this setup has no agents, Jenkins will act as our build agent and run the jobs for us. Therefore, we'll need to install Git and the PDK so that it can run commands for us. We use the Git plugin to provide us with a direct connection to our code, and the pipelines plugin gives us a DSL to write our steps in.

We're going to build a new module with the PDK by creating a profile directory, a manifests directory inside of that, and create a jenkins.pp in that folder:

#profile/manifests/jenkins.pp
class profile::jenkins {

class { 'jenkins': lts => true }

package {'git': ensure => latest }

file {'/tmp/pdk.rpm':
ensure => file,
source => 'https://puppet-pdk.s3.amazonaws.com/pdk/1.7.0.0/repos/el/7/puppet5/x86_64/pdk-1.7.0.0-1.el7.x86_64.rpm',
}

# Install latest PDK directly from Puppet Source
package {'pdk':
ensure => installed,
source => '/tmp/pdk.rpm',
require => File['/tmp/pdk.rpm'],
}

}

We're going to install our plugins manually. rtyler/jenkins does support plugins for Jenkins, but does not support dependencies. There are quite a few dependencies in these build pipelines, so we're going to manually install the plugins to highlight the two main plugins.

After our profile has been applied to the node, we've got a fresh Jenkins installation with our desired plugins. We can reach our new Jenkins node via the web URL on port 8080:

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.219.71.21