Skip to content

Instantly share code, notes, and snippets.

@rnelson0
Last active February 8, 2018 22:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save rnelson0/78f8673e2980ffe0a1fec9ed0667ea1f to your computer and use it in GitHub Desktop.
Save rnelson0/78f8673e2980ffe0a1fec9ed0667ea1f to your computer and use it in GitHub Desktop.
Jenkins Job 1.1
#.fixtures.yml
fixtures:
forge_modules:
zypprepo:
repo: "darin/zypprepo"
ref: "1.0.2"
archive:
repo: "puppet/archive"
ref: "1.2.0"
jenkins:
repo: "rtyler/jenkins"
ref: "1.7.0"
gnupg:
repo: "golja/gnupg"
ref: "1.2.3"
rvm:
repo: "maestrodev/rvm"
ref: "1.13.1"
java:
repo: "puppetlabs/java"
ref: "1.6.0"
stdlib:
repo: "puppetlabs/stdlib"
ref: "4.15.0"
#/dist/profile/manifests/jenkins.pp
# == Class: profile::jenkins
#
# jenkins server
#
# === Authors
#
# Rob Nelson <rnelson0@gmail.com>
#
# === Copyright
#
# Copyright 2017 Rob Nelson
#
class profile::jenkins (
Optional[Array] $plugins = undef,
) {
include ::jenkins
::sudo::conf { 'jenkins':
priority => 10,
content =>
'jenkins ALL=(root) NOPASSWD: /usr/bin/yum
Defaults!/usr/bin/yum !requiretty',
}
if $plugins {
$plugins.each |$plugin| {
jenkins::plugin { $plugin: }
}
}
firewall { '100 Jenkins HTTP/S inbound':
dport => [8080],
proto => tcp,
action => accept,
}
}
#dist/profile/manifests/rvm.pp
# == Class: profile::rvm
#
# RVM application
#
# === Authors
#
# Rob Nelson <rnelson0@gmail.com>
#
# === Copyright
#
# Copyright 2017 Rob Nelson
class profile::rvm (
) {
include '::rvm'
}
#dist/role/manifests/jenkins.pp
# == Class: role::jenkins
#
# Jenkins service role
#
# === Authors
#
# Rob Nelson <rnelson0@gmail.com>
#
# === Copyright
#
# Copyright 2017 Rob Nelson
#
class role::jenkins {
include profile::base # All roles should have the base profile
include profile::jenkins
}
#hiera/puppet_role/jenkins.yaml
---
classes:
role::jenkins
profile::jenkins::plugins:
# Plugins directly used
- git
- puppet-enterprise-pipeline
- rvm
- promoted-builds
- config-file-provider
- junit
- envinject
- bitbucket
- bitbucket-build-status-notifier
- bitbucket-pullrequest-builder
- github
- ghprb
# Dependencies
- workflow-scm-step
- git-client
- mailer
- matrix-project
- scm-api
- ssh-credentials
- plain-credentials
- workflow-basic-steps
- workflow-api
- script-security
- workflow-cps
- workflow-step-api
- workflow-durable-task-step
- structs
- maven-plugin
- display-url-api
- token-macro
- ruby-runtime
- javadoc
- ace-editor
- workflow-support
- jquery-detached
- mercurial
- workflow-job
- multiple-scms
- github-api
- durable-task
- ssh-agent
- bouncycastle-api
#Puppetfile
mod 'darin/zypprepo', '1.0.2'
mod 'golja/gnupg', '1.2.3'
mod 'maestrodev/rvm', '1.13.1'
mod 'puppet/archive', '1.2.0'
mod 'puppetlabs/apt', '2.3.0'
mod 'puppetlabs/java', '1.6.0'
mod 'puppetlabs/stdlib', '4.15.0'
mod 'rtyler/jenkins', '1.7.0'
#spec/classes/jenkins_spec.rb
require 'spec_helper'
describe 'profile::jenkins', :type => :class do
on_supported_os.each do |os, facts|
let :facts do
facts.merge(
jenkins_plugins: '',
clientcert: 'jenkins'
)
end
context 'with defaults for all parameters' do
it { is_expected.to create_class('profile::jenkins') }
it { is_expected.to contain_class('jenkins') }
it { is_expected.to contain_sudo__conf('jenkins') }
it { is_expected.to contain_jenkins__plugin('git') }
it { is_expected.to contain_jenkins__plugin('puppet-enterprise-pipeline') }
it { is_expected.to create_firewall('100 Jenkins HTTP/S inbound') }
end
end
end
#spec/classes/rvm_spec.rb
require 'spec_helper'
describe 'profile::rvm', :type => :class do
on_supported_os.each do |os, facts|
let :facts do
facts.merge(
gnupg_installed: true,
)
end
context 'with defaults for all parameters' do
it { is_expected.to create_class('profile::rvm') }
it { is_expected.to contain_class('rvm') }
end
end
end
#spec/fixtures/hieradata/jenkins.yaml
---
profile::jenkins::plugins:
- git
- puppet-enterprise-pipeline
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment