-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
48 lines (47 loc) · 1.36 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
pipeline {
agent any
environment {
DB_HOST = credentials('db_url')
DB_USER = credentials('db_user')
DB_PASSWORD = credentials('db_password')
CROSS_ORIGIN = credentials('cross_origin')
}
stages {
stage('docker compose down') {
steps {
script {
def exists = fileExists '/home/jenkins/workspace/backend-production/docker-compose.yml'
if (exists) {
sh 'docker-compose down'
}else {
sh 'echo skip this step'
}
}
}
}
stage('delete old version') {
when {
expression {
env.PWD == '/home/jenkins/workspace/backend-production'
}
}
steps {
sh 'rm -rf *'
}
}
stage('clone project and checkout') {
steps {
git branch: 'master',
credentialsId: 'sshgit',
url: 'git@github.com:KB-Group-Enterprise/integrated-backend.git'
sh 'ls -lat'
sh 'git log --oneline'
}
}
stage('docker compose up') {
steps {
sh 'docker-compose up -d --build'
}
}
}
}