-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
53 lines (53 loc) · 1.42 KB
/
Jenkinsfile
File metadata and controls
53 lines (53 loc) · 1.42 KB
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
pipeline{
agent any
environment {
SCRIPT_PATH = '/var/jenkins_home/custom/treen'
}
tools {
gradle 'gradle 8.5'
}
stages{
stage('Checkout') {
steps {
checkout scm
}
}
stage('Prepare'){
steps {
sh 'gradle clean'
}
}
stage('Replace Prod Properties') {
steps {
withCredentials([file(credentialsId: 'treenProd', variable: 'treenProd')]) {
script {
sh 'cp $snapCampusProd ./src/main/resources/application-prod.yml'
}
}
}
}
stage('Build') {
steps {
sh 'gradle build -x test'
}
}
stage('Test') {
steps {
sh 'gradle test'
}
}
stage('Deploy') {
steps {
sh '''
cp ./docker/docker-compose.blue.yml ${SCRIPT_PATH}
cp ./docker/docker-compose.green.yml ${SCRIPT_PATH}
cp ./docker/Dockerfile ${SCRIPT_PATH}
cp ./scripts/deploy.sh ${SCRIPT_PATH}
cp ./build/libs/*.jar ${SCRIPT_PATH}
chmod +x ${SCRIPT_PATH}/deploy.sh
${SCRIPT_PATH}/deploy.sh
'''
}
}
}
}