Skip to content

Commit

Permalink
updated bluegreen template
Browse files Browse the repository at this point in the history
  • Loading branch information
siamaksade committed Oct 12, 2017
1 parent d79baba commit f393f31
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions openshift/coolstore-bluegreen-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -935,12 +935,22 @@ objects:
def altTag = "green"
stage('Deploy (Not Live)') {
sh "oc get route cart -o jsonpath='{ .spec.to.name }' > activeservice"
activeService = readFile('activeservice').trim()
sh "oc get route cart -o json > routejson"
def json = readJSON text: readFile('routejson').trim()
def activeService
if (json.spec.to.weight == 100) {
activeService = json.spec.to.name
} else {
for (backend in json.spec.alternateBackends) {
if (backend.weight == 100) { activeService = backend.name }
}
}
if (activeService == "cart-blue") {
tag = "green"
altTag = "blue"
}
openshiftTag sourceStream: 'cart', sourceTag: 'latest', destinationStream: 'cart', destinationTag: "latest-${tag}"
sleep 10
openshiftVerifyDeployment deploymentConfig: "cart-${tag}", replicaCount: '1', verifyReplicaCount: true
Expand Down

0 comments on commit f393f31

Please sign in to comment.