Add a basic Ruby environment for running linting and validation locally

This commit also includes the CI scripts necessary to validate pull requests at
a basic level before merging them into `staging`
This commit is contained in:
R. Tyler Croy 2014-04-30 10:11:34 -07:00
parent 4d433ec7f4
commit 521cee1388
10 changed files with 159 additions and 1 deletions

2
.gitignore vendored
View File

@ -1 +1,3 @@
*.swp
.vagrant*
.ruby-*

17
Gemfile Normal file
View File

@ -0,0 +1,17 @@
source 'https://rubygems.org'
gem 'rake'
gem 'rspec-puppet'
gem 'puppet-lint'
gem 'puppet', '~> 3.4.0'
group :development do
# XXX: Shouldn't be needed anywhere by rtyler's machine, since Vagrant does'nt
# have proper installers for FreeBSD :(
gem 'vagrant', :github => 'mitchellh/vagrant', :ref => 'v1.5.4'
end
# Vagrant plugins
group :plugins do
gem 'vagrant-aws', :github => 'mitchellh/vagrant-aws'
end

112
Gemfile.lock Normal file
View File

@ -0,0 +1,112 @@
GIT
remote: git://github.com/mitchellh/vagrant-aws.git
revision: d125a2f8ca5422f55f555ab921aaac968d1e6e72
specs:
vagrant-aws (0.5.0.dev)
fog (~> 1.18)
GIT
remote: git://github.com/mitchellh/vagrant.git
revision: 285c7cdb2b3127d6dad4c2288cf9af6f15de6545
ref: v1.5.4
specs:
vagrant (1.5.4)
bundler (~> 1.5.2)
childprocess (~> 0.5.0)
erubis (~> 2.7.0)
i18n (~> 0.6.0)
listen (~> 2.7.1)
log4r (~> 1.1.9, < 1.1.11)
net-scp (~> 1.1.0)
net-ssh (>= 2.6.6, < 2.8.0)
rb-kqueue (~> 0.2.0)
wdm (~> 0.1.0)
GEM
remote: https://rubygems.org/
specs:
builder (3.2.2)
celluloid (0.15.2)
timers (~> 1.1.0)
celluloid-io (0.15.0)
celluloid (>= 0.15.0)
nio4r (>= 0.5.0)
childprocess (0.5.3)
ffi (~> 1.0, >= 1.0.11)
diff-lcs (1.2.5)
erubis (2.7.0)
excon (0.33.0)
facter (1.7.5)
ffi (1.9.3)
fog (1.22.0)
fog-brightbox
fog-core (~> 1.21, >= 1.21.1)
fog-json
nokogiri (~> 1.5, >= 1.5.11)
fog-brightbox (0.0.2)
fog-core
fog-json
fog-core (1.22.0)
builder
excon (~> 0.33)
formatador (~> 0.2)
mime-types
net-scp (~> 1.1)
net-ssh (>= 2.1.3)
fog-json (1.0.0)
multi_json (~> 1.0)
formatador (0.2.4)
hiera (1.3.2)
json_pure
i18n (0.6.9)
json_pure (1.8.1)
listen (2.7.3)
celluloid (>= 0.15.2)
celluloid-io (>= 0.15.0)
rb-fsevent (>= 0.9.3)
rb-inotify (>= 0.9)
log4r (1.1.10)
mime-types (2.2)
mini_portile (0.5.3)
multi_json (1.9.3)
net-scp (1.1.2)
net-ssh (>= 2.6.5)
net-ssh (2.7.0)
nio4r (1.0.0)
nokogiri (1.6.1)
mini_portile (~> 0.5.0)
puppet (3.4.3)
facter (~> 1.6)
hiera (~> 1.0)
rgen (~> 0.6.5)
puppet-lint (0.3.2)
rake (10.3.1)
rb-fsevent (0.9.4)
rb-inotify (0.9.4)
ffi (>= 0.5.0)
rb-kqueue (0.2.2)
ffi (>= 0.5.0)
rgen (0.6.6)
rspec (2.14.1)
rspec-core (~> 2.14.0)
rspec-expectations (~> 2.14.0)
rspec-mocks (~> 2.14.0)
rspec-core (2.14.8)
rspec-expectations (2.14.5)
diff-lcs (>= 1.1.3, < 2.0)
rspec-mocks (2.14.6)
rspec-puppet (1.0.1)
rspec
timers (1.1.0)
wdm (0.1.0)
PLATFORMS
ruby
DEPENDENCIES
puppet (~> 3.4.0)
puppet-lint
rake
rspec-puppet
vagrant!
vagrant-aws!

View File

@ -1,10 +1,13 @@
# Jenkins Infra
[![Build
Status](https://jenkins.ci.cloudbees.com/buildStatus/icon?job=infra/jenkins-infra)](https://jenkins.ci.cloudbees.com/job/infra/job/jenkins-infra/)
This repository is the [r10k](https://github.com/adrienthebo/r10k) control
repository for the [Jenkins](https://jenkins-ci.org) project's own
infrastructure.
**NOTE:** This repository and workflow are still a **work in progress**
## Contributing

11
Rakefile Normal file
View File

@ -0,0 +1,11 @@
require 'puppet-lint/tasks/puppet-lint'
PuppetLint.configuration.send('disable_80chars')
PuppetLint.configuration.ignore_paths = ["modules/**/*.pp"]
desc "Validate the Puppet syntax of all manifests"
task :validate do
Dir['./**/*.pp'].each do |filename|
sh "puppet parser validate '#{filename}'"
end
end

5
ci/00_setupgems.sh Executable file
View File

@ -0,0 +1,5 @@
#!/bin/sh -xe
gem install bundler --no-ri --no-rdoc
bundle install --without development plugins

3
ci/10_validatepuppet.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/sh -xe
bundle exec rake validate lint

View File

@ -1,3 +1,6 @@
#
# profile::puppetmaster is a governing what a Jenkins puppetmaster should look
# like
class profile::puppetmaster {
# Mange hiera.yaml
file { '/etc/puppetlabs/puppet/hiera.yaml':

View File

@ -1,3 +1,5 @@
#
# role::puppetmaster defines what a node role that should look like
class role::puppetmaster {
include profile::puppetmaster
}

0
spec/spec_helper.rb Normal file
View File