ruby-ex/deployment/pipeline.groovy

31 lines
1.4 KiB
Groovy
Raw Normal View History

2016-12-05 14:32:22 +00:00
node() {
2016-12-06 09:10:10 +00:00
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 buildConfigUrl = "https://raw.githubusercontent.com/omallo/ruby-ex/master/deployment/config/build.yaml"
def appConfigUrl = "https://raw.githubusercontent.com/omallo/ruby-ex/master/deployment/config/app.yaml"
2016-12-05 14:32:22 +00:00
stage('Build') {
sh "${ocCmd} process -f ${buildConfigUrl} -n rubex-dev | ${ocCmd} apply -f - -n rubex-dev"
2016-12-06 09:10:10 +00:00
sh "${ocCmd} start-build frontend -w -n rubex-dev"
2016-12-05 14:32:22 +00:00
}
stage('Deploy to DEV') {
sh "${ocCmd} process -f ${appConfigUrl} -v ENV=dev -n rubex-dev | ${ocCmd} apply -f - -n rubex-dev"
2016-12-06 09:10:10 +00:00
sh "${ocCmd} tag rubex-dev/frontend:latest rubex-dev/frontend:dev"
sh "${ocCmd} deploy frontend --latest --follow -n rubex-dev"
2016-12-05 14:32:22 +00:00
}
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') {
sh "${ocCmd} process -f ${appConfigUrl} -v ENV=test -n rubex-test | ${ocCmd} apply -f - -n rubex-test"
2016-12-06 09:10:10 +00:00
sh "${ocCmd} tag rubex-dev/frontend:dev rubex-dev/frontend:test"
sh "${ocCmd} deploy frontend --latest --follow -n rubex-test"
2016-12-05 14:32:22 +00:00
}
}
}