Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/recovery'
Browse files Browse the repository at this point in the history
Conflicts:
	Modulefile
  • Loading branch information
kohsuke committed Nov 13, 2013
2 parents 490926a + b0b5f5e commit 8b3f026
Show file tree
Hide file tree
Showing 36 changed files with 776 additions and 353 deletions.
2 changes: 2 additions & 0 deletions .fixtures.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@ fixtures:
repositories:
apt: "git://github.com/puppetlabs/puppetlabs-apt"
stdlib: "git://github.com/puppetlabs/puppetlabs-stdlib"
java: "git://github.com/puppetlabs/puppetlabs-java"
zypprepo: "git://github.com/deadpoint/puppet-zypprepo.git"
symlinks:
"jenkins": "#{source_dir}"
37 changes: 37 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
language: ruby
bundler_args: --without development
script: "bundle exec rake spec SPEC_OPTS='--format documentation'"
rvm:
- 1.8.7
- 1.9.3
- 2.0.0
- ruby-head
script:
- "rake lint"
- "rake spec SPEC_OPTS='--format documentation'"
env:
- PUPPET_VERSION="~> 2.7.0"
- PUPPET_VERSION="~> 3.0.0"
- PUPPET_VERSION="~> 3.1.0"
- PUPPET_VERSION="~> 3.2.0"
matrix:
exclude:
- rvm: 1.9.3
env: PUPPET_VERSION="~> 2.7.0"
- rvm: 2.0.0
env: PUPPET_VERSION="~> 2.7.0"
- rvm: 2.0.0
env: PUPPET_VERSION="~> 3.0.0"
- rvm: 2.0.0
env: PUPPET_VERSION="~> 3.1.0"
- rvm: ruby-head
env: PUPPET_VERSION="~> 2.7.0"
- rvm: ruby-head
env: PUPPET_VERSION="~> 3.0.0"
- rvm: ruby-head
env: PUPPET_VERSION="~> 3.1.0"
allow_failures:
- rvm: ruby-head
notifications:
email: false

19 changes: 6 additions & 13 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
source "https://rubygems.org"
source 'https://rubygems.org'

gem 'rake'
gem 'puppet', '~> 2.7'
gem 'puppet-module'

group :development do
gem 'cucumber'
gem 'puppet-lint'
gem 'puppetlabs_spec_helper'
gem 'rspec'
gem 'rspec-puppet'
gem 'blimpy'
gem 'vagrant'
end
gem 'puppet-lint'
gem 'rspec-puppet'
gem 'puppetlabs_spec_helper'
gem 'puppet-syntax'
gem 'puppet', ENV['PUPPET_VERSION'] || '~> 3.2.0'
6 changes: 4 additions & 2 deletions Modulefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
name 'rtyler-jenkins'
version '0.3.0'
source 'git://github.com/rtyler/puppet-jenkins.git'
source 'git://github.com/jenkinsci/puppet-jenkins.git'
author 'R. Tyler Croy <[email protected]>'
license 'Apache 2.0'
summary 'Manage the Jenkins continuous integration service with Puppet'
description 'Manage the Jenkins continuous integration service with Puppet'
project_page 'https://github.com/rtyler/puppet-jenkins'
project_page 'https://github.com/jenkinsci/puppet-jenkins'

