solano 1.31.10 → 1.31.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4da4f4f8e4baaad65f0c1fb3e25ae8d4c8c0e918
4
- data.tar.gz: e1e8e5945dc15ad77b3d96f0e62266e3abcf309e
3
+ metadata.gz: 0e3f777963ff4ba7d7d29a648d8381f9133ac8a8
4
+ data.tar.gz: f975a434acb278412e4c91d24310a36961818ef2
5
5
  SHA512:
6
- metadata.gz: 6edb2b435228c1608bb27251b8181934c8c7fb81a338bd4a2bda544277edeed3e3911644385bc5092e326ea939b97e125ae2c0d1cd5b85a1aa011521427e1227
7
- data.tar.gz: cd3f377c98c6e731ee7082c4b4ea2fee032d678c4a4f244aa5a91747b5f23bf9c3363f4567d6a90c842316f7e9f5a5882f7540d7c58827d089a36f41b63ad5cb
6
+ metadata.gz: 4891443cf77f11d21b08e193e2a59af67648129b0a525a3572514e256d4193932f6f720075dd373921533df2326f7eb18b40effa577dbc3a55c0428cd1979c23
7
+ data.tar.gz: 4b77d4b6ded750aab37667a20993429af93c53d8b3c76d59d446e9c8d9211ee837740855bb55d5f0980d8ec648862654ca47845e608ca86a7a574944d440c08b
@@ -10,6 +10,7 @@ module Solano
10
10
  method_option :force, :type=>:boolean, :default => false
11
11
  method_option :profile, :type => :string, :default => nil, :aliases => %w(--profile-name)
12
12
  method_option :queue, :type => :string, :default => nil
13
+ method_option :pipeline, type: :string, default: nil
13
14
  def rerun(session_id=nil)
14
15
  params = {:scm => true, :repo => false}
15
16
  if session_id.nil? then
@@ -38,6 +39,7 @@ module Solano
38
39
  cmd += " --force" if options[:force]
39
40
  cmd += " --profile=#{profile}" if profile
40
41
  cmd += " --queue=#{options[:queue]}" if options[:queue]
42
+ cmd += " --pipeline=#{options[:pipeline]}" if options[:pipeline]
41
43
  cmd += " #{tests.join(" ")}"
42
44
 
43
45
  say cmd
@@ -49,7 +51,7 @@ module Solano
49
51
  def session_id_for_current_suite
50
52
  return unless suite_for_current_branch?
