-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
38 lines (36 loc) · 1.29 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
pipeline {
agent any
options {
buildDiscarder(logRotator(numToKeepStr: '10'))
}
environment {
NAME = "${JOB_NAME.replaceAll("/", "-").toLowerCase()}"
DEV_NAME = "${NAME}"
DEV_HOST = "$GL_TEST_WEBSITES"
DEV_DEPLOY_PATH = "$GL_TEST_WEBSITES_PATH"
DEV_PASS = credentials('gl_test_websites')
DEMO_NAME = "${NAME}"
DEMO_HOST = "$GL_DEMO_WEBSITES"
DEMO_DEPLOY_PATH = "$GL_DEMO_WEBSITES_PATH"
DEMO_PASS = credentials('gl_demo_websites')
}
stages {
stage ('Checkout') {
steps {
sh 'printenv'
}
}
stage('Build & Deploy Test') {
//when { not { branch 'master' } }
steps {
sh "docker build -f Dockerfile --build-arg DEPLOY_PASS=$DEV_PASS --build-arg DEPLOY_NAME=$DEV_NAME --build-arg DEPLOY_HOST=$DEV_HOST --build-arg DEPLOY_PATH=$DEV_DEPLOY_PATH -t $NAME ."
}
}
stage('Build & Deploy Prod') {
when { branch 'master' }
steps {
sh "docker build -f Dockerfile --build-arg DEPLOY_PASS=$DEMO_PASS --build-arg DEPLOY_NAME=$DEMO_NAME --build-arg DEPLOY_HOST=$DEMO_HOST --build-arg DEPLOY_PATH=$DEMO_DEPLOY_PATH -t $NAME ."
}
}
}
}