-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathJenkinsfile
61 lines (59 loc) · 2.2 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
def baseDomain = 't-web.epitech.castornaut.com'
pipeline {
agent any
environment {
CI = 'true'
PRIVATE_NETWORK = 'private-network'
AUTH0_DOMAIN = 'dev-m6frxp9u.eu.auth0.com'
AUTH0_AUDIENCE = 'https://dev-m6frxp9u.eu.auth0.com/api/v2/'
CLIENT_ID = 'rEWYoWt0Gf19ygTZbLFEUJFEUv6LZ3Vk'
API_KEY_CRYPTOCOMPARE = credentials("API_KEY_CRYPTO_COMPARE")
CLIENT_SECRET = credentials("CLIENT_SECRET")
}
stages {
stage('Environment') {
steps {
script {
echo '[Environment]...'
if (env.BRANCH_NAME == 'master') {
env.BACKEND_DOMAIN = "backend.${baseDomain}";
env.FRONTEND_DOMAIN = "${baseDomain}";
} else {
env.BACKEND_DOMAIN = "backend.${BRANCH_NAME}.${baseDomain}";
env.FRONTEND_DOMAIN = "${BRANCH_NAME}.${baseDomain}";
}
sh 'printenv'
echo '...[Environment]'
}
}
}
stage('Build') {
steps {
script {
if (env.BRANCH_NAME == 'master') {
echo '[Building PROD]...'
sh "docker-compose -f docker-compose.prod.yml build"
} else {
echo "[Building ${JOB_BASE_NAME}]..."
sh "docker-compose -f docker-compose.staging.yml -p ${BRANCH_NAME} build"
}
echo "...[Building ${BRANCH_NAME}]"
}
}
}
stage('Deploy') {
steps {
script {
if (env.BRANCH_NAME == 'master') {
echo '[Deploying PROD]...'
sh "docker-compose -f docker-compose.prod.yml up -d"
} else if (env.BRANCH_NAME == 'develop') {
echo '[Deploying DEV]...'
sh "docker-compose -f docker-compose.staging.yml -p ${BRANCH_NAME} up -d"
}
echo '...[Deploying]'
}
}
}
}
}