From 65b2a832b0da5668533db5f0c052bf5664245369 Mon Sep 17 00:00:00 2001 From: Ovidio Mallo Date: Mon, 5 Dec 2016 15:32:22 +0100 Subject: [PATCH] Add a Jenkins pipeline script --- deployment/pipeline.groovy | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 deployment/pipeline.groovy diff --git a/deployment/pipeline.groovy b/deployment/pipeline.groovy new file mode 100644 index 0000000..53d3881 --- /dev/null +++ b/deployment/pipeline.groovy @@ -0,0 +1,25 @@ +def oc(args) { + def ocCmd = "/tmp/oc2 --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" + sh "${ocCmd} " + args +} + +node() { + stage('Build') { + oc "start-build frontend -w -n rubex-dev" + } + + stage('Deploy to DEV') { + // noop + } + + def isPromoteToTest = false + stage('Promote to TEST?') { + isPromoteToTest = input(message: 'Promotion', parameters: [booleanParam(defaultValue: false, name: 'Promote to TEST?')]) + } + + if (isPromoteToTest) { + stage('Deploy to TEST') { + oc "tag rubex-dev/frontend:latest rubex-dev/frontend:test" + } + } +}