Browse code

clean up jenkins example

Ben Parees authored on 2015/07/10 02:08:33
Showing 7 changed files
... ...
@@ -72,8 +72,8 @@ func TestExampleObjectSchemas(t *testing.T) {
72 72
 			"application-template-pullspecbuild": &templateapi.Template{},
73 73
 		},
74 74
 		"../examples/jenkins": {
75
-			"jenkins-config":       &kapi.List{},
76
-			"application-template": &templateapi.Template{},
75
+			"jenkins-ephemeral-template": &templateapi.Template{},
76
+			"application-template":       &templateapi.Template{},
77 77
 		},
78 78
 		"../examples/image-streams": {
79 79
 			"image-streams-centos7": &imageapi.ImageStreamList{},
... ...
@@ -251,6 +251,29 @@
251 251
           }
252 252
         ]
253 253
       }
254
+    },
255
+    {
256
+      "kind": "ImageStream",
257
+      "apiVersion": "v1beta3",
258
+      "metadata": {
259
+        "name": "jenkins",
260
+        "creationTimestamp": null
261
+      },
262
+      "spec": {
263
+        "dockerImageRepository": "openshift/jenkins-16-centos7",
264
+        "tags": [
265
+          {
266
+            "name": "latest"
267
+          },
268
+          {
269
+            "name": "1.6",
270
+            "from": {
271
+              "Kind": "ImageStreamTag",
272
+              "Name": "latest"
273
+            }
274
+          }
275
+        ]
276
+      }
254 277
     }
255 278
   ]
256 279
 }
... ...
@@ -1,6 +1,5 @@
1 1
 OpenShift 3 Jenkins Example
2 2
 =========================
3
-
4 3
 This sample walks through the process of starting up an OpenShift cluster and deploying a Jenkins Pod in it.
5 4
 It also configures a simple application and then creates a Jenkins job to trigger a build of that application.
6 5
 
... ...
@@ -10,46 +9,80 @@ the deployment works, and then tag the test version into production.
10 10
 Steps
11 11
 -----
12 12
 
13
-1. Follow steps 1-10 from the [sample-app](https://github.com/openshift/origin/blob/master/examples/sample-app/README.md)
13
+1. Follow steps 1-7 from the [sample-app](https://github.com/openshift/origin/blob/master/examples/sample-app/README.md)
14 14
 
15
-2. Start the Jenkins services
15
+    At this point you should be logged in to openshift as a normal user and working with a project named `test`.
16 16
 
17
-        $ oc create -n test -f jenkins-config.json
18
-        
19
-3. Create the application configuration
17
+2. Add the `edit` role to the `default` service account in the `test` project:
20 18
 
21
-        $ oc process -n test -f application-template.json | oc create -n test -f -
22
- 
23
-4. Locate the Jenkins service endpoint and go to it in your browser:
19
+        $ oc policy add-role-to-user edit system:serviceaccount:test:default
24 20
 
25
-        $ oc get services -n test jenkins --template="{{ .spec.portalIP }}:{{ with index .spec.ports 0 }}{{ .port }}{{ end }}"
21
+    This will allow the service account Jenkins uses to run builds and tag images.
26 22
 
27
-    Once it is available, proceed to the next step.
28
-    
29
-5. Create the Jenkins job named rubyJob:
23
+3. Optional:  If you are going to run Jenkins somewhere other than as a deployment within your same project you will need to provide an access token to Jenkins to access your project.
24
+
25
+    1. Identify the service account token secret:
26
+
27
+            $ oc describe serviceaccount default
28
+
29
+        Example output:
30
+
31
+            Name:       default
32
+            Labels:     <none>
33
+            Secrets:    {  default-token-uyswp    }
34
+                        {  default-dockercfg-xcr3d    }
35
+            Tokens:     default-token-izv1u
36
+                        default-token-uyswp
37
+
38
+        In this case the secret name is `default-token-uyswp`
39
+
40
+    2. Retrieve the token from the secret:
41
+
42
+            $ oc describe secret <secret name from above> # e.g. default-token-izv1u
43
+
44
+        Example output:
30 45
 
31
-        $ JENKINS_ENDPOINT=`oc get services -n test jenkins --template="{{ .spec.portalIP }}:{{ with index .spec.ports 0 }}{{ .port }}{{ end }}"`
32
-        $ cat job.xml | curl -X POST -H "Content-Type: application/xml" -H "Expect: " --data-binary @- http://$JENKINS_ENDPOINT/createItem?name=rubyJob
46
+            Name:       default-token-izv1u
47
+            Labels:     <none>
48
+            Annotations:    kubernetes.io/service-account.name=default,kubernetes.io/service-account.uid=32f5b661-2a8f-11e5-9528-3c970e3bf0b7
49
+            Type:   kubernetes.io/service-account-token
50
+            Data
51
+            ====
52
+            ca.crt: 1066 bytes
53
+            token:  eyJhbGc..<content cut>....wRA
33 54
 
34
-6. Add API credentials to the Jenkins build:
55
+        Copy the value from the `token` field, it will be used later.
35 56
 
36
-    1. Go back to your browser, refresh and select the rubyJob build job.
37
-    2. Choose `Configure`.
38
-    3. Locate the KUBECONFIG_CREDENTIALS parameter, and replace the default value with the contents of the `openshift.local.config/master/openshift-client.kubeconfig` file.
39
-    4. Click `Save`.
57
+4. Create and deploy the Jenkins service
40 58
 
41
-6. Run the Jenkins build
59
+        $ oc new-app jenkins-ephemeral-template.json
60
+    
61
+    Note the ip and port of the Jenkins service reported by this command, you will need it later.
62
+
63
+        $ oc deploy jenkins --latest
64
+
65
+    **Note**: This template uses an EmptyDir type volume.  If you want to ensure your jenkins configuration/job information is persisted through pod restarts and deployments, you will want to use a [PersistentVolume](https://docs.openshift.org/latest/admin_guide/persistent_storage_nfs.html) instead.
66
+    
67
+5. Create the sample application configuration
68
+
69
+        $ oc new-app application-template.json
70
+ 
71
+6. Open the Jenkins service ip:port from step 4 in your browser.  Once it is available, login using username `admin` and password `password`.
42 72
    
43
-    1. In the browser, select the rubyJob build job and choose `Build with parameters`.
44
-    2. Click `Build` (you should not need to modify any parameters).
73
+7. Select the the `OpenShift Sample` job and click `Configure`
74
+
75
+8. Optional (if the default value does not resolve to your OpenShift api endpoint): Fill in the `OPENSHIFT_API_URL` value with `https://hostname:port` where hostname/ip and port are for your OpenShift api endpoint.
76
+
77
+9. Optional (if not running Jenkins in the same OpenShift deployment as your application project): Fill in the `AUTH_TOKEN` value with the token value retrieved in step 3.
45 78
 
46
-7. Watch the job output
79
+10. Save your changes to the job and click `Build with Parameters` and then `Build`.
80
+
81
+11. Watch the job output
47 82
 
48 83
    It will trigger an OpenShift build of the application, wait for the build to result in a deployment,
49
-   confirm the new deployment works, and re-tag the image for production.  This re-tagging will trigger
50
-   another deployment, this time creating/updated the production service.
84
+   confirm the new deployment works, and then tag the image for production.  This tagging will trigger
85
+   another deployment, this time creating/updating the production service.
51 86
 
52
-8. Confirm both the test and production services are available by browsing to both services:
87
+12. Confirm both the test and production services are available by browsing to both services:
53 88
 
54 89
         $ oc get services -n test | grep frontend
55
-   
... ...
@@ -1,79 +1,19 @@
1 1
 {
2 2
   "kind": "Template",
3
-  "apiVersion": "v1beta3",
3
+  "apiVersion": "v1",
4 4
   "metadata": {
5
-    "name": "ruby-helloworld-sample",
6
-    "creationTimestamp": null
5
+    "name": "nodejs-helloworld-sample",
6
+    "creationTimestamp": null,
7
+    "annotations": {
8
+      "description": "This example shows how to create a simple nodejs application in openshift origin v3",
9
+      "iconClass": "icon-nodejs",
10
+      "tags": "instant-app,nodejs"
11
+    }
7 12
   },
8 13
   "objects": [
9 14
     {
10
-      "kind": "ImageStream",
11
-      "apiVersion": "v1beta3",
12
-      "metadata": {
13
-        "name": "origin-ruby-sample",
14
-        "creationTimestamp": null
15
-      },
16
-      "spec": {},
17
-      "status": {
18
-        "dockerImageRepository": ""
19
-      }
20
-    },
21
-    {
22
-      "kind": "BuildConfig",
23
-      "apiVersion": "v1beta3",
24
-      "metadata": {
25
-        "name": "ruby-test-build",
26
-        "creationTimestamp": null,
27
-        "labels": {
28
-          "name": "ruby-test-build"
29
-        }
30
-      },
31
-      "spec": {
32
-        "triggers": [
33
-          {
34
-            "type": "github",
35
-            "github": {
36
-              "secret": "secret101"
37
-            }
38
-          },
39
-          {
40
-            "type": "generic",
41
-            "generic": {
42
-              "secret": "secret101"
43
-            }
44
-          }
45
-        ],
46
-        "source": {
47
-          "type": "Git",
48
-          "git": {
49
-            "uri": "git://github.com/openshift/ruby-hello-world.git"
50
-          }
51
-        },
52
-        "strategy": {
53
-          "type": "Source",
54
-          "sourceStrategy": {
55
-            "from": {
56
-              "kind": "DockerImage",
57
-              "name": "openshift/ruby-20-centos7"
58
-            },
59
-            "incremental": true
60
-          }
61
-        },
62
-        "output": {
63
-          "to": {
64
-            "kind": "ImageStreamTag",
65
-            "name": "origin-ruby-sample:test"
66
-          }
67
-        },
68
-        "resources": {}
69
-      },
70
-      "status": {
71
-        "lastVersion": 0
72
-      }
73
-    },
74
-    {
75 15
       "kind": "Service",
76
-      "apiVersion": "v1beta3",
16
+      "apiVersion": "v1",
77 17
       "metadata": {
78 18
         "name": "frontend-prod",
79 19
         "creationTimestamp": null
... ...
@@ -81,8 +21,9 @@
81 81
       "spec": {
82 82
         "ports": [
83 83
           {
84
+            "name": "web",
84 85
             "protocol": "TCP",
85
-            "port": 5432,
86
+            "port": 8080,
86 87
             "targetPort": 8080,
87 88
             "nodePort": 0
88 89
           }
... ...
@@ -100,14 +41,19 @@
100 100
     },
101 101
     {
102 102
       "kind": "DeploymentConfig",
103
-      "apiVersion": "v1beta3",
103
+      "apiVersion": "v1",
104 104
       "metadata": {
105 105
         "name": "frontend-prod",
106 106
         "creationTimestamp": null
107 107
       },
108 108
       "spec": {
109 109
         "strategy": {
110
-          "type": "Recreate",
110
+          "type": "Rolling",
111
+          "rollingParams": {
112
+            "updatePeriodSeconds": 1,
113
+            "intervalSeconds": 1,
114
+            "timeoutSeconds": 120
115
+          },
111 116
           "resources": {}
112 117
         },
113 118
         "triggers": [
... ...
@@ -116,19 +62,21 @@
116 116
             "imageChangeParams": {
117 117
               "automatic": true,
118 118
               "containerNames": [
119
-                "ruby-helloworld-prod"
119
+                "nodejs-helloworld"
120 120
               ],
121 121
               "from": {
122 122
                 "kind": "ImageStreamTag",
123
-                "name": "origin-ruby-sample:latest"
124
-              },
125
-              "lastTriggeredImage": ""
123
+                "name": "origin-nodejs-sample:prod"
124
+              }
126 125
             }
126
+          },
127
+          {
128
+            "type": "ConfigChange"
127 129
           }
128 130
         ],
129 131
         "replicas": 1,
130 132
         "selector": {
131
-          "name": "frontend-prod"
133
+          "name":"frontend-prod"
132 134
         },
133 135
         "template": {
134 136
           "metadata": {
... ...
@@ -140,44 +88,17 @@
140 140
           "spec": {
141 141
             "containers": [
142 142
               {
143
-                "name": "ruby-helloworld-prod",
144
-                "image": "origin-ruby-sample",
143
+                "name": "nodejs-helloworld",
144
+                "image": "origin-nodejs-sample",
145 145
                 "ports": [
146 146
                   {
147 147
                     "containerPort": 8080,
148 148
                     "protocol": "TCP"
149 149
                   }
150 150
                 ],
151
-                "env": [
152
-                  {
153
-                    "name": "ADMIN_USERNAME",
154
-                    "value": "${ADMIN_USERNAME}"
155
-                  },
156
-                  {
157
-                    "name": "ADMIN_PASSWORD",
158
-                    "value": "${ADMIN_PASSWORD}"
159
-                  },
160
-                  {
161
-                    "name": "MYSQL_ROOT_PASSWORD",
162
-                    "value": "${MYSQL_ROOT_PASSWORD}"
163
-                  },
164
-                  {
165
-                    "name": "MYSQL_DATABASE",
166
-                    "value": "${MYSQL_DATABASE}"
167
-                  },
168
-                  {
169
-                    "name": "RACK_ENV",
170
-                    "value": "production"
171
-                  },
172
-                  {
173
-                    "name": "RAILS_ENV",
174
-                    "value": "production"
175
-                  }
176
-                ],
177 151
                 "resources": {},
178 152
                 "terminationMessagePath": "/dev/termination-log",
179 153
                 "imagePullPolicy": "IfNotPresent",
180
-                "capabilities": {},
181 154
                 "securityContext": {
182 155
                   "capabilities": {},
183 156
                   "privileged": false
... ...
@@ -185,31 +106,32 @@
185 185
               }
186 186
             ],
187 187
             "restartPolicy": "Always",
188
-            "dnsPolicy": "ClusterFirst",
189
-            "serviceAccount": ""
188
+            "dnsPolicy": "ClusterFirst"
190 189
           }
191 190
         }
192 191
       },
193 192
       "status": {}
194 193
     },
194
+
195 195
     {
196 196
       "kind": "Service",
197
-      "apiVersion": "v1beta3",
197
+      "apiVersion": "v1",
198 198
       "metadata": {
199
-        "name": "database",
199
+        "name": "frontend",
200 200
         "creationTimestamp": null
201 201
       },
202 202
       "spec": {
203 203
         "ports": [
204 204
           {
205
+            "name": "web",
205 206
             "protocol": "TCP",
206
-            "port": 5434,
207
-            "targetPort": 3306,
207
+            "port": 8080,
208
+            "targetPort": 8080,
208 209
             "nodePort": 0
209 210
           }
210 211
         ],
211 212
         "selector": {
212
-          "name": "database-prod"
213
+          "name": "frontend"
213 214
         },
214 215
         "portalIP": "",
215 216
         "type": "ClusterIP",
... ...
@@ -220,273 +142,147 @@
220 220
       }
221 221
     },
222 222
     {
223
-      "kind": "DeploymentConfig",
224
-      "apiVersion": "v1beta3",
223
+      "kind": "ImageStream",
224
+      "apiVersion": "v1",
225 225
       "metadata": {
226
-        "name": "database-prod",
226
+        "name": "origin-nodejs-sample",
227 227
         "creationTimestamp": null
228 228
       },
229
-      "spec": {
230
-        "strategy": {
231
-          "type": "Recreate",
232
-          "resources": {}
233
-        },
234
-        "triggers": [
235
-          {
236
-            "type": "ConfigChange"
237
-          }
238
-        ],
239
-        "replicas": 1,
240
-        "selector": {
241
-          "name": "database-prod"
242
-        },
243
-        "template": {
244
-          "metadata": {
245
-            "creationTimestamp": null,
246
-            "labels": {
247
-              "name": "database-prod"
248
-            }
249
-          },
250
-          "spec": {
251
-            "containers": [
252
-              {
253
-                "name": "ruby-helloworld-database",
254
-                "image": "mysql",
255
-                "ports": [
256
-                  {
257
-                    "containerPort": 3306,
258
-                    "protocol": "TCP"
259
-                  }
260
-                ],
261
-                "env": [
262
-                  {
263
-                    "name": "MYSQL_ROOT_PASSWORD",
264
-                    "value": "${MYSQL_ROOT_PASSWORD}"
265
-                  },
266
-                  {
267
-                    "name": "MYSQL_DATABASE",
268
-                    "value": "${MYSQL_DATABASE}"
269
-                  }
270
-                ],
271
-                "resources": {},
272
-                "terminationMessagePath": "/dev/termination-log",
273
-                "imagePullPolicy": "IfNotPresent",
274
-                "capabilities": {},
275
-                "securityContext": {
276
-                  "capabilities": {},
277
-                  "privileged": false
278
-                }
279
-              }
280
-            ],
281
-            "restartPolicy": "Always",
282
-            "dnsPolicy": "ClusterFirst",
283
-            "serviceAccount": ""
284
-          }
285
-        }
286
-      },
287
-      "status": {}
229
+      "spec": {},
230
+      "status": {
231
+        "dockerImageRepository": ""
232
+      }
288 233
     },
289 234
     {
290
-      "kind": "Service",
291
-      "apiVersion": "v1beta3",
235
+      "kind": "ImageStream",
236
+      "apiVersion": "v1",
292 237
       "metadata": {
293
-        "name": "frontend-test",
238
+        "name": "nodejs-010-centos7",
294 239
         "creationTimestamp": null
295 240
       },
296 241
       "spec": {
297
-        "ports": [
298
-          {
299
-            "protocol": "TCP",
300
-            "port": 5432,
301
-            "targetPort": 8080,
302
-            "nodePort": 0
303
-          }
304
-        ],
305
-        "selector": {
306
-          "name": "frontend-test"
307
-        },
308
-        "portalIP": "",
309
-        "type": "ClusterIP",
310
-        "sessionAffinity": "None"
242
+        "dockerImageRepository": "openshift/nodejs-010-centos7"
311 243
       },
312 244
       "status": {
313
-        "loadBalancer": {}
245
+        "dockerImageRepository": ""
314 246
       }
315 247
     },
316 248
     {
317
-      "kind": "DeploymentConfig",
318
-      "apiVersion": "v1beta3",
249
+      "kind": "BuildConfig",
250
+      "apiVersion": "v1",
319 251
       "metadata": {
320
-        "name": "frontend-test",
321
-        "creationTimestamp": null
252
+        "name": "frontend",
253
+        "creationTimestamp": null,
254
+        "labels": {
255
+          "name": "nodejs-sample-build"
256
+        }
322 257
       },
323 258
       "spec": {
324
-        "strategy": {
325
-          "type": "Recreate",
326
-          "resources": {}
327
-        },
328 259
         "triggers": [
329 260
           {
330
-            "type": "ImageChange",
331
-            "imageChangeParams": {
332
-              "automatic": true,
333
-              "containerNames": [
334
-                "ruby-helloworld-test"
335
-              ],
336
-              "from": {
337
-                "kind": "ImageStreamTag",
338
-                "name": "origin-ruby-sample:test"
339
-              },
340
-              "lastTriggeredImage": ""
261
+            "type": "GitHub",
262
+            "github": {
263
+              "secret": "secret101"
264
+            }
265
+          },
266
+          {
267
+            "type": "Generic",
268
+            "generic": {
269
+              "secret": "secret101"
341 270
             }
271
+          },
272
+          {
273
+            "type": "ImageChange",
274
+            "imageChange": {}
342 275
           }
343 276
         ],
344
-        "replicas": 1,
345
-        "selector": {
346
-          "name": "frontend-test"
277
+        "source": {
278
+          "type": "Git",
279
+          "git": {
280
+            "uri": "https://github.com/openshift/nodejs-ex.git"
281
+          }
347 282
         },
348
-        "template": {
349
-          "metadata": {
350
-            "creationTimestamp": null,
351
-            "labels": {
352
-              "name": "frontend-test"
283
+        "strategy": {
284
+          "type": "Source",
285
+          "sourceStrategy": {
286
+            "from": {
287
+              "kind": "ImageStreamTag",
288
+              "name": "nodejs-010-centos7:latest"
353 289
             }
354
-          },
355
-          "spec": {
356
-            "containers": [
357
-              {
358
-                "name": "ruby-helloworld-test",
359
-                "image": "origin-ruby-sample:test",
360
-                "ports": [
361
-                  {
362
-                    "containerPort": 8080,
363
-                    "protocol": "TCP"
364
-                  }
365
-                ],
366
-                "env": [
367
-                  {
368
-                    "name": "ADMIN_USERNAME",
369
-                    "value": "${ADMIN_USERNAME}"
370
-                  },
371
-                  {
372
-                    "name": "ADMIN_PASSWORD",
373
-                    "value": "${ADMIN_PASSWORD}"
374
-                  },
375
-                  {
376
-                    "name": "MYSQL_ROOT_PASSWORD",
377
-                    "value": "${MYSQL_ROOT_PASSWORD}"
378
-                  },
379
-                  {
380
-                    "name": "MYSQL_DATABASE",
381
-                    "value": "${MYSQL_DATABASE}"
382
-                  },
383
-                  {
384
-                    "name": "RACK_ENV",
385
-                    "value": "test"
386
-                  },
387
-                  {
388
-                    "name": "RAILS_ENV",
389
-                    "value": "test"
390
-                  }
391
-                ],
392
-                "resources": {},
393
-                "terminationMessagePath": "/dev/termination-log",
394
-                "imagePullPolicy": "IfNotPresent",
395
-                "capabilities": {},
396
-                "securityContext": {
397
-                  "capabilities": {},
398
-                  "privileged": false
399
-                }
400
-              }
401
-            ],
402
-            "restartPolicy": "Always",
403
-            "dnsPolicy": "ClusterFirst",
404
-            "serviceAccount": ""
405 290
           }
406
-        }
407
-      },
408
-      "status": {}
409
-    },
410
-    {
411
-      "kind": "Service",
412
-      "apiVersion": "v1beta3",
413
-      "metadata": {
414
-        "name": "database-test",
415
-        "creationTimestamp": null
416
-      },
417
-      "spec": {
418
-        "ports": [
419
-          {
420
-            "protocol": "TCP",
421
-            "port": 6434,
422
-            "targetPort": 3306,
423
-            "nodePort": 0
291
+        },
292
+        "output": {
293
+          "to": {
294
+            "kind": "ImageStreamTag",
295
+            "name": "origin-nodejs-sample:latest"
424 296
           }
425
-        ],
426
-        "selector": {
427
-          "name": "database-test"
428 297
         },
429
-        "portalIP": "",
430
-        "type": "ClusterIP",
431
-        "sessionAffinity": "None"
298
+        "resources": {}
432 299
       },
433 300
       "status": {
434
-        "loadBalancer": {}
301
+        "lastVersion": 0
435 302
       }
436 303
     },
437 304
     {
438 305
       "kind": "DeploymentConfig",
439
-      "apiVersion": "v1beta3",
306
+      "apiVersion": "v1",
440 307
       "metadata": {
441
-        "name": "database-test",
308
+        "name": "frontend",
442 309
         "creationTimestamp": null
443 310
       },
444 311
       "spec": {
445 312
         "strategy": {
446
-          "type": "Recreate",
313
+          "type": "Rolling",
314
+          "rollingParams": {
315
+            "updatePeriodSeconds": 1,
316
+            "intervalSeconds": 1,
317
+            "timeoutSeconds": 120
318
+          },
447 319
           "resources": {}
448 320
         },
449 321
         "triggers": [
450 322
           {
323
+            "type": "ImageChange",
324
+            "imageChangeParams": {
325
+              "automatic": true,
326
+              "containerNames": [
327
+                "nodejs-helloworld"
328
+              ],
329
+              "from": {
330
+                "kind": "ImageStreamTag",
331
+                "name": "origin-nodejs-sample:latest"
332
+              }
333
+            }
334
+          },
335
+          {
451 336
             "type": "ConfigChange"
452 337
           }
453 338
         ],
454 339
         "replicas": 1,
455 340
         "selector": {
456
-          "name": "database-test"
457
-        },
341
+          "name":"frontend"
342
+          },
458 343
         "template": {
459 344
           "metadata": {
460 345
             "creationTimestamp": null,
461 346
             "labels": {
462
-              "name": "database-test"
347
+              "name": "frontend"
463 348
             }
464 349
           },
465 350
           "spec": {
466 351
             "containers": [
467 352
               {
468
-                "name": "ruby-helloworld-database",
469
-                "image": "mysql",
353
+                "name": "nodejs-helloworld",
354
+                "image": "origin-nodejs-sample",
470 355
                 "ports": [
471 356
                   {
472
-                    "containerPort": 3306,
357
+                    "containerPort": 8080,
473 358
                     "protocol": "TCP"
474 359
                   }
475 360
                 ],
476
-                "env": [
477
-                  {
478
-                    "name": "MYSQL_ROOT_PASSWORD",
479
-                    "value": "${MYSQL_ROOT_PASSWORD}"
480
-                  },
481
-                  {
482
-                    "name": "MYSQL_DATABASE",
483
-                    "value": "${MYSQL_DATABASE}"
484
-                  }
485
-                ],
486 361
                 "resources": {},
487 362
                 "terminationMessagePath": "/dev/termination-log",
488 363
                 "imagePullPolicy": "IfNotPresent",
489
-                "capabilities": {},
490 364
                 "securityContext": {
491 365
                   "capabilities": {},
492 366
                   "privileged": false
... ...
@@ -494,8 +290,7 @@
494 494
               }
495 495
             ],
496 496
             "restartPolicy": "Always",
497
-            "dnsPolicy": "ClusterFirst",
498
-            "serviceAccount": ""
497
+            "dnsPolicy": "ClusterFirst"
499 498
           }
500 499
         }
501 500
       },
... ...
@@ -514,17 +309,9 @@
514 514
       "description": "administrator password",
515 515
       "generate": "expression",
516 516
       "from": "[a-zA-Z0-9]{8}"
517
-    },
518
-    {
519
-      "name": "MYSQL_ROOT_PASSWORD",
520
-      "description": "database password",
521
-      "generate": "expression",
522
-      "from": "[a-zA-Z0-9]{8}"
523
-    },
524
-    {
525
-      "name": "MYSQL_DATABASE",
526
-      "description": "database name",
527
-      "value": "root"
528 517
     }
529
-  ]
518
+  ],
519
+  "labels": {
520
+    "template": "application-template-stibuild"
521
+  }
530 522
 }
531 523
\ No newline at end of file
532 524
deleted file mode 100644
... ...
@@ -1,85 +0,0 @@
1
-{
2
-  "kind": "List",
3
-  "apiVersion": "v1beta3",
4
-  "metadata": {},
5
-  "items": [
6
-    {
7
-      "kind": "Service",
8
-      "apiVersion": "v1beta3",
9
-      "metadata": {
10
-        "name": "jenkins"
11
-      },
12
-      "spec": {
13
-        "ports": [
14
-          {
15
-            "protocol": "TCP",
16
-            "port": 5002,
17
-            "targetPort": 8080,
18
-            "nodePort": 0
19
-          }
20
-        ],
21
-        "selector": {
22
-          "name": "jenkinspod"
23
-        },
24
-        "portalIP": "",
25
-        "type": "ClusterIP",
26
-        "sessionAffinity": "None"
27
-      }
28
-    },
29
-    {
30
-      "kind": "DeploymentConfig",
31
-      "apiVersion": "v1beta3",
32
-      "metadata": {
33
-        "name": "jenkins",
34
-        "creationTimestamp": null
35
-      },
36
-      "spec": {
37
-        "strategy": {
38
-          "type": "Recreate",
39
-          "resources": {}
40
-        },
41
-        "triggers": [
42
-          {
43
-            "type": "ConfigChange"
44
-          }
45
-        ],
46
-        "replicas": 1,
47
-        "selector": {
48
-          "name": "jenkinspod"
49
-        },
50
-        "template": {
51
-          "metadata": {
52
-            "creationTimestamp": null,
53
-            "labels": {
54
-              "name": "jenkinspod"
55
-            }
56
-          },
57
-          "spec": {
58
-            "containers": [
59
-              {
60
-                "name": "jenkins-container",
61
-                "image": "openshift/jenkins-1-centos",
62
-                "ports": [
63
-                  {
64
-                    "containerPort": 8080,
65
-                    "protocol": "TCP"
66
-                  }
67
-                ],
68
-                "resources": {},
69
-                "terminationMessagePath": "/dev/termination-log",
70
-                "imagePullPolicy": "IfNotPresent",
71
-                "capabilities": {},
72
-                "securityContext": {
73
-                  "capabilities": {},
74
-                  "privileged": false
75
-                }
76
-              }
77
-            ],
78
-            "restartPolicy": "Always",
79
-            "dnsPolicy": "ClusterFirst"
80
-          }
81
-        }
82
-      }
83
-    }
84
-  ]
85
-}
86 1
\ No newline at end of file
87 2
new file mode 100644
... ...
@@ -0,0 +1,143 @@
0
+{
1
+  "kind": "Template",
2
+  "apiVersion": "v1",
3
+  "metadata": {
4
+    "name": "jenkins-ephemeral",
5
+    "creationTimestamp": null,
6
+    "annotations": {
7
+      "description": "Jenkins service, without persistent storage. WARNING: Any data stored will be lost upon pod destruction. Only use this template for testing",
8
+      "iconClass": "icon-jenkins",
9
+      "tags": "database,jenkins"
10
+    }
11
+  },
12
+  "objects": [
13
+    {
14
+      "kind": "Service",
15
+      "apiVersion": "v1",
16
+      "metadata": {
17
+        "name": "${JENKINS_SERVICE_NAME}",
18
+        "creationTimestamp": null
19
+      },
20
+      "spec": {
21
+        "ports": [
22
+          {
23
+            "name": "web",
24
+            "protocol": "TCP",
25
+            "port": 8080,
26
+            "targetPort": 8080,
27
+            "nodePort": 0
28
+          }
29
+        ],
30
+        "selector": {
31
+          "name": "${JENKINS_SERVICE_NAME}"
32
+        },
33
+        "portalIP": "",
34
+        "type": "ClusterIP",
35
+        "sessionAffinity": "None"
36
+      },
37
+      "status": {
38
+        "loadBalancer": {}
39
+      }
40
+    },
41
+    {
42
+      "kind": "DeploymentConfig",
43
+      "apiVersion": "v1",
44
+      "metadata": {
45
+        "name": "${JENKINS_SERVICE_NAME}",
46
+        "creationTimestamp": null
47
+      },
48
+      "spec": {
49
+        "strategy": {
50
+          "type": "Recreate",
51
+          "resources": {}
52
+        },
53
+        "triggers": [
54
+          {
55
+            "type": "ImageChange",
56
+            "imageChangeParams": {
57
+              "automatic": true,
58
+              "containerNames": [
59
+                "jenkins"
60
+              ],
61
+              "from": {
62
+                "kind": "ImageStreamTag",
63
+                "name": "jenkins:latest",
64
+                "namespace": "openshift"
65
+              }
66
+            }
67
+          },
68
+          {
69
+            "type": "ConfigChange"
70
+          }
71
+        ],
72
+        "replicas": 1,
73
+        "selector": {
74
+          "name": "${JENKINS_SERVICE_NAME}"
75
+        },
76
+        "template": {
77
+          "metadata": {
78
+            "creationTimestamp": null,
79
+            "labels": {
80
+              "name": "${JENKINS_SERVICE_NAME}"
81
+            }
82
+          },
83
+          "spec": {
84
+            "containers": [
85
+              {
86
+                "name": "jenkins",
87
+                "image": "openshift/jenkins-16-centos7",
88
+                "env": [
89
+                  {
90
+                    "name": "JENKINS_PASSWORD",
91
+                    "value": "${JENKINS_PASSWORD}"
92
+                  }
93
+                ],
94
+                "resources": {},
95
+                "volumeMounts": [
96
+                  {
97
+                    "name": "${JENKINS_SERVICE_NAME}-data",
98
+                    "mountPath": "/var/lib/jenkins"
99
+                  }
100
+                ],
101
+                "terminationMessagePath": "/dev/termination-log",
102
+                "imagePullPolicy": "IfNotPresent",
103
+                "capabilities": {},
104
+                "securityContext": {
105
+                  "capabilities": {},
106
+                  "privileged": false
107
+                }
108
+              }
109
+            ],
110
+            "volumes": [
111
+              {
112
+                "name": "${JENKINS_SERVICE_NAME}-data",
113
+                "emptyDir": {
114
+                  "medium": ""
115
+                }
116
+              }
117
+            ],
118
+            "restartPolicy": "Always",
119
+            "dnsPolicy": "ClusterFirst"
120
+          }
121
+        }
122
+      },
123
+      "status": {}
124
+    }
125
+  ],
126
+  "parameters": [
127
+    {
128
+      "name": "JENKINS_SERVICE_NAME",
129
+      "description": "Jenkins service name",
130
+      "value": "jenkins"
131
+    },
132
+    {
133
+      "name": "JENKINS_PASSWORD",
134
+      "description": "Password for the Jenkins user",
135
+      "generate": "expression",
136
+      "value": "password"
137
+    }
138
+  ],
139
+  "labels": {
140
+    "template": "jenkins-ephemeral-template"
141
+  }
142
+}
0 143
deleted file mode 100644
... ...
@@ -1,105 +0,0 @@
1
-<?xml version='1.0' encoding='UTF-8'?>
2
-<project>
3
-  <actions/>
4
-  <description></description>
5
-  <keepDependencies>false</keepDependencies>
6
-  <properties>
7
-    <hudson.model.ParametersDefinitionProperty>
8
-      <parameterDefinitions>
9
-        <hudson.model.TextParameterDefinition>
10
-          <name>KUBECONFIG_CREDENTIALS</name>
11
-          <description>Contents of .kubeconfig file containing API credentials</description>
12
-          <defaultValue>
13
-apiVersion: v1
14
-kind: Config
15
-clusters:
16
-- cluster:
17
-    server: https://172.17.42.1:8443
18
-    insecure-skip-tls-verify: true
19
-  name: master
20
-contexts:
21
-- context:
22
-    cluster: master
23
-    user: openshift-client
24
-  name: master
25
-current-context: master
26
-users:
27
-- name: openshift-client
28
-</defaultValue>
29
-        </hudson.model.TextParameterDefinition>
30
-      </parameterDefinitions>
31
-    </hudson.model.ParametersDefinitionProperty>
32
-  </properties>
33
-  <scm class="hudson.scm.NullSCM"/>
34
-  <canRoam>true</canRoam>
35
-  <disabled>false</disabled>
36
-  <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
37
-  <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
38
-  <triggers/>
39
-  <concurrentBuild>false</concurrentBuild>
40
-  <builders>
41
-    <hudson.tasks.Shell>
42
-      <command>
43
-export KUBECONFIG=.kubeconfig
44
-echo "${KUBECONFIG_CREDENTIALS}" > "${KUBECONFIG}"
45
-
46
-TEST_ENDPOINT=`oc get services -n test | grep frontend-test | awk '{print $4":"$5}'`
47
-
48
-REGISTRY_ENDPOINT=`oc get services | grep docker-registry | awk '{print $4":"$5}'`
49
-
50
-# clean up existing test deployment
51
-set +e
52
-echo "Removing old test deployment"
53
-TEST_RC_ID=`oc get -n test replicationController | grep frontend-test | awk '{print $1}'`
54
-if [ ! -z $TEST_RC_ID ]; then
55
-  oc delete -n test replicationController $TEST_RC_ID
56
-fi
57
-
58
-TEST_POD_ID=`oc get pod -n test | grep frontend-test | awk '{print $1}'`
59
-if [ ! -z $TEST_POD_ID ]; then
60
-  oc delete pod -n test $TEST_POD_ID
61
-fi
62
-set -e
63
-
64
-# wait for old pod to be torn down
65
-sleep 5
66
-
67
-# trigger a build
68
-echo "Triggering new application build and deployment"
69
-oc start-build -n test ruby-test-build
70
-
71
-# check that the build test image deployed successfully
72
-set +e
73
-rc=1
74
-count=0
75
-attempts=100
76
-
77
-echo "Checking test deployment at $TEST_ENDPOINT"
78
-while [ $rc -ne 0 -a $count -lt $attempts ]; do
79
-  curl -s --connect-timeout 2 $TEST_ENDPOINT
80
-  rc=$?
81
-  if [ $rc -ne 0 ]; then
82
-    count=$(($count+1))
83
-    echo "Attempt $count/$attempts"
84
-    sleep 5
85
-  fi
86
-done
87
-set -e
88
-
89
-if [ $count -eq $attempts ]; then
90
-    echo "Failed to reach test deployment"
91
-    exit 1
92
-fi
93
-
94
-
95
-# Tag the image into production
96
-echo "Test deployment succeeded, rolling out to production..."
97
-
98
-COMMIT=`curl -s http://$REGISTRY_ENDPOINT/v1/repositories/test/origin-ruby-sample/tags/test`
99
-curl -s -X PUT  http://$REGISTRY_ENDPOINT/v1/repositories/test/origin-ruby-sample/tags/prod -d "$COMMIT"
100
-      </command>
101
-    </hudson.tasks.Shell>
102
-  </builders>
103
-  <publishers/>
104
-  <buildWrappers/>
105
-</project>