engineyard-hudson 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +19 -1
- data/History.md +4 -0
- data/README.md +69 -9
- data/engineyard-hudson.gemspec +1 -1
- data/features/server.feature +32 -4
- data/features/step_definitions/common_steps.rb +8 -0
- data/lib/engineyard-hudson/cli.rb +5 -3
- data/lib/engineyard-hudson/cli/install.rb +1 -8
- data/lib/engineyard-hudson/cli/install/templates/{attributes.rb.erb → attributes.rb.tt} +0 -0
- data/lib/engineyard-hudson/cli/server.rb +41 -0
- data/lib/engineyard-hudson/cli/server/templates/attributes.rb.tt +3 -0
- data/lib/engineyard-hudson/cli/server/templates/cookbooks/hudson_master/recipes/default.rb +97 -0
- data/lib/engineyard-hudson/cli/server/templates/cookbooks/hudson_master/templates/default/init.sh.erb +24 -0
- data/lib/engineyard-hudson/cli/server/templates/cookbooks/hudson_master/templates/default/proxy.conf.erb +20 -0
- data/lib/engineyard-hudson/cli/server/templates/cookbooks/main/attributes/recipe.rb +3 -0
- data/lib/engineyard-hudson/cli/server/templates/cookbooks/main/definitions/ey_cloud_report.rb +6 -0
- data/lib/engineyard-hudson/cli/server/templates/cookbooks/main/libraries/ruby_block.rb +40 -0
- data/lib/engineyard-hudson/cli/server/templates/cookbooks/main/libraries/run_for_app.rb +12 -0
- data/lib/engineyard-hudson/cli/server/templates/cookbooks/main/recipes/default.rb +1 -0
- data/lib/engineyard-hudson/thor-ext/actions/directory.rb +33 -0
- metadata +15 -4
data/Gemfile.lock
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
engineyard-hudson (0.0
|
4
|
+
engineyard-hudson (0.2.0)
|
5
|
+
engineyard (~> 1.3.3)
|
5
6
|
thor (~> 0.14.3)
|
6
7
|
|
7
8
|
GEM
|
@@ -16,11 +17,27 @@ GEM
|
|
16
17
|
json (~> 1.4.6)
|
17
18
|
term-ansicolor (~> 1.0.5)
|
18
19
|
diff-lcs (1.1.2)
|
20
|
+
engineyard (1.3.3)
|
21
|
+
engineyard-serverside-adapter (= 1.3.5)
|
22
|
+
escape (~> 0.0.4)
|
23
|
+
highline (~> 1.5.2)
|
24
|
+
json_pure
|
25
|
+
rest-client (~> 1.4)
|
26
|
+
thor (~> 0.14.3)
|
27
|
+
engineyard-serverside-adapter (1.3.5)
|
28
|
+
escape (~> 0.0.4)
|
29
|
+
json_pure
|
30
|
+
escape (0.0.4)
|
19
31
|
gherkin (2.2.9)
|
20
32
|
json (~> 1.4.6)
|
21
33
|
term-ansicolor (~> 1.0.5)
|
34
|
+
highline (1.5.2)
|
22
35
|
json (1.4.6)
|
36
|
+
json_pure (1.4.6)
|
37
|
+
mime-types (1.16)
|
23
38
|
rake (0.8.7)
|
39
|
+
rest-client (1.6.1)
|
40
|
+
mime-types (>= 1.16)
|
24
41
|
rspec (2.0.1)
|
25
42
|
rspec-core (~> 2.0.1)
|
26
43
|
rspec-expectations (~> 2.0.1)
|
@@ -40,6 +57,7 @@ PLATFORMS
|
|
40
57
|
DEPENDENCIES
|
41
58
|
awesome_print
|
42
59
|
cucumber (~> 0.9.3)
|
60
|
+
engineyard (~> 1.3.3)
|
43
61
|
engineyard-hudson!
|
44
62
|
json (~> 1.4.0)
|
45
63
|
rake (~> 0.8.7)
|
data/History.md
CHANGED
data/README.md
CHANGED
@@ -10,29 +10,57 @@ It's a nightmare. It was for me. [Hudson CI](http://hudson-ci.org/), `engineyard
|
|
10
10
|
|
11
11
|
gem install engineyard-hudson
|
12
12
|
|
13
|
+
You might also like the `hudson` CLI to play with your Hudson CI from the command line:
|
14
|
+
|
15
|
+
gem install hudson
|
16
|
+
|
13
17
|
## Assumptions
|
14
18
|
|
15
|
-
It is assumed you are familiar with the
|
19
|
+
It is assumed you are familiar with the [engineyard](http://github.com/engineyard/engineyard) CLI gem.
|
16
20
|
|
17
21
|
You **do not** need to be familiar with custom chef recipes. Just follow the simple commands. Easy peasy.
|
18
22
|
|
19
|
-
## Warning
|
23
|
+
## Warning (aka TODO list)
|
24
|
+
|
25
|
+
In the very first release of `engineyard-hudson`:
|
26
|
+
|
27
|
+
* there is no support for authentication/authorization of Hudson CI.
|
28
|
+
* git URLs are converted to public `git://` urls on Hudson; until deploy key support is added
|
29
|
+
* no mail server configured for Hudson CI build failure notifications
|
30
|
+
|
31
|
+
That is, its really only useful - at this very "alpha" instant in time - to Open Source Rails projects. But that's just me being brutally honest.
|
32
|
+
|
33
|
+
## Hosting Hudson CI
|
20
34
|
|
21
|
-
|
35
|
+
Hosting Hudson CI on Engine Yard AppCloud is optional; yet delightfully simple. Hudson CI can be hosted anywhere.
|
22
36
|
|
23
|
-
|
37
|
+
### Hosting on Engine Yard AppCloud
|
24
38
|
|
25
|
-
|
39
|
+
Just a few steps and you will have your own Hudson CI:
|
40
|
+
|
41
|
+
$ mkdir hudson_server
|
42
|
+
$ cd hudson_server
|
43
|
+
$ ey-hudson server . --plugins 'googleanalytics,chucknorris'
|
44
|
+
|
45
|
+
Finally:
|
46
|
+
* edit cookbooks/hudson_master/attributes/default.rb as necessary.
|
47
|
+
* run: ey recipes upload # use --environment(-e) & --account(-c)
|
48
|
+
* run: ey recipes apply # to select environment
|
49
|
+
* Boot your environment if not already booted.
|
26
50
|
|
27
|
-
|
51
|
+
Do those steps and you're done! Now, you either visit your Hudson CI site or use `hudson list` to see the status of your projects being tested.
|
28
52
|
|
29
|
-
|
53
|
+
### Hosting elsewhere
|
54
|
+
|
55
|
+
You need the following information about your Hudson CI:
|
56
|
+
|
57
|
+
* Hudson CI public host (& port)
|
30
58
|
* Hudson CI's user's public key (probably at /home/hudson/.ssh/id_rsa.pub)
|
31
59
|
* Hudson CI's user's private key path (probably /home/hudson/.ssh/id_rsa)
|
32
60
|
|
33
61
|
## Running your tests in Hudson against Engine Yard AppCloud
|
34
62
|
|
35
|
-
|
63
|
+
Just a few steps and you will have your applications' tests running.
|
36
64
|
|
37
65
|
$ cd /my/project
|
38
66
|
$ ey-hudson install .
|
@@ -43,7 +71,7 @@ After a couple manual steps, you will have your applications tests running.
|
|
43
71
|
* run: ey recipes apply # to select environment
|
44
72
|
* Boot your environment if not already booted.
|
45
73
|
|
46
|
-
|
74
|
+
Do those steps and you're done! Now, you either visit your Hudson CI site or use `hudson list` to see the status of your projects being tested.
|
47
75
|
|
48
76
|
## Automatically triggering job builds
|
49
77
|
|
@@ -59,6 +87,10 @@ It is often desirable to have your SCM trigger Hudson CI to run your job build w
|
|
59
87
|
* Enter the URL `http://HUDSON-CI-URL/job/APP-NAME/build`
|
60
88
|
* Click "Update Settings"
|
61
89
|
|
90
|
+
And here's a picture.
|
91
|
+
|
92
|
+
<img src="http://img.skitch.com/20101031-d5wrc7hysrahihqr9k53xgxi1t.png" style="width: 100%;">
|
93
|
+
|
62
94
|
You can also use the "Test Hook" link to test this is wired up correctly.
|
63
95
|
|
64
96
|
### CLI
|
@@ -72,3 +104,31 @@ Using the `hudson` CLI:
|
|
72
104
|
You are triggering the build via a GET call to an URL endpoint. So you can also use `curl`:
|
73
105
|
|
74
106
|
curl http://HUDSON-CI-URL/job/APP-NAME/build
|
107
|
+
|
108
|
+
## Contributions
|
109
|
+
|
110
|
+
* Dr Nic Williams
|
111
|
+
* Bo Jeanes - initial chef recipes for Hudson server + slave
|
112
|
+
|
113
|
+
## License
|
114
|
+
|
115
|
+
Copyright (c) 2010 Dr Nic Williams, Engine Yard
|
116
|
+
|
117
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
118
|
+
a copy of this software and associated documentation files (the
|
119
|
+
"Software"), to deal in the Software without restriction, including
|
120
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
121
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
122
|
+
permit persons to whom the Software is furnished to do so, subject to
|
123
|
+
the following conditions:
|
124
|
+
|
125
|
+
The above copyright notice and this permission notice shall be
|
126
|
+
included in all copies or substantial portions of the Software.
|
127
|
+
|
128
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
129
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
130
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
131
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
132
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
133
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
134
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/engineyard-hudson.gemspec
CHANGED
data/features/server.feature
CHANGED
@@ -1,12 +1,40 @@
|
|
1
|
-
@wip
|
2
1
|
Feature: Managing ey hudson server
|
3
2
|
I want to setup and manage a Hudson CI server hosted on Engine Yard AppCloud
|
4
3
|
|
5
4
|
Scenario: Setup new Hudson CI server on AppCloud
|
6
5
|
Given I have an environment "hudson" on account "drnic" on AppCloud
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
When I run local executable "ey-hudson" with arguments "server ."
|
7
|
+
Then file "cookbooks/main/recipes/default.rb" is created
|
8
|
+
And file "cookbooks/hudson_master/recipes/default.rb" is created
|
9
|
+
And file "cookbooks/hudson_master/attributes/default.rb" contains ":plugins => %w[git github rake ruby greenballs]"
|
10
|
+
And I should see exactly
|
11
|
+
"""
|
12
|
+
create cookbooks
|
13
|
+
create cookbooks/hudson_master/recipes/default.rb
|
14
|
+
create cookbooks/hudson_master/templates/default/init.sh.erb
|
15
|
+
create cookbooks/hudson_master/templates/default/proxy.conf.erb
|
16
|
+
create cookbooks/main/attributes/recipe.rb
|
17
|
+
create cookbooks/main/definitions/ey_cloud_report.rb
|
18
|
+
create cookbooks/main/libraries/ruby_block.rb
|
19
|
+
create cookbooks/main/libraries/run_for_app.rb
|
20
|
+
create cookbooks/main/recipes/default.rb
|
21
|
+
create cookbooks/hudson_master/attributes/default.rb
|
22
|
+
|
23
|
+
Finally:
|
24
|
+
* edit cookbooks/hudson_master/attributes/default.rb as necessary.
|
25
|
+
* run: ey recipes upload # use --environment(-e) & --account(-c)
|
26
|
+
* run: ey recipes apply # to select environment
|
27
|
+
* Boot your environment if not already booted.
|
28
|
+
When the recipe completes, your solo instance will host a Hudson CI!
|
29
|
+
"""
|
30
|
+
|
31
|
+
Scenario: Setup Hudson CI server with additional Hudson plugins
|
32
|
+
Given I have an environment "hudson" on account "drnic" on AppCloud
|
33
|
+
When I run local executable "ey-hudson" with arguments "server . -p ' chucknorris , googleanalytics '"
|
34
|
+
Then file "cookbooks/main/recipes/default.rb" is created
|
35
|
+
And file "cookbooks/hudson_master/recipes/default.rb" is created
|
36
|
+
And file "cookbooks/hudson_master/attributes/default.rb" contains ":plugins => %w[git github rake ruby greenballs chucknorris googleanalytics]"
|
37
|
+
|
10
38
|
|
11
39
|
|
12
40
|
|
@@ -85,6 +85,14 @@ Then /^file "(.*)" contents (does|does not) match \/(.*)\// do |file, does, rege
|
|
85
85
|
end
|
86
86
|
end
|
87
87
|
|
88
|
+
Then /^file "([^"]*)" contains "([^"]*)"$/ do |file, text|
|
89
|
+
in_project_folder do
|
90
|
+
actual_output = File.read(file)
|
91
|
+
actual_output.should contain(text)
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
|
88
96
|
Then /gem file "(.*)" and generated file "(.*)" should be the same/ do |gem_file, project_file|
|
89
97
|
File.exists?(gem_file).should be_true
|
90
98
|
File.exists?(project_file).should be_true
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'thor'
|
2
|
+
require 'engineyard-hudson/thor-ext/actions/directory'
|
2
3
|
|
3
4
|
module Engineyard
|
4
5
|
module Hudson
|
@@ -17,9 +18,10 @@ module Engineyard
|
|
17
18
|
Engineyard::Hudson::Install.start(ARGV[1..-1])
|
18
19
|
end
|
19
20
|
|
20
|
-
desc "server", "Setup a Hudson CI server on AppCloud."
|
21
|
-
def server
|
22
|
-
|
21
|
+
desc "server PROJECT_PATH", "Setup a Hudson CI server on AppCloud."
|
22
|
+
def server(project_path)
|
23
|
+
require 'engineyard-hudson/cli/server'
|
24
|
+
Engineyard::Hudson::Server.start(ARGV[1..-1])
|
23
25
|
end
|
24
26
|
|
25
27
|
desc "version", "show version information"
|
@@ -19,7 +19,7 @@ module Engineyard
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def attributes
|
22
|
-
template "attributes.rb.
|
22
|
+
template "attributes.rb.tt", "cookbooks/hudson_slave/attributes/default.rb"
|
23
23
|
end
|
24
24
|
|
25
25
|
def recipe
|
@@ -36,13 +36,6 @@ module Engineyard
|
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
|
-
# README:
|
40
|
-
# Finally:
|
41
|
-
# * edit cookbooks/hudson_slave/attributes/default.rb as necessary
|
42
|
-
# * run: ey recipes upload
|
43
|
-
# * run: ey recipes apply
|
44
|
-
# * Boot your environment if not already booted.
|
45
|
-
# When the recipe completes, your project will commence its first build on Hudson CI.
|
46
39
|
def readme
|
47
40
|
say ""
|
48
41
|
say "Finally:"
|
File without changes
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'thor/group'
|
2
|
+
|
3
|
+
module Engineyard
|
4
|
+
module Hudson
|
5
|
+
class Server < Thor::Group
|
6
|
+
include Thor::Actions
|
7
|
+
|
8
|
+
argument :project_path
|
9
|
+
|
10
|
+
class_option :plugins, :aliases => '-p', :desc => 'additional Hudson CI plugins (comma separated)'
|
11
|
+
|
12
|
+
def self.source_root
|
13
|
+
File.join(File.dirname(__FILE__), "server", "templates")
|
14
|
+
end
|
15
|
+
|
16
|
+
def cookbooks
|
17
|
+
directory "cookbooks"
|
18
|
+
end
|
19
|
+
|
20
|
+
def attributes
|
21
|
+
@plugins = %w[git github rake ruby greenballs] + (options[:plugins] || '').strip.split(/\s*,\s*/)
|
22
|
+
template "attributes.rb.tt", "cookbooks/hudson_master/attributes/default.rb"
|
23
|
+
end
|
24
|
+
|
25
|
+
def readme
|
26
|
+
say ""
|
27
|
+
say "Finally:"
|
28
|
+
say "* edit "; say "cookbooks/hudson_master/attributes/default.rb ", :yellow; say "as necessary."
|
29
|
+
say "* run: "; say "ey recipes upload ", :green; say "# use --environment(-e) & --account(-c)"
|
30
|
+
say "* run: "; say "ey recipes apply ", :green; say "# to select environment"
|
31
|
+
say "* "; say "Boot your environment ", :yellow; say "if not already booted."
|
32
|
+
say "When the recipe completes, your solo instance will host a Hudson CI!"
|
33
|
+
end
|
34
|
+
|
35
|
+
private
|
36
|
+
def say(msg, color = nil)
|
37
|
+
color ? shell.say(msg, color) : shell.say(msg)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,97 @@
|
|
1
|
+
#
|
2
|
+
# Cookbook Name:: hudson
|
3
|
+
# Recipe:: default
|
4
|
+
#
|
5
|
+
|
6
|
+
# Using manual hudson for now not hudson gem. No ebuild seems to exist.
|
7
|
+
# Based on http://bit.ly/9Y852l
|
8
|
+
|
9
|
+
# You can use this in combination with http://github.com/bjeanes/ey_hudson_proxy
|
10
|
+
# to serve hudson publicly on a Hudson-only EY instance. This is so you don't have to
|
11
|
+
# find a simple app to run on the instance in lieu of an actual staging/production site.
|
12
|
+
# Alternatively, set up nginx asa reverse proxy manually.
|
13
|
+
|
14
|
+
# We'll assume running hudson under the default username
|
15
|
+
hudson_user = node[:users].first[:username]
|
16
|
+
hudson_port = 8082 # change this in your proxy if modified
|
17
|
+
hudson_home = "/data/hudson-ci"
|
18
|
+
hudson_pid = "#{hudson_home}/tmp/pid"
|
19
|
+
plugins = node[:hudson_master][:plugins]
|
20
|
+
|
21
|
+
if ['solo'].include?(node[:instance_role])
|
22
|
+
gem_package "bundler" do
|
23
|
+
source "http://gemcutter.org"
|
24
|
+
action :install
|
25
|
+
end
|
26
|
+
|
27
|
+
execute "setup-git-config-for-tagging" do
|
28
|
+
command %Q{ sudo su #{hudson_user} -c "git config --global user.email 'you@example.com' && git config --global user.name 'You are Special'" }
|
29
|
+
not_if %Q{ sudo su #{hudson_user} -c "git config user.email" }
|
30
|
+
end
|
31
|
+
|
32
|
+
%w[logs tmp war plugins .].each do |dir|
|
33
|
+
directory "#{hudson_home}/#{dir}" do
|
34
|
+
owner hudson_user
|
35
|
+
group hudson_user
|
36
|
+
mode 0755 unless dir == "war"
|
37
|
+
action :create
|
38
|
+
recursive true
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
remote_file "#{hudson_home}/hudson.war" do
|
43
|
+
source "http://hudson-ci.org/latest/hudson.war"
|
44
|
+
owner hudson_user
|
45
|
+
group hudson_user
|
46
|
+
not_if { FileTest.exists?("#{hudson_home}/hudson.war") }
|
47
|
+
end
|
48
|
+
|
49
|
+
template "/etc/init.d/hudson" do
|
50
|
+
source "init.sh.erb"
|
51
|
+
owner "root"
|
52
|
+
group "root"
|
53
|
+
mode 0755
|
54
|
+
variables(
|
55
|
+
:user => hudson_user,
|
56
|
+
:port => hudson_port,
|
57
|
+
:home => hudson_home,
|
58
|
+
:pid => hudson_pid
|
59
|
+
)
|
60
|
+
not_if { FileTest.exists?("/etc/init.d/hudson") }
|
61
|
+
end
|
62
|
+
|
63
|
+
plugins.each do |plugin|
|
64
|
+
remote_file "#{hudson_home}/plugins/#{plugin}.hpi" do
|
65
|
+
source "http://hudson-ci.org/latest/#{plugin}.hpi"
|
66
|
+
owner hudson_user
|
67
|
+
group hudson_user
|
68
|
+
not_if { FileTest.exists?("#{hudson_home}/plugins/#{plugin}.hpi") }
|
69
|
+
end
|
70
|
+
|
71
|
+
end
|
72
|
+
|
73
|
+
template "/data/nginx/servers/hudson_reverse_proxy.conf" do
|
74
|
+
source "proxy.conf.erb"
|
75
|
+
owner hudson_user
|
76
|
+
group hudson_user
|
77
|
+
mode 0644
|
78
|
+
variables(
|
79
|
+
:port => hudson_port
|
80
|
+
)
|
81
|
+
not_if { FileTest.exists?("/data/nginx/servers/hudson_reverse_proxy.conf") }
|
82
|
+
end
|
83
|
+
|
84
|
+
execute "ensure-hudson-is-running" do
|
85
|
+
command "/etc/init.d/hudson restart"
|
86
|
+
end
|
87
|
+
|
88
|
+
execute "Restart nginx" do
|
89
|
+
command "/etc/init.d/nginx restart"
|
90
|
+
end
|
91
|
+
|
92
|
+
execute "Generate key pair for slaves" do
|
93
|
+
key_path = "/home/#{node[:users].first[:username]}/.ssh/id_rsa"
|
94
|
+
command "ssh-keygen -f #{key_path} -N ''"
|
95
|
+
not_if { FileTest.exists?(key_path) }
|
96
|
+
end
|
97
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
#!/sbin/runscript
|
2
|
+
|
3
|
+
# Start/stop script for hudson
|
4
|
+
|
5
|
+
PIDFILE=<%= @pid %>
|
6
|
+
HUDSON_HOME=<%= @home %>
|
7
|
+
COMMAND=/usr/bin/java
|
8
|
+
ARGUMENTS="-Djava.io.tmpdir=${HUDSON_HOME}/tmp -jar ${HUDSON_HOME}/hudson.war --webroot=${HUDSON_HOME}/war --httpPort=<%= @port %> ajp13ListenAddress=127.0.0.1"
|
9
|
+
RUN_AS=<%= @user %>
|
10
|
+
NAME=Hudson-CI
|
11
|
+
|
12
|
+
start() {
|
13
|
+
ebegin "Starting $NAME"
|
14
|
+
export HUDSON_HOME=${HUDSON_HOME}
|
15
|
+
start-stop-daemon -b --start --make-pidfile --pidfile $PIDFILE --chuid $RUN_AS --exec $COMMAND -- $ARGUMENTS &>$HUDSON_HOME/logs/hudson_log
|
16
|
+
eend $?
|
17
|
+
}
|
18
|
+
|
19
|
+
stop() {
|
20
|
+
ebegin "Stopping $NAME"
|
21
|
+
start-stop-daemon --stop --quiet --pidfile $PIDFILE
|
22
|
+
rm -f $PIDFILE
|
23
|
+
eend $?
|
24
|
+
}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# Nginx config for Hudson CI behind a virtual host
|
2
|
+
# TODO: Add SSL support as per http://gist.github.com/460906
|
3
|
+
|
4
|
+
upstream hudson {
|
5
|
+
server localhost:<%= @port %>;
|
6
|
+
}
|
7
|
+
|
8
|
+
server {
|
9
|
+
listen 80 default;
|
10
|
+
server_name hudson.example.com;
|
11
|
+
|
12
|
+
location / {
|
13
|
+
proxy_set_header X-Real-IP $remote_addr;
|
14
|
+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
15
|
+
proxy_set_header X-Forwarded-Proto https;
|
16
|
+
proxy_set_header Host $http_host;
|
17
|
+
proxy_next_upstream error;
|
18
|
+
proxy_pass http://hudson;
|
19
|
+
}
|
20
|
+
}
|
@@ -0,0 +1,40 @@
|
|
1
|
+
|
2
|
+
class Chef
|
3
|
+
class Resource
|
4
|
+
class RubyBlock < Chef::Resource
|
5
|
+
def initialize(name, collection=nil, node=nil)
|
6
|
+
super(name, collection, node)
|
7
|
+
@resource_name = :ruby_block
|
8
|
+
@action = :create
|
9
|
+
@allowed_actions.push(:create)
|
10
|
+
end
|
11
|
+
|
12
|
+
def block(&block)
|
13
|
+
if block
|
14
|
+
@block = block
|
15
|
+
else
|
16
|
+
@block
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
class Chef
|
25
|
+
class Provider
|
26
|
+
class RubyBlock < Chef::Provider
|
27
|
+
def load_current_resource
|
28
|
+
Chef::Log.debug(@new_resource.inspect)
|
29
|
+
true
|
30
|
+
end
|
31
|
+
|
32
|
+
def action_create
|
33
|
+
@new_resource.block.call
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
Chef::Platform.platforms[:default].merge! :ruby_block => Chef::Provider::RubyBlock
|
40
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
require_recipe 'hudson_master'
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# Extension: Sorts the Dir[lookup] to ensure deterministic ordering of actions
|
2
|
+
# to allow test assertions
|
3
|
+
|
4
|
+
class Thor
|
5
|
+
module Actions
|
6
|
+
class Directory < EmptyDirectory #:nodoc:
|
7
|
+
protected
|
8
|
+
|
9
|
+
def execute!
|
10
|
+
lookup = config[:recursive] ? File.join(source, '**') : source
|
11
|
+
lookup = File.join(lookup, '{*,.[a-z]*}')
|
12
|
+
|
13
|
+
Dir[lookup].sort.each do |file_source|
|
14
|
+
next if File.directory?(file_source)
|
15
|
+
file_destination = File.join(given_destination, file_source.gsub(source, '.'))
|
16
|
+
file_destination.gsub!('/./', '/')
|
17
|
+
|
18
|
+
case file_source
|
19
|
+
when /\.empty_directory$/
|
20
|
+
dirname = File.dirname(file_destination).gsub(/\/\.$/, '')
|
21
|
+
next if dirname == given_destination
|
22
|
+
base.empty_directory(dirname, config)
|
23
|
+
when /\.tt$/
|
24
|
+
destination = base.template(file_source, file_destination[0..-4], config, &@block)
|
25
|
+
else
|
26
|
+
destination = base.copy_file(file_source, file_destination, config, &@block)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: engineyard-hudson
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
8
|
+
- 2
|
9
9
|
- 0
|
10
|
-
version: 0.
|
10
|
+
version: 0.2.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Dr Nic Williams
|
@@ -162,12 +162,23 @@ files:
|
|
162
162
|
- lib/engineyard-hudson.rb
|
163
163
|
- lib/engineyard-hudson/cli.rb
|
164
164
|
- lib/engineyard-hudson/cli/install.rb
|
165
|
-
- lib/engineyard-hudson/cli/install/templates/attributes.rb.
|
165
|
+
- lib/engineyard-hudson/cli/install/templates/attributes.rb.tt
|
166
166
|
- lib/engineyard-hudson/cli/install/templates/cookbooks/main/attributes/recipe.rb
|
167
167
|
- lib/engineyard-hudson/cli/install/templates/cookbooks/main/definitions/ey_cloud_report.rb
|
168
168
|
- lib/engineyard-hudson/cli/install/templates/cookbooks/main/libraries/ruby_block.rb
|
169
169
|
- lib/engineyard-hudson/cli/install/templates/cookbooks/main/libraries/run_for_app.rb
|
170
170
|
- lib/engineyard-hudson/cli/install/templates/recipes.rb
|
171
|
+
- lib/engineyard-hudson/cli/server.rb
|
172
|
+
- lib/engineyard-hudson/cli/server/templates/attributes.rb.tt
|
173
|
+
- lib/engineyard-hudson/cli/server/templates/cookbooks/hudson_master/recipes/default.rb
|
174
|
+
- lib/engineyard-hudson/cli/server/templates/cookbooks/hudson_master/templates/default/init.sh.erb
|
175
|
+
- lib/engineyard-hudson/cli/server/templates/cookbooks/hudson_master/templates/default/proxy.conf.erb
|
176
|
+
- lib/engineyard-hudson/cli/server/templates/cookbooks/main/attributes/recipe.rb
|
177
|
+
- lib/engineyard-hudson/cli/server/templates/cookbooks/main/definitions/ey_cloud_report.rb
|
178
|
+
- lib/engineyard-hudson/cli/server/templates/cookbooks/main/libraries/ruby_block.rb
|
179
|
+
- lib/engineyard-hudson/cli/server/templates/cookbooks/main/libraries/run_for_app.rb
|
180
|
+
- lib/engineyard-hudson/cli/server/templates/cookbooks/main/recipes/default.rb
|
181
|
+
- lib/engineyard-hudson/thor-ext/actions/directory.rb
|
171
182
|
has_rdoc: true
|
172
183
|
homepage: http://github.com/engineyard/engineyard-hudson
|
173
184
|
licenses: []
|