Browse code

Add advanced pipeline examples

Cesar Wong authored on 2016/12/08 04:14:04
Showing 8 changed files
... ...
@@ -3,6 +3,8 @@
3 3
 This set of files will allow you to deploy a Jenkins server that is capable of executing Jenkins pipelines and
4 4
 utilize pods run on OpenShift as Jenkins slaves.
5 5
 
6
+## Basic Pipeline
7
+
6 8
 To walk through the example:
7 9
 
8 10
 0. If using `oc cluster up`, be sure to grab the [latest oc command](https://github.com/openshift/origin/releases/latest)
... ...
@@ -32,12 +34,12 @@ jenkins template represented by jenkinstemplate.json by running these commands a
32 32
 4. Run this command to instantiate the template which will create a pipeline buildconfig and some other resources in your project:
33 33
 
34 34
     If you used cluster up:
35
-    
35
+
36 36
         $ oc new-app jenkins-pipeline-example
37 37
 
38 38
     Otherwise:
39
-    
40
-        $ oc new-app -f https://raw.githubusercontent.com/openshift/origin/master/examples/jenkins/pipeline/samplepipeline.json
39
+
40
+        $ oc new-app -f https://raw.githubusercontent.com/openshift/origin/master/examples/jenkins/pipeline/samplepipeline.yaml
41 41
 
42 42
     At this point if you run `oc get pods` you should see a jenkins pod, or at least a jenkins-deploy pod. (along with other items in your project)  This pod was created as a result of the new pipeline buildconfig being defined by the sample-pipeline template.
43 43
 
... ...
@@ -56,7 +58,7 @@ jenkins template represented by jenkinstemplate.json by running these commands a
56 56
     If you take this approach, run the following command before attempting to log into Jenkins:
57 57
 
58 58
         $ oc annotate sa/jenkins serviceaccounts.openshift.io/oauth-redirecturi.1=http://<jenkins_service_ip:jenkins_service_port>/securityRealm/finishLogin --overwrite
59
-    
59
+
60 60
     Only include the port in the uri if it is not port 80.
61 61
 
62 62
     Login with the user name used to create the "pipelineproject" and any non-empty password.
... ...
@@ -65,7 +67,93 @@ jenkins template represented by jenkinstemplate.json by running these commands a
65 65
 
66 66
         $ oc start-build sample-pipeline
67 67
 
68
-    Jenkins will: create an instance of the sample-pipeline job, launch a slave, trigger a build in openshift, trigger a
69
-deployment in openshift, and tear the slave down.
68
+    Jenkins will: create an instance of the sample-pipeline job, launch a slave, trigger a build in openshift, trigger a deployment in openshift, and tear the slave down.
70 69
 
71 70
     If you monitor the pods in your default project, you will also see the slave pod get created and deleted.
71
+
72
+## Maven Slave Example
73
+
74
+The `maven-pipeline.yaml` template contains a pipeline that uses a maven node to build and package a WAR.
75
+It then builds an image with the WAR using a Docker-strategy OpenShift build.
76
+
77
+To run this example:
78
+
79
+1. Ensure that you have a running OpenShift environment as described in the basic example
80
+2. Create a new project for your pipeline on the OpenShift web console:
81
+   1. Login 
82
+   2. Click on *New Project*
83
+   3. Enter a project name
84
+   4. Click *Create*
85
+3. In the *Add to Project* page, click on *Import YAML/JSON*
86
+4. In a separate browser tab, navigate to [maven-pipeline.yaml](https://raw.githubusercontent.com/openshift/origin/master/examples/jenkins/pipeline/maven-pipeline.yaml) and copy its content.
87
+5. Paste the YAML text in the text box of the *Import YAML/JSON* tab.
88
+6. Click on *Create*
89
+7. Leave *Process the template* checked and click on *Continue*
90
+8. Modify the URL and Reference of the code repository if you have created your own fork.
91
+9. Click on *Create*
92
+10. Navigate to *Builds* -> *Pipelines*
93
+11. Click on *Start Pipeline* next to *openshift-jee-sample*
94
+
95
+On the first pipeline run, there will be a delay as Jenkins is instantiated for the project. 
96
+When the pipeline completes, the openshift-jee-sample application should be deployed and running.
97
+
98
+## Orchestration Pipeline Example
99
+
100
+The `mapsapp-pipeline.yaml` template contains a pipeline that instantiates other pipelines and runs them.
101
+It shows how more than one pipeline can be launched in parallel and how a single Jenkins pipeline
102
+can work with multiple source code repositories.
103
+
104
+To run this example:
105
+
106
+1. Ensure that you have a running OpenShift environment as described in the basic example
107
+2. Create a new project for your pipeline on the OpenShift web console:
108
+   1. Login 
109
+   2. Click on *New Project*
110
+   3. Enter a project name
111
+   4. Click *Create*
112
+3. In the *Add to Project* page, click on *Import YAML/JSON*
113
+4. In a separate browser tab, navigate to [mapsapp-pipeline.yaml](https://raw.githubusercontent.com/openshift/origin/master/examples/jenkins/pipeline/mapsapp-pipeline.yaml) and copy its content.
114
+5. Paste the YAML text in the text box of the *Import YAML/JSON* tab.
115
+6. Click on *Create*
116
+7. Leave *Process the template* checked and click on *Continue*
117
+8. Modify the URLs and References of the sample repositories if you have created your own forks.
118
+9. Click on *Create*
119
+10. Navigate to *Builds* -> *Pipelines*
120
+11. Click on *Start Pipeline* next to *mapsapp-pipeline*
121
+
122
+On the first pipeline run, there will be a delay as Jenkins is instantiated for the project. The pipeline will instantiate 
123
+other pipelines and those will in turn instantiate OpenShift objects. Once the pipeline has completed, a maps frontend 
124
+should be running with 2 backends: nationalparks and mlbparks.
125
+
126
+
127
+## Blue Green Deployment Example
128
+
129
+The `bluegreen-pipeline.yaml` template contains a pipeline that demonstrates alternating blue/green 
130
+deployments with a manual approval step. The template contains three routes, one main route, and 2
131
+other routes; one prefixed by `blue` and the other one prefixed by `green`. Each time the pipeline
132
+is run, it will alternate between building the green or the blue service. You can verify the running
133
+code by browsing to the route that was just built. Once the deployment is approved, then the service
134
+that was just built becomes the *active* one.
135
+
136
+To run this example:
137
+
138
+1. Create a fork of https://github.com/openshift/nodejs-ex.git
139
+2. Create a new project for your pipeline on the OpenShift web console:
140
+   1. Login 
141
+   2. Click on *New Project*
142
+   3. Enter a project name
143
+   4. Click *Create*
144
+3. In the *Add to Project* page, click on *Import YAML/JSON*
145
+4. In a separate browser tab, navigate to [bluegreen-pipeline.yaml](https://raw.githubusercontent.com/openshift/origin/master/examples/jenkins/pipeline/bluegreen-pipeline.yaml) and copy its content.
146
+5. Paste the YAML text in the text box of the *Import YAML/JSON* tab.
147
+6. Click on *Create*
148
+7. Leave *Process the template* checked and click on *Continue*
149
+8. Modify the *Git Repository URL* to contain the URL of your fork
150
+9. Click on *Create*
151
+10. Navigate to *Builds* -> *Pipelines*
152
+11. Click on *Start Pipeline* next to *bluegreen-pipeline*
153
+12. Once the code has been deployed, the pipeline will pause for your approval. Click on the pause icon to approve the deployment of the changes.
154
+13. Push a change to your fork of the nodejs-ex repository
155
+14. Start the pipeline again. Go back to step 11 and repeat.
156
+
157
+On the first pipeline run, there will be a delay as Jenkins is instantiated for the project. 
72 158
new file mode 100644
... ...
@@ -0,0 +1,442 @@
0
+apiVersion: v1
1
+kind: Template
2
+labels:
3
+  template: bluegreen-pipeline
4
+message: A Jenkins server will be automatically instantiated in this project to manage
5
+  the Pipeline BuildConfig created by this template.  You will be able to log in to
6
+  it using your OpenShift user credentials.
7
+metadata:
8
+  annotations:
9
+    description: This example showcases a blue green deployment using a Jenkins 
10
+      pipeline that pauses for approval.
11
+    iconClass: icon-jenkins
12
+    tags: instant-app,jenkins
13
+  name: bluegreen-pipeline
14
+objects:
15
+- apiVersion: v1
16
+  kind: BuildConfig
17
+  metadata:
18
+    annotations:
19
+      pipeline.alpha.openshift.io/uses: '[{"name": "${NAME}", "namespace": "", "kind": "DeploymentConfig"}]'
20
+    creationTimestamp: null
21
+    labels:
22
+      name: bluegreen-pipeline
23
+    name: bluegreen-pipeline
24
+  spec:
25
+    strategy:
26
+      jenkinsPipelineStrategy:
27
+        jenkinsfile: |-
28
+          def appName="${NAME}"
29
+          def project=""
30
+          def tag="blue"
31
+          def altTag="green"
32
+
33
+          node {
34
+            project = env.PROJECT_NAME
35
+            stage("Initialize") {
36
+              sh "oc get route ${appName} -n ${project} -o jsonpath='{ .spec.to.weight }' > blueweight"
37
+              blueWeight = readFile('blueweight').trim()
38
+              if (blueWeight == "100") {
39
+                tag = "green"
40
+                altTag = "blue"
41
+              }
42
+              sh "oc get route ${tag}-${appName} -n ${project} -o jsonpath='{ .spec.host }' > routehost"
43
+              routeHost = readFile('routehost').trim()
44
+            }
45
+
46
+            stage("Build") {
47
+              echo "building tag ${tag}"
48
+              openshiftBuild buildConfig: appName, showBuildLogs: "true"
49
+            }
50
+
51
+            stage("Deploy Test") {
52
+              openshiftTag srcStream: appName, srcTag: 'latest', destinationStream: appName, destinationTag: tag
53
+              openshiftVerifyDeployment deploymentConfig: "${appName}-${tag}"
54
+            }
55
+
56
+            stage("Test") {
57
+              input "Test deployment: http://${routeHost}. Approve?"
58
+            }
59
+
60
+            stage("Go Live") {
61
+              sh "oc set -n ${project} route-backends ${appName} ${appName}-${tag}=100 ${appName}-${altTag}=0"
62
+            }
63
+          }
64
+      type: JenkinsPipeline
65
+    triggers:
66
+    - github:
67
+        secret: "${GITHUB_WEBHOOK_SECRET}"
68
+      type: GitHub
69
+    - generic:
70
+        secret: "${GENERIC_WEBHOOK_SECRET}"
71
+      type: Generic
72
+- apiVersion: v1
73
+  kind: Route
74
+  metadata:
75
+    name: blue-${NAME}
76
+  spec:
77
+    to:
78
+      kind: Service
79
+      name: ${NAME}-blue
80
+- apiVersion: v1
81
+  kind: Route
82
+  metadata:
83
+    name: green-${NAME}
84
+  spec:
85
+    to:
86
+      kind: Service
87
+      name: ${NAME}-green
88
+- apiVersion: v1
89
+  kind: Route
90
+  metadata:
91
+    name: ${NAME}
92
+  spec:
93
+    alternateBackends:
94
+    - name: ${NAME}-green
95
+      weight: "0"
96
+    to:
97
+      kind: Service
98
+      name: ${NAME}-blue
99
+      weight: "100"
100
+- apiVersion: v1
101
+  kind: ImageStream
102
+  metadata:
103
+    annotations:
104
+      description: Keeps track of changes in the application image
105
+    name: ${NAME}
106
+- apiVersion: v1
107
+  kind: BuildConfig
108
+  metadata:
109
+    annotations:
110
+      description: Defines how to build the application
111
+    name: ${NAME}
112
+  spec:
113
+    output:
114
+      to:
115
+        kind: ImageStreamTag
116
+        name: ${NAME}:latest
117
+    postCommit:
118
+      script: npm test
119
+    source:
120
+      contextDir: ${CONTEXT_DIR}
121
+      git:
122
+        ref: ${SOURCE_REPOSITORY_REF}
123
+        uri: ${SOURCE_REPOSITORY_URL}
124
+      type: Git
125
+    strategy:
126
+      sourceStrategy:
127
+        env:
128
+        - name: NPM_MIRROR
129
+          value: ${NPM_MIRROR}
130
+        from:
131
+          kind: ImageStreamTag
132
+          name: nodejs:4
133
+          namespace: ${NAMESPACE}
134
+      type: Source
135
+    triggers:
136
+    - github:
137
+        secret: ${GITHUB_WEBHOOK_SECRET}
138
+      type: GitHub
139
+    - generic:
140
+        secret: ${GENERIC_WEBHOOK_SECRET}
141
+      type: Generic
142
+- apiVersion: v1
143
+  kind: Service
144
+  metadata:
145
+    annotations:
146
+      service.alpha.openshift.io/dependencies: '[{"name": "${DATABASE_SERVICE_NAME}", "namespace": "", "kind": "Service"}]'
147
+    name: ${NAME}-blue
148
+  spec:
149
+    ports:
150
+    - name: web
151
+      port: 8080
152
+      targetPort: 8080
153
+    selector:
154
+      name: ${NAME}-blue
155
+- apiVersion: v1
156
+  kind: DeploymentConfig
157
+  metadata:
158
+    annotations:
159
+      description: Defines how to deploy the application server
160
+    name: ${NAME}-blue
161
+  spec:
162
+    replicas: 1
163
+    selector:
164
+      name: ${NAME}-blue
165
+    strategy:
166
+      type: Rolling
167
+    template:
168
+      metadata:
169
+        labels:
170
+          name: ${NAME}-blue
171
+        name: ${NAME}-blue
172
+      spec:
173
+        containers:
174
+        - env:
175
+          - name: DATABASE_SERVICE_NAME
176
+            value: ${DATABASE_SERVICE_NAME}
177
+          - name: MONGODB_USER
178
+            value: ${DATABASE_USER}
179
+          - name: MONGODB_PASSWORD
180
+            value: ${DATABASE_PASSWORD}
181
+          - name: MONGODB_DATABASE
182
+            value: ${DATABASE_NAME}
183
+          - name: MONGODB_ADMIN_PASSWORD
184
+            value: ${DATABASE_ADMIN_PASSWORD}
185
+          image: ' '
186
+          livenessProbe:
187
+            httpGet:
188
+              path: /pagecount
189
+              port: 8080
190
+            initialDelaySeconds: 30
191
+            timeoutSeconds: 3
192
+          name: nodejs-mongodb-example
193
+          ports:
194
+          - containerPort: 8080
195
+          readinessProbe:
196
+            httpGet:
197
+              path: /pagecount
198
+              port: 8080
199
+            initialDelaySeconds: 3
200
+            timeoutSeconds: 3
201
+          resources:
202
+            limits:
203
+              memory: ${MEMORY_LIMIT}
204
+    triggers:
205
+    - imageChangeParams:
206
+        automatic: true
207
+        containerNames:
208
+        - nodejs-mongodb-example
209
+        from:
210
+          kind: ImageStreamTag
211
+          name: ${NAME}:blue
212
+      type: ImageChange
213
+    - type: ConfigChange
214
+- apiVersion: v1
215
+  kind: Service
216
+  metadata:
217
+    annotations:
218
+      service.alpha.openshift.io/dependencies: '[{"name": "${DATABASE_SERVICE_NAME}", "namespace": "", "kind": "Service"}]'
219
+    name: ${NAME}-green
220
+  spec:
221
+    ports:
222
+    - name: web
223
+      port: 8080
224
+      targetPort: 8080
225
+    selector:
226
+      name: ${NAME}-green
227
+- apiVersion: v1
228
+  kind: DeploymentConfig
229
+  metadata:
230
+    annotations:
231
+      description: Defines how to deploy the application server
232
+    name: ${NAME}-green
233
+  spec:
234
+    replicas: 1
235
+    selector:
236
+      name: ${NAME}-green
237
+    strategy:
238
+      type: Rolling
239
+    template:
240
+      metadata:
241
+        labels:
242
+          name: ${NAME}-green
243
+        name: ${NAME}-green
244
+      spec:
245
+        containers:
246
+        - env:
247
+          - name: DATABASE_SERVICE_NAME
248
+            value: ${DATABASE_SERVICE_NAME}
249
+          - name: MONGODB_USER
250
+            value: ${DATABASE_USER}
251
+          - name: MONGODB_PASSWORD
252
+            value: ${DATABASE_PASSWORD}
253
+          - name: MONGODB_DATABASE
254
+            value: ${DATABASE_NAME}
255
+          - name: MONGODB_ADMIN_PASSWORD
256
+            value: ${DATABASE_ADMIN_PASSWORD}
257
+          image: ' '
258
+          livenessProbe:
259
+            httpGet:
260
+              path: /pagecount
261
+              port: 8080
262
+            initialDelaySeconds: 30
263
+            timeoutSeconds: 3
264
+          name: nodejs-mongodb-example
265
+          ports:
266
+          - containerPort: 8080
267
+          readinessProbe:
268
+            httpGet:
269
+              path: /pagecount
270
+              port: 8080
271
+            initialDelaySeconds: 3
272
+            timeoutSeconds: 3
273
+          resources:
274
+            limits:
275
+              memory: ${MEMORY_LIMIT}
276
+    triggers:
277
+    - imageChangeParams:
278
+        automatic: true
279
+        containerNames:
280
+        - nodejs-mongodb-example
281
+        from:
282
+          kind: ImageStreamTag
283
+          name: ${NAME}:green
284
+      type: ImageChange
285
+    - type: ConfigChange
286
+- apiVersion: v1
287
+  kind: Service
288
+  metadata:
289
+    annotations:
290
+      description: Exposes the database server
291
+    name: ${DATABASE_SERVICE_NAME}
292
+  spec:
293
+    ports:
294
+    - name: mongodb
295
+      port: 27017
296
+      targetPort: 27017
297
+    selector:
298
+      name: ${DATABASE_SERVICE_NAME}
299
+- apiVersion: v1
300
+  kind: DeploymentConfig
301
+  metadata:
302
+    annotations:
303
+      description: Defines how to deploy the database
304
+    name: ${DATABASE_SERVICE_NAME}
305
+  spec:
306
+    replicas: 1
307
+    selector:
308
+      name: ${DATABASE_SERVICE_NAME}
309
+    strategy:
310
+      type: Recreate
311
+    template:
312
+      metadata:
313
+        labels:
314
+          name: ${DATABASE_SERVICE_NAME}
315
+        name: ${DATABASE_SERVICE_NAME}
316
+      spec:
317
+        containers:
318
+        - env:
319
+          - name: MONGODB_USER
320
+            value: ${DATABASE_USER}
321
+          - name: MONGODB_PASSWORD
322
+            value: ${DATABASE_PASSWORD}
323
+          - name: MONGODB_DATABASE
324
+            value: ${DATABASE_NAME}
325
+          - name: MONGODB_ADMIN_PASSWORD
326
+            value: ${DATABASE_ADMIN_PASSWORD}
327
+          image: ' '
328
+          livenessProbe:
329
+            initialDelaySeconds: 30
330
+            tcpSocket:
331
+              port: 27017
332
+            timeoutSeconds: 1
333
+          name: mongodb
334
+          ports:
335
+          - containerPort: 27017
336
+          readinessProbe:
337
+            exec:
338
+              command:
339
+              - /bin/sh
340
+              - -i
341
+              - -c
342
+              - mongo 127.0.0.1:27017/$MONGODB_DATABASE -u $MONGODB_USER -p $MONGODB_PASSWORD
343
+                --eval="quit()"
344
+            initialDelaySeconds: 3
345
+            timeoutSeconds: 1
346
+          resources:
347
+            limits:
348
+              memory: ${MEMORY_MONGODB_LIMIT}
349
+          volumeMounts:
350
+          - mountPath: /var/lib/mongodb/data
351
+            name: ${DATABASE_SERVICE_NAME}-data
352
+        volumes:
353
+        - emptyDir:
354
+            medium: ""
355
+          name: ${DATABASE_SERVICE_NAME}-data
356
+    triggers:
357
+    - imageChangeParams:
358
+        automatic: true
359
+        containerNames:
360
+        - mongodb
361
+        from:
362
+          kind: ImageStreamTag
363
+          name: mongodb:3.2
364
+          namespace: ${NAMESPACE}
365
+      type: ImageChange
366
+    - type: ConfigChange
367
+parameters:
368
+- description: The name assigned to all of the frontend objects defined in this template.
369
+  displayName: Name
370
+  name: NAME
371
+  required: true
372
+  value: nodejs-mongodb-example
373
+- description: The exposed hostname that will route to the Node.js service, if left
374
+    blank a value will be defaulted.
375
+  displayName: Application Hostname
376
+  name: APPLICATION_DOMAIN
377
+- description: The URL of the repository with your application source code.
378
+  displayName: Git Repository URL
379
+  name: SOURCE_REPOSITORY_URL
380
+  required: true
381
+  value: https://github.com/openshift/nodejs-ex.git
382
+- description: The reference of the repository with your application source code.
383
+  displayName: Git Repository Ref
384
+  name: SOURCE_REPOSITORY_REF
385
+  required: true
386
+  value: master
387
+- displayName: Database Name
388
+  name: DATABASE_NAME
389
+  required: true
390
+  value: sampledb
391
+- description: Username for MongoDB user that will be used for accessing the database.
392
+  displayName: MongoDB Username
393
+  from: user[A-Z0-9]{3}
394
+  generate: expression
395
+  name: DATABASE_USER
396
+- description: Password for the MongoDB user.
397
+  displayName: MongoDB Password
398
+  from: '[a-zA-Z0-9]{16}'
399
+  generate: expression
400
+  name: DATABASE_PASSWORD
401
+- description: Maximum amount of memory the Node.js container can use.
402
+  displayName: Memory Limit
403
+  name: MEMORY_LIMIT
404
+  required: true
405
+  value: 512Mi
406
+- description: Maximum amount of memory the MongoDB container can use.
407
+  displayName: Memory Limit (MongoDB)
408
+  name: MEMORY_MONGODB_LIMIT
409
+  required: true
410
+  value: 512Mi
411
+- displayName: Database Service Name
412
+  name: DATABASE_SERVICE_NAME
413
+  required: true
414
+  value: mongodb
415
+- description: Password for the database admin user.
416
+  displayName: Database Administrator Password
417
+  from: '[a-zA-Z0-9]{16}'
418
+  generate: expression
419
+  name: DATABASE_ADMIN_PASSWORD
420
+- description: Set this to the relative path to your project if it is not in the root
421
+    of your repository.
422
+  displayName: Context Directory
423
+  name: CONTEXT_DIR
424
+- description: A secret string used to configure the GitHub webhook.
425
+  displayName: GitHub Webhook Secret
426
+  from: '[a-zA-Z0-9]{40}'
427
+  generate: expression
428
+  name: GITHUB_WEBHOOK_SECRET
429
+- description: A secret string used to configure the Generic webhook.
430
+  displayName: Generic Webhook Secret
431
+  from: '[a-zA-Z0-9]{40}'
432
+  generate: expression
433
+  name: GENERIC_WEBHOOK_SECRET
434
+- description: The custom NPM mirror URL
435
+  displayName: Custom NPM Mirror URL
436
+  name: NPM_MIRROR
437
+- description: The OpenShift Namespace where the NodeJS and MongoDB ImageStreams reside.
438
+  displayName: Namespace
439
+  name: NAMESPACE
440
+  required: true
441
+  value: openshift
0 442
new file mode 100644
... ...
@@ -0,0 +1,114 @@
0
+apiVersion: v1
1
+kind: Template
2
+labels:
3
+  application: mapsapp-pipeline
4
+metadata:
5
+  name: mapsapp-pipeline
6
+parameters:
7
+- description: NationalParks application source URI
8
+  displayName: NationalParks Source URI
9
+  name: NATIONALPARKS_GIT_URI
10
+  required: true
11
+  value: https://github.com/openshift-roadshow/nationalparks.git
12
+- description: NationalParks application source reference
13
+  displayName: NationalParks Source Ref
14
+  name: NATIONALPARKS_GIT_REF
15
+  required: true
16
+  value: master
17
+- description: MLBParks application source URI
18
+  displayName: MLBParks Source URI
19
+  name: MLBPARKS_GIT_URI
20
+  required: true
21
+  value: https://github.com/openshift-roadshow/mlbparks.git
22
+- description: MLBParks application source reference
23
+  displayName: MLBParks Source Ref
24
+  name: MLBPARKS_GIT_REF
25
+  required: true
26
+  value: master
27
+- description: ParksMap application source URI
28
+  displayName: ParksMap Source URI
29
+  name: PARKSMAP_GIT_URI
30
+  required: true
31
+  value: https://github.com/openshift-roadshow/parksmap-web.git
32
+- description: ParksMap application source reference
33
+  displayName: ParksMap Source Ref
34
+  name: PARKSMAP_GIT_REF
35
+  required: true
36
+  value: master
37
+- name: GITHUB_WEBHOOK_SECRET
38
+  displayName: GitHub Webhook Secret
39
+  description: A secret string used to configure the GitHub webhook.
40
+  generate: expression
41
+  from: "[a-zA-Z0-9]{40}"
42
+- name: GENERIC_WEBHOOK_SECRET
43
+  displayName: Generic Webhook Secret,
44
+  description: A secret string used to configure the Generic webhook.
45
+  generate: expression
46
+  from: "[a-zA-Z0-9]{40}"
47
+objects:
48
+- apiVersion: v1
49
+  kind: BuildConfig
50
+  metadata:
51
+    labels:
52
+      build: mapsapp-pipeline
53
+    name: mapsapp-pipeline
54
+  spec:
55
+    runPolicy: Serial
56
+    source: {}
57
+    strategy:
58
+      type: JenkinsPipeline
59
+      jenkinsPipelineStrategy:
60
+        jenkinsfile: |-
61
+          def project = ""
62
+          node {
63
+            project = "${env.PROJECT_NAME}"
64
+
65
+            stage('Create NationalParks back-end') {
66
+              def nationalParksURL = "${NATIONALPARKS_GIT_URI}"
67
+              def nationalParksBranch = "${NATIONALPARKS_GIT_REF}"
68
+              checkout([$class: "GitSCM", branches: [[name: "*/${nationalParksBranch}"]], doGenerateSubmoduleConfigurations: false, extensions: [[$class: "RelativeTargetDirectory", relativeTargetDir: "nationalparks"]], submoduleCfg: [], userRemoteConfigs: [[url: "${nationalParksURL}"]]])
69
+              sh "oc new-app -f nationalparks/ose3/pipeline-buildconfig-template.json -p GIT_URI=${nationalParksURL} -p GIT_REF=${nationalParksBranch} -n ${project} --dry-run -o yaml | oc apply -f - -n ${project}"
70
+            }
71
+
72
+            stage('Create MLBParks back-end') {
73
+              def mlbParksURL = "${MLBPARKS_GIT_URI}"
74
+              def mlbParksBranch = "${MLBPARKS_GIT_REF}"
75
+              checkout([$class: "GitSCM", branches: [[name: "*/${mlbParksBranch}"]], doGenerateSubmoduleConfigurations: false, extensions: [[$class: "RelativeTargetDirectory", relativeTargetDir: "mlbparks"]], submoduleCfg: [], userRemoteConfigs: [[url: "${mlbParksURL}"]]])
76
+              sh "oc new-app -f mlbparks/ose3/pipeline-buildconfig-template.json -p GIT_URI=${mlbParksURL} -p GIT_REF=${mlbParksBranch} -n ${project} --dry-run -o yaml | oc apply -f - -n ${project}"
77
+            }
78
+
79
+            stage('Create ParksMap front-end') {
80
+              def parksMapURL = "${PARKSMAP_GIT_URI}"
81
+              def parksMapBranch = "${PARKSMAP_GIT_REF}"
82
+              checkout([$class: "GitSCM", branches: [[name: "*/${parksMapBranch}"]], doGenerateSubmoduleConfigurations: false, extensions: [[$class: "RelativeTargetDirectory", relativeTargetDir: "parksmap"]], submoduleCfg: [], userRemoteConfigs: [[url: "${parksMapURL}"]]])
83
+              sh "oc new-app -f parksmap/ose3/pipeline-buildconfig-template.json -p GIT_URI=${parksMapURL} -p GIT_REF=${parksMapBranch} -n ${project} --dry-run -o yaml | oc apply -f - -n ${project}"
84
+            }
85
+          }
86
+
87
+          stage('Build Back-ends') {
88
+            parallel (
89
+              "nationalparks": {
90
+                node {
91
+                  openshiftBuild buildConfig: "nationalparks-pipeline", namespace: project
92
+                }
93
+              },
94
+              "mlbparks": {
95
+                node {
96
+                  openshiftBuild buildConfig: "mlbparks-pipeline", namespace: project
97
+                }
98
+              }
99
+            )
100
+          }
101
+
102
+          node {
103
+            stage('Build Front-end') {
104
+              openshiftBuild buildConfig: "parksmap-pipeline", namespace: project
105
+            }
106
+          }
107
+    triggers:
108
+    - github:
109
+        secret: ${GITHUB_TRIGGER_SECRET}
110
+      type: GitHub
111
+    - generic:
112
+        secret: ${GENERIC_TRIGGER_SECRET}
113
+      type: Generic
0 114
new file mode 100644
... ...
@@ -0,0 +1,228 @@
0
+apiVersion: v1
1
+kind: Template
2
+metadata:
3
+  name: maven-pipeline
4
+parameters:
5
+- name: APP_NAME
6
+  description: The name assigned to all of the application objects defined in this template.
7
+  displayName: Application Name
8
+  required: true
9
+  value: openshift-jee-sample
10
+- name: GIT_SOURCE_URL
11
+  description: The source URL for the application
12
+  displayName: Source URL
13
+  required: true
14
+  value: https://github.com/bparees/openshift-jee-sample.git
15
+- name: GIT_SOURCE_REF
16
+  description: The source Ref for the application
17
+  displayName: Source Ref
18
+  required: true
19
+  value: master
20
+- description: A secret string used to configure the GitHub webhook.
21
+  displayName: GitHub Webhook Secret
22
+  from: '[a-zA-Z0-9]{40}'
23
+  generate: expression
24
+  name: GITHUB_WEBHOOK_SECRET
25
+  required: true
26
+- description: A secret string used to configure the Generic webhook.
27
+  displayName: Generic Webhook Secret
28
+  from: '[a-zA-Z0-9]{40}'
29
+  generate: expression
30
+  name: GENERIC_WEBHOOK_SECRET
31
+  required: true
32
+objects:
33
+- apiVersion: v1
34
+  kind: ImageStream
35
+  metadata:
36
+    labels:
37
+      app: ${APP_NAME}
38
+    name: ${APP_NAME}
39
+  spec: {}
40
+  status:
41
+    dockerImageRepository: ""
42
+- apiVersion: v1
43
+  kind: BuildConfig
44
+  metadata:
45
+    annotations:
46
+      pipeline.alpha.openshift.io/uses: '[{"name": "${NAME}", "namespace": "", "kind": "DeploymentConfig"}]'
47
+    creationTimestamp: null
48
+    labels:
49
+      name: ${APP_NAME}
50
+    name: ${APP_NAME}
51
+  spec:
52
+    strategy:
53
+      jenkinsPipelineStrategy:
54
+        jenkinsfile: |-
55
+          def appName="${APP_NAME}"
56
+          def project=""
57
+
58
+          node {
59
+            stage("Initialize") {
60
+              project = env.PROJECT_NAME
61
+            }
62
+          }
63
+
64
+          node("maven") {
65
+            stage("Checkout") {
66
+              git url: "${GIT_SOURCE_URL}", branch: "${GIT_SOURCE_REF}"
67
+            }
68
+            stage("Build WAR") {
69
+              sh "mvn clean package -Popenshift"
70
+              stash name:"war", includes:"target/ROOT.war"
71
+            }
72
+          }
73
+
74
+          node {
75
+            stage("Build Image") {
76
+              unstash name:"war"
77
+              sh "oc start-build ${appName}-docker --from-file=target/ROOT.war --follow -n ${project}"
78
+            }
79
+            stage("Deploy") {
80
+              openshiftDeploy deploymentConfig: appName, namespace: project
81
+            }
82
+          }
83
+      type: JenkinsPipeline
84
+    triggers:
85
+    - github:
86
+        secret: "${GITHUB_WEBHOOK_SECRET}"
87
+      type: GitHub
88
+    - generic:
89
+        secret: "${GENERIC_WEBHOOK_SECRET}"
90
+      type: Generic
91
+- apiVersion: v1
92
+  kind: BuildConfig
93
+  metadata:
94
+    labels:
95
+      app: ${APP_NAME}-docker
96
+    name: ${APP_NAME}-docker
97
+  spec:
98
+    output:
99
+      to:
100
+        kind: ImageStreamTag
101
+        name: ${APP_NAME}:latest
102
+    postCommit: {}
103
+    resources: {}
104
+    runPolicy: Serial
105
+    source:
106
+      dockerfile: |-
107
+        FROM wildfly
108
+        COPY ROOT.war /wildfly/standalone/deployments/ROOT.war
109
+        CMD $STI_SCRIPTS_PATH/run
110
+      binary:
111
+        asFile: ROOT.war
112
+      type: Docker
113
+    strategy:
114
+      dockerStrategy:
115
+        from:
116
+          kind: ImageStreamTag
117
+          name: wildfly:latest
118
+          namespace: openshift
119
+      type: Docker
120
+    triggers: {}
121
+- apiVersion: v1
122
+  kind: DeploymentConfig
123
+  metadata:
124
+    labels:
125
+      app: ${APP_NAME}
126
+    name: ${APP_NAME}
127
+  spec:
128
+    replicas: 1
129
+    selector:
130
+      app: ${APP_NAME}
131
+      deploymentconfig: ${APP_NAME}
132
+    strategy:
133
+      rollingParams:
134
+        intervalSeconds: 1
135
+        maxSurge: 25%
136
+        maxUnavailable: 25%
137
+        timeoutSeconds: 600
138
+        updatePeriodSeconds: 1
139
+      type: Rolling
140
+    template:
141
+      metadata:
142
+        annotations:
143
+          openshift.io/container.${APP_NAME}.image.entrypoint: '["container-entrypoint","/bin/sh","-c","$STI_SCRIPTS_PATH/usage"]'
144
+        labels:
145
+          app: ${APP_NAME}
146
+          deploymentconfig: ${APP_NAME}
147
+      spec:
148
+        containers:
149
+        - image: ${APP_NAME}:latest
150
+          imagePullPolicy: Always
151
+          name: ${APP_NAME}
152
+          ports:
153
+          - containerPort: 8080
154
+            protocol: TCP
155
+          resources: {}
156
+          terminationMessagePath: /dev/termination-log
157
+          livenessProbe:
158
+            httpGet:
159
+              path: /
160
+              port: 8080
161
+              scheme: HTTP
162
+            initialDelaySeconds: 10
163
+            timeoutSeconds: 2
164
+            periodSeconds: 10
165
+            successThreshold: 1
166
+            failureThreshold: 3
167
+          readinessProbe:
168
+            httpGet:
169
+              path: /
170
+              port: 8080
171
+              scheme: HTTP
172
+            initialDelaySeconds: 30
173
+            timeoutSeconds: 2
174
+            periodSeconds: 10
175
+            successThreshold: 1
176
+            failureThreshold: 3
177
+        dnsPolicy: ClusterFirst
178
+        restartPolicy: Always
179
+        securityContext: {}
180
+        terminationGracePeriodSeconds: 30
181
+    test: false
182
+    triggers:
183
+    - type: ConfigChange
184
+    - imageChangeParams:
185
+        automatic: true
186
+        containerNames:
187
+        - ${APP_NAME}
188
+        from:
189
+          kind: ImageStreamTag
190
+          name: ${APP_NAME}:latest
191
+      type: ImageChange
192
+  status: {}
193
+- apiVersion: v1
194
+  kind: Service
195
+  metadata:
196
+    annotations:
197
+      openshift.io/generated-by: OpenShiftNewApp
198
+    labels:
199
+      app: ${APP_NAME}
200
+    name: ${APP_NAME}
201
+  spec:
202
+    ports:
203
+    - name: 8080-tcp
204
+      port: 8080
205
+      protocol: TCP
206
+      targetPort: 8080
207
+    selector:
208
+      app: ${APP_NAME}
209
+      deploymentconfig: ${APP_NAME}
210
+    sessionAffinity: None
211
+    type: ClusterIP
212
+  status:
213
+    loadBalancer: {}
214
+- apiVersion: v1
215
+  kind: Route
216
+  metadata:
217
+    name: ${APP_NAME}
218
+    labels:
219
+      app: ${APP_NAME}
220
+  spec:
221
+    to:
222
+      kind: Service
223
+      name: ${APP_NAME}
224
+      weight: 100
225
+    port:
226
+      targetPort: 8080-tcp
227
+    wildcardPolicy: None
0 228
deleted file mode 100644
... ...
@@ -1,499 +0,0 @@
1
-{
2
-  "kind": "Template",
3
-  "apiVersion": "v1",
4
-  "metadata": {
5
-    "name": "jenkins-pipeline-example",
6
-    "creationTimestamp": null,
7
-    "annotations": {
8
-      "description": "This example showcases the new Jenkins Pipeline integration in OpenShift, which performs continuous integration and deployment right on the platform. The template contains a Jenkinsfile - a definition of a multi-stage CI/CD process - that leverages the underlying OpenShift platform for dynamic and scalable builds. OpenShift integrates the status of your pipeline builds into the web console allowing you to see your entire application lifecycle in a single view.",
9
-      "iconClass": "icon-jenkins",
10
-      "tags": "instant-app,jenkins"
11
-    }
12
-  },
13
-  "message": "A Jenkins server will be automatically instantiated in this project to manage the Pipeline BuildConfig created by this template.  You will be able to log in to it using your OpenShift user credentials.",
14
-  "objects": [
15
-    {
16
-      "kind": "BuildConfig",
17
-      "apiVersion": "v1",
18
-      "metadata": {
19
-        "name": "sample-pipeline",
20
-        "creationTimestamp": null,
21
-        "labels": {
22
-          "name": "sample-pipeline"
23
-        },
24
-        "annotations": {
25
-          "pipeline.alpha.openshift.io/uses": "[{\"name\": \"${NAME}\", \"namespace\": \"\", \"kind\": \"DeploymentConfig\"}]"
26
-        }
27
-      },
28
-      "spec": {
29
-        "triggers": [
30
-          {
31
-            "type": "GitHub",
32
-            "github": {
33
-              "secret": "secret101"
34
-            }
35
-          },
36
-          {
37
-            "type": "Generic",
38
-            "generic": {
39
-              "secret": "secret101"
40
-            }
41
-          }
42
-        ],
43
-        "strategy": {
44
-          "type": "JenkinsPipeline",
45
-          "jenkinsPipelineStrategy": {
46
-            "jenkinsfile": "node('nodejs') {\n  stage('build') {\n    openshiftBuild(buildConfig: '${NAME}', showBuildLogs: 'true')\n  }\n  stage('deploy') {\n    openshiftDeploy(deploymentConfig: '${NAME}')\n  }\n}"
47
-          }
48
-        }
49
-      }
50
-    },
51
-      {
52
-        "kind": "Service",
53
-        "apiVersion": "v1",
54
-        "metadata": {
55
-          "name": "${NAME}",
56
-          "annotations": {
57
-            "service.alpha.openshift.io/dependencies": "[{\"name\": \"${DATABASE_SERVICE_NAME}\", \"namespace\": \"\", \"kind\": \"Service\"}]"
58
-          }
59
-        },
60
-        "spec": {
61
-          "ports": [
62
-            {
63
-              "name": "web",
64
-              "port": 8080,
65
-              "targetPort": 8080
66
-            }
67
-          ],
68
-          "selector": {
69
-            "name": "${NAME}"
70
-          }
71
-        }
72
-      },
73
-      {
74
-        "kind": "Route",
75
-        "apiVersion": "v1",
76
-        "metadata": {
77
-          "name": "${NAME}"
78
-        },
79
-        "spec": {
80
-          "host": "${APPLICATION_DOMAIN}",
81
-          "to": {
82
-            "kind": "Service",
83
-            "name": "${NAME}"
84
-          }
85
-        }
86
-      },
87
-      {
88
-        "kind": "ImageStream",
89
-        "apiVersion": "v1",
90
-        "metadata": {
91
-          "name": "${NAME}",
92
-          "annotations": {
93
-            "description": "Keeps track of changes in the application image"
94
-          }
95
-        }
96
-      },
97
-      {
98
-        "kind": "BuildConfig",
99
-        "apiVersion": "v1",
100
-        "metadata": {
101
-          "name": "${NAME}",
102
-          "annotations": {
103
-            "description": "Defines how to build the application"
104
-          }
105
-        },
106
-        "spec": {
107
-          "source": {
108
-            "type": "Git",
109
-            "git": {
110
-              "uri": "${SOURCE_REPOSITORY_URL}",
111
-              "ref": "${SOURCE_REPOSITORY_REF}"
112
-            },
113
-            "contextDir": "${CONTEXT_DIR}"
114
-          },
115
-          "strategy": {
116
-            "type": "Source",
117
-            "sourceStrategy": {
118
-              "from": {
119
-                "kind": "ImageStreamTag",
120
-                "namespace": "${NAMESPACE}",
121
-                "name": "nodejs:4"
122
-              },
123
-              "env":  [
124
-                {
125
-                    "name": "NPM_MIRROR",
126
-                    "value": "${NPM_MIRROR}"
127
-                }
128
-              ]
129
-            }
130
-          },
131
-          "output": {
132
-            "to": {
133
-              "kind": "ImageStreamTag",
134
-              "name": "${NAME}:latest"
135
-            }
136
-          },
137
-          "triggers": [
138
-            {
139
-              "type": "GitHub",
140
-              "github": {
141
-                "secret": "${GITHUB_WEBHOOK_SECRET}"
142
-              }
143
-            },
144
-            {
145
-              "type": "Generic",
146
-              "generic": {
147
-                "secret": "${GENERIC_WEBHOOK_SECRET}"
148
-              }
149
-            }
150
-          ],
151
-          "postCommit": {
152
-            "script": "npm test"
153
-          }
154
-        }
155
-      },
156
-      {
157
-        "kind": "DeploymentConfig",
158
-        "apiVersion": "v1",
159
-        "metadata": {
160
-          "name": "${NAME}",
161
-          "annotations": {
162
-            "description": "Defines how to deploy the application server"
163
-          }
164
-        },
165
-        "spec": {
166
-          "strategy": {
167
-            "type": "Rolling"
168
-          },
169
-          "triggers": [
170
-            {
171
-              "type": "ImageChange",
172
-              "imageChangeParams": {
173
-                "automatic": false,
174
-                "containerNames": [
175
-                  "nodejs-mongodb-example"
176
-                ],
177
-                "from": {
178
-                  "kind": "ImageStreamTag",
179
-                  "name": "${NAME}:latest"
180
-                }
181
-              }
182
-            },
183
-            {
184
-              "type": "ConfigChange"
185
-            }
186
-          ],
187
-          "replicas": 1,
188
-          "selector": {
189
-            "name": "${NAME}"
190
-          },
191
-          "template": {
192
-            "metadata": {
193
-              "name": "${NAME}",
194
-              "labels": {
195
-                "name": "${NAME}"
196
-              }
197
-            },
198
-            "spec": {
199
-              "containers": [
200
-                {
201
-                  "name": "nodejs-mongodb-example",
202
-                  "image": " ",
203
-                  "ports": [
204
-                    {
205
-                      "containerPort": 8080
206
-                    }
207
-                  ],
208
-                  "env": [
209
-                    {
210
-                      "name": "DATABASE_SERVICE_NAME",
211
-                      "value": "${DATABASE_SERVICE_NAME}"
212
-                    },
213
-                    {
214
-                      "name": "MONGODB_USER",
215
-                      "value": "${DATABASE_USER}"
216
-                    },
217
-                    {
218
-                      "name": "MONGODB_PASSWORD",
219
-                      "value": "${DATABASE_PASSWORD}"
220
-                    },
221
-                    {
222
-                      "name": "MONGODB_DATABASE",
223
-                      "value": "${DATABASE_NAME}"
224
-                    },
225
-                    {
226
-                      "name": "MONGODB_ADMIN_PASSWORD",
227
-                      "value": "${DATABASE_ADMIN_PASSWORD}"
228
-                    }
229
-                  ],
230
-                  "readinessProbe": {
231
-                    "timeoutSeconds": 3,
232
-                    "initialDelaySeconds": 3,
233
-                    "httpGet": {
234
-                      "path": "/pagecount",
235
-                      "port": 8080
236
-                    }
237
-                  },
238
-                  "livenessProbe": {
239
-                      "timeoutSeconds": 3,
240
-                      "initialDelaySeconds": 30,
241
-                      "httpGet": {
242
-                          "path": "/pagecount",
243
-                          "port": 8080
244
-                      }
245
-                  },
246
-                  "resources": {
247
-                      "limits": {
248
-                          "memory": "${MEMORY_LIMIT}"
249
-                      }
250
-                  }
251
-                }
252
-              ]
253
-            }
254
-          }
255
-        }
256
-      },
257
-      {
258
-        "kind": "Service",
259
-        "apiVersion": "v1",
260
-        "metadata": {
261
-          "name": "${DATABASE_SERVICE_NAME}",
262
-          "annotations": {
263
-            "description": "Exposes the database server"
264
-          }
265
-        },
266
-        "spec": {
267
-          "ports": [
268
-            {
269
-              "name": "mongodb",
270
-              "port": 27017,
271
-              "targetPort": 27017
272
-            }
273
-          ],
274
-          "selector": {
275
-            "name": "${DATABASE_SERVICE_NAME}"
276
-          }
277
-        }
278
-      },
279
-      {
280
-        "kind": "DeploymentConfig",
281
-        "apiVersion": "v1",
282
-        "metadata": {
283
-          "name": "${DATABASE_SERVICE_NAME}",
284
-          "annotations": {
285
-            "description": "Defines how to deploy the database"
286
-          }
287
-        },
288
-        "spec": {
289
-          "strategy": {
290
-            "type": "Recreate"
291
-          },
292
-          "triggers": [
293
-            {
294
-              "type": "ImageChange",
295
-              "imageChangeParams": {
296
-                "automatic": true,
297
-                "containerNames": [
298
-                  "mongodb"
299
-                ],
300
-                "from": {
301
-                  "kind": "ImageStreamTag",
302
-                  "namespace": "${NAMESPACE}",
303
-                  "name": "mongodb:3.2"
304
-                }
305
-              }
306
-            },
307
-            {
308
-              "type": "ConfigChange"
309
-            }
310
-          ],
311
-          "replicas": 1,
312
-          "selector": {
313
-            "name": "${DATABASE_SERVICE_NAME}"
314
-          },
315
-          "template": {
316
-            "metadata": {
317
-              "name": "${DATABASE_SERVICE_NAME}",
318
-              "labels": {
319
-                "name": "${DATABASE_SERVICE_NAME}"
320
-              }
321
-            },
322
-            "spec": {
323
-              "containers": [
324
-                {
325
-                  "name": "mongodb",
326
-                  "image": " ",
327
-                  "ports": [
328
-                    {
329
-                      "containerPort": 27017
330
-                    }
331
-                  ],
332
-                  "env": [
333
-                    {
334
-                      "name": "MONGODB_USER",
335
-                      "value": "${DATABASE_USER}"
336
-                    },
337
-                    {
338
-                      "name": "MONGODB_PASSWORD",
339
-                      "value": "${DATABASE_PASSWORD}"
340
-                    },
341
-                    {
342
-                      "name": "MONGODB_DATABASE",
343
-                      "value": "${DATABASE_NAME}"
344
-                    },
345
-                    {
346
-                      "name": "MONGODB_ADMIN_PASSWORD",
347
-                      "value": "${DATABASE_ADMIN_PASSWORD}"
348
-                    }
349
-                  ],
350
-                  "readinessProbe": {
351
-                    "timeoutSeconds": 1,
352
-                    "initialDelaySeconds": 3,
353
-                    "exec": {
354
-                      "command": [ "/bin/sh", "-i", "-c", "mongo 127.0.0.1:27017/$MONGODB_DATABASE -u $MONGODB_USER -p $MONGODB_PASSWORD --eval=\"quit()\""]
355
-                    }
356
-                  },
357
-                  "livenessProbe": {
358
-                    "timeoutSeconds": 1,
359
-                    "initialDelaySeconds": 30,
360
-                    "tcpSocket": {
361
-                      "port": 27017
362
-                    }
363
-                  },
364
-                  "resources": {
365
-                      "limits": {
366
-                          "memory": "${MEMORY_MONGODB_LIMIT}"
367
-                      }
368
-                  },
369
-                  "volumeMounts": [
370
-                    {
371
-                      "name": "${DATABASE_SERVICE_NAME}-data",
372
-                      "mountPath": "/var/lib/mongodb/data"
373
-                    }
374
-                  ]
375
-                }
376
-              ],
377
-              "volumes": [
378
-                {
379
-                  "name": "${DATABASE_SERVICE_NAME}-data",
380
-                  "emptyDir": {
381
-                    "medium": ""
382
-                  }
383
-                }
384
-              ]
385
-            }
386
-          }
387
-        }
388
-      }
389
-    ],
390
-  "parameters": [
391
-      {
392
-        "name": "NAME",
393
-        "displayName": "Name",
394
-        "description": "The name assigned to all of the frontend objects defined in this template.",
395
-        "required": true,
396
-        "value": "nodejs-mongodb-example"
397
-      },
398
-      {
399
-        "name": "APPLICATION_DOMAIN",
400
-        "displayName": "Application Hostname",
401
-        "description": "The exposed hostname that will route to the Node.js service, if left blank a value will be defaulted.",
402
-        "value": ""
403
-      },
404
-      {
405
-        "name": "SOURCE_REPOSITORY_URL",
406
-        "displayName": "Git Repository URL",
407
-        "description": "The URL of the repository with your application source code.",
408
-        "required": true,
409
-        "value": "https://github.com/openshift/nodejs-ex.git"
410
-      },
411
-      {
412
-        "name": "DATABASE_NAME",
413
-        "displayName": "Database Name",
414
-        "required": true,
415
-        "value": "sampledb"
416
-      },
417
-      {
418
-        "name": "DATABASE_USER",
419
-        "displayName": "MongoDB Username",
420
-        "description": "Username for MongoDB user that will be used for accessing the database.",
421
-        "generate": "expression",
422
-        "from": "user[A-Z0-9]{3}"
423
-      },
424
-      {
425
-        "name": "DATABASE_PASSWORD",
426
-        "displayName": "MongoDB Password",
427
-        "description": "Password for the MongoDB user.",
428
-        "generate": "expression",
429
-        "from": "[a-zA-Z0-9]{16}"
430
-      },
431
-      {
432
-        "name": "MEMORY_LIMIT",
433
-        "displayName": "Memory Limit",
434
-        "description": "Maximum amount of memory the Node.js container can use.",
435
-        "required": true,
436
-        "value": "512Mi"
437
-      },
438
-      {
439
-        "name": "MEMORY_MONGODB_LIMIT",
440
-        "displayName": "Memory Limit (MongoDB)",
441
-        "description": "Maximum amount of memory the MongoDB container can use.",
442
-        "required": true,
443
-        "value": "512Mi"
444
-      },
445
-      {
446
-        "name": "DATABASE_SERVICE_NAME",
447
-        "displayName": "Database Service Name",
448
-        "required": true,
449
-        "value": "mongodb"
450
-      },
451
-      {
452
-        "name": "DATABASE_ADMIN_PASSWORD",
453
-        "displayName": "Database Administrator Password",
454
-        "description": "Password for the database admin user.",
455
-        "generate": "expression",
456
-        "from": "[a-zA-Z0-9]{16}"
457
-      },
458
-      {
459
-        "name": "SOURCE_REPOSITORY_REF",
460
-        "displayName": "Git Reference",
461
-        "description": "Set this to a branch name, tag or other ref of your repository if you are not using the default branch."
462
-      },
463
-      {
464
-        "name": "CONTEXT_DIR",
465
-        "displayName": "Context Directory",
466
-        "description": "Set this to the relative path to your project if it is not in the root of your repository."
467
-      },
468
-      {
469
-        "name": "GITHUB_WEBHOOK_SECRET",
470
-        "displayName": "GitHub Webhook Secret",
471
-        "description": "A secret string used to configure the GitHub webhook.",
472
-        "generate": "expression",
473
-        "from": "[a-zA-Z0-9]{40}"
474
-      },
475
-      {
476
-        "name": "GENERIC_WEBHOOK_SECRET",
477
-        "displayName": "Generic Webhook Secret",
478
-        "description": "A secret string used to configure the Generic webhook.",
479
-        "generate": "expression",
480
-        "from": "[a-zA-Z0-9]{40}"
481
-      },
482
-      {
483
-        "name": "NPM_MIRROR",
484
-        "displayName": "Custom NPM Mirror URL",
485
-        "description": "The custom NPM mirror URL",
486
-        "value": ""
487
-      },
488
-      {
489
-        "name": "NAMESPACE",
490
-        "displayName": "Namespace",
491
-        "description": "The OpenShift Namespace where the NodeJS and MongoDB ImageStreams reside.",
492
-        "required": true,
493
-        "value": "openshift"
494
-      }
495
-  ],
496
-  "labels": {
497
-    "template": "application-template-sample-pipeline"
498
-  }
499
-}
500 1
new file mode 100644
... ...
@@ -0,0 +1,327 @@
0
+apiVersion: v1
1
+kind: Template
2
+labels:
3
+  template: application-template-sample-pipeline
4
+message: |-
5
+  A Jenkins server will be automatically instantiated in this project to manage
6
+  the Pipeline BuildConfig created by this template.  You will be able to log in to
7
+  it using your OpenShift user credentials.
8
+metadata:
9
+  annotations:
10
+    description: |-
11
+      This example showcases the new Jenkins Pipeline integration in OpenShift,
12
+      which performs continuous integration and deployment right on the platform.
13
+      The template contains a Jenkinsfile - a definition of a multi-stage CI/CD process - that
14
+      leverages the underlying OpenShift platform for dynamic and scalable
15
+      builds. OpenShift integrates the status of your pipeline builds into the web
16
+      console allowing you to see your entire application lifecycle in a single view.
17
+    iconClass: icon-jenkins
18
+    tags: instant-app,jenkins
19
+  name: jenkins-pipeline-example
20
+parameters:
21
+- description: The name assigned to all of the frontend objects defined in this template.
22
+  displayName: Name
23
+  name: NAME
24
+  required: true
25
+  value: nodejs-mongodb-example
26
+- description: The exposed hostname that will route to the Node.js service, if left
27
+    blank a value will be defaulted.
28
+  displayName: Application Hostname
29
+  name: APPLICATION_DOMAIN
30
+- description: The URL of the repository with your application source code.
31
+  displayName: Git Repository URL
32
+  name: SOURCE_REPOSITORY_URL
33
+  required: true
34
+  value: https://github.com/openshift/nodejs-ex.git
35
+- displayName: Database Name
36
+  name: DATABASE_NAME
37
+  required: true
38
+  value: sampledb
39
+- description: Username for MongoDB user that will be used for accessing the database.
40
+  displayName: MongoDB Username
41
+  from: user[A-Z0-9]{3}
42
+  generate: expression
43
+  name: DATABASE_USER
44
+- description: Password for the MongoDB user.
45
+  displayName: MongoDB Password
46
+  from: '[a-zA-Z0-9]{16}'
47
+  generate: expression
48
+  name: DATABASE_PASSWORD
49
+- description: Maximum amount of memory the Node.js container can use.
50
+  displayName: Memory Limit
51
+  name: MEMORY_LIMIT
52
+  required: true
53
+  value: 512Mi
54
+- description: Maximum amount of memory the MongoDB container can use.
55
+  displayName: Memory Limit (MongoDB)
56
+  name: MEMORY_MONGODB_LIMIT
57
+  required: true
58
+  value: 512Mi
59
+- displayName: Database Service Name
60
+  name: DATABASE_SERVICE_NAME
61
+  required: true
62
+  value: mongodb
63
+- description: Password for the database admin user.
64
+  displayName: Database Administrator Password
65
+  from: '[a-zA-Z0-9]{16}'
66
+  generate: expression
67
+  name: DATABASE_ADMIN_PASSWORD
68
+- description: Set this to a branch name, tag or other ref of your repository if you
69
+    are not using the default branch.
70
+  displayName: Git Reference
71
+  name: SOURCE_REPOSITORY_REF
72
+- description: Set this to the relative path to your project if it is not in the root
73
+    of your repository.
74
+  displayName: Context Directory
75
+  name: CONTEXT_DIR
76
+- description: A secret string used to configure the GitHub webhook.
77
+  displayName: GitHub Webhook Secret
78
+  from: '[a-zA-Z0-9]{40}'
79
+  generate: expression
80
+  name: GITHUB_WEBHOOK_SECRET
81
+- description: A secret string used to configure the Generic webhook.
82
+  displayName: Generic Webhook Secret
83
+  from: '[a-zA-Z0-9]{40}'
84
+  generate: expression
85
+  name: GENERIC_WEBHOOK_SECRET
86
+- description: The custom NPM mirror URL
87
+  displayName: Custom NPM Mirror URL
88
+  name: NPM_MIRROR
89
+- description: The OpenShift Namespace where the NodeJS and MongoDB ImageStreams reside.
90
+  displayName: Namespace
91
+  name: NAMESPACE
92
+  required: true
93
+  value: openshift
94
+objects:
95
+- apiVersion: v1
96
+  kind: BuildConfig
97
+  metadata:
98
+    annotations:
99
+      pipeline.alpha.openshift.io/uses: '[{"name": "${NAME}", "namespace": "", "kind": "DeploymentConfig"}]'
100
+    labels:
101
+      name: sample-pipeline
102
+    name: sample-pipeline
103
+  spec:
104
+    strategy:
105
+      jenkinsPipelineStrategy:
106
+        jenkinsfile: |-
107
+          node('nodejs') {
108
+            stage('build') {
109
+              openshiftBuild(buildConfig: '${NAME}', showBuildLogs: 'true')
110
+            }
111
+            stage('deploy') {
112
+              openshiftDeploy(deploymentConfig: '${NAME}')
113
+            }
114
+          }
115
+      type: JenkinsPipeline
116
+    triggers:
117
+    - github:
118
+        secret: secret101
119
+      type: GitHub
120
+    - generic:
121
+        secret: secret101
122
+      type: Generic
123
+- apiVersion: v1
124
+  kind: Service
125
+  metadata:
126
+    annotations:
127
+      service.alpha.openshift.io/dependencies: '[{"name": "${DATABASE_SERVICE_NAME}", "namespace": "", "kind": "Service"}]'
128
+    name: ${NAME}
129
+  spec:
130
+    ports:
131
+    - name: web
132
+      port: 8080
133
+      targetPort: 8080
134
+    selector:
135
+      name: ${NAME}
136
+- apiVersion: v1
137
+  kind: Route
138
+  metadata:
139
+    name: ${NAME}
140
+  spec:
141
+    host: ${APPLICATION_DOMAIN}
142
+    to:
143
+      kind: Service
144
+      name: ${NAME}
145
+- apiVersion: v1
146
+  kind: ImageStream
147
+  metadata:
148
+    annotations:
149
+      description: Keeps track of changes in the application image
150
+    name: ${NAME}
151
+- apiVersion: v1
152
+  kind: BuildConfig
153
+  metadata:
154
+    annotations:
155
+      description: Defines how to build the application
156
+    name: ${NAME}
157
+  spec:
158
+    output:
159
+      to:
160
+        kind: ImageStreamTag
161
+        name: ${NAME}:latest
162
+    postCommit:
163
+      script: npm test
164
+    source:
165
+      contextDir: ${CONTEXT_DIR}
166
+      git:
167
+        ref: ${SOURCE_REPOSITORY_REF}
168
+        uri: ${SOURCE_REPOSITORY_URL}
169
+      type: Git
170
+    strategy:
171
+      sourceStrategy:
172
+        env:
173
+        - name: NPM_MIRROR
174
+          value: ${NPM_MIRROR}
175
+        from:
176
+          kind: ImageStreamTag
177
+          name: nodejs:4
178
+          namespace: ${NAMESPACE}
179
+      type: Source
180
+    triggers:
181
+    - github:
182
+        secret: ${GITHUB_WEBHOOK_SECRET}
183
+      type: GitHub
184
+    - generic:
185
+        secret: ${GENERIC_WEBHOOK_SECRET}
186
+      type: Generic
187
+- apiVersion: v1
188
+  kind: DeploymentConfig
189
+  metadata:
190
+    annotations:
191
+      description: Defines how to deploy the application server
192
+    name: ${NAME}
193
+  spec:
194
+    replicas: 1
195
+    selector:
196
+      name: ${NAME}
197
+    strategy:
198
+      type: Rolling
199
+    template:
200
+      metadata:
201
+        labels:
202
+          name: ${NAME}
203
+        name: ${NAME}
204
+      spec:
205
+        containers:
206
+        - env:
207
+          - name: DATABASE_SERVICE_NAME
208
+            value: ${DATABASE_SERVICE_NAME}
209
+          - name: MONGODB_USER
210
+            value: ${DATABASE_USER}
211
+          - name: MONGODB_PASSWORD
212
+            value: ${DATABASE_PASSWORD}
213
+          - name: MONGODB_DATABASE
214
+            value: ${DATABASE_NAME}
215
+          - name: MONGODB_ADMIN_PASSWORD
216
+            value: ${DATABASE_ADMIN_PASSWORD}
217
+          image: ' '
218
+          livenessProbe:
219
+            httpGet:
220
+              path: /pagecount
221
+              port: 8080
222
+            initialDelaySeconds: 30
223
+            timeoutSeconds: 3
224
+          name: nodejs-mongodb-example
225
+          ports:
226
+          - containerPort: 8080
227
+          readinessProbe:
228
+            httpGet:
229
+              path: /pagecount
230
+              port: 8080
231
+            initialDelaySeconds: 3
232
+            timeoutSeconds: 3
233
+          resources:
234
+            limits:
235
+              memory: ${MEMORY_LIMIT}
236
+    triggers:
237
+    - imageChangeParams:
238
+        automatic: false
239
+        containerNames:
240
+        - nodejs-mongodb-example
241
+        from:
242
+          kind: ImageStreamTag
243
+          name: ${NAME}:latest
244
+      type: ImageChange
245
+    - type: ConfigChange
246
+- apiVersion: v1
247
+  kind: Service
248
+  metadata:
249
+    annotations:
250
+      description: Exposes the database server
251
+    name: ${DATABASE_SERVICE_NAME}
252
+  spec:
253
+    ports:
254
+    - name: mongodb
255
+      port: 27017
256
+      targetPort: 27017
257
+    selector:
258
+      name: ${DATABASE_SERVICE_NAME}
259
+- apiVersion: v1
260
+  kind: DeploymentConfig
261
+  metadata:
262
+    annotations:
263
+      description: Defines how to deploy the database
264
+    name: ${DATABASE_SERVICE_NAME}
265
+  spec:
266
+    replicas: 1
267
+    selector:
268
+      name: ${DATABASE_SERVICE_NAME}
269
+    strategy:
270
+      type: Recreate
271
+    template:
272
+      metadata:
273
+        labels:
274
+          name: ${DATABASE_SERVICE_NAME}
275
+        name: ${DATABASE_SERVICE_NAME}
276
+      spec:
277
+        containers:
278
+        - env:
279
+          - name: MONGODB_USER
280
+            value: ${DATABASE_USER}
281
+          - name: MONGODB_PASSWORD
282
+            value: ${DATABASE_PASSWORD}
283
+          - name: MONGODB_DATABASE
284
+            value: ${DATABASE_NAME}
285
+          - name: MONGODB_ADMIN_PASSWORD
286
+            value: ${DATABASE_ADMIN_PASSWORD}
287
+          image: ' '
288
+          livenessProbe:
289
+            initialDelaySeconds: 30
290
+            tcpSocket:
291
+              port: 27017
292
+            timeoutSeconds: 1
293
+          name: mongodb
294
+          ports:
295
+          - containerPort: 27017
296
+          readinessProbe:
297
+            exec:
298
+              command:
299
+              - /bin/sh
300
+              - -i
301
+              - -c
302
+              - mongo 127.0.0.1:27017/$MONGODB_DATABASE -u $MONGODB_USER -p $MONGODB_PASSWORD
303
+                --eval="quit()"
304
+            initialDelaySeconds: 3
305
+            timeoutSeconds: 1
306
+          resources:
307
+            limits:
308
+              memory: ${MEMORY_MONGODB_LIMIT}
309
+          volumeMounts:
310
+          - mountPath: /var/lib/mongodb/data
311
+            name: ${DATABASE_SERVICE_NAME}-data
312
+        volumes:
313
+        - emptyDir:
314
+            medium: ""
315
+          name: ${DATABASE_SERVICE_NAME}-data
316
+    triggers:
317
+    - imageChangeParams:
318
+        automatic: true
319
+        containerNames:
320
+        - mongodb
321
+        from:
322
+          kind: ImageStreamTag
323
+          name: mongodb:3.2
324
+          namespace: ${NAMESPACE}
325
+      type: ImageChange
326
+    - type: ConfigChange
... ...
@@ -12,7 +12,10 @@
12 12
 // examples/db-templates/postgresql-persistent-template.json
13 13
 // examples/jenkins/jenkins-ephemeral-template.json
14 14
 // examples/jenkins/jenkins-persistent-template.json
15
-// examples/jenkins/pipeline/samplepipeline.json
15
+// examples/jenkins/pipeline/bluegreen-pipeline.yaml
16
+// examples/jenkins/pipeline/mapsapp-pipeline.yaml
17
+// examples/jenkins/pipeline/maven-pipeline.yaml
18
+// examples/jenkins/pipeline/samplepipeline.yaml
16 19
 // examples/quickstarts/cakephp-mysql.json
17 20
 // examples/quickstarts/dancer-mysql.json
18 21
 // examples/quickstarts/django-postgresql.json
... ...
@@ -4241,518 +4244,1181 @@ func examplesJenkinsJenkinsPersistentTemplateJson() (*asset, error) {
4241 4241
 	return a, nil
4242 4242
 }
4243 4243
 
4244
-var _examplesJenkinsPipelineSamplepipelineJson = []byte(`{
4245
-  "kind": "Template",
4246
-  "apiVersion": "v1",
4247
-  "metadata": {
4248
-    "name": "jenkins-pipeline-example",
4249
-    "creationTimestamp": null,
4250
-    "annotations": {
4251
-      "description": "This example showcases the new Jenkins Pipeline integration in OpenShift, which performs continuous integration and deployment right on the platform. The template contains a Jenkinsfile - a definition of a multi-stage CI/CD process - that leverages the underlying OpenShift platform for dynamic and scalable builds. OpenShift integrates the status of your pipeline builds into the web console allowing you to see your entire application lifecycle in a single view.",
4252
-      "iconClass": "icon-jenkins",
4253
-      "tags": "instant-app,jenkins"
4254
-    }
4255
-  },
4256
-  "message": "A Jenkins server will be automatically instantiated in this project to manage the Pipeline BuildConfig created by this template.  You will be able to log in to it using your OpenShift user credentials.",
4257
-  "objects": [
4258
-    {
4259
-      "kind": "BuildConfig",
4260
-      "apiVersion": "v1",
4261
-      "metadata": {
4262
-        "name": "sample-pipeline",
4263
-        "creationTimestamp": null,
4264
-        "labels": {
4265
-          "name": "sample-pipeline"
4266
-        },
4267
-        "annotations": {
4268
-          "pipeline.alpha.openshift.io/uses": "[{\"name\": \"${NAME}\", \"namespace\": \"\", \"kind\": \"DeploymentConfig\"}]"
4269
-        }
4270
-      },
4271
-      "spec": {
4272
-        "triggers": [
4273
-          {
4274
-            "type": "GitHub",
4275
-            "github": {
4276
-              "secret": "secret101"
4244
+var _examplesJenkinsPipelineBluegreenPipelineYaml = []byte(`apiVersion: v1
4245
+kind: Template
4246
+labels:
4247
+  template: bluegreen-pipeline
4248
+message: A Jenkins server will be automatically instantiated in this project to manage
4249
+  the Pipeline BuildConfig created by this template.  You will be able to log in to
4250
+  it using your OpenShift user credentials.
4251
+metadata:
4252
+  annotations:
4253
+    description: This example showcases a blue green deployment using a Jenkins 
4254
+      pipeline that pauses for approval.
4255
+    iconClass: icon-jenkins
4256
+    tags: instant-app,jenkins
4257
+  name: bluegreen-pipeline
4258
+objects:
4259
+- apiVersion: v1
4260
+  kind: BuildConfig
4261
+  metadata:
4262
+    annotations:
4263
+      pipeline.alpha.openshift.io/uses: '[{"name": "${NAME}", "namespace": "", "kind": "DeploymentConfig"}]'
4264
+    creationTimestamp: null
4265
+    labels:
4266
+      name: bluegreen-pipeline
4267
+    name: bluegreen-pipeline
4268
+  spec:
4269
+    strategy:
4270
+      jenkinsPipelineStrategy:
4271
+        jenkinsfile: |-
4272
+          def appName="${NAME}"
4273
+          def project=""
4274
+          def tag="blue"
4275
+          def altTag="green"
4276
+
4277
+          node {
4278
+            project = env.PROJECT_NAME
4279
+            stage("Initialize") {
4280
+              sh "oc get route ${appName} -n ${project} -o jsonpath='{ .spec.to.weight }' > blueweight"
4281
+              blueWeight = readFile('blueweight').trim()
4282
+              if (blueWeight == "100") {
4283
+                tag = "green"
4284
+                altTag = "blue"
4285
+              }
4286
+              sh "oc get route ${tag}-${appName} -n ${project} -o jsonpath='{ .spec.host }' > routehost"
4287
+              routeHost = readFile('routehost').trim()
4277 4288
             }
4278
-          },
4279
-          {
4280
-            "type": "Generic",
4281
-            "generic": {
4282
-              "secret": "secret101"
4289
+
4290
+            stage("Build") {
4291
+              echo "building tag ${tag}"
4292
+              openshiftBuild buildConfig: appName, showBuildLogs: "true"
4283 4293
             }
4284
-          }
4285
-        ],
4286
-        "strategy": {
4287
-          "type": "JenkinsPipeline",
4288
-          "jenkinsPipelineStrategy": {
4289
-            "jenkinsfile": "node('nodejs') {\n  stage('build') {\n    openshiftBuild(buildConfig: '${NAME}', showBuildLogs: 'true')\n  }\n  stage('deploy') {\n    openshiftDeploy(deploymentConfig: '${NAME}')\n  }\n}"
4290
-          }
4291
-        }
4292
-      }
4293
-    },
4294
-      {
4295
-        "kind": "Service",
4296
-        "apiVersion": "v1",
4297
-        "metadata": {
4298
-          "name": "${NAME}",
4299
-          "annotations": {
4300
-            "service.alpha.openshift.io/dependencies": "[{\"name\": \"${DATABASE_SERVICE_NAME}\", \"namespace\": \"\", \"kind\": \"Service\"}]"
4301
-          }
4302
-        },
4303
-        "spec": {
4304
-          "ports": [
4305
-            {
4306
-              "name": "web",
4307
-              "port": 8080,
4308
-              "targetPort": 8080
4309
-            }
4310
-          ],
4311
-          "selector": {
4312
-            "name": "${NAME}"
4313
-          }
4314
-        }
4315
-      },
4316
-      {
4317
-        "kind": "Route",
4318
-        "apiVersion": "v1",
4319
-        "metadata": {
4320
-          "name": "${NAME}"
4321
-        },
4322
-        "spec": {
4323
-          "host": "${APPLICATION_DOMAIN}",
4324
-          "to": {
4325
-            "kind": "Service",
4326
-            "name": "${NAME}"
4327
-          }
4328
-        }
4329
-      },
4330
-      {
4331
-        "kind": "ImageStream",
4332
-        "apiVersion": "v1",
4333
-        "metadata": {
4334
-          "name": "${NAME}",
4335
-          "annotations": {
4336
-            "description": "Keeps track of changes in the application image"
4337
-          }
4338
-        }
4339
-      },
4340
-      {
4341
-        "kind": "BuildConfig",
4342
-        "apiVersion": "v1",
4343
-        "metadata": {
4344
-          "name": "${NAME}",
4345
-          "annotations": {
4346
-            "description": "Defines how to build the application"
4347
-          }
4348
-        },
4349
-        "spec": {
4350
-          "source": {
4351
-            "type": "Git",
4352
-            "git": {
4353
-              "uri": "${SOURCE_REPOSITORY_URL}",
4354
-              "ref": "${SOURCE_REPOSITORY_REF}"
4355
-            },
4356
-            "contextDir": "${CONTEXT_DIR}"
4357
-          },
4358
-          "strategy": {
4359
-            "type": "Source",
4360
-            "sourceStrategy": {
4361
-              "from": {
4362
-                "kind": "ImageStreamTag",
4363
-                "namespace": "${NAMESPACE}",
4364
-                "name": "nodejs:4"
4365
-              },
4366
-              "env":  [
4367
-                {
4368
-                    "name": "NPM_MIRROR",
4369
-                    "value": "${NPM_MIRROR}"
4370
-                }
4371
-              ]
4294
+
4295
+            stage("Deploy Test") {
4296
+              openshiftTag srcStream: appName, srcTag: 'latest', destinationStream: appName, destinationTag: tag
4297
+              openshiftVerifyDeployment deploymentConfig: "${appName}-${tag}"
4372 4298
             }
4373
-          },
4374
-          "output": {
4375
-            "to": {
4376
-              "kind": "ImageStreamTag",
4377
-              "name": "${NAME}:latest"
4299
+
4300
+            stage("Test") {
4301
+              input "Test deployment: http://${routeHost}. Approve?"
4378 4302
             }
4379
-          },
4380
-          "triggers": [
4381
-            {
4382
-              "type": "GitHub",
4383
-              "github": {
4384
-                "secret": "${GITHUB_WEBHOOK_SECRET}"
4385
-              }
4386
-            },
4387
-            {
4388
-              "type": "Generic",
4389
-              "generic": {
4390
-                "secret": "${GENERIC_WEBHOOK_SECRET}"
4391
-              }
4303
+
4304
+            stage("Go Live") {
4305
+              sh "oc set -n ${project} route-backends ${appName} ${appName}-${tag}=100 ${appName}-${altTag}=0"
4392 4306
             }
4393
-          ],
4394
-          "postCommit": {
4395
-            "script": "npm test"
4396 4307
           }
4397
-        }
4398
-      },
4399
-      {
4400
-        "kind": "DeploymentConfig",
4401
-        "apiVersion": "v1",
4402
-        "metadata": {
4403
-          "name": "${NAME}",
4404
-          "annotations": {
4405
-            "description": "Defines how to deploy the application server"
4308
+      type: JenkinsPipeline
4309
+    triggers:
4310
+    - github:
4311
+        secret: "${GITHUB_WEBHOOK_SECRET}"
4312
+      type: GitHub
4313
+    - generic:
4314
+        secret: "${GENERIC_WEBHOOK_SECRET}"
4315
+      type: Generic
4316
+- apiVersion: v1
4317
+  kind: Route
4318
+  metadata:
4319
+    name: blue-${NAME}
4320
+  spec:
4321
+    to:
4322
+      kind: Service
4323
+      name: ${NAME}-blue
4324
+- apiVersion: v1
4325
+  kind: Route
4326
+  metadata:
4327
+    name: green-${NAME}
4328
+  spec:
4329
+    to:
4330
+      kind: Service
4331
+      name: ${NAME}-green
4332
+- apiVersion: v1
4333
+  kind: Route
4334
+  metadata:
4335
+    name: ${NAME}
4336
+  spec:
4337
+    alternateBackends:
4338
+    - name: ${NAME}-green
4339
+      weight: "0"
4340
+    to:
4341
+      kind: Service
4342
+      name: ${NAME}-blue
4343
+      weight: "100"
4344
+- apiVersion: v1
4345
+  kind: ImageStream
4346
+  metadata:
4347
+    annotations:
4348
+      description: Keeps track of changes in the application image
4349
+    name: ${NAME}
4350
+- apiVersion: v1
4351
+  kind: BuildConfig
4352
+  metadata:
4353
+    annotations:
4354
+      description: Defines how to build the application
4355
+    name: ${NAME}
4356
+  spec:
4357
+    output:
4358
+      to:
4359
+        kind: ImageStreamTag
4360
+        name: ${NAME}:latest
4361
+    postCommit:
4362
+      script: npm test
4363
+    source:
4364
+      contextDir: ${CONTEXT_DIR}
4365
+      git:
4366
+        ref: ${SOURCE_REPOSITORY_REF}
4367
+        uri: ${SOURCE_REPOSITORY_URL}
4368
+      type: Git
4369
+    strategy:
4370
+      sourceStrategy:
4371
+        env:
4372
+        - name: NPM_MIRROR
4373
+          value: ${NPM_MIRROR}
4374
+        from:
4375
+          kind: ImageStreamTag
4376
+          name: nodejs:4
4377
+          namespace: ${NAMESPACE}
4378
+      type: Source
4379
+    triggers:
4380
+    - github:
4381
+        secret: ${GITHUB_WEBHOOK_SECRET}
4382
+      type: GitHub
4383
+    - generic:
4384
+        secret: ${GENERIC_WEBHOOK_SECRET}
4385
+      type: Generic
4386
+- apiVersion: v1
4387
+  kind: Service
4388
+  metadata:
4389
+    annotations:
4390
+      service.alpha.openshift.io/dependencies: '[{"name": "${DATABASE_SERVICE_NAME}", "namespace": "", "kind": "Service"}]'
4391
+    name: ${NAME}-blue
4392
+  spec:
4393
+    ports:
4394
+    - name: web
4395
+      port: 8080
4396
+      targetPort: 8080
4397
+    selector:
4398
+      name: ${NAME}-blue
4399
+- apiVersion: v1
4400
+  kind: DeploymentConfig
4401
+  metadata:
4402
+    annotations:
4403
+      description: Defines how to deploy the application server
4404
+    name: ${NAME}-blue
4405
+  spec:
4406
+    replicas: 1
4407
+    selector:
4408
+      name: ${NAME}-blue
4409
+    strategy:
4410
+      type: Rolling
4411
+    template:
4412
+      metadata:
4413
+        labels:
4414
+          name: ${NAME}-blue
4415
+        name: ${NAME}-blue
4416
+      spec:
4417
+        containers:
4418
+        - env:
4419
+          - name: DATABASE_SERVICE_NAME
4420
+            value: ${DATABASE_SERVICE_NAME}
4421
+          - name: MONGODB_USER
4422
+            value: ${DATABASE_USER}
4423
+          - name: MONGODB_PASSWORD
4424
+            value: ${DATABASE_PASSWORD}
4425
+          - name: MONGODB_DATABASE
4426
+            value: ${DATABASE_NAME}
4427
+          - name: MONGODB_ADMIN_PASSWORD
4428
+            value: ${DATABASE_ADMIN_PASSWORD}
4429
+          image: ' '
4430
+          livenessProbe:
4431
+            httpGet:
4432
+              path: /pagecount
4433
+              port: 8080
4434
+            initialDelaySeconds: 30
4435
+            timeoutSeconds: 3
4436
+          name: nodejs-mongodb-example
4437
+          ports:
4438
+          - containerPort: 8080
4439
+          readinessProbe:
4440
+            httpGet:
4441
+              path: /pagecount
4442
+              port: 8080
4443
+            initialDelaySeconds: 3
4444
+            timeoutSeconds: 3
4445
+          resources:
4446
+            limits:
4447
+              memory: ${MEMORY_LIMIT}
4448
+    triggers:
4449
+    - imageChangeParams:
4450
+        automatic: true
4451
+        containerNames:
4452
+        - nodejs-mongodb-example
4453
+        from:
4454
+          kind: ImageStreamTag
4455
+          name: ${NAME}:blue
4456
+      type: ImageChange
4457
+    - type: ConfigChange
4458
+- apiVersion: v1
4459
+  kind: Service
4460
+  metadata:
4461
+    annotations:
4462
+      service.alpha.openshift.io/dependencies: '[{"name": "${DATABASE_SERVICE_NAME}", "namespace": "", "kind": "Service"}]'
4463
+    name: ${NAME}-green
4464
+  spec:
4465
+    ports:
4466
+    - name: web
4467
+      port: 8080
4468
+      targetPort: 8080
4469
+    selector:
4470
+      name: ${NAME}-green
4471
+- apiVersion: v1
4472
+  kind: DeploymentConfig
4473
+  metadata:
4474
+    annotations:
4475
+      description: Defines how to deploy the application server
4476
+    name: ${NAME}-green
4477
+  spec:
4478
+    replicas: 1
4479
+    selector:
4480
+      name: ${NAME}-green
4481
+    strategy:
4482
+      type: Rolling
4483
+    template:
4484
+      metadata:
4485
+        labels:
4486
+          name: ${NAME}-green
4487
+        name: ${NAME}-green
4488
+      spec:
4489
+        containers:
4490
+        - env:
4491
+          - name: DATABASE_SERVICE_NAME
4492
+            value: ${DATABASE_SERVICE_NAME}
4493
+          - name: MONGODB_USER
4494
+            value: ${DATABASE_USER}
4495
+          - name: MONGODB_PASSWORD
4496
+            value: ${DATABASE_PASSWORD}
4497
+          - name: MONGODB_DATABASE
4498
+            value: ${DATABASE_NAME}
4499
+          - name: MONGODB_ADMIN_PASSWORD
4500
+            value: ${DATABASE_ADMIN_PASSWORD}
4501
+          image: ' '
4502
+          livenessProbe:
4503
+            httpGet:
4504
+              path: /pagecount
4505
+              port: 8080
4506
+            initialDelaySeconds: 30
4507
+            timeoutSeconds: 3
4508
+          name: nodejs-mongodb-example
4509
+          ports:
4510
+          - containerPort: 8080
4511
+          readinessProbe:
4512
+            httpGet:
4513
+              path: /pagecount
4514
+              port: 8080
4515
+            initialDelaySeconds: 3
4516
+            timeoutSeconds: 3
4517
+          resources:
4518
+            limits:
4519
+              memory: ${MEMORY_LIMIT}
4520
+    triggers:
4521
+    - imageChangeParams:
4522
+        automatic: true
4523
+        containerNames:
4524
+        - nodejs-mongodb-example
4525
+        from:
4526
+          kind: ImageStreamTag
4527
+          name: ${NAME}:green
4528
+      type: ImageChange
4529
+    - type: ConfigChange
4530
+- apiVersion: v1
4531
+  kind: Service
4532
+  metadata:
4533
+    annotations:
4534
+      description: Exposes the database server
4535
+    name: ${DATABASE_SERVICE_NAME}
4536
+  spec:
4537
+    ports:
4538
+    - name: mongodb
4539
+      port: 27017
4540
+      targetPort: 27017
4541
+    selector:
4542
+      name: ${DATABASE_SERVICE_NAME}
4543
+- apiVersion: v1
4544
+  kind: DeploymentConfig
4545
+  metadata:
4546
+    annotations:
4547
+      description: Defines how to deploy the database
4548
+    name: ${DATABASE_SERVICE_NAME}
4549
+  spec:
4550
+    replicas: 1
4551
+    selector:
4552
+      name: ${DATABASE_SERVICE_NAME}
4553
+    strategy:
4554
+      type: Recreate
4555
+    template:
4556
+      metadata:
4557
+        labels:
4558
+          name: ${DATABASE_SERVICE_NAME}
4559
+        name: ${DATABASE_SERVICE_NAME}
4560
+      spec:
4561
+        containers:
4562
+        - env:
4563
+          - name: MONGODB_USER
4564
+            value: ${DATABASE_USER}
4565
+          - name: MONGODB_PASSWORD
4566
+            value: ${DATABASE_PASSWORD}
4567
+          - name: MONGODB_DATABASE
4568
+            value: ${DATABASE_NAME}
4569
+          - name: MONGODB_ADMIN_PASSWORD
4570
+            value: ${DATABASE_ADMIN_PASSWORD}
4571
+          image: ' '
4572
+          livenessProbe:
4573
+            initialDelaySeconds: 30
4574
+            tcpSocket:
4575
+              port: 27017
4576
+            timeoutSeconds: 1
4577
+          name: mongodb
4578
+          ports:
4579
+          - containerPort: 27017
4580
+          readinessProbe:
4581
+            exec:
4582
+              command:
4583
+              - /bin/sh
4584
+              - -i
4585
+              - -c
4586
+              - mongo 127.0.0.1:27017/$MONGODB_DATABASE -u $MONGODB_USER -p $MONGODB_PASSWORD
4587
+                --eval="quit()"
4588
+            initialDelaySeconds: 3
4589
+            timeoutSeconds: 1
4590
+          resources:
4591
+            limits:
4592
+              memory: ${MEMORY_MONGODB_LIMIT}
4593
+          volumeMounts:
4594
+          - mountPath: /var/lib/mongodb/data
4595
+            name: ${DATABASE_SERVICE_NAME}-data
4596
+        volumes:
4597
+        - emptyDir:
4598
+            medium: ""
4599
+          name: ${DATABASE_SERVICE_NAME}-data
4600
+    triggers:
4601
+    - imageChangeParams:
4602
+        automatic: true
4603
+        containerNames:
4604
+        - mongodb
4605
+        from:
4606
+          kind: ImageStreamTag
4607
+          name: mongodb:3.2
4608
+          namespace: ${NAMESPACE}
4609
+      type: ImageChange
4610
+    - type: ConfigChange
4611
+parameters:
4612
+- description: The name assigned to all of the frontend objects defined in this template.
4613
+  displayName: Name
4614
+  name: NAME
4615
+  required: true
4616
+  value: nodejs-mongodb-example
4617
+- description: The exposed hostname that will route to the Node.js service, if left
4618
+    blank a value will be defaulted.
4619
+  displayName: Application Hostname
4620
+  name: APPLICATION_DOMAIN
4621
+- description: The URL of the repository with your application source code.
4622
+  displayName: Git Repository URL
4623
+  name: SOURCE_REPOSITORY_URL
4624
+  required: true
4625
+  value: https://github.com/openshift/nodejs-ex.git
4626
+- description: The reference of the repository with your application source code.
4627
+  displayName: Git Repository Ref
4628
+  name: SOURCE_REPOSITORY_REF
4629
+  required: true
4630
+  value: master
4631
+- displayName: Database Name
4632
+  name: DATABASE_NAME
4633
+  required: true
4634
+  value: sampledb
4635
+- description: Username for MongoDB user that will be used for accessing the database.
4636
+  displayName: MongoDB Username
4637
+  from: user[A-Z0-9]{3}
4638
+  generate: expression
4639
+  name: DATABASE_USER
4640
+- description: Password for the MongoDB user.
4641
+  displayName: MongoDB Password
4642
+  from: '[a-zA-Z0-9]{16}'
4643
+  generate: expression
4644
+  name: DATABASE_PASSWORD
4645
+- description: Maximum amount of memory the Node.js container can use.
4646
+  displayName: Memory Limit
4647
+  name: MEMORY_LIMIT
4648
+  required: true
4649
+  value: 512Mi
4650
+- description: Maximum amount of memory the MongoDB container can use.
4651
+  displayName: Memory Limit (MongoDB)
4652
+  name: MEMORY_MONGODB_LIMIT
4653
+  required: true
4654
+  value: 512Mi
4655
+- displayName: Database Service Name
4656
+  name: DATABASE_SERVICE_NAME
4657
+  required: true
4658
+  value: mongodb
4659
+- description: Password for the database admin user.
4660
+  displayName: Database Administrator Password
4661
+  from: '[a-zA-Z0-9]{16}'
4662
+  generate: expression
4663
+  name: DATABASE_ADMIN_PASSWORD
4664
+- description: Set this to the relative path to your project if it is not in the root
4665
+    of your repository.
4666
+  displayName: Context Directory
4667
+  name: CONTEXT_DIR
4668
+- description: A secret string used to configure the GitHub webhook.
4669
+  displayName: GitHub Webhook Secret
4670
+  from: '[a-zA-Z0-9]{40}'
4671
+  generate: expression
4672
+  name: GITHUB_WEBHOOK_SECRET
4673
+- description: A secret string used to configure the Generic webhook.
4674
+  displayName: Generic Webhook Secret
4675
+  from: '[a-zA-Z0-9]{40}'
4676
+  generate: expression
4677
+  name: GENERIC_WEBHOOK_SECRET
4678
+- description: The custom NPM mirror URL
4679
+  displayName: Custom NPM Mirror URL
4680
+  name: NPM_MIRROR
4681
+- description: The OpenShift Namespace where the NodeJS and MongoDB ImageStreams reside.
4682
+  displayName: Namespace
4683
+  name: NAMESPACE
4684
+  required: true
4685
+  value: openshift
4686
+`)
4687
+
4688
+func examplesJenkinsPipelineBluegreenPipelineYamlBytes() ([]byte, error) {
4689
+	return _examplesJenkinsPipelineBluegreenPipelineYaml, nil
4690
+}
4691
+
4692
+func examplesJenkinsPipelineBluegreenPipelineYaml() (*asset, error) {
4693
+	bytes, err := examplesJenkinsPipelineBluegreenPipelineYamlBytes()
4694
+	if err != nil {
4695
+		return nil, err
4696
+	}
4697
+
4698
+	info := bindataFileInfo{name: "examples/jenkins/pipeline/bluegreen-pipeline.yaml", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)}
4699
+	a := &asset{bytes: bytes, info:  info}
4700
+	return a, nil
4701
+}
4702
+
4703
+var _examplesJenkinsPipelineMapsappPipelineYaml = []byte(`apiVersion: v1
4704
+kind: Template
4705
+labels:
4706
+  application: mapsapp-pipeline
4707
+metadata:
4708
+  name: mapsapp-pipeline
4709
+parameters:
4710
+- description: NationalParks application source URI
4711
+  displayName: NationalParks Source URI
4712
+  name: NATIONALPARKS_GIT_URI
4713
+  required: true
4714
+  value: https://github.com/openshift-roadshow/nationalparks.git
4715
+- description: NationalParks application source reference
4716
+  displayName: NationalParks Source Ref
4717
+  name: NATIONALPARKS_GIT_REF
4718
+  required: true
4719
+  value: master
4720
+- description: MLBParks application source URI
4721
+  displayName: MLBParks Source URI
4722
+  name: MLBPARKS_GIT_URI
4723
+  required: true
4724
+  value: https://github.com/openshift-roadshow/mlbparks.git
4725
+- description: MLBParks application source reference
4726
+  displayName: MLBParks Source Ref
4727
+  name: MLBPARKS_GIT_REF
4728
+  required: true
4729
+  value: master
4730
+- description: ParksMap application source URI
4731
+  displayName: ParksMap Source URI
4732
+  name: PARKSMAP_GIT_URI
4733
+  required: true
4734
+  value: https://github.com/openshift-roadshow/parksmap-web.git
4735
+- description: ParksMap application source reference
4736
+  displayName: ParksMap Source Ref
4737
+  name: PARKSMAP_GIT_REF
4738
+  required: true
4739
+  value: master
4740
+- name: GITHUB_WEBHOOK_SECRET
4741
+  displayName: GitHub Webhook Secret
4742
+  description: A secret string used to configure the GitHub webhook.
4743
+  generate: expression
4744
+  from: "[a-zA-Z0-9]{40}"
4745
+- name: GENERIC_WEBHOOK_SECRET
4746
+  displayName: Generic Webhook Secret,
4747
+  description: A secret string used to configure the Generic webhook.
4748
+  generate: expression
4749
+  from: "[a-zA-Z0-9]{40}"
4750
+objects:
4751
+- apiVersion: v1
4752
+  kind: BuildConfig
4753
+  metadata:
4754
+    labels:
4755
+      build: mapsapp-pipeline
4756
+    name: mapsapp-pipeline
4757
+  spec:
4758
+    runPolicy: Serial
4759
+    source: {}
4760
+    strategy:
4761
+      type: JenkinsPipeline
4762
+      jenkinsPipelineStrategy:
4763
+        jenkinsfile: |-
4764
+          def project = ""
4765
+          node {
4766
+            project = "${env.PROJECT_NAME}"
4767
+
4768
+            stage('Create NationalParks back-end') {
4769
+              def nationalParksURL = "${NATIONALPARKS_GIT_URI}"
4770
+              def nationalParksBranch = "${NATIONALPARKS_GIT_REF}"
4771
+              checkout([$class: "GitSCM", branches: [[name: "*/${nationalParksBranch}"]], doGenerateSubmoduleConfigurations: false, extensions: [[$class: "RelativeTargetDirectory", relativeTargetDir: "nationalparks"]], submoduleCfg: [], userRemoteConfigs: [[url: "${nationalParksURL}"]]])
4772
+              sh "oc new-app -f nationalparks/ose3/pipeline-buildconfig-template.json -p GIT_URI=${nationalParksURL} -p GIT_REF=${nationalParksBranch} -n ${project} --dry-run -o yaml | oc apply -f - -n ${project}"
4773
+            }
4774
+
4775
+            stage('Create MLBParks back-end') {
4776
+              def mlbParksURL = "${MLBPARKS_GIT_URI}"
4777
+              def mlbParksBranch = "${MLBPARKS_GIT_REF}"
4778
+              checkout([$class: "GitSCM", branches: [[name: "*/${mlbParksBranch}"]], doGenerateSubmoduleConfigurations: false, extensions: [[$class: "RelativeTargetDirectory", relativeTargetDir: "mlbparks"]], submoduleCfg: [], userRemoteConfigs: [[url: "${mlbParksURL}"]]])
4779
+              sh "oc new-app -f mlbparks/ose3/pipeline-buildconfig-template.json -p GIT_URI=${mlbParksURL} -p GIT_REF=${mlbParksBranch} -n ${project} --dry-run -o yaml | oc apply -f - -n ${project}"
4780
+            }
4781
+
4782
+            stage('Create ParksMap front-end') {
4783
+              def parksMapURL = "${PARKSMAP_GIT_URI}"
4784
+              def parksMapBranch = "${PARKSMAP_GIT_REF}"
4785
+              checkout([$class: "GitSCM", branches: [[name: "*/${parksMapBranch}"]], doGenerateSubmoduleConfigurations: false, extensions: [[$class: "RelativeTargetDirectory", relativeTargetDir: "parksmap"]], submoduleCfg: [], userRemoteConfigs: [[url: "${parksMapURL}"]]])
4786
+              sh "oc new-app -f parksmap/ose3/pipeline-buildconfig-template.json -p GIT_URI=${parksMapURL} -p GIT_REF=${parksMapBranch} -n ${project} --dry-run -o yaml | oc apply -f - -n ${project}"
4787
+            }
4406 4788
           }
4407
-        },
4408
-        "spec": {
4409
-          "strategy": {
4410
-            "type": "Rolling"
4411
-          },
4412
-          "triggers": [
4413
-            {
4414
-              "type": "ImageChange",
4415
-              "imageChangeParams": {
4416
-                "automatic": false,
4417
-                "containerNames": [
4418
-                  "nodejs-mongodb-example"
4419
-                ],
4420
-                "from": {
4421
-                  "kind": "ImageStreamTag",
4422
-                  "name": "${NAME}:latest"
4789
+
4790
+          stage('Build Back-ends') {
4791
+            parallel (
4792
+              "nationalparks": {
4793
+                node {
4794
+                  openshiftBuild buildConfig: "nationalparks-pipeline", namespace: project
4423 4795
                 }
4424
-              }
4425
-            },
4426
-            {
4427
-              "type": "ConfigChange"
4428
-            }
4429
-          ],
4430
-          "replicas": 1,
4431
-          "selector": {
4432
-            "name": "${NAME}"
4433
-          },
4434
-          "template": {
4435
-            "metadata": {
4436
-              "name": "${NAME}",
4437
-              "labels": {
4438
-                "name": "${NAME}"
4439
-              }
4440
-            },
4441
-            "spec": {
4442
-              "containers": [
4443
-                {
4444
-                  "name": "nodejs-mongodb-example",
4445
-                  "image": " ",
4446
-                  "ports": [
4447
-                    {
4448
-                      "containerPort": 8080
4449
-                    }
4450
-                  ],
4451
-                  "env": [
4452
-                    {
4453
-                      "name": "DATABASE_SERVICE_NAME",
4454
-                      "value": "${DATABASE_SERVICE_NAME}"
4455
-                    },
4456
-                    {
4457
-                      "name": "MONGODB_USER",
4458
-                      "value": "${DATABASE_USER}"
4459
-                    },
4460
-                    {
4461
-                      "name": "MONGODB_PASSWORD",
4462
-                      "value": "${DATABASE_PASSWORD}"
4463
-                    },
4464
-                    {
4465
-                      "name": "MONGODB_DATABASE",
4466
-                      "value": "${DATABASE_NAME}"
4467
-                    },
4468
-                    {
4469
-                      "name": "MONGODB_ADMIN_PASSWORD",
4470
-                      "value": "${DATABASE_ADMIN_PASSWORD}"
4471
-                    }
4472
-                  ],
4473
-                  "readinessProbe": {
4474
-                    "timeoutSeconds": 3,
4475
-                    "initialDelaySeconds": 3,
4476
-                    "httpGet": {
4477
-                      "path": "/pagecount",
4478
-                      "port": 8080
4479
-                    }
4480
-                  },
4481
-                  "livenessProbe": {
4482
-                      "timeoutSeconds": 3,
4483
-                      "initialDelaySeconds": 30,
4484
-                      "httpGet": {
4485
-                          "path": "/pagecount",
4486
-                          "port": 8080
4487
-                      }
4488
-                  },
4489
-                  "resources": {
4490
-                      "limits": {
4491
-                          "memory": "${MEMORY_LIMIT}"
4492
-                      }
4493
-                  }
4796
+              },
4797
+              "mlbparks": {
4798
+                node {
4799
+                  openshiftBuild buildConfig: "mlbparks-pipeline", namespace: project
4494 4800
                 }
4495
-              ]
4496
-            }
4801
+              }
4802
+            )
4497 4803
           }
4498
-        }
4499
-      },
4500
-      {
4501
-        "kind": "Service",
4502
-        "apiVersion": "v1",
4503
-        "metadata": {
4504
-          "name": "${DATABASE_SERVICE_NAME}",
4505
-          "annotations": {
4506
-            "description": "Exposes the database server"
4804
+
4805
+          node {
4806
+            stage('Build Front-end') {
4807
+              openshiftBuild buildConfig: "parksmap-pipeline", namespace: project
4808
+            }
4507 4809
           }
4508
-        },
4509
-        "spec": {
4510
-          "ports": [
4511
-            {
4512
-              "name": "mongodb",
4513
-              "port": 27017,
4514
-              "targetPort": 27017
4515
-            }
4516
-          ],
4517
-          "selector": {
4518
-            "name": "${DATABASE_SERVICE_NAME}"
4810
+    triggers:
4811
+    - github:
4812
+        secret: ${GITHUB_TRIGGER_SECRET}
4813
+      type: GitHub
4814
+    - generic:
4815
+        secret: ${GENERIC_TRIGGER_SECRET}
4816
+      type: Generic
4817
+`)
4818
+
4819
+func examplesJenkinsPipelineMapsappPipelineYamlBytes() ([]byte, error) {
4820
+	return _examplesJenkinsPipelineMapsappPipelineYaml, nil
4821
+}
4822
+
4823
+func examplesJenkinsPipelineMapsappPipelineYaml() (*asset, error) {
4824
+	bytes, err := examplesJenkinsPipelineMapsappPipelineYamlBytes()
4825
+	if err != nil {
4826
+		return nil, err
4827
+	}
4828
+
4829
+	info := bindataFileInfo{name: "examples/jenkins/pipeline/mapsapp-pipeline.yaml", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)}
4830
+	a := &asset{bytes: bytes, info:  info}
4831
+	return a, nil
4832
+}
4833
+
4834
+var _examplesJenkinsPipelineMavenPipelineYaml = []byte(`apiVersion: v1
4835
+kind: Template
4836
+metadata:
4837
+  name: maven-pipeline
4838
+parameters:
4839
+- name: APP_NAME
4840
+  description: The name assigned to all of the application objects defined in this template.
4841
+  displayName: Application Name
4842
+  required: true
4843
+  value: openshift-jee-sample
4844
+- name: GIT_SOURCE_URL
4845
+  description: The source URL for the application
4846
+  displayName: Source URL
4847
+  required: true
4848
+  value: https://github.com/bparees/openshift-jee-sample.git
4849
+- name: GIT_SOURCE_REF
4850
+  description: The source Ref for the application
4851
+  displayName: Source Ref
4852
+  required: true
4853
+  value: master
4854
+- description: A secret string used to configure the GitHub webhook.
4855
+  displayName: GitHub Webhook Secret
4856
+  from: '[a-zA-Z0-9]{40}'
4857
+  generate: expression
4858
+  name: GITHUB_WEBHOOK_SECRET
4859
+  required: true
4860
+- description: A secret string used to configure the Generic webhook.
4861
+  displayName: Generic Webhook Secret
4862
+  from: '[a-zA-Z0-9]{40}'
4863
+  generate: expression
4864
+  name: GENERIC_WEBHOOK_SECRET
4865
+  required: true
4866
+objects:
4867
+- apiVersion: v1
4868
+  kind: ImageStream
4869
+  metadata:
4870
+    labels:
4871
+      app: ${APP_NAME}
4872
+    name: ${APP_NAME}
4873
+  spec: {}
4874
+  status:
4875
+    dockerImageRepository: ""
4876
+- apiVersion: v1
4877
+  kind: BuildConfig
4878
+  metadata:
4879
+    annotations:
4880
+      pipeline.alpha.openshift.io/uses: '[{"name": "${NAME}", "namespace": "", "kind": "DeploymentConfig"}]'
4881
+    creationTimestamp: null
4882
+    labels:
4883
+      name: ${APP_NAME}
4884
+    name: ${APP_NAME}
4885
+  spec:
4886
+    strategy:
4887
+      jenkinsPipelineStrategy:
4888
+        jenkinsfile: |-
4889
+          def appName="${APP_NAME}"
4890
+          def project=""
4891
+
4892
+          node {
4893
+            stage("Initialize") {
4894
+              project = env.PROJECT_NAME
4895
+            }
4519 4896
           }
4520
-        }
4521
-      },
4522
-      {
4523
-        "kind": "DeploymentConfig",
4524
-        "apiVersion": "v1",
4525
-        "metadata": {
4526
-          "name": "${DATABASE_SERVICE_NAME}",
4527
-          "annotations": {
4528
-            "description": "Defines how to deploy the database"
4897
+
4898
+          node("maven") {
4899
+            stage("Checkout") {
4900
+              git url: "${GIT_SOURCE_URL}", branch: "${GIT_SOURCE_REF}"
4901
+            }
4902
+            stage("Build WAR") {
4903
+              sh "mvn clean package -Popenshift"
4904
+              stash name:"war", includes:"target/ROOT.war"
4905
+            }
4529 4906
           }
4530
-        },
4531
-        "spec": {
4532
-          "strategy": {
4533
-            "type": "Recreate"
4534
-          },
4535
-          "triggers": [
4536
-            {
4537
-              "type": "ImageChange",
4538
-              "imageChangeParams": {
4539
-                "automatic": true,
4540
-                "containerNames": [
4541
-                  "mongodb"
4542
-                ],
4543
-                "from": {
4544
-                  "kind": "ImageStreamTag",
4545
-                  "namespace": "${NAMESPACE}",
4546
-                  "name": "mongodb:3.2"
4547
-                }
4548
-              }
4549
-            },
4550
-            {
4551
-              "type": "ConfigChange"
4907
+
4908
+          node {
4909
+            stage("Build Image") {
4910
+              unstash name:"war"
4911
+              sh "oc start-build ${appName}-docker --from-file=target/ROOT.war --follow -n ${project}"
4552 4912
             }
4553
-          ],
4554
-          "replicas": 1,
4555
-          "selector": {
4556
-            "name": "${DATABASE_SERVICE_NAME}"
4557
-          },
4558
-          "template": {
4559
-            "metadata": {
4560
-              "name": "${DATABASE_SERVICE_NAME}",
4561
-              "labels": {
4562
-                "name": "${DATABASE_SERVICE_NAME}"
4563
-              }
4564
-            },
4565
-            "spec": {
4566
-              "containers": [
4567
-                {
4568
-                  "name": "mongodb",
4569
-                  "image": " ",
4570
-                  "ports": [
4571
-                    {
4572
-                      "containerPort": 27017
4573
-                    }
4574
-                  ],
4575
-                  "env": [
4576
-                    {
4577
-                      "name": "MONGODB_USER",
4578
-                      "value": "${DATABASE_USER}"
4579
-                    },
4580
-                    {
4581
-                      "name": "MONGODB_PASSWORD",
4582
-                      "value": "${DATABASE_PASSWORD}"
4583
-                    },
4584
-                    {
4585
-                      "name": "MONGODB_DATABASE",
4586
-                      "value": "${DATABASE_NAME}"
4587
-                    },
4588
-                    {
4589
-                      "name": "MONGODB_ADMIN_PASSWORD",
4590
-                      "value": "${DATABASE_ADMIN_PASSWORD}"
4591
-                    }
4592
-                  ],
4593
-                  "readinessProbe": {
4594
-                    "timeoutSeconds": 1,
4595
-                    "initialDelaySeconds": 3,
4596
-                    "exec": {
4597
-                      "command": [ "/bin/sh", "-i", "-c", "mongo 127.0.0.1:27017/$MONGODB_DATABASE -u $MONGODB_USER -p $MONGODB_PASSWORD --eval=\"quit()\""]
4598
-                    }
4599
-                  },
4600
-                  "livenessProbe": {
4601
-                    "timeoutSeconds": 1,
4602
-                    "initialDelaySeconds": 30,
4603
-                    "tcpSocket": {
4604
-                      "port": 27017
4605
-                    }
4606
-                  },
4607
-                  "resources": {
4608
-                      "limits": {
4609
-                          "memory": "${MEMORY_MONGODB_LIMIT}"
4610
-                      }
4611
-                  },
4612
-                  "volumeMounts": [
4613
-                    {
4614
-                      "name": "${DATABASE_SERVICE_NAME}-data",
4615
-                      "mountPath": "/var/lib/mongodb/data"
4616
-                    }
4617
-                  ]
4618
-                }
4619
-              ],
4620
-              "volumes": [
4621
-                {
4622
-                  "name": "${DATABASE_SERVICE_NAME}-data",
4623
-                  "emptyDir": {
4624
-                    "medium": ""
4625
-                  }
4626
-                }
4627
-              ]
4913
+            stage("Deploy") {
4914
+              openshiftDeploy deploymentConfig: appName, namespace: project
4628 4915
             }
4629 4916
           }
4630
-        }
4631
-      }
4632
-    ],
4633
-  "parameters": [
4634
-      {
4635
-        "name": "NAME",
4636
-        "displayName": "Name",
4637
-        "description": "The name assigned to all of the frontend objects defined in this template.",
4638
-        "required": true,
4639
-        "value": "nodejs-mongodb-example"
4640
-      },
4641
-      {
4642
-        "name": "APPLICATION_DOMAIN",
4643
-        "displayName": "Application Hostname",
4644
-        "description": "The exposed hostname that will route to the Node.js service, if left blank a value will be defaulted.",
4645
-        "value": ""
4646
-      },
4647
-      {
4648
-        "name": "SOURCE_REPOSITORY_URL",
4649
-        "displayName": "Git Repository URL",
4650
-        "description": "The URL of the repository with your application source code.",
4651
-        "required": true,
4652
-        "value": "https://github.com/openshift/nodejs-ex.git"
4653
-      },
4654
-      {
4655
-        "name": "DATABASE_NAME",
4656
-        "displayName": "Database Name",
4657
-        "required": true,
4658
-        "value": "sampledb"
4659
-      },
4660
-      {
4661
-        "name": "DATABASE_USER",
4662
-        "displayName": "MongoDB Username",
4663
-        "description": "Username for MongoDB user that will be used for accessing the database.",
4664
-        "generate": "expression",
4665
-        "from": "user[A-Z0-9]{3}"
4666
-      },
4667
-      {
4668
-        "name": "DATABASE_PASSWORD",
4669
-        "displayName": "MongoDB Password",
4670
-        "description": "Password for the MongoDB user.",
4671
-        "generate": "expression",
4672
-        "from": "[a-zA-Z0-9]{16}"
4673
-      },
4674
-      {
4675
-        "name": "MEMORY_LIMIT",
4676
-        "displayName": "Memory Limit",
4677
-        "description": "Maximum amount of memory the Node.js container can use.",
4678
-        "required": true,
4679
-        "value": "512Mi"
4680
-      },
4681
-      {
4682
-        "name": "MEMORY_MONGODB_LIMIT",
4683
-        "displayName": "Memory Limit (MongoDB)",
4684
-        "description": "Maximum amount of memory the MongoDB container can use.",
4685
-        "required": true,
4686
-        "value": "512Mi"
4687
-      },
4688
-      {
4689
-        "name": "DATABASE_SERVICE_NAME",
4690
-        "displayName": "Database Service Name",
4691
-        "required": true,
4692
-        "value": "mongodb"
4693
-      },
4694
-      {
4695
-        "name": "DATABASE_ADMIN_PASSWORD",
4696
-        "displayName": "Database Administrator Password",
4697
-        "description": "Password for the database admin user.",
4698
-        "generate": "expression",
4699
-        "from": "[a-zA-Z0-9]{16}"
4700
-      },
4701
-      {
4702
-        "name": "SOURCE_REPOSITORY_REF",
4703
-        "displayName": "Git Reference",
4704
-        "description": "Set this to a branch name, tag or other ref of your repository if you are not using the default branch."
4705
-      },
4706
-      {
4707
-        "name": "CONTEXT_DIR",
4708
-        "displayName": "Context Directory",
4709
-        "description": "Set this to the relative path to your project if it is not in the root of your repository."
4710
-      },
4711
-      {
4712
-        "name": "GITHUB_WEBHOOK_SECRET",
4713
-        "displayName": "GitHub Webhook Secret",
4714
-        "description": "A secret string used to configure the GitHub webhook.",
4715
-        "generate": "expression",
4716
-        "from": "[a-zA-Z0-9]{40}"
4717
-      },
4718
-      {
4719
-        "name": "GENERIC_WEBHOOK_SECRET",
4720
-        "displayName": "Generic Webhook Secret",
4721
-        "description": "A secret string used to configure the Generic webhook.",
4722
-        "generate": "expression",
4723
-        "from": "[a-zA-Z0-9]{40}"
4724
-      },
4725
-      {
4726
-        "name": "NPM_MIRROR",
4727
-        "displayName": "Custom NPM Mirror URL",
4728
-        "description": "The custom NPM mirror URL",
4729
-        "value": ""
4730
-      },
4731
-      {
4732
-        "name": "NAMESPACE",
4733
-        "displayName": "Namespace",
4734
-        "description": "The OpenShift Namespace where the NodeJS and MongoDB ImageStreams reside.",
4735
-        "required": true,
4736
-        "value": "openshift"
4737
-      }
4738
-  ],
4739
-  "labels": {
4740
-    "template": "application-template-sample-pipeline"
4741
-  }
4917
+      type: JenkinsPipeline
4918
+    triggers:
4919
+    - github:
4920
+        secret: "${GITHUB_WEBHOOK_SECRET}"
4921
+      type: GitHub
4922
+    - generic:
4923
+        secret: "${GENERIC_WEBHOOK_SECRET}"
4924
+      type: Generic
4925
+- apiVersion: v1
4926
+  kind: BuildConfig
4927
+  metadata:
4928
+    labels:
4929
+      app: ${APP_NAME}-docker
4930
+    name: ${APP_NAME}-docker
4931
+  spec:
4932
+    output:
4933
+      to:
4934
+        kind: ImageStreamTag
4935
+        name: ${APP_NAME}:latest
4936
+    postCommit: {}
4937
+    resources: {}
4938
+    runPolicy: Serial
4939
+    source:
4940
+      dockerfile: |-
4941
+        FROM wildfly
4942
+        COPY ROOT.war /wildfly/standalone/deployments/ROOT.war
4943
+        CMD $STI_SCRIPTS_PATH/run
4944
+      binary:
4945
+        asFile: ROOT.war
4946
+      type: Docker
4947
+    strategy:
4948
+      dockerStrategy:
4949
+        from:
4950
+          kind: ImageStreamTag
4951
+          name: wildfly:latest
4952
+          namespace: openshift
4953
+      type: Docker
4954
+    triggers: {}
4955
+- apiVersion: v1
4956
+  kind: DeploymentConfig
4957
+  metadata:
4958
+    labels:
4959
+      app: ${APP_NAME}
4960
+    name: ${APP_NAME}
4961
+  spec:
4962
+    replicas: 1
4963
+    selector:
4964
+      app: ${APP_NAME}
4965
+      deploymentconfig: ${APP_NAME}
4966
+    strategy:
4967
+      rollingParams:
4968
+        intervalSeconds: 1
4969
+        maxSurge: 25%
4970
+        maxUnavailable: 25%
4971
+        timeoutSeconds: 600
4972
+        updatePeriodSeconds: 1
4973
+      type: Rolling
4974
+    template:
4975
+      metadata:
4976
+        annotations:
4977
+          openshift.io/container.${APP_NAME}.image.entrypoint: '["container-entrypoint","/bin/sh","-c","$STI_SCRIPTS_PATH/usage"]'
4978
+        labels:
4979
+          app: ${APP_NAME}
4980
+          deploymentconfig: ${APP_NAME}
4981
+      spec:
4982
+        containers:
4983
+        - image: ${APP_NAME}:latest
4984
+          imagePullPolicy: Always
4985
+          name: ${APP_NAME}
4986
+          ports:
4987
+          - containerPort: 8080
4988
+            protocol: TCP
4989
+          resources: {}
4990
+          terminationMessagePath: /dev/termination-log
4991
+          livenessProbe:
4992
+            httpGet:
4993
+              path: /
4994
+              port: 8080
4995
+              scheme: HTTP
4996
+            initialDelaySeconds: 10
4997
+            timeoutSeconds: 2
4998
+            periodSeconds: 10
4999
+            successThreshold: 1
5000
+            failureThreshold: 3
5001
+          readinessProbe:
5002
+            httpGet:
5003
+              path: /
5004
+              port: 8080
5005
+              scheme: HTTP
5006
+            initialDelaySeconds: 30
5007
+            timeoutSeconds: 2
5008
+            periodSeconds: 10
5009
+            successThreshold: 1
5010
+            failureThreshold: 3
5011
+        dnsPolicy: ClusterFirst
5012
+        restartPolicy: Always
5013
+        securityContext: {}
5014
+        terminationGracePeriodSeconds: 30
5015
+    test: false
5016
+    triggers:
5017
+    - type: ConfigChange
5018
+    - imageChangeParams:
5019
+        automatic: true
5020
+        containerNames:
5021
+        - ${APP_NAME}
5022
+        from:
5023
+          kind: ImageStreamTag
5024
+          name: ${APP_NAME}:latest
5025
+      type: ImageChange
5026
+  status: {}
5027
+- apiVersion: v1
5028
+  kind: Service
5029
+  metadata:
5030
+    annotations:
5031
+      openshift.io/generated-by: OpenShiftNewApp
5032
+    labels:
5033
+      app: ${APP_NAME}
5034
+    name: ${APP_NAME}
5035
+  spec:
5036
+    ports:
5037
+    - name: 8080-tcp
5038
+      port: 8080
5039
+      protocol: TCP
5040
+      targetPort: 8080
5041
+    selector:
5042
+      app: ${APP_NAME}
5043
+      deploymentconfig: ${APP_NAME}
5044
+    sessionAffinity: None
5045
+    type: ClusterIP
5046
+  status:
5047
+    loadBalancer: {}
5048
+- apiVersion: v1
5049
+  kind: Route
5050
+  metadata:
5051
+    name: ${APP_NAME}
5052
+    labels:
5053
+      app: ${APP_NAME}
5054
+  spec:
5055
+    to:
5056
+      kind: Service
5057
+      name: ${APP_NAME}
5058
+      weight: 100
5059
+    port:
5060
+      targetPort: 8080-tcp
5061
+    wildcardPolicy: None
5062
+`)
5063
+
5064
+func examplesJenkinsPipelineMavenPipelineYamlBytes() ([]byte, error) {
5065
+	return _examplesJenkinsPipelineMavenPipelineYaml, nil
5066
+}
5067
+
5068
+func examplesJenkinsPipelineMavenPipelineYaml() (*asset, error) {
5069
+	bytes, err := examplesJenkinsPipelineMavenPipelineYamlBytes()
5070
+	if err != nil {
5071
+		return nil, err
5072
+	}
5073
+
5074
+	info := bindataFileInfo{name: "examples/jenkins/pipeline/maven-pipeline.yaml", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)}
5075
+	a := &asset{bytes: bytes, info:  info}
5076
+	return a, nil
4742 5077
 }
5078
+
5079
+var _examplesJenkinsPipelineSamplepipelineYaml = []byte(`apiVersion: v1
5080
+kind: Template
5081
+labels:
5082
+  template: application-template-sample-pipeline
5083
+message: |-
5084
+  A Jenkins server will be automatically instantiated in this project to manage
5085
+  the Pipeline BuildConfig created by this template.  You will be able to log in to
5086
+  it using your OpenShift user credentials.
5087
+metadata:
5088
+  annotations:
5089
+    description: |-
5090
+      This example showcases the new Jenkins Pipeline integration in OpenShift,
5091
+      which performs continuous integration and deployment right on the platform.
5092
+      The template contains a Jenkinsfile - a definition of a multi-stage CI/CD process - that
5093
+      leverages the underlying OpenShift platform for dynamic and scalable
5094
+      builds. OpenShift integrates the status of your pipeline builds into the web
5095
+      console allowing you to see your entire application lifecycle in a single view.
5096
+    iconClass: icon-jenkins
5097
+    tags: instant-app,jenkins
5098
+  name: jenkins-pipeline-example
5099
+parameters:
5100
+- description: The name assigned to all of the frontend objects defined in this template.
5101
+  displayName: Name
5102
+  name: NAME
5103
+  required: true
5104
+  value: nodejs-mongodb-example
5105
+- description: The exposed hostname that will route to the Node.js service, if left
5106
+    blank a value will be defaulted.
5107
+  displayName: Application Hostname
5108
+  name: APPLICATION_DOMAIN
5109
+- description: The URL of the repository with your application source code.
5110
+  displayName: Git Repository URL
5111
+  name: SOURCE_REPOSITORY_URL
5112
+  required: true
5113
+  value: https://github.com/openshift/nodejs-ex.git
5114
+- displayName: Database Name
5115
+  name: DATABASE_NAME
5116
+  required: true
5117
+  value: sampledb
5118
+- description: Username for MongoDB user that will be used for accessing the database.
5119
+  displayName: MongoDB Username
5120
+  from: user[A-Z0-9]{3}
5121
+  generate: expression
5122
+  name: DATABASE_USER
5123
+- description: Password for the MongoDB user.
5124
+  displayName: MongoDB Password
5125
+  from: '[a-zA-Z0-9]{16}'
5126
+  generate: expression
5127
+  name: DATABASE_PASSWORD
5128
+- description: Maximum amount of memory the Node.js container can use.
5129
+  displayName: Memory Limit
5130
+  name: MEMORY_LIMIT
5131
+  required: true
5132
+  value: 512Mi
5133
+- description: Maximum amount of memory the MongoDB container can use.
5134
+  displayName: Memory Limit (MongoDB)
5135
+  name: MEMORY_MONGODB_LIMIT
5136
+  required: true
5137
+  value: 512Mi
5138
+- displayName: Database Service Name
5139
+  name: DATABASE_SERVICE_NAME
5140
+  required: true
5141
+  value: mongodb
5142
+- description: Password for the database admin user.
5143
+  displayName: Database Administrator Password
5144
+  from: '[a-zA-Z0-9]{16}'
5145
+  generate: expression
5146
+  name: DATABASE_ADMIN_PASSWORD
5147
+- description: Set this to a branch name, tag or other ref of your repository if you
5148
+    are not using the default branch.
5149
+  displayName: Git Reference
5150
+  name: SOURCE_REPOSITORY_REF
5151
+- description: Set this to the relative path to your project if it is not in the root
5152
+    of your repository.
5153
+  displayName: Context Directory
5154
+  name: CONTEXT_DIR
5155
+- description: A secret string used to configure the GitHub webhook.
5156
+  displayName: GitHub Webhook Secret
5157
+  from: '[a-zA-Z0-9]{40}'
5158
+  generate: expression
5159
+  name: GITHUB_WEBHOOK_SECRET
5160
+- description: A secret string used to configure the Generic webhook.
5161
+  displayName: Generic Webhook Secret
5162
+  from: '[a-zA-Z0-9]{40}'
5163
+  generate: expression
5164
+  name: GENERIC_WEBHOOK_SECRET
5165
+- description: The custom NPM mirror URL
5166
+  displayName: Custom NPM Mirror URL
5167
+  name: NPM_MIRROR
5168
+- description: The OpenShift Namespace where the NodeJS and MongoDB ImageStreams reside.
5169
+  displayName: Namespace
5170
+  name: NAMESPACE
5171
+  required: true
5172
+  value: openshift
5173
+objects:
5174
+- apiVersion: v1
5175
+  kind: BuildConfig
5176
+  metadata:
5177
+    annotations:
5178
+      pipeline.alpha.openshift.io/uses: '[{"name": "${NAME}", "namespace": "", "kind": "DeploymentConfig"}]'
5179
+    labels:
5180
+      name: sample-pipeline
5181
+    name: sample-pipeline
5182
+  spec:
5183
+    strategy:
5184
+      jenkinsPipelineStrategy:
5185
+        jenkinsfile: |-
5186
+          node('nodejs') {
5187
+            stage('build') {
5188
+              openshiftBuild(buildConfig: '${NAME}', showBuildLogs: 'true')
5189
+            }
5190
+            stage('deploy') {
5191
+              openshiftDeploy(deploymentConfig: '${NAME}')
5192
+            }
5193
+          }
5194
+      type: JenkinsPipeline
5195
+    triggers:
5196
+    - github:
5197
+        secret: secret101
5198
+      type: GitHub
5199
+    - generic:
5200
+        secret: secret101
5201
+      type: Generic
5202
+- apiVersion: v1
5203
+  kind: Service
5204
+  metadata:
5205
+    annotations:
5206
+      service.alpha.openshift.io/dependencies: '[{"name": "${DATABASE_SERVICE_NAME}", "namespace": "", "kind": "Service"}]'
5207
+    name: ${NAME}
5208
+  spec:
5209
+    ports:
5210
+    - name: web
5211
+      port: 8080
5212
+      targetPort: 8080
5213
+    selector:
5214
+      name: ${NAME}
5215
+- apiVersion: v1
5216
+  kind: Route
5217
+  metadata:
5218
+    name: ${NAME}
5219
+  spec:
5220
+    host: ${APPLICATION_DOMAIN}
5221
+    to:
5222
+      kind: Service
5223
+      name: ${NAME}
5224
+- apiVersion: v1
5225
+  kind: ImageStream
5226
+  metadata:
5227
+    annotations:
5228
+      description: Keeps track of changes in the application image
5229
+    name: ${NAME}
5230
+- apiVersion: v1
5231
+  kind: BuildConfig
5232
+  metadata:
5233
+    annotations:
5234
+      description: Defines how to build the application
5235
+    name: ${NAME}
5236
+  spec:
5237
+    output:
5238
+      to:
5239
+        kind: ImageStreamTag
5240
+        name: ${NAME}:latest
5241
+    postCommit:
5242
+      script: npm test
5243
+    source:
5244
+      contextDir: ${CONTEXT_DIR}
5245
+      git:
5246
+        ref: ${SOURCE_REPOSITORY_REF}
5247
+        uri: ${SOURCE_REPOSITORY_URL}
5248
+      type: Git
5249
+    strategy:
5250
+      sourceStrategy:
5251
+        env:
5252
+        - name: NPM_MIRROR
5253
+          value: ${NPM_MIRROR}
5254
+        from:
5255
+          kind: ImageStreamTag
5256
+          name: nodejs:4
5257
+          namespace: ${NAMESPACE}
5258
+      type: Source
5259
+    triggers:
5260
+    - github:
5261
+        secret: ${GITHUB_WEBHOOK_SECRET}
5262
+      type: GitHub
5263
+    - generic:
5264
+        secret: ${GENERIC_WEBHOOK_SECRET}
5265
+      type: Generic
5266
+- apiVersion: v1
5267
+  kind: DeploymentConfig
5268
+  metadata:
5269
+    annotations:
5270
+      description: Defines how to deploy the application server
5271
+    name: ${NAME}
5272
+  spec:
5273
+    replicas: 1
5274
+    selector:
5275
+      name: ${NAME}
5276
+    strategy:
5277
+      type: Rolling
5278
+    template:
5279
+      metadata:
5280
+        labels:
5281
+          name: ${NAME}
5282
+        name: ${NAME}
5283
+      spec:
5284
+        containers:
5285
+        - env:
5286
+          - name: DATABASE_SERVICE_NAME
5287
+            value: ${DATABASE_SERVICE_NAME}
5288
+          - name: MONGODB_USER
5289
+            value: ${DATABASE_USER}
5290
+          - name: MONGODB_PASSWORD
5291
+            value: ${DATABASE_PASSWORD}
5292
+          - name: MONGODB_DATABASE
5293
+            value: ${DATABASE_NAME}
5294
+          - name: MONGODB_ADMIN_PASSWORD
5295
+            value: ${DATABASE_ADMIN_PASSWORD}
5296
+          image: ' '
5297
+          livenessProbe:
5298
+            httpGet:
5299
+              path: /pagecount
5300
+              port: 8080
5301
+            initialDelaySeconds: 30
5302
+            timeoutSeconds: 3
5303
+          name: nodejs-mongodb-example
5304
+          ports:
5305
+          - containerPort: 8080
5306
+          readinessProbe:
5307
+            httpGet:
5308
+              path: /pagecount
5309
+              port: 8080
5310
+            initialDelaySeconds: 3
5311
+            timeoutSeconds: 3
5312
+          resources:
5313
+            limits:
5314
+              memory: ${MEMORY_LIMIT}
5315
+    triggers:
5316
+    - imageChangeParams:
5317
+        automatic: false
5318
+        containerNames:
5319
+        - nodejs-mongodb-example
5320
+        from:
5321
+          kind: ImageStreamTag
5322
+          name: ${NAME}:latest
5323
+      type: ImageChange
5324
+    - type: ConfigChange
5325
+- apiVersion: v1
5326
+  kind: Service
5327
+  metadata:
5328
+    annotations:
5329
+      description: Exposes the database server
5330
+    name: ${DATABASE_SERVICE_NAME}
5331
+  spec:
5332
+    ports:
5333
+    - name: mongodb
5334
+      port: 27017
5335
+      targetPort: 27017
5336
+    selector:
5337
+      name: ${DATABASE_SERVICE_NAME}
5338
+- apiVersion: v1
5339
+  kind: DeploymentConfig
5340
+  metadata:
5341
+    annotations:
5342
+      description: Defines how to deploy the database
5343
+    name: ${DATABASE_SERVICE_NAME}
5344
+  spec:
5345
+    replicas: 1
5346
+    selector:
5347
+      name: ${DATABASE_SERVICE_NAME}
5348
+    strategy:
5349
+      type: Recreate
5350
+    template:
5351
+      metadata:
5352
+        labels:
5353
+          name: ${DATABASE_SERVICE_NAME}
5354
+        name: ${DATABASE_SERVICE_NAME}
5355
+      spec:
5356
+        containers:
5357
+        - env:
5358
+          - name: MONGODB_USER
5359
+            value: ${DATABASE_USER}
5360
+          - name: MONGODB_PASSWORD
5361
+            value: ${DATABASE_PASSWORD}
5362
+          - name: MONGODB_DATABASE
5363
+            value: ${DATABASE_NAME}
5364
+          - name: MONGODB_ADMIN_PASSWORD
5365
+            value: ${DATABASE_ADMIN_PASSWORD}
5366
+          image: ' '
5367
+          livenessProbe:
5368
+            initialDelaySeconds: 30
5369
+            tcpSocket:
5370
+              port: 27017
5371
+            timeoutSeconds: 1
5372
+          name: mongodb
5373
+          ports:
5374
+          - containerPort: 27017
5375
+          readinessProbe:
5376
+            exec:
5377
+              command:
5378
+              - /bin/sh
5379
+              - -i
5380
+              - -c
5381
+              - mongo 127.0.0.1:27017/$MONGODB_DATABASE -u $MONGODB_USER -p $MONGODB_PASSWORD
5382
+                --eval="quit()"
5383
+            initialDelaySeconds: 3
5384
+            timeoutSeconds: 1
5385
+          resources:
5386
+            limits:
5387
+              memory: ${MEMORY_MONGODB_LIMIT}
5388
+          volumeMounts:
5389
+          - mountPath: /var/lib/mongodb/data
5390
+            name: ${DATABASE_SERVICE_NAME}-data
5391
+        volumes:
5392
+        - emptyDir:
5393
+            medium: ""
5394
+          name: ${DATABASE_SERVICE_NAME}-data
5395
+    triggers:
5396
+    - imageChangeParams:
5397
+        automatic: true
5398
+        containerNames:
5399
+        - mongodb
5400
+        from:
5401
+          kind: ImageStreamTag
5402
+          name: mongodb:3.2
5403
+          namespace: ${NAMESPACE}
5404
+      type: ImageChange
5405
+    - type: ConfigChange
4743 5406
 `)
4744 5407
 
4745
-func examplesJenkinsPipelineSamplepipelineJsonBytes() ([]byte, error) {
4746
-	return _examplesJenkinsPipelineSamplepipelineJson, nil
5408
+func examplesJenkinsPipelineSamplepipelineYamlBytes() ([]byte, error) {
5409
+	return _examplesJenkinsPipelineSamplepipelineYaml, nil
4747 5410
 }
4748 5411
 
4749
-func examplesJenkinsPipelineSamplepipelineJson() (*asset, error) {
4750
-	bytes, err := examplesJenkinsPipelineSamplepipelineJsonBytes()
5412
+func examplesJenkinsPipelineSamplepipelineYaml() (*asset, error) {
5413
+	bytes, err := examplesJenkinsPipelineSamplepipelineYamlBytes()
4751 5414
 	if err != nil {
4752 5415
 		return nil, err
4753 5416
 	}
4754 5417
 
4755
-	info := bindataFileInfo{name: "examples/jenkins/pipeline/samplepipeline.json", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)}
5418
+	info := bindataFileInfo{name: "examples/jenkins/pipeline/samplepipeline.yaml", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)}
4756 5419
 	a := &asset{bytes: bytes, info:  info}
4757 5420
 	return a, nil
4758 5421
 }
... ...
@@ -7882,7 +8548,10 @@ var _bindata = map[string]func() (*asset, error){
7882 7882
 	"examples/db-templates/postgresql-persistent-template.json": examplesDbTemplatesPostgresqlPersistentTemplateJson,
7883 7883
 	"examples/jenkins/jenkins-ephemeral-template.json": examplesJenkinsJenkinsEphemeralTemplateJson,
7884 7884
 	"examples/jenkins/jenkins-persistent-template.json": examplesJenkinsJenkinsPersistentTemplateJson,
7885
-	"examples/jenkins/pipeline/samplepipeline.json": examplesJenkinsPipelineSamplepipelineJson,
7885
+	"examples/jenkins/pipeline/bluegreen-pipeline.yaml": examplesJenkinsPipelineBluegreenPipelineYaml,
7886
+	"examples/jenkins/pipeline/mapsapp-pipeline.yaml": examplesJenkinsPipelineMapsappPipelineYaml,
7887
+	"examples/jenkins/pipeline/maven-pipeline.yaml": examplesJenkinsPipelineMavenPipelineYaml,
7888
+	"examples/jenkins/pipeline/samplepipeline.yaml": examplesJenkinsPipelineSamplepipelineYaml,
7886 7889
 	"examples/quickstarts/cakephp-mysql.json": examplesQuickstartsCakephpMysqlJson,
7887 7890
 	"examples/quickstarts/dancer-mysql.json": examplesQuickstartsDancerMysqlJson,
7888 7891
 	"examples/quickstarts/django-postgresql.json": examplesQuickstartsDjangoPostgresqlJson,
... ...
@@ -7963,7 +8632,13 @@ var _bintree = &bintree{nil, map[string]*bintree{
7963 7963
 			"jenkins-persistent-template.json": &bintree{examplesJenkinsJenkinsPersistentTemplateJson, map[string]*bintree{
7964 7964
 			}},
7965 7965
 			"pipeline": &bintree{nil, map[string]*bintree{
7966
-				"samplepipeline.json": &bintree{examplesJenkinsPipelineSamplepipelineJson, map[string]*bintree{
7966
+				"bluegreen-pipeline.yaml": &bintree{examplesJenkinsPipelineBluegreenPipelineYaml, map[string]*bintree{
7967
+				}},
7968
+				"mapsapp-pipeline.yaml": &bintree{examplesJenkinsPipelineMapsappPipelineYaml, map[string]*bintree{
7969
+				}},
7970
+				"maven-pipeline.yaml": &bintree{examplesJenkinsPipelineMavenPipelineYaml, map[string]*bintree{
7971
+				}},
7972
+				"samplepipeline.yaml": &bintree{examplesJenkinsPipelineSamplepipelineYaml, map[string]*bintree{
7967 7973
 				}},
7968 7974
 			}},
7969 7975
 		}},
... ...
@@ -101,7 +101,7 @@ var (
101 101
 		"rails quickstart":            "examples/quickstarts/rails-postgresql.json",
102 102
 		"jenkins pipeline ephemeral":  "examples/jenkins/jenkins-ephemeral-template.json",
103 103
 		"jenkins pipeline persistent": "examples/jenkins/jenkins-persistent-template.json",
104
-		"sample pipeline":             "examples/jenkins/pipeline/samplepipeline.json",
104
+		"sample pipeline":             "examples/jenkins/pipeline/samplepipeline.yaml",
105 105
 		"logging":                     "examples/logging/logging-deployer.yaml",
106 106
 	}
107 107
 	dockerVersion19  = semver.MustParse("1.9.0")