jenkins_pipeline_builder 0.10.14 → 0.10.15
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZTQzMTY2NWY5YWIwYjk4Y2JjNGI5MzU3YWQ3NTk1MDNlZTJkN2ViYg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZDk5MDZjMTEzMWQ3M2UzMWRhYjRhMDAzZmQzNjZjZmU0NmZlNzZkZg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
OGJjMDZmZTQzN2QyYmIzOWIzZTJmMjU0MDNlYmRhNWFjOGQyMjZiZmQ1ZGE0
|
10
|
+
ZjNhMDdjZTU4NDkzNmI0MmVhMzM2MWFhYzkxMTcxOWZjZWViODRhMzM2MTUx
|
11
|
+
NmQwNTUyZjZlYTdjMWE1NGE3MDQzMjcxZGY0M2YzNmE3ZTY2NjM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NjhhOTAyNjg0ZmVlOWQxNzM3NDAyNDJmMzVkZTcxN2MzYWM4NTBlYWVjMmQz
|
14
|
+
ZGZjYjY2MWYyYzA5MmI0OTIzZTljZmZjNmY2ODgwMGM3ODg3Yjg1ZjE1NjUw
|
15
|
+
NDY1NmYwMTZjYzFjZWQ1ZTliNjc5NWRiZDQ2MjJhNzAwNzJlMmY=
|
@@ -69,6 +69,12 @@ module JenkinsPipelineBuilder
|
|
69
69
|
def change_name!
|
70
70
|
@project[:name] = "#{@project[:name]}-PR#{@number}" if @project[:name]
|
71
71
|
@project[:value][:name] = "#{@project[:value][:name]}-PR#{@number}" if @project[:value][:name]
|
72
|
+
|
73
|
+
return unless project[:inject_pr_into]
|
74
|
+
|
75
|
+
key = project[:inject_pr_into].to_sym
|
76
|
+
project[key] = "#{project[key]}-PR#{@number}" if project[key]
|
77
|
+
project[:value][key] = "#{project[:value][key]}-PR#{@number}" if @project[:value][key]
|
72
78
|
end
|
73
79
|
|
74
80
|
# Apply any specified changes to each job
|
@@ -22,6 +22,8 @@
|
|
22
22
|
|
23
23
|
module JenkinsPipelineBuilder
|
24
24
|
class PullRequestGenerator
|
25
|
+
class NotFound < StandardError; end
|
26
|
+
|
25
27
|
attr_reader :purge, :create, :jobs, :project, :generator, :pull_generator, :errors, :pull_requests
|
26
28
|
|
27
29
|
def initialize(project, generator)
|
@@ -123,7 +125,7 @@ module JenkinsPipelineBuilder
|
|
123
125
|
|
124
126
|
pull_job = job if job[:value][:job_type] == 'pull_request_generator'
|
125
127
|
end
|
126
|
-
fail 'No jobs of type pull_request_generator found' unless pull_job
|
128
|
+
fail NotFound, 'No jobs of type pull_request_generator found' unless pull_job
|
127
129
|
pull_job
|
128
130
|
end
|
129
131
|
|
@@ -9,9 +9,54 @@ describe JenkinsPipelineBuilder::PullRequest do
|
|
9
9
|
JenkinsPipelineBuilder.registry.registry[:job][:scm_params].clear_installed_version
|
10
10
|
end
|
11
11
|
let(:pull_request_class) { JenkinsPipelineBuilder::PullRequest }
|
12
|
-
let(:project)
|
13
|
-
|
14
|
-
|
12
|
+
let(:project) do
|
13
|
+
{
|
14
|
+
name: 'pull_req_test',
|
15
|
+
type: :project,
|
16
|
+
value: {
|
17
|
+
name: 'pull_req_test',
|
18
|
+
jobs: ['{{name}}-00', '{{name}}-10', '{{name}}-11']
|
19
|
+
}
|
20
|
+
}
|
21
|
+
end
|
22
|
+
let(:pull_request) do
|
23
|
+
{
|
24
|
+
name: '{{name}}-00',
|
25
|
+
type: :job,
|
26
|
+
name: '{{name}}-00',
|
27
|
+
job_type: 'pull_request_generator',
|
28
|
+
git_url: 'https://www.github.com/',
|
29
|
+
git_repo: 'jenkins_pipeline_builder',
|
30
|
+
git_org: 'constantcontact',
|
31
|
+
value: {
|
32
|
+
jobs: ['{{name}}-10', '{{name}}-11']
|
33
|
+
},
|
34
|
+
builders: [
|
35
|
+
{ shell_command: 'generate -v || gem install jenkins_pipeline_builder\ngenerate pipeline -c config/{{login_config}} pull_request pipeline/ {{name}}\n' }
|
36
|
+
]
|
37
|
+
}
|
38
|
+
end
|
39
|
+
let(:jobs) do
|
40
|
+
{
|
41
|
+
'{{name}}-10' => {
|
42
|
+
name: '{{name}}-10',
|
43
|
+
type: :'job-template',
|
44
|
+
value: {
|
45
|
+
name: '{{name}}-10',
|
46
|
+
description: '{{description}}',
|
47
|
+
publishers: [{ downstream: { project: '{{job@{{name}}-11}}' } }]
|
48
|
+
}
|
49
|
+
},
|
50
|
+
'{{name}}-11' => {
|
51
|
+
name: '{{name}}-11',
|
52
|
+
type: :'job-template',
|
53
|
+
value: {
|
54
|
+
name: '{{name}}-11',
|
55
|
+
description: '{{description}}'
|
56
|
+
}
|
57
|
+
}
|
58
|
+
}
|
59
|
+
end
|
15
60
|
describe '#initialize' do
|
16
61
|
it 'process pull_request' do
|
17
62
|
pull = pull_request_class.new(project, 2, jobs, pull_request)
|
@@ -44,4 +89,62 @@ describe JenkinsPipelineBuilder::PullRequest do
|
|
44
89
|
expect(pull.jobs).to eq(post_jobs)
|
45
90
|
end
|
46
91
|
end
|
92
|
+
|
93
|
+
context 'when the job does not have {{name}} in it' do
|
94
|
+
let(:project) do
|
95
|
+
{
|
96
|
+
name: 'pull_req_test',
|
97
|
+
type: :project,
|
98
|
+
inject_pr_into: :app_name,
|
99
|
+
app_name: 'my_app',
|
100
|
+
value: {
|
101
|
+
name: 'pull_req_test',
|
102
|
+
app_name: 'my_app',
|
103
|
+
jobs: ['{{app_name}}-00', '{{app_name}}-10', '{{app_name}}-11']
|
104
|
+
}
|
105
|
+
}
|
106
|
+
end
|
107
|
+
let(:pull_request) do
|
108
|
+
{
|
109
|
+
name: '{{name}}-00',
|
110
|
+
type: :pull_request_generator,
|
111
|
+
job_type: 'pull_request_generator',
|
112
|
+
git_url: 'https://www.github.com/',
|
113
|
+
git_repo: 'jenkins_pipeline_builder',
|
114
|
+
git_org: 'constantcontact',
|
115
|
+
value: {
|
116
|
+
jobs: ['{{app_name}}-10', '{{app_name}}-11']
|
117
|
+
},
|
118
|
+
builders: [
|
119
|
+
{ shell_command: 'generate -v || gem install jenkins_pipeline_builder\ngenerate pipeline -c config/{{login_config}} pull_request pipeline/ {{name}}\n' }
|
120
|
+
]
|
121
|
+
}
|
122
|
+
end
|
123
|
+
let(:jobs) do
|
124
|
+
{
|
125
|
+
'{{app_name}}-10' => {
|
126
|
+
name: '{{app_name}}-10',
|
127
|
+
type: :'job-template',
|
128
|
+
value: {
|
129
|
+
name: '{{app_name}}-10',
|
130
|
+
description: '{{description}}',
|
131
|
+
publishers: [{ downstream: { project: '{{job@{{name}}-11}}' } }]
|
132
|
+
}
|
133
|
+
},
|
134
|
+
'{{app_name}}-11' => {
|
135
|
+
name: '{{app_name}}-11',
|
136
|
+
type: :'job-template',
|
137
|
+
value: {
|
138
|
+
name: '{{app_name}}-11',
|
139
|
+
description: '{{description}}'
|
140
|
+
}
|
141
|
+
}
|
142
|
+
}
|
143
|
+
end
|
144
|
+
it 'injects the pr number into the job name when told to' do
|
145
|
+
pull = pull_request_class.new project, 2, jobs, pull_request
|
146
|
+
expect(pull.project[:app_name]).to eq 'my_app-PR2'
|
147
|
+
expect(pull.project[:value][:app_name]).to eq 'my_app-PR2'
|
148
|
+
end
|
149
|
+
end
|
47
150
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jenkins_pipeline_builder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Igor Moochnick
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-04-
|
12
|
+
date: 2015-04-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|