Skip to content

Instantly share code, notes, and snippets.

@philsturgeon
Created January 30, 2013 22:27
Show Gist options
  • Save philsturgeon/4677809 to your computer and use it in GitHub Desktop.
Save philsturgeon/4677809 to your computer and use it in GitHub Desktop.
A vague attempt.
#
# Cookbook Name:: kapture
# Recipe:: ci
#
# Future Phil - When shit breaks try this:
# http://sqa.stackexchange.com/questions/5242/jenkins-fails-to-restart-after-updating-plugins
app_name = 'kapture-ci'
app_config = node[app_name]
# We'll need ANT
package "ant" do
action :install
end
# Apparently this is a thing
package "maven2" do
action :install
end
# DURP
package "jenkins" do
action :install
end
# And a shitload of PHP tools
['php5-curl', 'php-pear', 'php5-xdebug', 'php5-dev', 'php5-xsl', 'php5-imagick'].each do |p|
package "#{p}" do
action :install
end
end
# PEAR config
execute "pear_auto_discover" do
command "pear config-set auto_discover 1"
action :run
end
# Install PEAR shit
php_pear "ezc/eZComponents" do
channel "components.ez.no"
options "-a"
action :install
end
php_pear "phploc" do
channel "pear.phpunit.de"
action :install
end
php_pear "phpcpd" do
channel "pear.phpunit.de"
action :install
end
php_pear "PHP_Depend" do
channel "pear.pdepend.org"
action :install
end
php_pear "PHP_PMD" do
channel "pear.phpmd.org"
action :install
end
php_pear "PHP_CodeSniffer" do
action :install
end
php_pear "phpDox" do
preferred_state "alpha"
channel "pear.netpirates.net"
action :install
end
php_pear "PHP_CodeBrowser" do
channel "pear.phpqatools.org"
options "-a"
action :install
end
# Set up each job
['admin'].each do |job|
job_dir = "/var/lib/jenkins/jobs/#{job}"
directory "#{job_dir}" do
owner "jenkins"
group "jenkins"
action :create
end
# Admin Config
template "#{job_dir}/config.xml" do
source "#{app_name}/config.xml.erb"
owner "jenkins"
group "jenkins"
end
end
# Download the Jenkins CLI jar file
execute "download_jenkins_jar" do
user "jenkins"
group "jenkins"
cwd "/home/jenkins"
command <<-EOH
wget http://#{app_config['server_name']}:8080/jnlpJars/jenkins-cli.jar
EOH
action :run
creates "/home/jenkins/jenkins-cli.jar"
end
# Update the Update Center, or Jenkins will randomly bitch that things arent plugins
# execute "jenkins_update_center" do
# user "jenkins"
# group "jenkins"
# cwd "/home/jenkins"
# command <<-EOH
# curl -L http://updates.jenkins-ci.org/update-center.json | sed '1d;$d' | curl -X POST -H 'Accept: application/json' -d @- http://#{app_config['server_name']}:8080/updateCenter/byId/default/postBack &&
# java -jar jenkins-cli.jar -s http://#{app_config['server_name']}:8080 restart
# EOH
# action :run
# creates "/home/jenkins/update-center.json"
# end
# Hacktastic installaiton
# https://gist.github.com/1026918
# bash "install_plugins" do
# user "jenkins"
# group "jenkins"
# cwd "/home/jenkins"
# code <<-EOH
# java -jar jenkins-cli.jar -s http://#{app_config['server_name']}:8080 install-plugin \
# ant checkstyle cloverphp dry htmlpublisher git github maven-plugin jdepend plot pmd violations xunit &&
# java -jar jenkins-cli.jar -s http://#{app_config['server_name']}:8080 safe-restart
# EOH
# end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment