jenkins_pipeline_builder 0.6.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (29) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +3 -11
  3. data/README.md +19 -29
  4. data/commit_build.sh +1 -4
  5. data/lib/jenkins_pipeline_builder.rb +9 -13
  6. data/lib/jenkins_pipeline_builder/cli/describe.rb +14 -5
  7. data/lib/jenkins_pipeline_builder/cli/helper.rb +2 -0
  8. data/lib/jenkins_pipeline_builder/cli/list.rb +11 -4
  9. data/lib/jenkins_pipeline_builder/extensions.rb +151 -40
  10. data/lib/jenkins_pipeline_builder/{builders.rb → extensions/builders.rb} +22 -15
  11. data/lib/jenkins_pipeline_builder/{job_builder.rb → extensions/job_attributes.rb} +37 -27
  12. data/lib/jenkins_pipeline_builder/{publishers.rb → extensions/publishers.rb} +55 -20
  13. data/lib/jenkins_pipeline_builder/{triggers.rb → extensions/triggers.rb} +18 -8
  14. data/lib/jenkins_pipeline_builder/{wrappers.rb → extensions/wrappers.rb} +23 -36
  15. data/lib/jenkins_pipeline_builder/generator.rb +29 -62
  16. data/lib/jenkins_pipeline_builder/module_registry.rb +21 -9
  17. data/lib/jenkins_pipeline_builder/pull_request.rb +1 -1
  18. data/lib/jenkins_pipeline_builder/version.rb +1 -1
  19. data/pipeline/Jenkins-Pipeline-Builder.yaml +3 -7
  20. data/pipeline/project.yaml +10 -0
  21. data/spec/lib/jenkins_pipeline_builder/compiler_spec.rb +9 -1
  22. data/spec/lib/jenkins_pipeline_builder/extensions/builders_spec.rb +53 -0
  23. data/spec/lib/jenkins_pipeline_builder/extensions/publishers_spec.rb +140 -0
  24. data/spec/lib/jenkins_pipeline_builder/extensions_spec.rb +113 -31
  25. data/spec/lib/jenkins_pipeline_builder/generator_spec.rb +12 -4
  26. data/spec/lib/jenkins_pipeline_builder/module_registry_spec.rb +202 -44
  27. data/spec/lib/jenkins_pipeline_builder/spec_helper.rb +5 -5
  28. data/spec/requests/pipeline_spec.rb +20 -0
  29. metadata +16 -7
@@ -21,8 +21,9 @@
21
21
 
22
22
  builder do
23
23
  name :multi_job
24
- plugin_id 123
25
- min_version 0
24
+ plugin_id 'jenkins-multijob-plugin'
25
+ description 'This plugin, created by Tikal ALM team, gives the option to define complex and hierarchical jobs structure in Jenkins.'
26
+ jenkins_name 'MultiJob Phase'
26
27
  announced false
27
28
 
28
29
  xml do |params|
@@ -39,7 +40,7 @@ builder do
39
40
  configs do
40
41
  if job[:config].key? :predefined_build_parameters
41
42
  send('hudson.plugins.parameterizedtrigger.PredefinedBuildParameters') do
42
- properties job[:config][:predefined_build_parameters].join "\n"
43
+ properties job[:config][:predefined_build_parameters]
43
44
  end
44
45
  end
45
46
  end
@@ -55,8 +56,9 @@ end
55
56
 
56
57
  builder do
57
58
  name :maven3
58
- plugin_id 123
59
- min_version 0
59
+ plugin_id 'maven-plugin'
60
+ description 'Jenkins plugin for building Maven 2/3 jobs via a special project type.'
61
+ jenkins_name 'Invoke Maven 3'
60
62
  announced false
61
63
 
62
64
  xml do |params|
@@ -71,8 +73,9 @@ end
71
73
 
72
74
  builder do
73
75
  name :shell_command
74
- plugin_id 123
75
- min_version 0
76
+ plugin_id 'builtin'
77
+ description 'Lets you run shell commands as a build step.'
78
+ jenkins_name 'Execute shell'
76
79
  announced false
