Skip to content

Commit c2973a0

Browse files
committed
Move README to root.
1 parent a3508e0 commit c2973a0

File tree

1 file changed

+188
-0
lines changed

1 file changed

+188
-0
lines changed

README.rdoc

+188
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,188 @@
1+
= DESCRIPTION:
2+
3+
Installs and configures Jenkins CI server & node slaves. Resource providers to support automation via jenkins-cli, including job create/update.
4+
5+
= REQUIREMENTS:
6+
7+
== Chef:
8+
9+
* Chef version 0.9.10 or higher
10+
11+
== Platform:
12+
13+
* 'default' - Server installation - currently supports Red Hat/CentOS 5.x and Ubuntu 8.x/9.x/10.x
14+
15+
* 'node_ssh' - Any platform that is running sshd.
16+
17+
* 'node_jnlp' - Unix platforms. (depends on runit recipe)
18+
19+
* 'node_windows' - Windows platforms only. Depends on .NET Framework, which can be installed with the windows::dotnetfx recipe.
20+
21+
== Java:
22+
23+
Jenkins requires Java 1.5 or higher, which can be installed via the Opscode java cookbook or windows::java recipe.
24+
25+
== Jenkins node authentication:
26+
27+
If your Jenkins instance requires authentication, you'll either need to embed user:pass in the jenkins.server.url or issue a jenkins-cli.jar login command prior to using the jenkins::node_* recipes. For example, define a role like so:
28+
29+
name "jenkins_ssh_node"
30+
description "cli login & register ssh slave with Jenkins"
31+
run_list %w(vmw::jenkins_login jenkins::node_ssh)
32+
33+
Where the jenkins_login recipe is simply:
34+
35+
jenkins_cli "login --username #{node[:jenkins][:username]} --password #{node[:jenkins][:password]}"
36+
37+
= ATTRIBUTES:
38+
39+
* jenkins[:mirror] - Base URL for downloading Jenkins (server)
40+
* jenkins[:java_home] - Java install path, used for for cli commands
41+
* jenkins[:server][:home] - JENKINS_HOME directory
42+
* jenkins[:server][:user] - User the Jenkins server runs as
43+
* jenkins[:server][:group] - Jenkins user primary group
44+
* jenkins[:server][:port] - TCP listen port for the Jenkins server
45+
* jenkins[:server][:url] - Base URL of the Jenkins server
46+
* jenkins[:server][:plugins] - Download the latest version of plugins in this list, bypassing update center
47+
* jenkins[:node][:name] - Name of the node within Jenkins
48+
* jenkins[:node][:description] - Jenkins node description
49+
* jenkins[:node][:executors] - Number of node executors
50+
* jenkins[:node][:home] - Home directory ("Remote FS root") of the node
51+
* jenkins[:node][:labels] - Node labels
52+
* jenkins[:node][:mode] - Node usage mode, "normal" or "exclusive" (tied jobs only)
53+
* jenkins[:node][:launcher] - Node launch method, "jnlp", "ssh" or "command"
54+
* jenkins[:node][:availability] - "always" keeps node on-line, "demand" off-lines when idle
55+
* jenkins[:node][:in_demand_delay] - number of minutes for which jobs must be waiting in the queue before attempting to launch this slave.
56+
* jenkins[:node][:idle_delay] - number of minutes that this slave must remain idle before taking it off-line.
57+
* jenkins[:node][:env] - "Node Properties" -> "Environment Variables"
58+
* jenkins[:node][:user] - user the slave runs as
59+
* jenkins[:node][:ssh_host] - Hostname or IP Jenkins should connect to when launching an SSH slave
60+
* jenkins[:node][:ssh_port] - SSH slave port
61+
* jenkins[:node][:ssh_user] - SSH slave user name (only required if jenkins server and slave user is different)
62+
* jenkins[:node][:ssh_pass] - SSH slave password (not required when server is installed via default recipe)
63+
* jenkins[:node][:ssh_private_key] - jenkins master defaults to: `~/.ssh/id_rsa` (created by the default recipe)
64+
* jenkins[:node][:jvm_options] - SSH slave JVM options
65+
* jenkins[:iptables_allow] - if iptables is enabled, add a rule passing 'jenkins[:server][:port]'
66+
* jenkins[:http_proxy][:variant] - use `nginx` or `apache2` to proxy traffic to jenkins backend (`nil` by default)
67+
* jenkins[:http_proxy][:www_redirect] - add a redirect rule for 'www.*' URL requests ("disable" by default)
68+
* jenkins[:http_proxy][:listen_ports] - list of HTTP ports for the HTTP proxy to listen on ([80] by default)
69+
* jenkins[:http_proxy][:host_name] - primary vhost name for the HTTP proxy to respond to (`node[:fqdn]` by default)
70+
* jenkins[:http_proxy][:host_aliases] - optional list of other host aliases to respond to (empty by default)
71+
* jenkins[:http_proxy][:client_max_body_size] - max client upload size ("1024m" by default, nginx only)
72+
73+
= USAGE:
74+
75+
== 'default' recipe
76+
77+
Installs a Jenkins CI server using the http://jenkins-ci.org/redhat RPM. The recipe also generates an ssh private key and stores the ssh public key in the node 'jenkins[:pubkey]' attribute for use by the node recipes.
78+
79+
== 'node_ssh' recipe
80+
81+
Creates the user and group for the Jenkins slave to run as and sets `.ssh/authorized_keys` to the 'jenkins[:pubkey]' attribute. The 'jenkins-cli.jar'[1] is downloaded from the Jenkins server and used to manage the nodes via the 'groovy'[2] cli command. Jenkins is configured to launch a slave agent on the node using its SSH slave plugin[3].
82+
83+
[1] http://wiki.jenkins-ci.org/display/JENKINS/Jenkins+CLI
84+
[2] http://wiki.jenkins-ci.org/display/JENKINS/Jenkins+Script+Console
85+
[3] http://wiki.jenkins-ci.org/display/JENKINS/SSH+Slaves+plugin
86+
87+
== 'node_jnlp' recipe
88+
89+
Creates the user and group for the Jenkins slave to run as and '/jnlpJars/slave.jar' is downloaded from the Jenkins server. Depends on runit_service from the runit cookbook.
90+
91+
== 'node_windows' recipe
92+
93+
Creates the home directory for the node slave and sets 'JENKINS_HOME' and 'JENKINS_URL' system environment variables. The 'winsw'[1] Windows service wrapper will be downloaded and installed, along with generating `jenkins-slave.xml` from a template. Jenkins is configured with the node as a 'jnlp'[2] slave and '/jnlpJars/slave.jar' is downloaded from the Jenkins server. The 'jenkinsslave' service will be started the first time the recipe is run or if the service is not running. The 'jenkinsslave' service will be restarted if '/jnlpJars/slave.jar' has changed. The end results is functionally the same had you chosen the option to "Let Jenkins control this slave as a Windows service"[3].
94+
95+
[1] http://weblogs.java.net/blog/2008/09/29/winsw-windows-service-wrapper-less-restrictive-license
96+
[2] http://wiki.jenkins-ci.org/display/JENKINS/Distributed+builds
97+
[3] http://wiki.jenkins-ci.org/display/JENKINS/Installing+Jenkins+as+a+Windows+service
98+
99+
== 'proxy_nginx' recipe
100+
101+
Uses the nginx::source recipe from the nginx cookbook to install an HTTP frontend proxy. To automatically activate this recipe set the `node[:jenkins][:http_proxy][:variant]` to `nginx`.
102+
103+
== 'proxy_apache2' recipe
104+
105+
Uses the apache2 recipe from the apache2 cookbook to install an HTTP frontend proxy. To automatically activate this recipe set the `node[:jenkins][:http_proxy][:variant]` to `apache2`.
106+
107+
== 'jenkins_cli' resource provider
108+
109+
This resource can be used to execute the Jenkins cli from your recipes. For example, install plugins via update center and restart Jenkins:
110+
111+
%w(git URLSCM build-publisher).each do |plugin|
112+
jenkins_cli "install-plugin #{plugin}"
113+
jenkins_cli "safe-restart"
114+
end
115+
116+
== 'jenkins_node' resource provider
117+
118+
This resource can be used to configure nodes as the 'node_ssh' and 'node_windows' recipes do or "Launch slave via execution of command on the Master".
119+
120+
jenkins_node node[:fqdn] do
121+
description "My node for things, stuff and whatnot"
122+
executors 5
123+
remote_fs "/var/jenkins"
124+
launcher "command"
125+
command "ssh -i my_key #{node[:fqdn]} java -jar #{remote_fs}/slave.jar"
126+
env "ANT_HOME" => "/usr/local/ant", "M2_REPO" => "/dev/null"
127+
end
128+
129+
== 'jenkins_job' resource provider
130+
131+
This resource manages jenkins jobs, supporting the following actions:
132+
133+
:create, :update, :delete, :build, :disable, :enable
134+
135+
The 'create' and 'update' actions require a jenkins job config.xml. Example:
136+
137+
git_branch = 'master'
138+
job_name = "sigar-#{branch}-#{node[:os]}-#{node[:kernel][:machine]}"
139+
140+
job_config = File.join(node[:jenkins][:node][:home], "#{job_name}-config.xml")
141+
142+
jenkins_job job_name do
143+
action :nothing
144+
config job_config
145+
end
146+
147+
template job_config do
148+
source "sigar-jenkins-config.xml"
149+
variables :job_name => job_name, :branch => git_branch, :node => node[:fqdn]
150+
notifies :update, resources(:jenkins_job => job_name), :immediately
151+
notifies :build, resources(:jenkins_job => job_name), :immediately
152+
end
153+
154+
== 'manage_node' library
155+
156+
The script to generate groovy that manages a node can be used standalone. For example:
157+
158+
% ruby manage_node.rb name slave-hostname remote_fs /home/jenkins ... | java -jar jenkins-cli.jar -s http://jenkins:8080/ groovy =
159+
160+
= ISSUES
161+
162+
* CLI authentication - http://issues.jenkins-ci.org/browse/JENKINS-3796
163+
164+
* CLI *-node commands fail with "No argument is allowed: nameofslave" - http://issues.jenkins-ci.org/browse/JENKINS-5973
165+
166+
= LICENSE & AUTHOR:
167+
168+
This is a downstream fork of Doug MacEachern's Hudson cookbook (https://github.com/dougm/site-cookbooks) and therefore deserves all the glory.
169+
170+
Author:: Doug MacEachern (<[email protected]>)
171+
172+
Contributor:: Fletcher Nichol <[email protected]>
173+
Contributor:: Roman Kamyk <[email protected]>
174+
Contributor:: Darko Fabijan <[email protected]>
175+
176+
Copyright:: 2010, VMware, Inc
177+
178+
Licensed under the Apache License, Version 2.0 (the "License");
179+
you may not use this file except in compliance with the License.
180+
You may obtain a copy of the License at
181+
182+
http://www.apache.org/licenses/LICENSE-2.0
183+
184+
Unless required by applicable law or agreed to in writing, software
185+
distributed under the License is distributed on an "AS IS" BASIS,
186+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
187+
See the License for the specific language governing permissions and
188+
limitations under the License.

0 commit comments

Comments
 (0)