bellows 1.2.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,10 @@
1
+ * Mon Apr 29 2013 Dan Prince <dprince@redhat.com> - 2.0.0
2
+ - Add support for stackforge puppet modules.
3
+
4
+ This changes breaks compat with the old config file format
5
+ in that all projects must now be prefixed with their org.
6
+ Examples: openstack/nova, stackforge/puppet-nova, etc.
7
+
1
8
  * Sat Nov 3 2012 Dan Prince <dprince@redhat.com> - 1.2.0
2
9
  - Rename 'job_types' to 'comment_configs' in the config file.
3
10
  - Add 'config_template_id' to 'comment_configs' sections. This
data/README.md CHANGED
@@ -21,7 +21,6 @@ Installation
21
21
 
22
22
  config_template_ids:
23
23
  - 1
24
- - 2
25
24
 
26
25
  test_suite_ids:
27
26
  - 1
@@ -58,22 +57,20 @@ Available bellows tasks:
58
57
 
59
58
  Run bellows sync to create smokestack test configurations and update refspecs for active reviews:
60
59
 
61
- bellows sync nova
60
+ bellows sync openstack/nova
62
61
 
63
62
  Purge 'merged' reviews from SmokeStack:
64
63
 
65
- bellows purge nova
64
+ bellows purge openstack/nova
66
65
 
67
66
  Sync test suite choices for active reviews in SmokeStack (based on the selections in your .bellows.conf file):
68
67
 
69
- bellows sync nova --all
68
+ bellows sync openstack/nova --all
70
69
 
71
70
  Fire tests for reviews without results (3 at a time):
72
71
 
73
- bellows fire nova --limit=3
74
-
75
- All commands support creating and maintaining test configs for nova, glance, and keystone.
72
+ bellows fire openstack/nova --limit=3
76
73
 
77
74
  License
78
75
  -------
79
- Copyright (c) 2011-2012 Dan Prince. Copyright 2012 Red Hat Inc. See LICENSE.txt for further details.
76
+ Copyright (c) 2011-2013 Dan Prince. Copyright 2012 Red Hat Inc. See LICENSE.txt for further details.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.2.0
1
+ 2.0.0
@@ -14,11 +14,15 @@ module Bellows
14
14
  end
15
15
 
16
16
  def self.reviews(project, status="open", branch="master")
17
+ # Assume projects without a slash are 'openstack' org projects
18
+ #if not x =~ /.*\/.*/ then
19
+ # project = "openstack/#{project}"
20
+ #end
17
21
  reviews = []
