-
Notifications
You must be signed in to change notification settings - Fork 183
/
Jenkinsfile
52 lines (37 loc) · 1.47 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
pipeline {
agent any
stages {
stage('Build') {
steps {
echo "env: ${env.BRANCH_NAME}"
echo "Building.."
sh "/opt/maven/bin/mvn package -Dmaven.test.skip=true -P${env.BRANCH_NAME}"
}
}
stage('Test') {
steps {
echo "env: ${env.BRANCH_NAME}"
echo 'Testing..'
}
}
stage('Deploy') {
steps {
echo "env: ${env.BRANCH_NAME}"
echo "mrcms-${env.BRANCH_NAME} docker stop...."
sh '''
ssh root@ww-server-15 "docker stop mrcms-${BRANCH_NAME}"
echo "douruimi-web bakup...."
if [ ! -f "/opt/data/tomcat/mrcms/$BRANCH_NAME.war" ];then
echo "文件不存在"
else
mv /opt/data/tomcat/mrcms/$BRANCH_NAME.war /opt/data/tomcat/app-$(date +%Y%m%d%h%m%s).war
fi
scp ./target/mrcms-1.0.0.war root@ww-server-15:/opt/data/tomcat/mrcms/ROOT.war
echo "mrcms-${BRANCH_NAME} docker deploying...."
echo "mrcms-${BRANCH_NAME} docker start...."
ssh root@ww-server-15 "docker start mrcms-${BRANCH_NAME}"
'''
}
}
}
}