jenkins_pipeline_builder 0.13.0 → 0.13.1
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
|
+
M2I2YjcyZjFkOWFhOWRjOGNmNzlmNDgwYjNhODM5MGU5ZWFiNDI4Nw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZmY1YWRiNjk3NTIxMjk5MzU0YjQyY2YwOWZhODg0NTM2OWQ0ZjQ3MQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NTFiMzZhNTJiYTQ3ZDg4YmFmZWZlODA2MDBkYzhjMzgxZjUzZjljOGUzNThh
|
10
|
+
YzZlNGNlN2YzNWUxZWU4MTE4YjgzNTkzNmE4MTcyMmVlOGU2ZWYwZjU1MDY4
|
11
|
+
OTA3YmJiZTcwNjU5ZmUyMDg2NDIzNzNmODRiNDJkNDMwNTA3Yzg=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZDQ2OWY1YWJlOTllNjE1NmQyZTM1MjBiMjI0Mzc2YTBkNzM5ZjhkZjJhODNk
|
14
|
+
MDcyZWI3YmM1ZmJlZDBmMWNmMDUyMTY3MzAxOGRiY2FhYjlkMGNjOTRhNzNh
|
15
|
+
Y2I5NTI2MDAzZTAzMjQzMWU0NjAxZmMyMmU3YTlkMjZjNzhhMmM=
|
@@ -25,7 +25,7 @@ module JenkinsPipelineBuilder
|
|
25
25
|
attr_accessor :open_prs, :application_name
|
26
26
|
|
27
27
|
def initialize(defaults = {})
|
28
|
-
@application_name = defaults[:application_name]
|
28
|
+
@application_name = defaults[:application_name] || fail('Please set "application_name" in your project!')
|
29
29
|
@open_prs = active_prs defaults[:github_site], defaults[:git_org], defaults[:git_repo_name]
|
30
30
|
end
|
31
31
|
|
@@ -36,7 +36,7 @@ module JenkinsPipelineBuilder
|
|
36
36
|
|
37
37
|
def delete_closed_prs
|
38
38
|
return if JenkinsPipelineBuilder.debug
|
39
|
-
jobs_to_delete = JenkinsPipelineBuilder.client.job.list "
|
39
|
+
jobs_to_delete = JenkinsPipelineBuilder.client.job.list "^#{application_name}-PR.*"
|
40
40
|
open_prs.each do |n|
|
41
41
|
jobs_to_delete.reject! { |j| j.start_with? "#{application_name}-PR#{n}" }
|
42
42
|
end
|
@@ -31,6 +31,11 @@ describe JenkinsPipelineBuilder::PullRequestGenerator do
|
|
31
31
|
JenkinsPipelineBuilder::PullRequestGenerator.new(application_name: 'name')
|
32
32
|
end.to raise_error('Please set github_site, git_org and git_repo_name in your project.')
|
33
33
|
end
|
34
|
+
it 'fails when application_name is not set' do
|
35
|
+
expect do
|
36
|
+
JenkinsPipelineBuilder::PullRequestGenerator.new(github_site: 'foo', git_org: 'bar', git_repo_name: 'baz')
|
37
|
+
end.to raise_error('Please set "application_name" in your project!')
|
38
|
+
end
|
34
39
|
it 'fails when github is not reponding properly' do
|
35
40
|
stub_request(:get, url)
|
36
41
|
.with(headers: { 'Accept' => '*/*',
|
@@ -51,7 +56,7 @@ describe JenkinsPipelineBuilder::PullRequestGenerator do
|
|
51
56
|
'User-Agent' => 'Ruby' })
|
52
57
|
.to_return(status: 200, body: open_prs_json, headers: {})
|
53
58
|
job = double('job')
|
54
|
-
expect(job).to receive(:list).with("
|
59
|
+
expect(job).to receive(:list).with("^#{application_name}-PR.*").and_return prs
|
55
60
|
client = double('client', job: job)
|
56
61
|
expect(JenkinsPipelineBuilder).to receive(:debug).and_return false
|
57
62
|
allow(JenkinsPipelineBuilder).to receive(:client).and_return client
|
@@ -67,7 +72,7 @@ describe JenkinsPipelineBuilder::PullRequestGenerator do
|
|
67
72
|
'User-Agent' => 'Ruby' })
|
68
73
|
.to_return(status: 200, body: open_prs_json, headers: {})
|
69
74
|
job = double('job')
|
70
|
-
expect(job).to receive(:list).with("
|
75
|
+
expect(job).to receive(:list).with("^#{application_name}-PR.*").and_return prs - closed_prs
|
71
76
|
client = double('client', job: job)
|
72
77
|
expect(JenkinsPipelineBuilder).to receive(:debug).and_return false
|
73
78
|
allow(JenkinsPipelineBuilder).to receive(:client).and_return client
|
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.13.
|
4
|
+
version: 0.13.1
|
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-11-
|
12
|
+
date: 2015-11-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|