This commit is contained in:
Ovidio Mallo 2016-12-09 16:57:26 +01:00
parent 3abdeb66e2
commit 914354169e
2 changed files with 6 additions and 5 deletions

View file

@ -1,4 +1,6 @@
dev:
foo: bar
params:
REPLICAS: 1
test:
foo2: bar2
params:
REPLICAS: 2

View file

@ -1,5 +1,4 @@
import org.yaml.snakeyaml.Yaml
import org.yaml.snakeyaml.constructor.Constructor
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"
@ -34,7 +33,7 @@ node() {
}
stage("Deploy to DEV") {
def replicas = getReplicasOrDefault("frontend", "rubex-dev", 1)
def replicas = getReplicasOrDefault("frontend", "rubex-dev", config.dev.params.REPLICAS)
sh "${ocCmd} process -f ${appManifest} -v ENV=dev -v REPLICAS=${replicas} -n rubex-dev | ${ocCmd} apply -f - -n rubex-dev"
sh "${ocCmd} tag rubex-dev/frontend:latest rubex-dev/frontend:dev"
sh "${ocCmd} rollout latest dc/frontend -n rubex-dev"
@ -48,7 +47,7 @@ node() {
if (isPromoteToTest) {
stage("Deploy to TEST") {
def replicas = getReplicasOrDefault("frontend", "rubex-test", 2)
def replicas = getReplicasOrDefault("frontend", "rubex-test", config.test.params.REPLICAS)
sh "${ocCmd} process -f ${appManifest} -v ENV=test -v REPLICAS=${replicas} -n rubex-test | ${ocCmd} apply -f - -n rubex-test"
sh "${ocCmd} tag rubex-dev/frontend:dev rubex-dev/frontend:test"
sh "${ocCmd} rollout latest dc/frontend -n rubex-test"