77
80
 
78
81
  xml do |param|
@@ -84,8 +87,9 @@ end
84
87
 
85
88
  builder do
86
89
  name :inject_vars_file
87
- plugin_id 123
88
- min_version 0
90
+ plugin_id 'envinject'
91
+ description 'This plugin makes it possible to have an isolated environment for your jobs.'
92
+ jenkins_name 'Inject environment variables'
89
93
  announced false
90
94
 
91
95
  xml do |params|
@@ -99,8 +103,9 @@ end
99
103
 
100
104
  builder do
101
105
  name :blocking_downstream
102
- plugin_id 123
103
- min_version 0
106
+ plugin_id 'parameterized-trigger'
107
+ description 'This plugin lets you trigger new builds when your build has completed, with various ways of specifying parameters for the new build.'
108
+ jenkins_name 'Trigger/call builds on other projects'
104
109
  announced false
105
110
 
106
111
  xml do |params|
@@ -167,8 +172,9 @@ end
167
172
 
168
173
  builder do
169
174
  name :remote_job
170
- plugin_id 123
171
- min_version 0
175
+ plugin_id 'Parameterized-Remote-Trigger'
176
+ description 'A plugin for Jenkins CI that gives you the ability to trigger parameterized builds on a remote Jenkins server as part of your build.'
177
+ jenkins_name 'Trigger a remote parameterized job'
172
178
  announced false
173
179
 
174
180
  xml do |params|
@@ -220,8 +226,9 @@ end
220
226
 
221
227
  builder do
222
228
  name :copy_artifact
223
- plugin_id 123
224
- min_version 0
229
+ plugin_id 'copyartifact'
230
+ description 'Adds a build step to copy artifacts from another project. The plugin lets you specify which build to copy artifacts from (e.g. the last successful/stable build, by build number, or by a build parameter). You can also control the copying process by filtering the files being copied, specifying a destination directory within the target project, etc. Click the help icon on each field to learn the details, such as selecting Maven or multiconfiguration projects or using build parameters. You can also copy from the workspace of the latest completed build of the source project, instead of its artifacts. All artifacts copied are automatically fingerprinted for you.'
231
+ jenkins_name 'Copy artifacts from another project'
225
232
  announced false
226
233
 
227
234
  xml do |params|
@@ -22,23 +22,26 @@
22
22
 
23
23
  job_attribute do
24
24
  name :description
25
- plugin_id 123
26
- min_version 0
25
+ plugin_id 'builtin'
26
+ description 'This is the description of your job.'
27
+ jenkins_name 'Description'
27
28
  announced false
28
29
 
29
30
  before do
30
31
  xpath('//project/description').remove
31
32
  end
32
33
 
33
- xml('//project') do |description|
34
+ xml path: '//project' do |description|
34
35
  description "#{description}"
35
36
  end
36
37
  end
37
38
 
38
39
  job_attribute do
39
40
  name :scm_params
40
- plugin_id 123
41
- min_version 0
41
+ plugin_id 'git'
42
+ description 'NOTE: This only supports git currently, the following is the description for the git plugin.
43
+ This plugin allows use of Git as a build SCM. A recent Git runtime is required (1.7.9 minimum, 1.8.x recommended). Plugin is only tested on official git client. Use exotic installations at your own risks.'
44
+ jenkins_name "Git (inside 'Source Code Management')"
42
45
  announced false
43
46
 
44
47
  # XML preprocessing
@@ -58,7 +61,7 @@ job_attribute do
58
61
 
59
62
  end
60
63
 
61
- xml '//scm' do |params|
64
+ xml path: '//scm' do |params|
62
65
  localBranch params[:local_branch] if params[:local_branch]
63
66
  recursiveSubmodules params[:recursive_update] if params[:recursive_update]
64
67
  wipeOutWorkspace params[:wipe_workspace] if params[:wipe_workspace]
@@ -85,11 +88,12 @@ end
85
88
 
86
89
  job_attribute do
87
90
  name :hipchat