18
- out=Gerrit.run_cmd(%{query status:#{status} project:openstack/#{project} branch:#{branch} limit:500 --current-patch-set --format JSON})
22
+ out=Gerrit.run_cmd(%{query status:#{status} project:#{project} branch:#{branch} limit:500 --current-patch-set --format JSON})
19
23
  out.each_line do |line|
20
24
  data = JSON.parse(line)
21
- if data['project'] and data['project'] == "openstack/#{project}" and data['branch'] and data['branch'] == branch
25
+ if data['project'] and data['project'] == "#{project}" and data['branch'] and data['branch'] == branch
22
26
  if block_given?
23
27
  yield data
24
28
  else
@@ -5,6 +5,51 @@ require 'bellows/util'
5
5
  module Bellows
6
6
  class SmokeStack
7
7
 
8
+ PROJ_REVISIONS = {
9
+ 'openstack/nova' => 'nova_revision',
10
+ 'openstack/glance' => 'glance_revision',
11
+ 'openstack/keystone' => 'keystone_revision',
12
+ 'openstack/swift' => 'swift_revision',
13
+ 'openstack/cinder' => 'cinder_revision',
14
+ 'openstack/quantum' => 'quantum_revision',
15
+ 'stackforge/puppet-nova' => 'nova_conf_module_revision',
16
+ 'stackforge/puppet-glance' => 'glance_conf_module_revision',
17
+ 'stackforge/puppet-keystone' => 'keystone_conf_module_revision',
18
+ 'stackforge/puppet-swift' => 'swift_conf_module_revision',
19
+ 'stackforge/puppet-cinder' => 'cinder_conf_module_revision',
20
+ 'stackforge/puppet-quantum' => 'quantum_conf_module_revision',
21
+ }
22
+
23
+ OBJECT_NAMES = {
24
+ 'openstack/nova' => 'nova_package_builder',
25
+ 'openstack/glance' => 'glance_package_builder',
26
+ 'openstack/keystone' => 'keystone_package_builder',
27
+ 'openstack/swift' => 'swift_package_builder',
28
+ 'openstack/cinder' => 'cinder_package_builder',
29
+ 'openstack/quantum' => 'quantum_package_builder',
30
+ 'stackforge/puppet-nova' => 'nova_config_module',
31
+ 'stackforge/puppet-glance' => 'glance_config_module',
32
+ 'stackforge/puppet-keystone' => 'keystone_config_module',
33
+ 'stackforge/puppet-swift' => 'swift_config_module',
34
+ 'stackforge/puppet-cinder' => 'cinder_config_module',
35
+ 'stackforge/puppet-quantum' => 'quantum_config_module',
36
+ }
37
+
38
+ ATTRIBUTE_NAMES = {
39
+ 'openstack/nova' => 'nova_package_builder_attributes',
40
+ 'openstack/glance' => 'glance_package_builder_attributes',
41
+ 'openstack/keystone' => 'keystone_package_builder_attributes',
42
+ 'openstack/swift' => 'swift_package_builder_attributes',
43
+ 'openstack/cinder' => 'cinder_package_builder_attributes',
44
+ 'openstack/quantum' => 'quantum_package_builder_attributes',
45
+ 'stackforge/puppet-nova' => 'nova_config_module_attributes',
46
+ 'stackforge/puppet-glance' => 'glance_config_module_attributes',
47
+ 'stackforge/puppet-keystone' => 'keystone_config_module_attributes',
48
+ 'stackforge/puppet-swift' => 'swift_config_module_attributes',
49
+ 'stackforge/puppet-cinder' => 'cinder_config_module_attributes',
50
+ 'stackforge/puppet-quantum' => 'quantum_config_module_attributes',
51
+ }
52
+
8
53
  def self.jobs()
9
54
  JSON.parse(Bellows::HTTP.get("/jobs.json?limit=99999"))
10
55
  end
@@ -17,7 +62,7 @@ module Bellows
17
62
  jobs.each do |job|
18
63
  data = job.values[0]
19
64
  Util.projects.each do |project|
20
- revision = data["#{project}_revision"]
65
+ revision = data[PROJ_REVISIONS[project]]
21
66
  if revision and revision == git_hash then
22
67
  jobs_found << job
23
68
  end
@@ -70,7 +115,8 @@ module Bellows
70
115
  data = JSON.parse(Bellows::HTTP.get("/smoke_tests.json"))
71
116
  data.each do |item|
72
117
  projects.each do |project|
73
- branch = item['smoke_test']["#{project}_package_builder"]['branch']
118
+ # core projects use this
119
+ branch = item['smoke_test'][OBJECT_NAMES[project]]['branch']
74
120
  if branch and not branch.empty? then
75
121
  tests.store(Bellows::Util.short_spec(branch), item['smoke_test'])
76
122
  end
@@ -101,9 +147,9 @@ module Bellows
101
147
 
102
148
  data = JSON.parse(Bellows::HTTP.get("/smoke_tests/#{id}.json"))
103
149
  Util.projects.each do |proj|
104
- if updates["#{proj}_package_builder"]
105
- data["smoke_test"]["#{proj}_package_builder"].merge!(updates["#{proj}_package_builder"])
106
- updates.delete("#{proj}_package_builder")
150
+ if updates[OBJECT_NAMES[proj]]
151
+ data["smoke_test"][OBJECT_NAMES[proj]].merge!(updates[OBJECT_NAMES[proj]])
152
+ updates.delete(OBJECT_NAMES[proj])
107
153
  end
108
154
  end
109
155
  data['smoke_test'].merge!(updates)
@@ -117,15 +163,15 @@ module Bellows
117
163
 
118
164
  post_data = { "smoke_test[description]" => description }
119
165
 
120
- Util.projects.each do |proj|
121
- base_name="smoke_test[#{proj}_package_builder_attributes]"
166
+ Util::ALL_PROJECTS.each do |proj|
167
+ base_name="smoke_test[#{ATTRIBUTE_NAMES[proj]}]"
122
168
  if project == proj then
123
- post_data.store("#{base_name}[url]", "https://review.openstack.org/p/openstack/#{project}")
169
+ post_data.store("#{base_name}[url]", "https://review.openstack.org/#{proj}")
124
170
  post_data.store("#{base_name}[branch]", refspec)
125
171
  post_data.store("#{base_name}[merge_trunk]", "1")
126
172
  else
127
173
  post_data.store("#{base_name}[merge_trunk]", "0")
128
- post_data.store("#{base_name}[url]", "git://github.com/openstack/#{proj}.git")
174
+ post_data.store("#{base_name}[url]", "git://github.com/#{proj}.git")
129
175
  post_data.store("#{base_name}[branch]", "master")
130
176
  end
131
177
  end
data/lib/bellows/tasks.rb CHANGED
@@ -31,13 +31,13 @@ module Bellows
31
31
  puts "Creating... " + desc
32
32
  Bellows::SmokeStack.create_smoke_test(project, desc, refspec, config_template_ids, test_suite_ids) if not test
33
33
  else
34
- if smoke_test["#{project}_package_builder"]['branch'] != refspec then
34
+ if smoke_test[Bellows::SmokeStack::OBJECT_NAMES[project]]['branch'] != refspec then
35
35
  puts "Updating... " + desc if not options[:quiet]
36
36
  puts "refspec: " + refspec if not options[:quiet]
37
- Bellows::SmokeStack.update_smoke_test(smoke_test['id'], {"#{project}_package_builder" => { "branch" => refspec}, "description" => desc, "status" => "Updated", "test_suite_ids" => test_suite_ids, "config_template_ids" => config_template_ids}) if not test
37
+ Bellows::SmokeStack.update_smoke_test(smoke_test['id'], {Bellows::SmokeStack::OBJECT_NAMES[project] => { "branch" => refspec}, "description" => desc, "status" => "Updated", "test_suite_ids" => test_suite_ids, "config_template_ids" => config_template_ids}) if not test
38
38
  elsif all then
39
39
  puts "Updating (all)... " + desc if not options[:quiet]
40
- Bellows::SmokeStack.update_smoke_test(smoke_test['id'], {"#{project}_package_builder" => { "branch" => refspec}, "description" => desc, "test_suite_ids" => test_suite_ids, "config_template_ids" => config_template_ids}) if not test
40
+ Bellows::SmokeStack.update_smoke_test(smoke_test['id'], {Bellows::SmokeStack::OBJECT_NAMES[project] => { "branch" => refspec}, "description" => desc, "test_suite_ids" => test_suite_ids, "config_template_ids" => config_template_ids}) if not test
41
41
  end
42
42
  end
43
43
  end # reviews
@@ -86,7 +86,7 @@ module Bellows
86
86
  projects.each do |project|
87
87
  data = job.values[0]
88
88
  if data
89
- revision = data["#{project}_revision"]
89
+ revision = data[Bellows::SmokeStack::PROJ_REVISIONS[project]]
90
90
  if revision and not revision.empty?
91
91
  jobs.add(revision[0,7])
92
92
  end
@@ -197,7 +197,7 @@ module Bellows
197
197
  projects = Util.projects
198
198
 
199
199
  Bellows::Gerrit.stream_events('patchset-created') do |patchset|
200
- project = patchset['change']['project'].sub(/.*\//, '')
200
+ project = patchset['change']['project']
201
201
  patch_branch = patchset['change']['branch']
202
202
  if projects.include?(project) and patch_branch == branch then
203
203
  owner = patchset['change']['owner']['name']
@@ -217,7 +217,7 @@ module Bellows
217
217
  # update existing smoke test
218
218
  puts "Updating... " + desc if not options[:quiet]
219
219
  puts "refspec: " + refspec if not options[:quiet]
220
- Bellows::SmokeStack.update_smoke_test(smoke_test['id'], {"#{project}_package_builder" => { "branch" => refspec}, "description" => desc, "status" => "Updated", "test_suite_ids" => test_suite_ids, "config_template_ids" => config_template_ids}) if not test
220
+ Bellows::SmokeStack.update_smoke_test(smoke_test['id'], {Bellows::SmokeStack::OBJECT_NAMES[project] => { "branch" => refspec}, "description" => desc, "status" => "Updated", "test_suite_ids" => test_suite_ids, "config_template_ids" => config_template_ids}) if not test
221
221
  smoke_test_id = smoke_test['id']
222
222
 
223
223
  end
data/lib/bellows/util.rb CHANGED
@@ -3,7 +3,12 @@ require 'yaml'
3
3
  module Bellows
4
4
  module Util
5
5
 
6
- DEFAULT_PROJECTS = ['nova', 'glance', 'keystone', 'swift', 'cinder', 'quantum']
6
+ CORE_PROJECTS = ['openstack/nova', 'openstack/glance', 'openstack/keystone', 'openstack/swift', 'openstack/cinder', 'openstack/quantum']
7
+
8
+ PUPPET_PROJECTS = ['stackforge/puppet-nova', 'stackforge/puppet-glance', 'stackforge/puppet-keystone', 'stackforge/puppet-swift', 'stackforge/puppet-cinder', 'stackforge/puppet-quantum']
9
+
10
+ ALL_PROJECTS = CORE_PROJECTS + PUPPET_PROJECTS
11
+
7
12
  @@configs=nil
8
13
 
9
14
  def self.load_configs
@@ -48,7 +53,7 @@ module Bellows
48
53
  configs=self.load_configs
49
54
  projects = configs['projects']
50
55
  if projects.nil? or projects.empty? then
51
- projects = DEFAULT_PROJECTS
56
+ projects = CORE_PROJECTS + PUPPET_PROJECTS
52
57
  end
53
58
  if not projects.include?(project) then
54
59
  puts "ERROR: Please specify a valid project name."
@@ -67,7 +72,7 @@ module Bellows
67
72
  configs=self.load_configs
68
73
  proj_list = configs['projects']
69
74
  if proj_list.nil? or proj_list.empty? then
70
- proj_list = DEFAULT_PROJECTS
75
+ proj_list = CORE_PROJECTS + PUPPET_PROJECTS
71
76
  end
72
77
  return proj_list
73
78
  end
@@ -17,7 +17,7 @@ glance:
17
17
  test_suite_ids:
18
18
  - 2
19
19
 
20
- nova:
20
+ openstack/nova:
21
21
  comment_configs:
22
22
  - name: job_unit_tester
23
23
  auto_approved: true
@@ -40,16 +40,16 @@ class SmokeStackTest < Test::Unit::TestCase
40
40
  assert_equal 1, Bellows::SmokeStack.comment_configs.size
41
41
 
42
42
  # there should only be 1 set for the glance project
43
- assert_equal 1, Bellows::SmokeStack.comment_configs("glance").size
43
+ assert_equal 1, Bellows::SmokeStack.comment_configs("openstack/glance").size
44
44
 
45
45
  # the nova project should have custom job types defined
46
- unit_tester_type = Bellows::SmokeStack.comment_configs("nova")[0]
46
+ unit_tester_type = Bellows::SmokeStack.comment_configs("openstack/nova")[0]
47
47
  assert_equal 'job_unit_tester', unit_tester_type['name']
48
48
  assert_equal 'Unit', unit_tester_type['description']
49
49
  assert_nil unit_tester_type['config_template_id']
50
50
  assert_equal true, unit_tester_type['auto_approved']
51
51
 
52
- puppet_vpc_type = Bellows::SmokeStack.comment_configs("nova")[1]
52
+ puppet_vpc_type = Bellows::SmokeStack.comment_configs("openstack/nova")[1]
53
53
  assert_equal 'job_puppet_vpc', puppet_vpc_type['name']
54
54
  assert_equal 3, puppet_vpc_type['config_template_id']
55
55
  assert_equal 'Libvirt (Fedora 16)', puppet_vpc_type['description']
data/test/test_task.rb CHANGED
@@ -18,7 +18,7 @@ class TaskTest < Test::Unit::TestCase
18
18
  response = mock()
19
19
  Bellows::HTTP.stubs(:post).returns(response)
20
20
  tasks = Bellows::Tasks.new
21
- tasks.fire('nova', options={:quiet => true})
21
+ tasks.fire('openstack/nova', options={:quiet => true})
22
22
 
23
23
  end
24
24
 
@@ -39,7 +39,7 @@ class TaskTest < Test::Unit::TestCase
39
39
  Bellows::HTTP.stubs(:post).returns(response)
40
40
  tasks = Bellows::Tasks.new
41
41
 
42
- tasks.comment('nova', options={:quiet => true, :cache_file => cache_file.path})
42
+ tasks.comment('openstack/nova', options={:quiet => true, :cache_file => cache_file.path})
43
43
 
44
44
  end
45
45
 
data/test/test_util.rb CHANGED
@@ -21,7 +21,7 @@ class UtilTest < Test::Unit::TestCase
21
21
  assert_equal "2", test_suite_ids[0]
22
22
 
23
23
  # ensure default configs are used for project that doesn't specify them
24
- test_suite_ids, config_template_ids = Bellows::Util.test_configs("nova")
24
+ test_suite_ids, config_template_ids = Bellows::Util.test_configs("openstack/nova")
25
25
 
26
26
  assert_equal "1", config_template_ids[0]
27
27
  assert_equal "2", config_template_ids[1]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bellows
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 2.0.0
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-11-04 00:00:00.000000000 Z
12
+ date: 2013-04-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -173,7 +173,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
173
173
  version: '0'
174
174
  segments:
175
175
  - 0
176
- hash: 2150126569573728096
176
+ hash: 221927905361736624
177
177
  required_rubygems_version: !ruby/object:Gem::Requirement
178
178
  none: false
179
179
  requirements: