lobot 0.10.0 → 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/generators/lobot/USAGE +10 -3
- data/lib/generators/lobot/config_generator.rb +29 -50
- data/lib/generators/lobot/templates/chef/cookbooks/pivotal_ci/recipes/default.rb +1 -0
- data/lib/generators/lobot/templates/chef/cookbooks/pivotal_ci/recipes/fonts.rb +5 -0
- data/lib/generators/lobot/templates/ci.yml +1 -1
- data/lib/lobot/tasks/ci.rake +30 -15
- data/lib/lobot/version.rb +1 -1
- metadata +3 -2
data/lib/generators/lobot/USAGE
CHANGED
@@ -1,8 +1,15 @@
|
|
1
1
|
Description:
|
2
|
-
|
2
|
+
Lobot is a gem that will help you spin-up, bootstrap, and install Jenkins for CI for your Rails app on Amazon EC2.
|
3
3
|
|
4
4
|
Example:
|
5
|
-
rails generate install
|
5
|
+
rails generate lobot:install
|
6
6
|
|
7
7
|
This will create:
|
8
|
-
|
8
|
+
chef/ - chef cookbooks in a subfolder
|
9
|
+
config/ci.yml - a configuration file for lobot
|
10
|
+
script/ci_build.sh - a build script you can use to run your CI build
|
11
|
+
config/capistrano/ci.rb - a set of lobot specific Capistrano tasks
|
12
|
+
|
13
|
+
rails generate lobot:config
|
14
|
+
|
15
|
+
This will configure config/ci.yml for you
|
@@ -12,11 +12,11 @@ module Lobot
|
|
12
12
|
default_app_name = File.basename(Rails.root)
|
13
13
|
config = {
|
14
14
|
'app_name' => default_app_name,
|
15
|
-
'app_user' =>
|
15
|
+
'app_user' => "ci",
|
16
16
|
'git_location' => default_git_location,
|
17
17
|
'basic_auth' => [
|
18
18
|
{
|
19
|
-
'username' => "
|
19
|
+
'username' => "ci"
|
20
20
|
}
|
21
21
|
],
|
22
22
|
'credentials' => {
|
@@ -35,80 +35,65 @@ module Lobot
|
|
35
35
|
"github_private_ssh_key_path" => File.expand_path("~/.ssh/id_rsa")
|
36
36
|
}
|
37
37
|
|
38
|
-
say "* The name of your application as it will appear in CI"
|
39
|
-
app_name = ask
|
38
|
+
say "* The name of your application as it will appear in CI", :green
|
39
|
+
app_name = ask("Application Name [#{config['app_name']}]:", :bold)
|
40
40
|
config['app_name'] = app_name if app_name != ""
|
41
41
|
|
42
|
-
say "* The
|
43
|
-
|
44
|
-
config['app_user'] = app_user if app_user != ""
|
45
|
-
|
46
|
-
say "* The location of your remote git repository which CI will poll and pull from on changes"
|
47
|
-
git_location = ask "Git Repository Location [#{config['git_location']}]: "
|
42
|
+
say "* The location of your remote git repository which CI will poll and pull from on changes", :green
|
43
|
+
git_location = ask("Git Repository Location [#{config['git_location']}]:", :bold)
|
48
44
|
config['git_location'] = git_location if git_location != ""
|
49
45
|
|
50
|
-
say "* The username you will use to access the CI web interface"
|
51
|
-
ci_username = ask
|
46
|
+
say "* The username you will use to access the CI web interface", :green
|
47
|
+
ci_username = ask("CI Username [#{config['basic_auth'][0]['username']}]:", :bold)
|
52
48
|
config['basic_auth'][0]['username'] = ci_username if ci_username != ""
|
53
49
|
|
54
|
-
say "* The password you will use to access the
|
50
|
+
say "* The password you will use to access the CI web interface", :green
|
55
51
|
while true do
|
56
|
-
ci_password = ask
|
52
|
+
ci_password = ask("Choose a CI password:", :bold)
|
57
53
|
config['basic_auth'][0]['password'] = ci_password
|
58
54
|
if ci_password == ""
|
59
|
-
say "Password cannot be blank"
|
55
|
+
say "Password cannot be blank", :red
|
60
56
|
else
|
61
57
|
break
|
62
58
|
end
|
63
59
|
end
|
64
60
|
|
65
|
-
say <<-EOS
|
61
|
+
say (<<-EOS).chop, :green
|
62
|
+
|
66
63
|
* See https://aws-portal.amazon.com/gp/aws/developer/account/index.html?ie=UTF8&action=access-key
|
67
64
|
* for access key id and secret access key
|
68
65
|
EOS
|
69
|
-
|
70
66
|
while true do
|
71
|
-
aws_access_key_id = ask
|
67
|
+
aws_access_key_id = ask("AWS Access Key ID:", :bold)
|
72
68
|
config['credentials']['aws_access_key_id'] = aws_access_key_id
|
73
69
|
if aws_access_key_id == ""
|
74
|
-
say "AWS Access Key ID cannot be blank"
|
70
|
+
say "AWS Access Key ID cannot be blank", :red
|
75
71
|
else
|
76
72
|
break
|
77
73
|
end
|
78
74
|
end
|
79
75
|
|
80
76
|
while true do
|
81
|
-
aws_secret_access_key = ask
|
77
|
+
aws_secret_access_key = ask("AWS Secret Access Key:", :bold)
|
82
78
|
config['credentials']['aws_secret_access_key'] = aws_secret_access_key
|
83
79
|
if aws_secret_access_key == ""
|
84
|
-
say "AWS Secret Access Key cannot be blank"
|
80
|
+
say "AWS Secret Access Key cannot be blank", :red
|
85
81
|
else
|
86
82
|
break
|
87
83
|
end
|
88
84
|
end
|
89
85
|
|
90
|
-
|
91
|
-
* See http://aws.amazon.com/ec2/instance-types/ API name values (e.g. m1.large)
|
92
|
-
EOS
|
93
|
-
flavor_id = ask "Choose an EC2 instance type [#{config['server']['flavor_id']}]: "
|
94
|
-
config['server']['flavor_id'] = flavor_id if flavor_id != ""
|
95
|
-
|
96
|
-
security_group = ask "AWS EC2 Security Group Name [#{config['server']['security_group']}]: "
|
97
|
-
config['server']['security_group'] = security_group if security_group != ""
|
98
|
-
|
99
|
-
ssh_port = ask "Server SSH Port [#{config['server']['ssh_port']}]: "
|
100
|
-
config['server']['ssh_port'] = ssh_port if ssh_port != ""
|
101
|
-
|
102
|
-
build_command = ask "Build Command: [#{config['build_command']}]: "
|
86
|
+
build_command = ask("Build Command: [#{config['build_command']}]:", :bold)
|
103
87
|
config['build_command'] = build_command if build_command != ""
|
104
88
|
|
105
|
-
say <<-EOS
|
89
|
+
say (<<-EOS).chop, :green
|
90
|
+
|
106
91
|
* This should refer to an SSH key pair that you have already generated. You may wish to generate a new key
|
107
92
|
* separate from what you may already be using for github or other systems.
|
108
93
|
* For a tutorial on this see: http://open.bsdcow.org/histerical/tutorials/ssh_pubkey_auth#1.2
|
109
94
|
EOS
|
110
95
|
while true do
|
111
|
-
id_rsa_path = ask
|
96
|
+
id_rsa_path = ask("Path to SSH Private Key for EC2 Access [#{config['ec2_server_access']['id_rsa_path']}]:", :bold)
|
112
97
|
config['ec2_server_access']['id_rsa_path'] = id_rsa_path if id_rsa_path != ""
|
113
98
|
if config['ec2_server_access']['id_rsa_path'] != File.expand_path(config['ec2_server_access']['id_rsa_path'])
|
114
99
|
config['ec2_server_access']['id_rsa_path'] = File.expand_path(File.join(ENV['HOME'], '.ssh', config['ec2_server_access']['id_rsa_path']))
|
@@ -116,23 +101,17 @@ module Lobot
|
|
116
101
|
if File.exist?(config['ec2_server_access']['id_rsa_path']) && File.exist?("#{config['ec2_server_access']['id_rsa_path']}.pub")
|
117
102
|
break
|
118
103
|
else
|
119
|
-
say "Unable to find both #{config['ec2_server_access']['id_rsa_path']} and #{config['ec2_server_access']['id_rsa_path']}.pub"
|
104
|
+
say "Unable to find both #{config['ec2_server_access']['id_rsa_path']} and #{config['ec2_server_access']['id_rsa_path']}.pub", :red
|
120
105
|
end
|
121
106
|
end
|
122
107
|
|
123
|
-
say <<-EOS
|
124
|
-
* This is an arbitrary label corresponding to the SSH credentials that you just selected
|
125
|
-
* You may name this anything you like. For example: your project name, hostname or name of the SSH key you just chose
|
126
|
-
EOS
|
127
|
-
key_pair_name = ask "AWS EC2 Key Pair Name [#{config['ec2_server_access']['key_pair_name']}]: "
|
128
|
-
config['ec2_server_access']['key_pair_name'] = key_pair_name if key_pair_name != ""
|
108
|
+
say (<<-EOS).chop, :green
|
129
109
|
|
130
|
-
say <<-EOS
|
131
110
|
* This needs to refer to an SSH Private Key that has been associated an account that has access to the git
|
132
111
|
* repository you entered above. On github this will be listed here: https://github.com/settings/ssh
|
133
112
|
EOS
|
134
113
|
while true do
|
135
|
-
github_private_ssh_key_path = ask
|
114
|
+
github_private_ssh_key_path = ask("Path to SSH Private Key for Github [#{config['github_private_ssh_key_path']}]:", :bold)
|
136
115
|
config['github_private_ssh_key_path'] = github_private_ssh_key_path if github_private_ssh_key_path != ""
|
137
116
|
if config['github_private_ssh_key_path'] != File.expand_path(config['github_private_ssh_key_path'])
|
138
117
|
config['github_private_ssh_key_path'] = File.expand_path(File.join(ENV['HOME'], '.ssh', config['github_private_ssh_key_path']))
|
@@ -140,12 +119,10 @@ module Lobot
|
|
140
119
|
if File.exist?(config['github_private_ssh_key_path'])
|
141
120
|
break
|
142
121
|
else
|
143
|
-
say "Unable to find #{config['github_private_ssh_key_path']}"
|
122
|
+
say "Unable to find #{config['github_private_ssh_key_path']}", :red
|
144
123
|
end
|
145
124
|
end
|
146
125
|
|
147
|
-
|
148
|
-
|
149
126
|
config_ci = YAML.load_file(Rails.root.join("config/ci.yml")) rescue {}
|
150
127
|
config_ci.merge!(config)
|
151
128
|
|
@@ -153,8 +130,10 @@ module Lobot
|
|
153
130
|
f << config_ci.to_yaml
|
154
131
|
end
|
155
132
|
|
156
|
-
say "\n\nconfig/ci.yml configured.
|
157
|
-
say "
|
133
|
+
say "\n\nconfig/ci.yml configured:\n#{File.read(Rails.root.join('config/ci.yml'))}\n"
|
134
|
+
say "You can edit this file to change any additional defaults."
|
135
|
+
say "Before continuing, be sure to push uncommitted changes to your git repository.", :red
|
136
|
+
say "For next steps, see README.md"
|
158
137
|
end
|
159
138
|
end
|
160
139
|
end
|
@@ -0,0 +1,5 @@
|
|
1
|
+
%w(xorg-x11-fonts-Type1 xorg-x11-fonts-75dpi bitmap-fonts xorg-x11-fonts-ISO8859-1-75dpi xorg-x11-fonts-truetype xorg-x11-fonts-ISO8859-15-75dpi xorg-x11-fonts-ISO8859-15-100dpi xorg-x11-fonts-ISO8859-1-100dpi liberation-fonts dejavu-lgc-fonts).each do |font|
|
2
|
+
yum_package font do
|
3
|
+
action :install
|
4
|
+
end
|
5
|
+
end
|
@@ -10,7 +10,7 @@ credentials:
|
|
10
10
|
aws_secret_access_key: AWS_SECRET
|
11
11
|
provider: AWS # leave this one
|
12
12
|
server:
|
13
|
-
flavor_id: m1.large
|
13
|
+
flavor_id: m1.large # See http://aws.amazon.com/ec2/instance-types/ API name values
|
14
14
|
security_group: ci_servers
|
15
15
|
name: # run 'rake ci:server_start to populate'
|
16
16
|
instance_id: # run 'rake ci:server_start to populate'
|
data/lib/lobot/tasks/ci.rake
CHANGED
@@ -215,28 +215,43 @@ namespace :ci do
|
|
215
215
|
ci_conf_location = File.join(Dir.pwd, 'config', 'ci.yml')
|
216
216
|
ci_conf = YAML.load_file(ci_conf_location)
|
217
217
|
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
218
|
+
if ci_conf['server']['elastic_ip']
|
219
|
+
puts "CI Monitor Config:"
|
220
|
+
puts "\tURL:\t\thttp://#{ci_conf['server']['elastic_ip']}/job/#{ci_conf['app_name']}/rssAll"
|
221
|
+
puts "\tProject Type:\tHudson/Jenkins"
|
222
|
+
puts "\tFeed Username:\t#{ci_conf['basic_auth'][0]['username']}"
|
223
|
+
puts "\tFeed Password:\t#{ci_conf['basic_auth'][0]['password']}"
|
224
|
+
puts "\t-- Lobot Setup --"
|
225
|
+
puts "\tEC2 Instance ID:\t#{ci_conf['server']['instance_id']}"
|
226
|
+
puts "\tEC2 Elastic IP Address:\t#{ci_conf['server']['elastic_ip']}"
|
227
|
+
puts "\tEC2 Access Key ID:\t#{ci_conf['credentials']['aws_access_key_id']}"
|
228
|
+
puts "\tEC2 Secret Access Key :\t#{ci_conf['credentials']['aws_secret_access_key']}"
|
229
|
+
puts ""
|
230
|
+
puts "CC Menu Config:"
|
231
|
+
puts "\tURL:\thttp://#{ci_conf['basic_auth'][0]['username']}:#{ci_conf['basic_auth'][0]['password']}@#{ci_conf['server']['elastic_ip']}/cc.xml"
|
232
|
+
else
|
233
|
+
puts "EC2 instance information not available. Did you run rake ci:server_start?"
|
234
|
+
end
|
231
235
|
end
|
232
236
|
|
233
237
|
desc "Run a command with a virtual frame buffer"
|
234
238
|
task :headlessly, :command do |task, args|
|
235
|
-
exit_code = nil
|
236
239
|
# headless is your friend on linux - http://www.aentos.com/blog/easy-setup-your-cucumber-scenarios-using-headless-gem-run-selenium-your-ci-server
|
240
|
+
begin
|
241
|
+
Headless
|
242
|
+
rescue NameError
|
243
|
+
puts "Headless not available, did you add it to your Gemfile?"
|
244
|
+
exit 1
|
245
|
+
end
|
246
|
+
unless args[:command]
|
247
|
+
puts "Usage: rake ci:headlessly[command] <additional options>"
|
248
|
+
exit 1
|
249
|
+
end
|
250
|
+
exit_code = 1
|
237
251
|
Headless.ly(:display => 42) do |headless|
|
238
252
|
begin
|
239
|
-
|
253
|
+
system(args[:command])
|
254
|
+
exit_code = $?.exitstatus
|
240
255
|
ensure
|
241
256
|
headless.destroy
|
242
257
|
end
|
data/lib/lobot/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lobot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-04-
|
12
|
+
date: 2012-04-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: fog
|
@@ -231,6 +231,7 @@ files:
|
|
231
231
|
- lib/generators/lobot/templates/chef/cookbooks/pivotal_ci/attributes/nginx.rb
|
232
232
|
- lib/generators/lobot/templates/chef/cookbooks/pivotal_ci/libraries/ci_config.rb
|
233
233
|
- lib/generators/lobot/templates/chef/cookbooks/pivotal_ci/recipes/default.rb
|
234
|
+
- lib/generators/lobot/templates/chef/cookbooks/pivotal_ci/recipes/fonts.rb
|
234
235
|
- lib/generators/lobot/templates/chef/cookbooks/pivotal_ci/recipes/git_config.rb
|
235
236
|
- lib/generators/lobot/templates/chef/cookbooks/pivotal_ci/recipes/id_rsa.rb
|
236
237
|
- lib/generators/lobot/templates/chef/cookbooks/pivotal_ci/recipes/jenkins.rb
|