jenkins_pipeline_builder 0.10.2 → 0.10.3

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
- NjdkNzhhMGU3MGUyYmJhMWE4N2Y0MTJlZDFhZjNiNzg0NmQ0ZDA0Mw==
4
+ YjVmMTJkOWM4Y2Q3ZTc2N2FmMDU0MjU2NDk3YTJmNmZiYzIzMWE0Mw==
5
5
  data.tar.gz: !binary |-
6
- MDdkYTU4ODk2OGU5MTU1MjMwN2ZhZDU3NjU3NWY2YzVhZmM0MDc5Ng==
6
+ MzBhZjUyNjgwM2JmN2FhYmEwYjM1NGQ4ZDVkYTVkYzhjMDlhNWQwZQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NGI2OGRjZDVkZGFiODU0YTlkYWFkZjFmYmNjY2QwZGZhN2MwZWJhOTQwYzQ3
10
- MDBiNGZhYmQ1NmNmNTlkZjUzNWYyOTAwMjA1MDEzM2Q1YmIzOWRmZGNiMzNh
11
- OTEzOTk5YjFkZDNkNjM4YjA2M2JiYzNjYWNkMjlkYWM5YmQyNzM=
9
+ NmM2YThhNjUxMjlkOTJhODY5YjdjYmQ1Y2IzN2VjMTFmNzNhNzJkZDEyMjFh
10
+ YmE4NDQzN2QyN2M4MDY1MmM0MDg2ZGVjMTRkYTRkMzI4YWE0MDM1YTRkNzlm
11
+ Zjg4MzlkN2IxZTAwMzE0MjgzYTQwMTEzZmI5OTViOTRiZGU0MWU=
12
12
  data.tar.gz: !binary |-
13
- MjczZDM1N2IwNDZhNGQ0OGRkMzQwZTMwYjlmZDc3ZjdlZGVkZjYyYjZmZDkz
14
- ZDEwODQzZjI3NjY4MDZhYmI4MWIwMGRkZTA5OWY3OTliNWMyNTE0M2Q0OWI1
15
- ZGRkNDViM2RiYThkOGZmYjJjNTI0YjA0ZDEzMDgxYTg4YjcwMjI=
13
+ M2FmNjEyMTk4ZjUwMTA3MzZiYWFhNTAwN2RlY2I3OTBiNWY4N2Q2ODRkMDdk
14
+ NGFmZjlhMDBjNDA5MmJlZDJjMTliNDcxNTNhNDY0N2UwYjRmMGRjNjFkNDNi
15
+ NmJmMzA3ZTY3MWNhMzA1Yjg5MzM0MDAzNmNlYWMyODdkMzlhOTY=
@@ -107,11 +107,16 @@ module JenkinsPipelineBuilder
107
107
  if item.key?(:enabled) && item.key?(:parameters) && item.length == 2
108
108
  enabled_switch = resolve_value(item[:enabled], settings, job_collection)
109
109
  return [true, {}] if enabled_switch == 'false'
110
- return [false, { 'value error' => "Invalid value for #{item[:enabled]}: #{enabled_switch}" }] \
111
- if enabled_switch != 'true'
112
- item = item.merge item[:parameters]
113
- item.delete :parameters
114
- item.delete :enabled
110
+ if enabled_switch != 'true'
111
+ return [false, { 'value error' => "Invalid value for #{item[:enabled]}: #{enabled_switch}" }]
112
+ end
113
+ if item[:parameters].is_a? Hash
114
+ item = item.merge item[:parameters]
115
+ item.delete :parameters
116
+ item.delete :enabled
117
+ else
118
+ item = item[:parameters]
119
+ end
115
120
  end
116
121
  [true, item]
117
122
  end
@@ -21,5 +21,5 @@
21
21
  #
22
22
 
23
23
  module JenkinsPipelineBuilder
24
- VERSION = '0.10.2'
24
+ VERSION = '0.10.3'
25
25
  end
@@ -48,6 +48,15 @@ describe JenkinsPipelineBuilder::Compiler do
48
48
  expect(item).to eq(rootPom: 'path_to_pomasd')
49
49
  end
50
50
 
51
+ it 'generates correct new jobs when the params are a string' do
52
+ item = { enabled: '{{use1}}', parameters: 'path_to_pomasd' }
53
+ settings = { name: 'PushTest', description: 'DB Pipeline tooling', git_repo: 'git@github.roving.com:devops/DBPipeline.git', git_branch: 'master', excluded_user: 'buildmaster', hipchat_room: 'CD Builds', hipchat_auth_token: 'f3e98ed54605b36f56dd2c562e3775', discard_days: '30', discard_number: '100', maven_name: 'tools-maven-3.0.3', hipchat_jenkins_url: 'https://cd-jenkins.ad.prodcc.net/', use1: true }
54
+ job_collection = { '{{name}}-build' => { name: '{{name}}-build', type: :job, value: { name: '{{name}}-build', project_name: '{{name}}', builders: [{ maven3: { enabled: '{{use1}}', parameters: 'path_to_pomasd' } }] } }, 'global' => { name: 'global', type: :defaults, value: { name: 'global', description: 'DB Pipeline tooling', git_repo: 'git@github.roving.com:devops/DBPipeline.git', git_branch: 'master', excluded_user: 'buildmaster', hipchat_room: 'CD Builds', hipchat_auth_token: 'f3e98ed54605b36f56dd2c562e3775', discard_days: '30', discard_number: '100', maven_name: 'tools-maven-3.0.3', hipchat_jenkins_url: 'https://cd-jenkins.ad.prodcc.net/', use1: true } }, 'PushTest' => { name: 'PushTest', type: :project, value: { name: 'PushTest', hipchat_jenkins_url: 'https://cd-jenkins.ad.prodcc.net/', jobs: [{ :"{{name}}-build" => {} }] }, settings: { name: 'PushTest', description: 'DB Pipeline tooling', git_repo: 'git@github.roving.com:devops/DBPipeline.git', git_branch: 'master', excluded_user: 'buildmaster', hipchat_room: 'CD Builds', hipchat_auth_token: 'f3e98ed54605b36f56dd2c562e3775', discard_days: '30', discard_number: '100', maven_name: 'tools-maven-3.0.3', hipchat_jenkins_url: 'https://cd-jenkins.ad.prodcc.net/', use1: true } } }
55
+ success, item = compiler.handle_enable(item, settings, job_collection)
56
+ expect(success).to be true
57
+ expect(item).to eq('path_to_pomasd')
58
+ end
59
+
51
60
  it 'generates correct new jobs with false' do
52
61
  item = { enabled: '{{use1}}', parameters: { rootPom: 'path_to_pomasd' } }
53
62
  settings = { name: 'PushTest', description: 'DB Pipeline tooling', git_repo: 'git@github.roving.com:devops/DBPipeline.git', git_branch: 'master', excluded_user: 'buildmaster', hipchat_room: 'CD Builds', hipchat_auth_token: 'f3e98ed54605b36f56dd2c562e3775', discard_days: '30', discard_number: '100', maven_name: 'tools-maven-3.0.3', hipchat_jenkins_url: 'https://cd-jenkins.ad.prodcc.net/', use1: false }
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.2
4
+ version: 0.10.3
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-01-29 00:00:00.000000000 Z
12
+ date: 2015-01-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri