jenkins_pipeline_builder 0.10.1 → 0.10.2
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 +8 -8
- data/.gitignore +2 -1
- data/README.md +1 -267
- data/example/pipeline/.ruby-version +1 -0
- data/example/pipeline/Example-Commit.yaml +16 -0
- data/example/pipeline/Example-Pipeline.yaml +27 -0
- data/example/pipeline/Example-PipelineGenerator.yaml +20 -0
- data/example/pipeline/Example-Release.yaml +16 -0
- data/example/pipeline/Example-Upgrade.yaml +16 -0
- data/example/pipeline/project.yaml +26 -0
- data/example/templates/job-template/1/Acceptance.yaml +16 -0
- data/lib/jenkins_pipeline_builder/generator.rb +13 -2
- data/lib/jenkins_pipeline_builder/version.rb +1 -1
- data/spec/lib/jenkins_pipeline_builder/generator_spec.rb +30 -27
- metadata +10 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NjdkNzhhMGU3MGUyYmJhMWE4N2Y0MTJlZDFhZjNiNzg0NmQ0ZDA0Mw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MDdkYTU4ODk2OGU5MTU1MjMwN2ZhZDU3NjU3NWY2YzVhZmM0MDc5Ng==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NGI2OGRjZDVkZGFiODU0YTlkYWFkZjFmYmNjY2QwZGZhN2MwZWJhOTQwYzQ3
|
10
|
+
MDBiNGZhYmQ1NmNmNTlkZjUzNWYyOTAwMjA1MDEzM2Q1YmIzOWRmZGNiMzNh
|
11
|
+
OTEzOTk5YjFkZDNkNjM4YjA2M2JiYzNjYWNkMjlkYWM5YmQyNzM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MjczZDM1N2IwNDZhNGQ0OGRkMzQwZTMwYjlmZDc3ZjdlZGVkZjYyYjZmZDkz
|
14
|
+
ZDEwODQzZjI3NjY4MDZhYmI4MWIwMGRkZTA5OWY3OTliNWMyNTE0M2Q0OWI1
|
15
|
+
ZGRkNDViM2RiYThkOGZmYjJjNTI0YjA0ZDEzMDgxYTg4YjcwMjI=
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -87,273 +87,7 @@ The pipeline builder now suppots json for config and pipeline files instead of o
|
|
87
87
|
DSL:
|
88
88
|
----
|
89
89
|
|
90
|
-
|
91
|
-
Here's a high level overview of what's available:
|
92
|
-
|
93
|
-
```yaml
|
94
|
-
- job:
|
95
|
-
name: nameStr # Name of your Job
|
96
|
-
job_type: free_style # Optional [free_style|multi_project|job_dsl|build_flow|pull_request_generator]
|
97
|
-
concurrent_build: true or false
|
98
|
-
discard_old: # Discard old builds after:
|
99
|
-
days: 1 # Optional, number of days after which the build is deleted
|
100
|
-
number: 2 # Optional, number of builds after which the build is deleted
|
101
|
-
artifact_days: 3 # Optional, number of days after which the artifact is deleted
|
102
|
-
artifact_number: 4 # Optional, number of builds after which the artifact is deleted
|
103
|
-
throttle: # Optional, throttles concurrent jobs
|
104
|
-
max_per_node: int
|
105
|
-
max_total: int
|
106
|
-
option: category or alone
|
107
|
-
category: string # Only used if option == category
|
108
|
-
prepare_environment:
|
109
|
-
properties_content: string
|
110
|
-
keep_environment: true
|
111
|
-
keep_build: true
|
112
|
-
parameters:
|
113
|
-
- name: param_name
|
114
|
-
type: string
|
115
|
-
default: default value
|
116
|
-
description: text
|
117
|
-
scm_provider: git # See more info on Jenkins Api Client
|
118
|
-
scm_url: git@github.com:your_url_here
|
119
|
-
scm_branch: master
|
120
|
-
scm_params:
|
121
|
-
excluded_users: user
|
122
|
-
local_branch: branch_name
|
123
|
-
recursive_update: true
|
124
|
-
wipe_workspace: true
|
125
|
-
skip_tag: true # Optional, defaults to false
|
126
|
-
excluded_regions: region
|
127
|
-
included_regions: region
|
128
|
-
shell_command: '. commit_build.sh'
|
129
|
-
inject_env_vars_pre_scm:
|
130
|
-
file: '${PARENT_WORKSPACE}/{{shared_job_settings_file}}'
|
131
|
-
promoted_builds:
|
132
|
-
- 'Stage Promotion'
|
133
|
-
- 'Prod Promotion'
|
134
|
-
hipchat:
|
135
|
-
room: room name here
|
136
|
-
start-notify: true
|
137
|
-
priority: # Optional
|
138
|
-
use_priority: true # true OR false
|
139
|
-
job_priority: 1 # Default value is -1
|
140
|
-
builders:
|
141
|
-
- multi_job:
|
142
|
-
phases:
|
143
|
-
"Phase One":
|
144
|
-
jobs:
|
145
|
-
- name: first
|
146
|
-
exposed_scm: true
|
147
|
-
current_params: true
|
148
|
-
config:
|
149
|
-
predefined_build_parameters: |
|
150
|
-
PARAM_NAME_1: PARAM_VALUE_1
|
151
|
-
PARAM_NAME_2: PARAM_VALUE_2
|
152
|
-
- name: second
|
153
|
-
continue_condition: COMPLETED
|
154
|
-
"Phase Two":
|
155
|
-
jobs:
|
156
|
-
- name: third
|
157
|
-
- inject_vars_file: build_job_info
|
158
|
-
- shell_command: |
|
159
|
-
echo 'Doing some work'
|
160
|
-
run command1
|
161
|
-
- maven3:
|
162
|
-
goals: -B clean
|
163
|
-
rootPom: path_to_pom
|
164
|
-
mavenName: maven-name # Optional
|
165
|
-
- remote_job:
|
166
|
-
server: 'Name of Server' # Name of the Remote Jenkins Server
|
167
|
-
job_name: name_of_remote_build
|
168
|
-
blocking: true # Block current job until remote job finishes
|
169
|
-
polling_interval: 10 # Optional, number of seconds between polls, defaults to 10
|
170
|
-
continue_on_remote_failure: false
|
171
|
-
parameters: # Optional, if both are specified only the file is used
|
172
|
-
file: 'foo.prop'
|
173
|
-
content: |
|
174
|
-
VAR1 = value_1
|
175
|
-
VAR2 = value_2
|
176
|
-
credentials: # Optional, if you want to override the server credentials
|
177
|
-
type: api_token or none
|
178
|
-
username: name_of_user
|
179
|
-
api_token: APITOKEN
|
180
|
-
- blocking_downstream:
|
181
|
-
project: nameStr
|
182
|
-
data:
|
183
|
-
- params: |
|
184
|
-
param1
|
185
|
-
param2
|
186
|
-
trigger_with_no_parameters: false
|
187
|
-
# Below is Optional, values can be SUCCESS, FAILURE, UNSTABLE, never
|
188
|
-
fail: FAILURE # Fail this build step if the triggered build is worse or equal to
|
189
|
-
mark_fail: SUCCESS # Mark this build as failure if the triggered build is worse or equal to
|
190
|
-
mark_unstable: UNSTABLE # Mark this build as unstable if the triggered build is worse or equal to
|
191
|
-
- copy_artifact:
|
192
|
-
project: nameStr # Name of the project
|
193
|
-
artifacts: 'artifact.txt' # Selector for artifacts
|
194
|
-
target_directory: 'artifacts' # Where the artifacts should go, blank for Workspace root
|
195
|
-
filter: 'test=true' # String of filters, PARAM1=VALUE1,PARAM2=VALUE2, Optional
|
196
|
-
fingerprint: true # Optional, true or false, defaults to true
|
197
|
-
flatten: false # Optional, true or false, defaults to false
|
198
|
-
optional: false # Optional, true or false, defaults to false
|
199
|
-
selector: # Optional
|
200
|
-
type: status # Defaults to status, options: status, saved, triggered, permalink, specific, workspace, parameter
|
201
|
-
stable: true # Use if type = 'status', true or false
|
202
|
-
fallback: true # Use if type = 'triggered', true or false
|
203
|
-
id: lastBuild # Use if type = 'permalink', options: lastBuild, lastStableBuild, lastSuccessfulBuild, lastFailedBuild, lastUnstableBuild, lastUnsucceessfulBuild
|
204
|
-
number: '123' # Use if type = 'specific', the number of the build to use
|
205
|
-
param: 'BUILD_SELECTOR' # Use if type = 'parameter', the build parameter name
|
206
|
-
wrappers:
|
207
|
-
- timestamp: true
|
208
|
-
- ansicolor: true
|
209
|
-
- artifactory:
|
210
|
-
url: 'https://url.com/path'
|
211
|
-
artifactory-name: 'key'
|
212
|
-
release-repo: release
|
213
|
-
snapshot-repo: snapshot
|
214
|
-
publish: 'pkg/*.gem'
|
215
|
-
publish-build-info: true # Optional
|
216
|
-
properties: key=value;key2=value2,value2.1
|
217
|
-
- maven3artifactory:
|
218
|
-
url: https://artifactory.com/artifactory
|
219
|
-
artifactory-name: name
|
220
|
-
release-repo: release
|
221
|
-
snapshot-repo: snapshot
|
222
|
-
publish-build-info: true # Optional
|
223
|
-
- inject_env_var:
|
224
|
-
file: 'foo.prop'
|
225
|
-
content: |
|
226
|
-
VAR1 = value_1
|
227
|
-
VAR2 = value_2
|
228
|
-
- inject_passwords:
|
229
|
-
- name: pwd_name
|
230
|
-
value: some_encrypted_password
|
231
|
-
- rvm: "ruby-version@ruby-gemset"
|
232
|
-
publishers:
|
233
|
-
- junit_result:
|
234
|
-
test_results: 'out/**/*.xml'
|
235
|
-
- git:
|
236
|
-
push-merge: true
|
237
|
-
push-only-if-success: false
|
238
|
-
- hipchat:
|
239
|
-
jenkinsUrl: 'https://jenkins_url/'
|
240
|
-
authToken: 'auth_token'
|
241
|
-
room: 'room name'
|
242
|
-
- coverage_result:
|
243
|
-
report_dir: out/coverage/rcov
|
244
|
-
total:
|
245
|
-
healthy: 80
|
246
|
-
unhealthy: 0
|
247
|
-
unstable: 0
|
248
|
-
code:
|
249
|
-
healthy: 80
|
250
|
-
unhealthy: 0
|
251
|
-
unstable: 0
|
252
|
-
- description_setter:
|
253
|
-
regexp: See the build details at (.*)
|
254
|
-
description: 'Build Details: <a href="\1">\1</a>'
|
255
|
-
- downstream:
|
256
|
-
project: project_name
|
257
|
-
data:
|
258
|
-
- params: |
|
259
|
-
PARAM1=value1
|
260
|
-
PARAM2=value2
|
261
|
-
- file: promote-job-params
|
262
|
-
- archive_artifact:
|
263
|
-
artifacts: 'artifact.txt' #Artifact include string/pattern
|
264
|
-
exclude: '' # Optional, exclude string/pattern
|
265
|
-
latest_only: false # Optional, true or false, defaults to false
|
266
|
-
allow_empty: false # Optional, true or false, defaults to false
|
267
|
-
- email_notifications:
|
268
|
-
recipients: 'test@example.com' # Whitepace-delimited list of recipients
|
269
|
-
send_if_unstable: false # Optional, default to true
|
270
|
-
send_to_individuals: true # Optional, default to false
|
271
|
-
- sonar_result:
|
272
|
-
branch: 'sonar-results-branch-name'
|
273
|
-
maven_installation_name: 'name'
|
274
|
-
triggers:
|
275
|
-
- git_push: true
|
276
|
-
- scm_polling: 'H/5 * * * *'
|
277
|
-
- periodic_build: 'H/15 * * * *'
|
278
|
-
- upstream: # Trigger this build after another build has completed
|
279
|
-
projects: project-name-here
|
280
|
-
status: failed, unstable, stable # Optional, stable by default
|
281
|
-
build_flow: |
|
282
|
-
guard {
|
283
|
-
build("job_name1", param1: params["param1"]);
|
284
|
-
} rescue {
|
285
|
-
build("job_name2", param1: build21.environment.get("some_var"))
|
286
|
-
}
|
287
|
-
```
|
288
|
-
|
289
|
-
NOTE: The *promoted_builds* plugin is not fully implemented. This plugin just helps you point to the jobs that you have in order to promote your build.
|
290
|
-
You need to manually create your promotion rules. Using this plugin will help you regenerate your jobs without breaking your manual promotion jobs.
|
291
|
-
|
292
|
-
### Enable Blocks
|
293
|
-
Blocks can be enabled and disabled like so:
|
294
|
-
|
295
|
-
Project.yaml
|
296
|
-
```yaml
|
297
|
-
- defaults:
|
298
|
-
name: global
|
299
|
-
description: DB Pipeline tooling
|
300
|
-
git_repo: git@github.roving.com:devops/DBPipeline.git
|
301
|
-
git_branch: master
|
302
|
-
excluded_user: buildmaster
|
303
|
-
hipchat_room: CD Builds
|
304
|
-
hipchat_auth_token: f3e98ed54605b36f56dd2c562e3775
|
305
|
-
discard_days: '30'
|
306
|
-
discard_number: '100'
|
307
|
-
maven_name: 'tools-maven-3.0.3'
|
308
|
-
hipchat_jenkins_url: 'https://cd-jenkins.ad.prodcc.net/'
|
309
|
-
|
310
|
-
- project:
|
311
|
-
name: 'PushTest'
|
312
|
-
hipchat_jenkins_url: 'https://cd-jenkins.ad.prodcc.net/'
|
313
|
-
jobs:
|
314
|
-
- '{{name}}-build':
|
315
|
-
use: true
|
316
|
-
```
|
317
|
-
|
318
|
-
build.yaml
|
319
|
-
```yaml
|
320
|
-
- job:
|
321
|
-
name: '{{name}}-build'
|
322
|
-
project_name: '{{name}}'
|
323
|
-
builders:
|
324
|
-
- maven3:
|
325
|
-
enabled: '{{use}}'
|
326
|
-
parameters:
|
327
|
-
rootPom: one
|
328
|
-
```
|
329
|
-
|
330
|
-
If use is true, the params are applied to the maven3 block as seen
|
331
|
-
below:
|
332
|
-
|
333
|
-
build.yaml
|
334
|
-
```yaml
|
335
|
-
- job:
|
336
|
-
name: '{{name}}-build'
|
337
|
-
project_name: '{{name}}'
|
338
|
-
builders:
|
339
|
-
- maven3:
|
340
|
-
rootPom: one
|
341
|
-
```
|
342
|
-
|
343
|
-
The above two build.yaml files are equivalent (for use: true)
|
344
|
-
|
345
|
-
The block needs to have both an enabled and parameters key, and no other
|
346
|
-
keys for the enables to work. Also note that this will fail:
|
347
|
-
|
348
|
-
```yaml
|
349
|
-
enabled: {{use}}
|
350
|
-
```
|
351
|
-
|
352
|
-
While this will work:
|
353
|
-
|
354
|
-
```yaml
|
355
|
-
enabled: '{{use}}'
|
356
|
-
```
|
90
|
+
Please see the [DSL Wiki Page](https://github.com/constantcontact/jenkins_pipeline_builder/wiki/DSL)
|
357
91
|
|
358
92
|
### Pull Request Generator
|
359
93
|
|
@@ -0,0 +1 @@
|
|
1
|
+
ruby-2.1.2
|
@@ -0,0 +1,16 @@
|
|
1
|
+
- job:
|
2
|
+
name: '{{name}}-Commit'
|
3
|
+
scm_url: '{{git_repo}}'
|
4
|
+
scm_provider: git
|
5
|
+
scm_params:
|
6
|
+
excluded_users: jenkins
|
7
|
+
local_branch: '{{git_branch}}'
|
8
|
+
recursive_update: true
|
9
|
+
wipe_workspace: true
|
10
|
+
builders:
|
11
|
+
- shell_command: |
|
12
|
+
sleep 1
|
13
|
+
wrappers:
|
14
|
+
- timestamp: true
|
15
|
+
- ansicolor: true
|
16
|
+
- rvm: '{{rvm}}'
|
@@ -0,0 +1,27 @@
|
|
1
|
+
- job:
|
2
|
+
name: '{{name}}-Pipeline'
|
3
|
+
description: 'Pipeline'
|
4
|
+
job_type: multi_project
|
5
|
+
wrappers:
|
6
|
+
- timestamp: true
|
7
|
+
- ansicolor: true
|
8
|
+
- rvm: '{{rvm}}'
|
9
|
+
builders:
|
10
|
+
- multi_job:
|
11
|
+
phases:
|
12
|
+
Commit:
|
13
|
+
jobs:
|
14
|
+
- name: '{{name}}-Commit'
|
15
|
+
continue_condition: SUCCESSFUL
|
16
|
+
Acceptance:
|
17
|
+
jobs:
|
18
|
+
- name: '{{name}}-Acceptance'
|
19
|
+
continue_condiction: SUCCESSFUL
|
20
|
+
Upgrade:
|
21
|
+
jobs:
|
22
|
+
- name: '{{name}}-Upgrade'
|
23
|
+
continue_condiction: SUCCESSFUL
|
24
|
+
Release:
|
25
|
+
jobs:
|
26
|
+
- name: '{{name}}-Release'
|
27
|
+
continue_condiction: SUCCESSFUL
|
@@ -0,0 +1,20 @@
|
|
1
|
+
- job:
|
2
|
+
name: '{{name}}-PipelineGenerator'
|
3
|
+
description: 'Generator for jobs'
|
4
|
+
scm_provider: git
|
5
|
+
scm_url: '{{git_repo}}'
|
6
|
+
scm_branch: '{{git_branch}}'
|
7
|
+
publishers:
|
8
|
+
- downstream:
|
9
|
+
project: '{{name}}-Pipeline'
|
10
|
+
condition: SUCCESS
|
11
|
+
builders:
|
12
|
+
- shell_command: |
|
13
|
+
cd example/pipeline # Change if you use this example as a template
|
14
|
+
bundle -v || gem install bundler
|
15
|
+
bundle install
|
16
|
+
bundle exec generate pipeline bootstrap pipeline/
|
17
|
+
wrappers:
|
18
|
+
- timestamp: true
|
19
|
+
- ansicolor: true
|
20
|
+
- rvm: '{{rvm}}'
|
@@ -0,0 +1,16 @@
|
|
1
|
+
- job:
|
2
|
+
name: '{{name}}-Release'
|
3
|
+
scm_url: '{{git_repo}}'
|
4
|
+
scm_provider: git
|
5
|
+
scm_params:
|
6
|
+
excluded_users: jenkins
|
7
|
+
local_branch: '{{git_branch}}'
|
8
|
+
recursive_update: true
|
9
|
+
wipe_workspace: true
|
10
|
+
builders:
|
11
|
+
- shell_command: |
|
12
|
+
sleep 60
|
13
|
+
wrappers:
|
14
|
+
- timestamp: true
|
15
|
+
- ansicolor: true
|
16
|
+
- rvm: '{{rvm}}'
|
@@ -0,0 +1,16 @@
|
|
1
|
+
- job:
|
2
|
+
name: '{{name}}-Upgrade'
|
3
|
+
scm_url: '{{git_repo}}'
|
4
|
+
scm_provider: git
|
5
|
+
scm_params:
|
6
|
+
excluded_users: jenkins
|
7
|
+
local_branch: '{{git_branch}}'
|
8
|
+
recursive_update: true
|
9
|
+
wipe_workspace: true
|
10
|
+
builders:
|
11
|
+
- shell_command: |
|
12
|
+
sleep 1
|
13
|
+
wrappers:
|
14
|
+
- timestamp: true
|
15
|
+
- ansicolor: true
|
16
|
+
- rvm: '{{rvm}}'
|
@@ -0,0 +1,26 @@
|
|
1
|
+
- dependencies:
|
2
|
+
- source:
|
3
|
+
url: 'https://github.com/constantcontact/jenkins_pipeline_builder/archive/master.tar.gz'
|
4
|
+
templates:
|
5
|
+
- name: generator-template
|
6
|
+
version: 1
|
7
|
+
template_root: 'example/templates' # To keep tempaltes in this repo, we specify a folder
|
8
|
+
|
9
|
+
- defaults:
|
10
|
+
name: global
|
11
|
+
description: Example Pipeline
|
12
|
+
git_repo: git@github.com:constantcontact/jenkins_pipeline_builder.git
|
13
|
+
git_branch: master
|
14
|
+
discard_days: '30'
|
15
|
+
discard_number: '100'
|
16
|
+
rvm: '`cat pipeline/.ruby-version`'
|
17
|
+
|
18
|
+
- project:
|
19
|
+
name: 'ExamplePipeline'
|
20
|
+
jobs:
|
21
|
+
- '{{name}}-PipelineGenerator'
|
22
|
+
- '{{name}}-Pipeline'
|
23
|
+
- '{{name}}-Commit'
|
24
|
+
- '{{name}}-Acceptance' # from template (see dependencies section)
|
25
|
+
- '{{name}}-Upgrade'
|
26
|
+
- '{{name}}-Release'
|
@@ -0,0 +1,16 @@
|
|
1
|
+
- job:
|
2
|
+
name: '{{name}}-Acceptance'
|
3
|
+
scm_url: '{{git_repo}}'
|
4
|
+
scm_provider: git
|
5
|
+
scm_params:
|
6
|
+
excluded_users: jenkins
|
7
|
+
local_branch: '{{git_branch}}'
|
8
|
+
recursive_update: true
|
9
|
+
wipe_workspace: true
|
10
|
+
builders:
|
11
|
+
- shell_command: |
|
12
|
+
sleep 1
|
13
|
+
wrappers:
|
14
|
+
- timestamp: true
|
15
|
+
- ansicolor: true
|
16
|
+
- rvm: '{{rvm}}'
|
@@ -75,7 +75,7 @@ module JenkinsPipelineBuilder
|
|
75
75
|
if projects.any?
|
76
76
|
errors = publish_project(project_name)
|
77
77
|
else
|
78
|
-
errors = publish_jobs(jobs)
|
78
|
+
errors = publish_jobs(standalone jobs)
|
79
79
|
end
|
80
80
|
errors.each do |k, v|
|
81
81
|
logger.error "Encountered errors compiling: #{k}:"
|
@@ -125,6 +125,17 @@ module JenkinsPipelineBuilder
|
|
125
125
|
|
126
126
|
private
|
127
127
|
|
128
|
+
# Converts standalone jobs to the format that they have when loaded as part of a project.
|
129
|
+
# This addresses an issue where #pubish_jobs assumes that each job will be wrapped
|
130
|
+
# with in a hash a referenced under a key called :result, which is what happens when
|
131
|
+
# it is loaded as part of a project.
|
132
|
+
#
|
133
|
+
# @return An array of jobs
|
134
|
+
#
|
135
|
+
def standalone(jobs)
|
136
|
+
jobs.map! { |job| { result: job } }
|
137
|
+
end
|
138
|
+
|
128
139
|
def purge_pull_request_jobs(pull)
|
129
140
|
pull.purge.each do |purge_job|
|
130
141
|
jobs = client.job.list "#{purge_job}.*"
|
@@ -155,7 +166,7 @@ module JenkinsPipelineBuilder
|
|
155
166
|
job = @job_collection[job.to_s]
|
156
167
|
pull_job = job if job[:value][:job_type] == 'pull_request_generator'
|
157
168
|
end
|
158
|
-
fail 'No
|
169
|
+
fail 'No jobs of type pull_request_generator found' unless pull_job
|
159
170
|
pull_job
|
160
171
|
end
|
161
172
|
|
@@ -1,5 +1,11 @@
|
|
1
1
|
require File.expand_path('../spec_helper', __FILE__)
|
2
2
|
|
3
|
+
def cleanup_compiled_xml(job_name)
|
4
|
+
Dir["#{job_name}*.xml"].each do |file|
|
5
|
+
File.delete(file)
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
3
9
|
describe JenkinsPipelineBuilder::Generator do
|
4
10
|
after :each do
|
5
11
|
JenkinsPipelineBuilder.registry.clear_versions
|
@@ -71,38 +77,37 @@ describe JenkinsPipelineBuilder::Generator do
|
|
71
77
|
allow(JenkinsPipelineBuilder.client).to receive(:plugin).and_return double(
|
72
78
|
list_installed: { 'description' => '20.0', 'git' => '20.0' })
|
73
79
|
end
|
74
|
-
|
80
|
+
|
81
|
+
def bootstrap(fixture_path, job_name)
|
75
82
|
@generator.debug = true
|
76
|
-
|
77
|
-
|
78
|
-
errors
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
+
errors = @generator.bootstrap(fixture_path, job_name)
|
84
|
+
cleanup_compiled_xml(job_name)
|
85
|
+
errors
|
86
|
+
end
|
87
|
+
|
88
|
+
def fixture_path(fixture)
|
89
|
+
File.expand_path("../fixtures/generator_tests/#{fixture}", __FILE__)
|
90
|
+
end
|
91
|
+
|
92
|
+
it 'produces no errors while creating pipeline SamplePipeline with view' do
|
93
|
+
errors = bootstrap(fixture_path('sample_pipeline'), 'SamplePipeline')
|
94
|
+
expect(errors).to be_empty
|
95
|
+
end
|
96
|
+
|
97
|
+
it 'produces no errors while creating a single job' do
|
98
|
+
errors = bootstrap(fixture_path('sample_pipeline/SamplePipeline-10-Commit.yaml'), 'SamplePipeline-10-Commit')
|
99
|
+
expect(errors).to be_empty
|
83
100
|
end
|
84
101
|
|
85
102
|
it 'produces no errors while creating pipeline TemplatePipeline' do
|
86
|
-
|
87
|
-
|
88
|
-
path = File.expand_path('../fixtures/generator_tests/template_pipeline', __FILE__)
|
89
|
-
errors = @generator.bootstrap(path, job_name)
|
90
|
-
expect(errors.empty?).to be true
|
91
|
-
Dir["#{job_name}*.xml"].each do |file|
|
92
|
-
File.delete(file)
|
93
|
-
end
|
103
|
+
errors = bootstrap(fixture_path('template_pipeline'), 'TemplatePipeline')
|
104
|
+
expect(errors).to be_empty
|
94
105
|
end
|
95
106
|
|
96
107
|
it 'loads extensions in remote dependencies' do
|
97
|
-
|
98
|
-
|
99
|
-
path = File.expand_path('../fixtures/generator_tests/template_pipeline', __FILE__)
|
100
|
-
errors = @generator.bootstrap(path, job_name)
|
101
|
-
expect(errors.empty?).to be true
|
108
|
+
errors = bootstrap(fixture_path('template_pipeline'), 'TemplatePipeline')
|
109
|
+
expect(errors).to be_empty
|
102
110
|
expect(@generator.module_registry.registry[:job][:wrappers].keys).to include :test_wrapper
|
103
|
-
Dir["#{job_name}*.xml"].each do |file|
|
104
|
-
File.delete(file)
|
105
|
-
end
|
106
111
|
@generator.module_registry.registry[:job][:wrappers].delete(:test_wrapper)
|
107
112
|
end
|
108
113
|
# Things to check for:
|
@@ -155,9 +160,7 @@ describe JenkinsPipelineBuilder::Generator do
|
|
155
160
|
)
|
156
161
|
success = @generator.pull_request(path, job_name)
|
157
162
|
expect(success).to be_truthy
|
158
|
-
|
159
|
-
File.delete(file)
|
160
|
-
end
|
163
|
+
cleanup_compiled_xml(job_name)
|
161
164
|
end
|
162
165
|
# Things to check for
|
163
166
|
# Fail - no PR job type found
|
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.2
|
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-
|
12
|
+
date: 2015-01-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|
@@ -333,6 +333,14 @@ files:
|
|
333
333
|
- bin/generate
|
334
334
|
- commit_build.sh
|
335
335
|
- config/login.yml
|
336
|
+
- example/pipeline/.ruby-version
|
337
|
+
- example/pipeline/Example-Commit.yaml
|
338
|
+
- example/pipeline/Example-Pipeline.yaml
|
339
|
+
- example/pipeline/Example-PipelineGenerator.yaml
|
340
|
+
- example/pipeline/Example-Release.yaml
|
341
|
+
- example/pipeline/Example-Upgrade.yaml
|
342
|
+
- example/pipeline/project.yaml
|
343
|
+
- example/templates/job-template/1/Acceptance.yaml
|
336
344
|
- jenkins_pipeline_builder.gemspec
|
337
345
|
- lib/jenkins_pipeline_builder.rb
|
338
346
|
- lib/jenkins_pipeline_builder/cli/base.rb
|