Jenkins Profile

We'll change up our profile first. In the following example, we'll add the following resources and features:

  • Install Docker, if the node is not already a Docker Container
  • Install RVM, Ruby 2.4.1 and all RubyGems needed for Kitchen

We have added the preceding resources and features in the following code:

# Jenkins Profile
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'],
}

if $::virtual != 'docker' {
class {'docker':
docker_users => ['jenkins']
}
}

include rvm

rvm::system_user { 'jenkins':}

rvm_system_ruby {'ruby-2.4.1':
ensure => 'present',
default_use => true,
}

rvm_gem {['ruby-2.4.1/librarian-puppet',
'ruby-2.4.1/test-kitchen',
'ruby-2.4.1/executable-hooks',
'ruby-2.4.1/kitchen-inspec',
'ruby-2.4.1/kitchen-puppet',
'ruby-2.4.1/kitchen-docker']:
ensure => installed,
require => Rvm_system_ruby['ruby-2.4.1'],
notify => Service['jenkins'],
}

}
We'll need to deploy this new profile to our Jenkins node before we continue through the rest of the section. Make sure you deploy this to your Puppet Master before continuing on editing the build. Working with your CI/CD system can sometimes feel like a series of chicken before the egg scenarios. This is normal, but the concepts extend beyond our CI/CD system.
..................Content has been hidden....................

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