From 5cf826925cb555a451297d2eb0c9b8b9d957bc8f Mon Sep 17 00:00:00 2001 From: Ovidio Mallo Date: Thu, 8 Dec 2016 00:28:53 +0100 Subject: [PATCH] Minor cleanup --- deployment/pipeline.groovy | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/deployment/pipeline.groovy b/deployment/pipeline.groovy index d48a5ed..bea1f01 100644 --- a/deployment/pipeline.groovy +++ b/deployment/pipeline.groovy @@ -1,11 +1,16 @@ -def ocCmd = "oc --token=`cat /var/run/secrets/kubernetes.io/serviceaccount/token` --server=https://openshift.default.svc.cluster.local --certificate-authority=/run/secrets/kubernetes.io/serviceaccount/ca.crt" +def getOcCmd() { + return "oc --token=`cat /var/run/secrets/kubernetes.io/serviceaccount/token` --server=https://openshift.default.svc.cluster.local --certificate-authority=/run/secrets/kubernetes.io/serviceaccount/ca.crt" +} def getReplicasOpt(deploymentConfig, project) { + def ocCmd = getOcCmd() def replicas = sh(script: "${ocCmd} get dc ${deploymentConfig} --template='{{ .spec.replicas }}' -n ${project}", returnStdout: true).trim() return replicas ? "-v REPLICAS=${replicas}" : "" } node() { + def ocCmd = getOcCmd() + def buildConfigFile = "deployment/config/build.yaml" def appConfigFile = "deployment/config/app.yaml"