88
- plugin_id 123
89
- min_version 0
91
+ plugin_id 'hipchat'
92
+ description 'This plugin allows your team to setup build notifications to be sent to HipChat rooms.'
93
+ jenkins_name 'HipChat Notifications'
90
94
  announced false
91
95
 
92
- xml '//properties' do |params|
96
+ xml path: '//properties' do |params|
93
97
  fail 'No HipChat room specified' unless params[:room]
94
98
 
95
99
  send('jenkins.plugins.hipchat.HipChatNotifier_-HipChatJobProperty') do
@@ -101,11 +105,12 @@ end
101
105
 
102
106
  job_attribute do
103
107
  name :priority
104
- plugin_id 123
105
- min_version 0
108
+ plugin_id 'PrioritySorter'
109
+ description 'This plugin adds the ability to assign different priorities to Jobs, the lower priority the job has the sooner the Job will run.'
110
+ jenkins_name 'Use specific priority for this Job'
106
111
  announced false
107
112
 
108
- xml '//properties' do |params|
113
+ xml path: '//properties' do |params|
109
114
  send('jenkins.advancedqueue.AdvancedQueueSorterJobProperty', 'plugin' => 'PrioritySorter') do
110
115
  useJobPriority params[:use_priority]
111
116
  priority params[:job_priority] || -1
@@ -115,11 +120,12 @@ end
115
120
 
116
121
  job_attribute do
117
122
  name :parameters
118
- plugin_id 123
119
- min_version 0
123
+ plugin_id 'builtin'
124
+ description 'Allows the job to take parameters.'
125
+ jenkins_name 'This build is parameterized'
120
126
  announced false
121
127
 
122
- xml '//properties' do |params|
128
+ xml path: '//properties' do |params|
123
129
  send('hudson.model.ParametersDefinitionProperty') do
124
130
  parameterDefinitions do
125
131
  params.each do |param|
@@ -160,11 +166,12 @@ end
160
166
 
161
167
  job_attribute do
162
168
  name :discard_old
163
- plugin_id 123
164
- min_version 0
169
+ plugin_id 'builtin'
170
+ description 'Allows you to discard old builds.'
171
+ jenkins_name 'Discard Old Builds'
165
172
  announced false
166
173
 
167
- xml '//project' do |params|
174
+ xml path: '//project' do |params|
168
175
  send('logRotator', 'class' => 'hudson.tasks.LogRotator') do
169
176
  daysToKeep params[:days] if params[:days]
170
177
  numToKeep params[:number] || -1
@@ -176,11 +183,12 @@ end
176
183
 
177
184
  job_attribute do
178
185
  name :throttle
179
- plugin_id 100
180
- min_version 0
186
+ plugin_id 'throttle-concurrents'
187
+ description 'This plugin allows for throttling the number of concurrent builds of a project running per node or globally.'
188
+ jenkins_name 'Throttle Concurrent Builds'
181
189
  announced false
182
190
 
183
- xml '//properties' do |params|
191
+ xml path: '//properties' do |params|
184
192
  cat_set = params[:option] == 'category'
185
193
  send('hudson.plugins.throttleconcurrents.ThrottleJobProperty', 'plugin' => 'throttle-concurrents') do
186
194
  maxConcurrentPerNode params[:max_per_node] || 0
@@ -196,11 +204,12 @@ end
196
204
 
197
205
  job_attribute do
198
206
  name :prepare_environment
199
- plugin_id 123
200
- min_version 0
207
+ plugin_id 'envinject'
208
+ description 'This plugin makes it possible to have an isolated environment for your jobs.'
209
+ jenkins_name 'Prepare an environment for the run'
201
210
  announced false
202
211
 
203
- xml '//properties' do |params|
212
+ xml path: '//properties' do |params|
204
213
  send('EnvInjectJobProperty') do
205
214
  info do
206
215
  propertiesContent params[:properties_content] if params[:properties_content]
@@ -215,11 +224,12 @@ end
215
224
 
216
225
  job_attribute do
217
226
  name :concurrent_build
218
- plugin_id 123
219
- min_version 0
227
+ plugin_id 'builtin'
228
+ description 'Allows toggling of concurrent builds.'
229
+ jenkins_name 'Execute concurrent builds if necessary'
220
230
  announced false
221
231
 
222
- xml '//concurrentBuild' do |params|
232
+ xml path: '//concurrentBuild' do |params|
223
233
  (params == true) ? 'true' : 'false'
224
234
  end
225
235
  end
@@ -21,8 +21,9 @@
21
21
 
22
22
  publisher do
23
23
  name :description_setter
24
- plugin_id 123
25
- min_version 0
24
+ plugin_id 'description-setter'
25
+ description 'This plugin sets the description for each build, based upon a RegEx test of the build log file.'
26
+ jenkins_name 'Set build description'
26
27
  announced false
27
28
 
28
29
  xml do |params|
@@ -38,8 +39,9 @@ end
38
39
 
39
40
  publisher do
40
41
  name :downstream
41
- plugin_id 123
42
- min_version 0
42
+ plugin_id 'parameterized-trigger'
43
+ description 'This plugin lets you trigger new builds when your build has completed, with various ways of specifying parameters for the new build.'
44
+ jenkins_name 'Trigger parameterized build on other projects'
43
45
  announced false
44
46
 
45
47
  xml do |params|
@@ -73,8 +75,9 @@ end
73
75
 
74
76
  publisher do
75
77
  name :hipchat
76
- plugin_id 101
77
- min_version 0
78
+ plugin_id 'hipchat'
79
+ description 'This plugin allows your team to setup build notifications to be sent to HipChat rooms.'
80
+ jenkins_name 'HipChat Notifications'
78
81
  announced false
79
82
 
80
83
  xml do |params|
@@ -89,8 +92,9 @@ end
89
92
 
90
93
  publisher do
91
94
  name :git
92
- plugin_id 123
93
- min_version 0
95
+ plugin_id 'git'
96
+ description 'This plugin allows use of Git as a build SCM. A recent Git runtime is required (1.7.9 minimum, 1.8.x recommended). Plugin is only tested on official git client. Use exotic installations at your own risks.'
97
+ jenkins_name 'Git Publisher'
94
98
  announced false
95
99
 
96
100
  xml do |params|
@@ -110,8 +114,9 @@ end
110
114
 
111
115
  publisher do
112
116
  name :junit_result
113
- plugin_id 123
114
- min_version 0
117
+ plugin_id 'builtin'
118
+ description 'Archives your test results?'
119
+ jenkins_name 'Publish JUnit test result report'
115
120
  announced false
116
121
 
117
122
  xml do |params|
@@ -125,8 +130,9 @@ end
125
130
 
126
131
  publisher do
127
132
  name :coverage_result
128
- plugin_id 123
129
- min_version 0
133
+ plugin_id 'rubyMetrics'
134
+ description 'Ruby metric reports for Jenkins. Rcov, Rails stats, Rails notes and Flog.'
135
+ jenkins_name 'Publish Rcov report'
130
136
  announced false
131
137
 
132
138
  xml do |params|
@@ -148,8 +154,9 @@ end
148
154
 
149
155
  publisher do
150
156
  name :post_build_script
151
- plugin_id 123
152
- min_version 0
157
+ plugin_id 'postbuildscript'
158
+ description 'PostBuildScript makes it possible to execute a set of scripts at the end of the build.'
159
+ jenkins_name 'Execute a set of scripts'
153
160
  announced false
154
161
 
155
162
  xml do |params|
@@ -170,8 +177,9 @@ end
170
177
 
171
178
  publisher do
172
179
  name :groovy_postbuild
173
- plugin_id 123
174
- min_version 0
180
+ plugin_id 'groovy-postbuild'
181
+ description 'This plugin executes a groovy script in the Jenkins JVM. Typically, the script checks some conditions and changes accordingly the build result, puts badges next to the build in the build history and/or displays information on the build summary page.'
182
+ jenkins_name 'Groovy Postbuild'
175
183
  announced false
176
184
 
177
185
  xml do |params|
@@ -192,8 +200,9 @@ end
192
200
 
193
201
  publisher do
194
202
  name :archive_artifact
195
- plugin_id 123
196
- min_version 0
203
+ plugin_id 'builtin'
204
+ description 'Archives artifacts'
205
+ jenkins_name 'Archive the artifacts'
197
206
  announced false
198
207
 
199
208
  xml do |params|
@@ -209,8 +218,9 @@ end
209
218
 
210
219
  publisher do
211
220
  name :email_notifications
212
- plugin_id 123
213
- min_version 0
221
+ plugin_id 'mailer'
222
+ description 'This plugin allows you to configure email notifications. This is a break-out of the original core based email component.'
223
+ jenkins_name 'E-mail Notification'
214
224
  announced false
215
225
 
216
226
  xml do |params|
@@ -223,3 +233,28 @@ publisher do
223
233
  end
224
234
  end
225
235
  end
236
+
237
+ publisher do
238
+ name :sonar_result
239
+ plugin_id 'sonar'
240
+ description 'The plugin allows you to trigger SonarQube analysis from Jenkins using either a:
241
+ * Build step to trigger the analysis with the SonarQube Runner
242
+ * Post-build action to trigger the analysis with Maven'
243
+ jenkins_name 'Sonar'
244
+ announced false
245
+
246
+ xml do |params|
247
+ send('hudson.plugins.sonar.SonarPublisher') do
248
+ jdk '(Inherit From Job)'
249
+ branch params[:branch] || ''
250
+ language
251
+ mavenOpts
252
+ jobAdditionalProperties
253
+ mavenInstallationName params[:maven_installation_name] || ''
254
+ rootPom
255
+ settings class: 'jenkins.mvn.DefaultSettingsProvider'
256
+ globalSettings class: 'jenkins.mvn.DefaultGlobalSettingsProvider'
257
+ usePrivateRepository false
258
+ end
259
+ end
260
+ end
@@ -21,8 +21,15 @@
21
21
 
22
22
  trigger do
23
23
  name :git_push
24
- plugin_id 123
25
- min_version 0
24
+ plugin_id 'github'
25
+ description 'This plugin integrates Jenkins with Github projects.
26
+
27
+ The plugin currently has two major functionalities:
28
+
29
+ * Create hyperlinks between your Jenkins projects and GitHub
30
+ * Trigger a job when you push to the repository by groking HTTP POSTs from post-receive hook and optionally auto-managing the hook setup.'
31
+
32
+ jenkins_name 'Build when a change is pushed to GitHub'
26
33
  announced false
27
34
 
28
35
  xml do |_|
@@ -34,8 +41,9 @@ end
34
41
 
35
42
  trigger do
36
43
  name :scm_polling
37
- plugin_id 123
38
- min_version 0
44
+ plugin_id 'builtin'
45
+ description 'Poll selected SCM for changes and builds if there are any changes.'
46
+ jenkins_name 'Poll SCM'
39
47
  announced false
40
48
 
41
49
  xml do |scm_polling|
@@ -48,8 +56,9 @@ end
48
56
 
49
57
  trigger do
50
58
  name :periodic_build
51
- plugin_id 123
52
- min_version 0
59
+ plugin_id 'builtin'
60
+ description 'Builts the job at selected interval'
61
+ jenkins_name 'Build periodically'
53
62
  announced false
54
63
 
55
64
  xml do |periodic_build|
@@ -61,8 +70,9 @@ end
61
70
 
62
71
  trigger do
63
72
  name :upstream
64
- plugin_id 123
65
- min_version 0
73
+ plugin_id 'builtin'
74
+ description 'Build when an upstream job finishes'
75
+ jenkins_name 'Build after other projects are built'
66
76
  announced false
67
77
 
68
78
  xml do |params|
@@ -22,11 +22,10 @@
22
22
 
23
23
  wrapper do
24
24
  name :ansicolor
25
- plugin_id 123
26
- min_version 0
25
+ plugin_id 'ansicolor'
27
26
  announced false
