diff --git a/deployment/pipeline.groovy b/deployment/pipeline.groovy index 1165794..1cfde21 100644 --- a/deployment/pipeline.groovy +++ b/deployment/pipeline.groovy @@ -1,26 +1,13 @@ -def oc(args) { - sh getOcCmd(args) -} - -def ocPipe(args1, args2) { - def ocCmd1 = getOcCmd(args1) - def ocCmd2 = getOcCmd(args2) - sh "${ocCmd1} | ${ocCmd2}" -} - -def getOcCmd(args) { - def ocBin = "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" - return "${ocBin} ${args}" -} - node() { + 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" + stage('Build') { - oc "start-build frontend -w -n rubex-dev" + sh "${ocCmd} start-build frontend -w -n rubex-dev" } stage('Deploy to DEV') { - oc "tag rubex-dev/frontend:latest rubex-dev/frontend:dev" - oc "deploy frontend --latest --follow -n rubex-dev" + sh "${ocCmd} tag rubex-dev/frontend:latest rubex-dev/frontend:dev" + sh "${ocCmd} deploy frontend --latest --follow -n rubex-dev" } def isPromoteToTest = false @@ -30,8 +17,8 @@ node() { if (isPromoteToTest) { stage('Deploy to TEST') { - oc "tag rubex-dev/frontend:dev rubex-dev/frontend:test" - oc "deploy frontend --latest --follow -n rubex-test" + sh "${ocCmd} tag rubex-dev/frontend:dev rubex-dev/frontend:test" + sh "${ocCmd} deploy frontend --latest --follow -n rubex-test" } } }