evrone-ci-router 0.2.0.pre3 → 0.2.0.pre4
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.
- checksums.yaml +4 -4
- data/lib/evrone/ci/router/build.rb +0 -2
- data/lib/evrone/ci/router/build_matrix.rb +22 -5
- data/lib/evrone/ci/router/script_builder/env.rb +3 -0
- data/lib/evrone/ci/router/travis.rb +8 -2
- data/lib/evrone/ci/router/version.rb +1 -1
- data/spec/lib/build_matrix_spec.rb +19 -0
- data/spec/lib/build_spec.rb +0 -1
- data/spec/lib/travis_spec.rb +3 -3
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5f07b623520997770118ec0c990da47e9307969f
|
4
|
+
data.tar.gz: 3bd64424754d66dffb5f17e7340ddc632d003c33
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ffefbb4db637a63ac918df5aa001988f677d38a60c9af4d6735bbf23ec025150353ece55b2803be93e2e11830e7969580aa98653b1567bddd8f7d7d2953c11b1
|
7
|
+
data.tar.gz: 843ee07a50d637b045f38bcdf08621ab5dfc08991844e6fc6e5f3013a5e73e77c529e011af3b232b427790f6e089e674d821018c245cbc817ac04418c9c70d63
|
@@ -30,7 +30,6 @@ module Evrone
|
|
30
30
|
name: message.name,
|
31
31
|
src: message.src,
|
32
32
|
sha: sha,
|
33
|
-
pull_request_id: message.pull_request_id,
|
34
33
|
deploy_key: message.deploy_key,
|
35
34
|
job_id: job_id,
|
36
35
|
before_script: script_builder.to_before_script,
|
@@ -46,7 +45,6 @@ module Evrone
|
|
46
45
|
build_id: message.id,
|
47
46
|
status: status,
|
48
47
|
tm: tm.to_i,
|
49
|
-
tm_usec: tm.usec,
|
50
48
|
jobs_count: jobs_count || 0,
|
51
49
|
}
|
52
50
|
|
@@ -3,7 +3,7 @@ module Evrone
|
|
3
3
|
class Router
|
4
4
|
class BuildMatrix
|
5
5
|
|
6
|
-
KEYS = (Travis::LANGS + %w{ env }).freeze
|
6
|
+
KEYS = (Travis::LANGS + %w{ matrix_env:env }).freeze
|
7
7
|
NOT_MATRIX_KEYS = %w{ script before_script }
|
8
8
|
|
9
9
|
attr_reader :travis
|
@@ -17,16 +17,30 @@ module Evrone
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def travises
|
20
|
-
|
21
|
-
|
20
|
+
attributes_for_new_travises_with_merged_env.map do |attrs|
|
21
|
+
attrs = attrs.merge(
|
22
22
|
NOT_MATRIX_KEYS.inject({}) do |a,v|
|
23
23
|
a[v] = travis.public_send(v)
|
24
24
|
a
|
25
25
|
end
|
26
26
|
)
|
27
|
+
Travis.new attrs
|
27
28
|
end
|
28
29
|
end
|
29
30
|
|
31
|
+
def attributes_for_new_travises_with_merged_env
|
32
|
+
attrs = attributes_for_new_travises
|
33
|
+
attrs.map do |a|
|
34
|
+
e = a["env"]
|
35
|
+
a["env"] = {
|
36
|
+
"global" => Array(e) + travis.global_env,
|
37
|
+
"matrix" => e
|
38
|
+
}
|
39
|
+
a
|
40
|
+
end
|
41
|
+
attrs
|
42
|
+
end
|
43
|
+
|
30
44
|
def attributes_for_new_travises
|
31
45
|
permutate_and_build_values.inject([]) do |ac, values|
|
32
46
|
ac << values.inject({}) do |a,val|
|
@@ -56,8 +70,11 @@ module Evrone
|
|
56
70
|
|
57
71
|
def extract_pair_of_key_and_values
|
58
72
|
KEYS.map.inject([]) do |a, k|
|
59
|
-
|
60
|
-
|
73
|
+
k_method, k_name = k.split(":")
|
74
|
+
k_name ||= k_method
|
75
|
+
|
76
|
+
if (val = travis[k_method]) && !val.empty?
|
77
|
+
a << [k_name, val]
|
61
78
|
end
|
62
79
|
a
|
63
80
|
end
|
@@ -25,9 +25,11 @@ module Evrone
|
|
25
25
|
def matrix_keys
|
26
26
|
@matrix_keys ||=
|
27
27
|
BuildMatrix::KEYS.inject([]) do |a,k|
|
28
|
-
|
28
|
+
k_method, k_name = k.split(":")
|
29
|
+
k_name ||= k_method
|
30
|
+
val = send(k_method)
|
29
31
|
unless val.empty?
|
30
|
-
a << val.map{|v| "#{
|
32
|
+
a << val.map{|v| "#{k_name}:#{v}" }
|
31
33
|
end
|
32
34
|
a
|
33
35
|
end.flatten.sort
|
@@ -42,6 +44,10 @@ module Evrone
|
|
42
44
|
end
|
43
45
|
|
44
46
|
def env
|
47
|
+
attributes["env"]
|
48
|
+
end
|
49
|
+
|
50
|
+
def matrix_env
|
45
51
|
attributes["env"]["matrix"]
|
46
52
|
end
|
47
53
|
|
@@ -74,6 +74,25 @@ describe Evrone::CI::Router::BuildMatrix do
|
|
74
74
|
end
|
75
75
|
end
|
76
76
|
|
77
|
+
context "attributes_for_new_travises_with_merged_env" do
|
78
|
+
subject { matrix.attributes_for_new_travises_with_merged_env }
|
79
|
+
|
80
|
+
before do
|
81
|
+
attributes.merge!(
|
82
|
+
env: {
|
83
|
+
"global" => "FOO=1",
|
84
|
+
"matrix" => %w{ BAR=1 BAR=2 }
|
85
|
+
}
|
86
|
+
)
|
87
|
+
end
|
88
|
+
|
89
|
+
it { should have(12).items }
|
90
|
+
|
91
|
+
it "should merge matrix env to global env" do
|
92
|
+
expect(subject.map{|i| i["env"]["global"] }.uniq.sort).to eq([["BAR=1", "FOO=1"], ["BAR=2", "FOO=1"]])
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
77
96
|
context 'attributes_for_new_travises' do
|
78
97
|
subject { matrix.attributes_for_new_travises }
|
79
98
|
|
data/spec/lib/build_spec.rb
CHANGED
data/spec/lib/travis_spec.rb
CHANGED
@@ -145,17 +145,17 @@ describe Evrone::CI::Router::Travis do
|
|
145
145
|
|
146
146
|
context "when attributes[env] is Array" do
|
147
147
|
let(:env) { %w{ FOO=1 BAR=2 } }
|
148
|
-
it { should eq
|
148
|
+
it { should eq("matrix"=>["FOO=1", "BAR=2"], "global"=>[]) }
|
149
149
|
end
|
150
150
|
|
151
151
|
context "when attributes[env] is Hash" do
|
152
152
|
let(:env) { { "matrix" => %w{ BAZ=1 } } }
|
153
|
-
it { should eq
|
153
|
+
it { should eq("matrix"=>["BAZ=1"], "global"=>[]) }
|
154
154
|
end
|
155
155
|
|
156
156
|
context "when attributes[env] is empty" do
|
157
157
|
let(:env) { {} }
|
158
|
-
it { should eq([]) }
|
158
|
+
it { should eq("matrix"=>[], "global"=>[]) }
|
159
159
|
end
|
160
160
|
end
|
161
161
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: evrone-ci-router
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.0.
|
4
|
+
version: 0.2.0.pre4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dmitry Galinsky
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.2.0.
|
19
|
+
version: 0.2.0.pre4
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.2.0.
|
26
|
+
version: 0.2.0.pre4
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: evrone-ci-message
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.2.0.
|
33
|
+
version: 0.2.0.pre4
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.2.0.
|
40
|
+
version: 0.2.0.pre4
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: evrone-common-amqp
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|