lobot 0.9.5 → 0.9.6
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/README.md +6 -0
- data/lib/lobot/tasks/ci.rake +38 -18
- data/lib/lobot/version.rb +1 -1
- metadata +3 -3
data/README.md
CHANGED
@@ -80,6 +80,12 @@ Upload the contents of your chef/cookbooks/ directory, upload the soloistrc, and
|
|
80
80
|
|
81
81
|
cap ci chef
|
82
82
|
|
83
|
+
## Add your new CI instance to [cimonitor](http://github.com/pivotal/cimonitor) and CCMenu
|
84
|
+
|
85
|
+
Lobot can generate the config for you, just run:
|
86
|
+
|
87
|
+
rake ci:info
|
88
|
+
|
83
89
|
## Dependencies
|
84
90
|
|
85
91
|
* fog
|
data/lib/lobot/tasks/ci.rake
CHANGED
@@ -35,7 +35,7 @@ namespace :ci do
|
|
35
35
|
|
36
36
|
unless is_in_security_group
|
37
37
|
puts "Allowing port #{port} into '#{security_group_name}' security group"
|
38
|
-
security_group.authorize_port_range(port..port)
|
38
|
+
security_group.authorize_port_range(port..port)
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
@@ -53,10 +53,10 @@ namespace :ci do
|
|
53
53
|
:public_key => File.read(File.expand_path("#{public_key_local_path}"))
|
54
54
|
).save
|
55
55
|
end
|
56
|
-
|
56
|
+
|
57
57
|
number_of_servers = aws_connection.servers.select{ |server| server.state == 'running' }.length
|
58
58
|
puts "you have #{number_of_servers} server(s) already running in this account" if number_of_servers > 0
|
59
|
-
|
59
|
+
|
60
60
|
puts "Launching server... (this costs money until you stop it)"
|
61
61
|
server = aws_connection.servers.create(
|
62
62
|
:image_id => 'ami-d4de25bd',
|
@@ -64,17 +64,17 @@ namespace :ci do
|
|
64
64
|
:key_name => ec2_key_pair_name,
|
65
65
|
:groups => [security_group_name]
|
66
66
|
)
|
67
|
-
|
67
|
+
|
68
68
|
unless aws_conf['server']['elastic_ip'] =~ /\d.\.\d.\.\d.\.\d./
|
69
69
|
elastic_ip = aws_connection.addresses.create
|
70
70
|
aws_conf['server']['elastic_ip'] = elastic_ip.public_ip
|
71
71
|
puts "Allocated elastic IP address #{aws_conf['server']['elastic_ip']}"
|
72
72
|
end
|
73
|
-
|
73
|
+
|
74
74
|
server.wait_for { ready? }
|
75
|
-
|
75
|
+
|
76
76
|
aws_connection.associate_address(server.id, aws_conf['server']['elastic_ip'])
|
77
|
-
|
77
|
+
|
78
78
|
socket = false
|
79
79
|
Timeout::timeout(120) do
|
80
80
|
p "Server booted, waiting for SSH."
|
@@ -91,15 +91,15 @@ namespace :ci do
|
|
91
91
|
|
92
92
|
p server
|
93
93
|
puts "Server is ready"
|
94
|
-
|
94
|
+
|
95
95
|
p "Writing server instance_id(#{server.id}) and elastic IP(#{aws_conf['server']['elastic_ip']}) to ci.yml"
|
96
96
|
aws_conf["server"].merge!("instance_id" => server.id)
|
97
|
-
|
97
|
+
|
98
98
|
f = File.open(aws_conf_location, "w")
|
99
99
|
f.write(aws_conf.to_yaml)
|
100
100
|
f.close
|
101
101
|
end
|
102
|
-
|
102
|
+
|
103
103
|
desc "stop(suspend) the CI Server"
|
104
104
|
task :stop do
|
105
105
|
require 'fog'
|
@@ -116,10 +116,10 @@ namespace :ci do
|
|
116
116
|
:aws_access_key_id => aws_credentials['aws_access_key_id'],
|
117
117
|
:aws_secret_access_key => aws_credentials['aws_secret_access_key']
|
118
118
|
)
|
119
|
-
|
119
|
+
|
120
120
|
aws_connection.servers.new(:id => server_config['instance_id']).stop
|
121
121
|
end
|
122
|
-
|
122
|
+
|
123
123
|
desc "start(resume) the CI Server"
|
124
124
|
task :start do
|
125
125
|
require 'fog'
|
@@ -136,14 +136,14 @@ namespace :ci do
|
|
136
136
|
:aws_access_key_id => aws_credentials['aws_access_key_id'],
|
137
137
|
:aws_secret_access_key => aws_credentials['aws_secret_access_key']
|
138
138
|
)
|
139
|
-
|
139
|
+
|
140
140
|
server = aws_connection.servers.new(:id => server_config['instance_id'])
|
141
141
|
server.start
|
142
142
|
server.wait_for { ready? }
|
143
|
-
|
143
|
+
|
144
144
|
aws_connection.associate_address(server_config['instance_id'], server_config['elastic_ip']) if server_config['elastic_ip']
|
145
145
|
end
|
146
|
-
|
146
|
+
|
147
147
|
desc "open the CI interface in a browser"
|
148
148
|
task :open do
|
149
149
|
aws_conf_location = File.join(Dir.pwd, 'config', 'ci.yml')
|
@@ -151,7 +151,7 @@ namespace :ci do
|
|
151
151
|
server_config = aws_conf['server']
|
152
152
|
exec "open http://#{server_config['elastic_ip']}"
|
153
153
|
end
|
154
|
-
|
154
|
+
|
155
155
|
desc "ssh to CI"
|
156
156
|
task :ssh do
|
157
157
|
aws_conf_location = File.join(Dir.pwd, 'config', 'ci.yml')
|
@@ -159,13 +159,13 @@ namespace :ci do
|
|
159
159
|
server_config = aws_conf['server']
|
160
160
|
exec "ssh -i #{aws_conf['ec2_server_access']['id_rsa_path']} #{aws_conf['app_user']}@#{server_config['elastic_ip']}"
|
161
161
|
end
|
162
|
-
|
162
|
+
|
163
163
|
desc "Get build status"
|
164
164
|
task :status do
|
165
165
|
require 'nokogiri'
|
166
166
|
aws_conf_location = File.join(Dir.pwd, 'config', 'ci.yml')
|
167
167
|
ci_conf = YAML.load_file(aws_conf_location)
|
168
|
-
|
168
|
+
|
169
169
|
jenkins_rss_feed = `curl -s --user #{ci_conf['basic_auth'][0]['username']}:#{ci_conf['basic_auth'][0]['password']} --anyauth http://#{ci_conf['server']['elastic_ip']}/rssAll`
|
170
170
|
latest_build = Nokogiri::XML.parse(jenkins_rss_feed.downcase).css('feed entry:first').first
|
171
171
|
status = !!(latest_build.css("title").first.content =~ /success|stable|back to normal/)
|
@@ -176,4 +176,24 @@ namespace :ci do
|
|
176
176
|
end
|
177
177
|
status ? exit(0) : exit(1)
|
178
178
|
end
|
179
|
+
|
180
|
+
desc "Print cimonitor and ccmenu setup information"
|
181
|
+
task :info do
|
182
|
+
ci_conf_location = File.join(Dir.pwd, 'config', 'ci.yml')
|
183
|
+
ci_conf = YAML.load_file(ci_conf_location)
|
184
|
+
|
185
|
+
puts "CI Monitor Config:"
|
186
|
+
puts "\tURL:\t\thttp://#{ci_conf['server']['elastic_ip']}/job/#{ci_conf['app_name']}/rssAll"
|
187
|
+
puts "\tProject Type:\tHudson/Jenkins"
|
188
|
+
puts "\tFeed Username:\t#{ci_conf['basic_auth'][0]['username']}"
|
189
|
+
puts "\tFeed Password:\t#{ci_conf['basic_auth'][0]['password']}"
|
190
|
+
puts "\t-- Lobot Setup --"
|
191
|
+
puts "\tEC2 Instance ID:\t#{ci_conf['server']['instance_id']}"
|
192
|
+
puts "\tEC2 Elastic IP Address:\t#{ci_conf['server']['elastic_ip']}"
|
193
|
+
puts "\tEC2 Access Key ID:\t#{ci_conf['credentials']['aws_access_key_id']}"
|
194
|
+
puts "\tEC2 Secret Access Key :\t#{ci_conf['credentials']['aws_secret_access_key']}"
|
195
|
+
puts ""
|
196
|
+
puts "CC Menu Config:"
|
197
|
+
puts "\tURL:\thttp://#{ci_conf['basic_auth'][0]['username']}:#{ci_conf['basic_auth'][0]['password']}@#{ci_conf['server']['elastic_ip']}/cc.xml"
|
198
|
+
end
|
179
199
|
end
|
data/lib/lobot/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lobot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 55
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 9
|
9
|
-
-
|
10
|
-
version: 0.9.
|
9
|
+
- 6
|
10
|
+
version: 0.9.6
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Matthew Kocher & Lee Edwards
|