51
53
  suite_params = {
52
- :suite_id => @solano_api.current_suite_id,
54
+ :suite_id => calc_current_suite_id,
53
55
  :active => false,
54
56
  :limit => 1,
55
57
  :origin => %w(ci cli)
@@ -27,15 +27,26 @@ module Solano
27
27
  method_option :default_branch, :type => :string, :default => nil
28
28
  method_option :force_snapshot, :type => :boolean, :default => false
29
29
  method_option :volume, :type => :string, :default => nil
30
+ method_option :pipeline, type: :string, default: nil
30
31
  def spec(*pattern)
31
32
  machine_data = {}
32
33
 
33
34
  solano_setup({:repo => true})
34
35
 
35
- suite_auto_configure unless options[:machine]
36
+ unless options[:pipeline]
37
+ suites = @solano_api.get_suites.select { |suite| suite['repo_url'] == @scm.origin_url }
38
+ repo_names = suites.map { |suite| suite['repo_name'] }.uniq
39
+ if repo_names.count > 1
40
+ say "You already have pipelines with url: #{@scm.origin_url}"
41
+ repo_names.each { |repo_name| say " " + repo_name }
42
+ exit_failure "You must specify an pipeline by passing the --pipeline option."
43
+ end
44
+ end
36
45
 
46
+ suite_auto_configure unless options[:machine]
37
47
  exit_failure unless suite_for_current_branch?
38
48
 
49
+ suite_id = calc_current_suite_id
39
50
  if !options[:machine] && @solano_api.get_keys.empty? then
40
51
  warn(Text::Warning::NO_SSH_KEY)
41
52
  end
@@ -81,9 +92,9 @@ module Solano
81
92
  end
82
93
 
83
94
  # Call the API to get the suite and its tests
84
- suite_details = @solano_api.get_suite_by_id(@solano_api.current_suite_id,
85
- :session_id => options[:session_id])
86
95
 
96
+ suite_details = @solano_api.get_suite_by_id(suite_id,
97
+ :session_id => options[:session_id])
87
98
  start_time = Time.now
88
99
 
89
100
  new_session_params = {
@@ -135,7 +146,7 @@ module Solano
135
146
  session_data = if session_id && session_id > 0
136
147
  @solano_api.update_session(session_id, new_session_params)
137
148
  else
138
- sess, manager = @solano_api.create_session(@solano_api.current_suite_id, new_session_params)
149
+ sess, manager = @solano_api.create_session(suite_id, new_session_params)
139
150
  sess
140
151
  end
141
152
 
@@ -186,7 +197,7 @@ module Solano
186
197
  machine_data[:session_id] = session_id
187
198
 
188
199
  # Register the tests
189
- @solano_api.register_session(session_id, @solano_api.current_suite_id, test_pattern, test_exclude_pattern)
200
+ @solano_api.register_session(session_id, suite_id, test_pattern, test_exclude_pattern)
190
201
 
191
202
  # Start the tests
192
203
  start_test_executions = @solano_api.start_session(session_id, test_execution_params)
@@ -290,7 +301,7 @@ module Solano
290
301
  say Text::Process::SUMMARY_STATUS % session_status
291
302
  say ""
292
303
 
293
- suite = suite_details.merge({"id" => @solano_api.current_suite_id})
304
+ suite = suite_details.merge({"id" => suite_id})
294
305
  @api_config.set_suite(suite)
295
306
  @api_config.write_config
296
307
 
@@ -9,6 +9,7 @@ module Solano
9
9
  method_option :commit, :type => :string, :default => nil
10
10
  method_option :account, :type => :string, :default => nil,
11
11
  :aliases => %w(--org --organization)
12
+ method_option :pipeline, type: :string, default: nil
12
13
  def status
13
14
  solano_setup({:repo => true})
14
15
 
@@ -16,9 +17,8 @@ module Solano
16
17
  # solano_setup asserts that we're in a supported SCM repo
17
18
  origin_url = @scm.origin_url
18
19
  repo_params = {
19
- :active => true,
20
- :repo_url => origin_url
21
- }
20
+ :active => true
21
+ }
22
22
 
23
23
  if suite_for_current_branch? then
24
24
  status_branch = @solano_api.current_branch
@@ -40,7 +40,12 @@ module Solano
40
40
  suite_params[:last_commit_id] = options[:commit]
41
41
  end
42
42
 
43
- suites = @solano_api.get_suites(:repo_url => origin_url, :branch => status_branch)
43
+ if options[:pipeline]
44
+ suites = @solano_api.get_suites(:branch => status_branch).select { |s| s['repo_name'] == options[:pipeline] }
45
+ else
46
+ suites = @solano_api.get_suites(:repo_url => origin_url, :branch => status_branch)
47
+ end
48
+
44
49
  if suites.count == 0
45
50
  exit_failure Text::Error::CANT_FIND_SUITE % [origin_url, status_branch]
46
51
  elsif suites.count > 1
@@ -59,6 +64,7 @@ module Solano
59
64
  end
60
65
 
61
66
  suite_params[:suite_id] = suites.first['id']
67
+ repo_params[:suite_id] = suites.first['id']
62
68
 
63
69
  if options[:json]
64
70
  res = {}
@@ -23,15 +23,14 @@ module Solano
23
23
  # Did the user set a configuration option on the command line?
24
24
  # If so, auto-configure a new suite and re-configure an existing one
25
25
  user_config = options.member?(:tool)
26
-
27
- current_suite_id = @solano_api.current_suite_id
26
+ current_suite_id = calc_current_suite_id
28
27
  if current_suite_id && !user_config then
29
28
  current_suite = @solano_api.get_suite_by_id(current_suite_id)
30
29
  else
31
30
  params = Hash.new
32
31
  params[:branch] = @scm.current_branch
33
32
  params[:repo_url] = @scm.origin_url
34
- params[:repo_name] = @scm.repo_name
33
+ params[:repo_name] = options[:pipeline] || @scm.repo_name
35
34
  params[:scm] = @scm.scm_name
36
35
  if options[:account] && !params.member?(:account_id) then
37
36
  account_id = @solano_api.get_account_id(options[:account])
@@ -63,8 +62,22 @@ module Solano
63
62
  details
64
63
  end
65
64
 
65
+ def calc_current_suite_id
66
+ if options[:pipeline] && options[:account]
67
+ suites = @solano_api.get_suites.select { |s| s['repo_name'] == options[:pipeline] && s['account'] == options[:account] }
68
+ suite = suites.select { |s| s['branch'] == @scm.current_branch }.first
69
+ suite ? suite['id'] : nil
70
+ elsif options[:pipeline]
71
+ suites = @solano_api.get_suites.select { |s| s['repo_name'] == options[:pipeline] }
72
+ suite = suites.select { |s| s['branch'] == @scm.current_branch }.first
73
+ suite ? suite['id'] : nil
74
+ else
75
+ @solano_api.current_suite_id
76
+ end
77
+ end
78
+
66
79
  def suite_for_current_branch?
67
- return true if @solano_api.current_suite_id
80
+ return true if calc_current_suite_id
68
81
  say Text::Error::NO_SUITE_EXISTS % @scm.current_branch
69
82
  false
70
83
  end
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2011-2017 Solano Labs All Rights Reserved
2
2
 
3
3
  module Solano
4
- VERSION = "1.31.10"
4
+ VERSION = "1.31.11"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solano
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.31.10
4
+ version: 1.31.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - GE Digital LLC
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-11-28 00:00:00.000000000 Z
11
+ date: 2019-05-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -411,7 +411,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
411
411
  version: '0'
412
412
  requirements: []
413
413
  rubyforge_project:
414
- rubygems_version: 2.6.14.1
414
+ rubygems_version: 2.6.11
415
415
  signing_key:
416
416
  specification_version: 4
417
417
  summary: Run tests in Predix CI Hosted Test Environment