1
- apiVersion : v1
1
+ apiVersion : template.openshift.io/ v1
2
2
kind : Template
3
3
labels :
4
4
template : bluegreen-pipeline
@@ -13,7 +13,7 @@ metadata:
13
13
tags : instant-app,jenkins
14
14
name : bluegreen-pipeline
15
15
objects :
16
- - apiVersion : v1
16
+ - apiVersion : build.openshift.io/ v1
17
17
kind : BuildConfig
18
18
metadata :
19
19
annotations :
@@ -33,7 +33,7 @@ objects:
33
33
def tag="blue"
34
34
def altTag="green"
35
35
def verbose="${VERBOSE}"
36
-
36
+
37
37
node {
38
38
project = env.PROJECT_NAME
39
39
stage("Initialize") {
@@ -46,7 +46,7 @@ objects:
46
46
sh "oc get route ${tag}-${appName} -n ${project} -o jsonpath='{ .spec.host }' --loglevel=4 > routehost"
47
47
routeHost = readFile('routehost').trim()
48
48
}
49
-
49
+
50
50
openshift.withCluster() {
51
51
openshift.withProject() {
52
52
stage("Build") {
@@ -55,19 +55,19 @@ objects:
55
55
bld.untilEach {
56
56
return it.object().status.phase == "Running"
57
57
}
58
- bld.logs('-f')
58
+ bld.logs('-f')
59
59
}
60
-
60
+
61
61
stage("Deploy Test") {
62
62
openshift.tag("${appName}:latest", "${appName}:${tag}")
63
63
def dc = openshift.selector('dc', "${appName}-${tag}")
64
64
dc.rollout().status()
65
65
}
66
-
66
+
67
67
stage("Test") {
68
68
input message: "Test deployment: http://${routeHost}. Approve?", id: "approval"
69
69
}
70
-
70
+
71
71
stage("Go Live") {
72
72
sh "oc set -n ${project} route-backends ${appName} ${appName}-${tag}=100 ${appName}-${altTag}=0 --loglevel=4"
73
73
}
@@ -81,7 +81,7 @@ objects:
81
81
echo "Caught: ${err}"
82
82
currentBuild.result = 'FAILURE'
83
83
throw err
84
- }
84
+ }
85
85
type : JenkinsPipeline
86
86
triggers :
87
87
- github :
@@ -98,23 +98,23 @@ objects:
98
98
database-admin-password : ${DATABASE_ADMIN_PASSWORD}
99
99
database-password : ${DATABASE_PASSWORD}
100
100
database-user : ${DATABASE_USER}
101
- - apiVersion : v1
101
+ - apiVersion : route.openshift.io/ v1
102
102
kind : Route
103
103
metadata :
104
104
name : blue-${NAME}
105
105
spec :
106
106
to :
107
107
kind : Service
108
108
name : ${NAME}-blue
109
- - apiVersion : v1
109
+ - apiVersion : route.openshift.io/ v1
110
110
kind : Route
111
111
metadata :
112
112
name : green-${NAME}
113
113
spec :
114
114
to :
115
115
kind : Service
116
116
name : ${NAME}-green
117
- - apiVersion : v1
117
+ - apiVersion : route.openshift.io/ v1
118
118
kind : Route
119
119
metadata :
120
120
name : ${NAME}
@@ -126,13 +126,13 @@ objects:
126
126
kind : Service
127
127
name : ${NAME}-blue
128
128
weight : 100
129
- - apiVersion : v1
129
+ - apiVersion : image.openshift.io/ v1
130
130
kind : ImageStream
131
131
metadata :
132
132
annotations :
133
133
description : Keeps track of changes in the application image
134
134
name : ${NAME}
135
- - apiVersion : v1
135
+ - apiVersion : build.openshift.io/ v1
136
136
kind : BuildConfig
137
137
metadata :
138
138
annotations :
@@ -181,7 +181,7 @@ objects:
181
181
targetPort : 8080
182
182
selector :
183
183
name : ${NAME}-blue
184
- - apiVersion : v1
184
+ - apiVersion : apps.openshift.io/ v1
185
185
kind : DeploymentConfig
186
186
metadata :
187
187
annotations :
@@ -253,7 +253,7 @@ objects:
253
253
targetPort : 8080
254
254
selector :
255
255
name : ${NAME}-green
256
- - apiVersion : v1
256
+ - apiVersion : apps.openshift.io/ v1
257
257
kind : DeploymentConfig
258
258
metadata :
259
259
annotations :
@@ -332,7 +332,7 @@ objects:
332
332
targetPort : 5432
333
333
selector :
334
334
name : ${DATABASE_SERVICE_NAME}
335
- - apiVersion : v1
335
+ - apiVersion : apps.openshift.io/ v1
336
336
kind : DeploymentConfig
337
337
metadata :
338
338
annotations :
0 commit comments