## Add dependencies, if any:
dependency 'puppetlabs/stdlib', '>= 2.0.0'
dependency 'puppetlabs/apt', '>= 0.0.3'
dependency 'puppetlabs/java', '>= 1.0.1'
dependency 'darin/zypprepo', '>= 1.0.1'
220 changes: 122 additions & 98 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -4,71 +4,77 @@ This is intended to be a re-usable
[Puppet](http://www.puppetlabs.com/puppet/introduction/) module that you can
include in your own tree.

# Using puppet-jenkins

## Using puppet-jenkins
## Getting Started
```bash
puppet module install rtyler/jenkins
```

```puppet
### With librarian
node 'hostname.example.com' {
include jenkins
If you use [librarian-puppet](https://github.com/rodjek/librarian-puppet), add
the following to your `Puppetfile`:
}
```
Then the service should be running at [http://hostname.example.com:8080/](http://hostname.example.com:8080/).

```ruby
mod "jenkins",
:git => "git://github.com/jenkinsci/puppet-jenkins.git"
### Installing Jenkins plugins

mod "apt",
:git => "git://github.com/puppetlabs/puppetlabs-apt.git"

mod "stdlib",
:git => "git://github.com/puppetlabs/puppetlabs-stdlib.git"
```
The Jenkins puppet module defines the `jenkins::plugin` resource which
will download and install the plugin "[by
hand](https://wiki.jenkins-ci.org/display/JENKINS/Plugins#Plugins-Byhand)"

### With git-submodule(1)
The names of the plugins can be found on the [update
site](http://updates.jenkins-ci.org/download/plugins)

In order to add this module, run the following commands in your own, presumably
Git, puppet tree:
#### Latest
By default, the resource will install the latest plugin, i.e.:

% git submodule add git://github.com/jenkinsci/puppet-jenkins.git modules/jenkins
% git submodule update --init
jenkins::plugin {
"git" : ;
}

### With the "puppet module" tool
#### By version
If you need to peg a specific version, simply specify that as a string, i.e.:

This module is compatible with the puppet module tool. To build a package file
of this module, please use the `rake build` task. The resulting package file
may be uploaded to the [Puppet Forge](http://forge.puppetlabs.com/).
jenkins::plugin {
"git" :
version => "1.1.11";
}

### Slaves
You can automatically add slaves to jenkins, and have them auto register themselves. Most options are actually optional, as nodes will autodiscover the master, and connect.

To quickly try this module with the puppet module tool:
Full documention for the slave code is in jenkins::slave.

% rake build
% cd /etc/puppet/modules
% sudo puppet-module install /tmp/rtyler-jenkins-0.0.1.tar.gz
Installed "rtyler-jenkins-0.0.1" into directory: jenkins
% sudo puppet apply -v -e 'include jenkins'
info: Loading facts in facter_dot_d
info: Loading facts in facter_dot_d
info: Applying configuration version '1323459431'
notice: /Stage[main]/Jenkins::Repo::El/Yumrepo[jenkins]/descr: descr changed '' to 'Jenkins'
notice: /Stage[main]/Jenkins::Repo::El/Yumrepo[jenkins]/baseurl: baseurl changed '' to 'http://pkg.jenkins-ci.org/redhat/'
notice: /Stage[main]/Jenkins::Repo::El/Yumrepo[jenkins]/gpgcheck: gpgcheck changed '' to '1'
notice: /Stage[main]/Jenkins::Repo::El/File[/etc/yum/jenkins-ci.org.key]/ensure: defined content as '{md5}9fa06089848262c5a6383ec27fdd2575'
notice: /Stage[main]/Jenkins::Repo::El/Exec[rpm --import /etc/yum/jenkins-ci.org.key]/returns: executed successfully
notice: /Stage[main]/Jenkins::Package/Package[jenkins]/ensure: created
notice: /Stage[main]/Jenkins::Service/Service[jenkins]/ensure: ensure changed 'stopped' to 'running'
notice: Finished catalog run in 27.46 seconds
It requires the swarm plugin on the master & the class jenkins::slave on the slaves, as below:

Then the service should be running at [http://my.host.name:8080/](http://my.host.name:8080/).
```puppet
node /jenkins-slave.*/ {
class { 'jenkins::slave':
masterurl => 'http://jenkins-master1.domain.com:8080',
ui_user => 'adminuser',
ui_pass => 'adminpass',
}
}
----
node /jenkins-master.*/ {
include jenkins
include jenkins::master
}
```

### Dependencies

The dependencies for this module currently are:

* [stdlib module](http://forge.puppetlabs.com/puppetlabs/stdlib)
* [apt module](http://forge.puppetlabs.com/puppetlabs/apt) (for Debian/Ubuntu users)

* [java module](http://github.com/puppetlabs/puppetlabs-java)
* [zypprepo](https://forge.puppetlabs.com/darin/zypprepo) (for Suse users)


### Depending on Jenkins
Expand All @@ -83,65 +89,75 @@ the following `require` statement:
}


### Advanced features
1. Plugin Hash - jenkins::plugins
2. Config Hash - jennkins::config
3. Configure Firewall - jenkins (init.pp)
4. Outbound Jenkins Proxy Config - jenkins (init.pp)

## Installing Jenkins plugins

## Using from Github / source

The Jenkins puppet module defines the `install-jenkins-plugin` resource which
will download and install the plugin "[by
hand](https://wiki.jenkins-ci.org/display/JENKINS/Plugins#Plugins-Byhand)"

The names of the plugins can be found on the [update
site](http://updates.jenkins-ci.org/download/plugins)


### Latest
### With librarian

By default, the resource will install the latest plugin, i.e.:
If you use [librarian-puppet](https://github.com/rodjek/librarian-puppet), add
the following to your `Puppetfile`:

```ruby
mod "jenkins",
:git => "git://github.com/jenkinsci/puppet-jenkins.git"

jenkins::plugin {
"git" : ;
}
mod "apt",
:git => "git://github.com/puppetlabs/puppetlabs-apt.git"

mod "stdlib",
:git => "git://github.com/puppetlabs/puppetlabs-stdlib.git"
```

### By version
### With git-submodule(1)

If you need to peg a specific version, simply specify that as a string, i.e.:
In order to add this module, run the following commands in your own, presumably
Git, puppet tree:

jenkins::plugin {
"git" :
version => "1.1.11";
}
% git submodule add git://github.com/jenkinsci/puppet-jenkins.git modules/jenkins
% git submodule update --init

### With the "puppet module" tool

## Slaves
This module is compatible with the puppet module tool. To build a package file
of this module, please use the `rake build` task. The resulting package file
may be uploaded to the [Puppet Forge](http://forge.puppetlabs.com/).

An example:

```puppet

node /jenkins-slave.*/ {
class { 'jenkins::slave':
masterurl => 'http://jenkins-master1.domain.com:8080',
ui_user => 'adminuser',
ui_pass => 'adminpass',
}
}
To quickly try this module with the puppet module tool:

node /jenkins-master.*/ {
include jenkins
jenkins::plugin {'swarm':}
% rake build
% cd /etc/puppet/modules
% sudo puppet module install /tmp/rtyler-jenkins-0.0.1.tar.gz
Installed "rtyler-jenkins-0.0.1" into directory: jenkins
% sudo puppet apply -v -e 'include jenkins'
info: Loading facts in facter_dot_d
info: Loading facts in facter_dot_d
info: Applying configuration version '1323459431'
notice: /Stage[main]/Jenkins::Repo::El/Yumrepo[jenkins]/descr: descr changed '' to 'Jenkins'
notice: /Stage[main]/Jenkins::Repo::El/Yumrepo[jenkins]/baseurl: baseurl changed '' to 'http://pkg.jenkins-ci.org/redhat/'
notice: /Stage[main]/Jenkins::Repo::El/Yumrepo[jenkins]/gpgcheck: gpgcheck changed '' to '1'
notice: /Stage[main]/Jenkins::Repo::El/File[/etc/yum/jenkins-ci.org.key]/ensure: defined content as '{md5}9fa06089848262c5a6383ec27fdd2575'
notice: /Stage[main]/Jenkins::Repo::El/Exec[rpm --import /etc/yum/jenkins-ci.org.key]/returns: executed successfully
notice: /Stage[main]/Jenkins::Package/Package[jenkins]/ensure: created
notice: /Stage[main]/Jenkins::Service/Service[jenkins]/ensure: ensure changed 'stopped' to 'running'
notice: Finished catalog run in 27.46 seconds

}
```
----


# Developing/Contributing

## RSpec Testing
## Testing

This module has behavior tests written using [RSpec 2](https://www.relishapp.com/rspec).
This module has behavior tests written using [RSpec 2](https://www.relishapp.com/rspec),
is syntax checked with [puppet-syntax](https://github.com/gds-operations/puppet-syntax), and style checked with [puppet-lint](http://puppet-lint.com/).
The goal of these tests are to validate the expected behavior of the module.
As more features and platform support are added to this module the tests
provide an automated way to validate the expectations previous contributors
Expand All @@ -155,33 +171,41 @@ In order to validate the behavior, please run the `rake spec` task.
Finished in 0.31279 seconds
1 example, 0 failures

Lint, spec, and syntax checks can be run by using the default rake task by
simply running 'rake'.

### Lint checking

The lint checks require the `puppet-lint` gem to be installed. Running
'rake lint' will lint check all of the *.pp files to ensure they conform to the
puppet style guide.

### RSpec Testing Requirements

The spec tests require the `rspec-puppet` gem to be installed. These tests
have initially be tested with the following integration of components in
addition to this module. Modules such as
[stdlib](https://github.com/puppetlabs/puppetlabs-stdlib) may be checked out
into the same parent directory as this module. The spec tests will
automatically add this parent directory to the Puppet module search path.
The spec tests require the `rspec-puppet` gem to be installed. Running 'rake spec'
will automatically check out all of the modules in the .fixtures.yml needed to run
the tests.

### Syntax checking

* rspec 2.6
* rspec-puppet 0.1.0
* puppet 2.7.6
* facter 1.6.3
* stdlib 2.2.0
The syntax checks require the `puppet-syntax` gem to be installed. Running
'rake syntax' will sytanx check the manifests and templates.

### Installing RSpec Testing Requirements
### Installing Testing Requirements

To install the testing requirements:

% gem install rspec-puppet --no-ri --no-rdoc
Successfully installed rspec-core-2.7.1
Successfully installed diff-lcs-1.1.3
Successfully installed rspec-expectations-2.7.0
Successfully installed rspec-mocks-2.7.0
Successfully installed rspec-2.7.0
Successfully installed rspec-puppet-0.1.0
6 gems installed
% gem install rspec-puppet puppet-lint puppet-syntax --no-ri --no-rdoc
Successfully installed rspec-core-2.14.5
Successfully installed diff-lcs-1.2.4
Successfully installed rspec-expectations-2.14.3
Successfully installed rspec-mocks-2.14.3
Successfully installed rspec-2.14.1
Successfully installed rspec-puppet-0.1.6
Successfully installed puppet-lint-0.3.2
Successfully installed rake-10.1.0
Successfully installed puppet-syntax-1.1.0
10 gems installed

### Adding Tests

Expand Down
Loading

0 comments on commit 8b3f026

Please sign in to comment.