28
- jenkins_name 'color ansi'
29
- description 'this is a description'
27
+ jenkins_name 'Color ANSI Console Output'
28
+ description 'This plugin adds support for ANSI escape sequences, including color, to Console Output.'
30
29
  xml do |_|
31
30
  send('hudson.plugins.ansicolor.AnsiColorBuildWrapper') do
32
31
  colorMapName 'xterm'
@@ -36,8 +35,9 @@ end
36
35
 
37
36
  wrapper do
38
37
  name :timestamp
39
- plugin_id 123
40
- min_version 0
38
+ plugin_id 'timestamper'
39
+ description 'Adds timestamps to the Console Output.'
40
+ jenkins_name 'Add timestamps to the Console Output'
41
41
  announced false
42
42
 
43
43
  xml do |_|
@@ -47,12 +47,13 @@ end
47
47
 
48
48
  wrapper do
49
49
  name :rvm
50
- plugin_id 123
51
- min_version '0.5'
50
+ plugin_id 'rvm'
51
+ description 'This plugin runs your jobs in the RVM managed ruby+gemset of your choice.'
52
+ jenkins_name 'Run the build in a RVM-managed environment'
52
53
  announced false
53
- description 'rvm plugin for versions 0.5 and greater'
54
+ description 'rvm plugin'
54
55
 
55
- xml do |wrapper|
56
+ xml version: '0.5' do |wrapper|
56
57
  send('ruby-proxy-object') do
57
58
  send('ruby-object', 'ruby-class' => 'Jenkins::Tasks::BuildWrapperProxy', 'pluginid' => 'rvm') do
58
59
  object('ruby-class' => 'RvmWrapper', 'pluginid' => 'rvm') do
@@ -62,24 +63,6 @@ wrapper do
62
63
  end
63
64
  end
64
65
  end
65
- end
66
-
67
- wrapper do
68
- name :name
69
- plugin_id 123
70
- min_version 0
71
- announced false
72
-
73
- xml do |_|
74
- end
75
- end
76
-
77
- wrapper do
78
- name :rvm
79
- plugin_id 123
80
- min_version '0'
81
- announced false
82
- description 'rvm plugin for versions less than 0.5'
83
66
 
84
67
  xml do |wrapper|
85
68
  send('ruby-proxy-object') do
@@ -97,8 +80,9 @@ end
97
80
 
98
81
  wrapper do
99
82
  name :inject_passwords
100
- plugin_id 123
101
- min_version 0
83
+ plugin_id 'envinject'
84
+ description 'This plugin makes it possible to have an isolated environment for your jobs.'
85
+ jenkins_name 'Inject passwords to the build as environment variables'
102
86
  announced false
103
87
 
104
88
  xml do |passwords|
@@ -118,8 +102,9 @@ end
118
102
 
119
103
  wrapper do
120
104
  name :inject_env_var
121
- plugin_id 123
122
- min_version 0
105
+ plugin_id 'envinject'
106
+ description 'This plugin makes it possible to have an isolated environment for your jobs.'
107
+ jenkins_name 'Inject environment variables to the build process'
123
108
  announced false
124
109
 
125
110
  xml do |params|
@@ -135,8 +120,9 @@ end
135
120
 
136
121
  wrapper do
137
122
  name :artifactory
138
- plugin_id 123
139
- min_version 0
123
+ plugin_id 'artifactory'
124
+ description 'This plugin allows deploying Maven 2, Maven 3, Ivy and Gradle artifacts and build info to the Artifactory artifacts manager.'
125
+ jenkins_name 'Generic-Artifactory Integration'
140
126
  announced false
141
127
 
142
128
  xml do |wrapper|
@@ -164,8 +150,9 @@ end
164
150
 
165
151
  wrapper do
166
152
  name :maven3artifactory
167
- plugin_id 123
168
- min_version 0
153
+ plugin_id 'maven-plugin'
154
+ description 'Jenkins plugin for building Maven 2/3 jobs via a special project type.'
155
+ jenkins_name 'Maven3-Artifactory Integration'
169
156
  announced false
170
157
 
171
158
  xml do |wrapper|