-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
66 lines (60 loc) · 2.24 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
62
63
64
65
66
pipeline {
agent { label 'RaspberryPi_MasterNode' }
tools {
maven 'Maven 3.6.3 Rasp'
jdk 'Java11 (openjdk) ARM'
}
options { buildDiscarder(logRotator(numToKeepStr: '3', artifactNumToKeepStr: '1')) }
stages {
stage("MVN Clean") {
steps {
withMaven {
sh "mvn clean"
}
}
}
stage("Compile source code") {
steps {
withMaven {
sh "mvn compile -P prod"
}
}
}
stage('Unit Tests') {
steps {
withMaven {
sh 'mvn resources:testResources compiler:testCompile surefire:test'
}
}
}
stage("Packaging SpringBoot artifact") {
steps {
withMaven {
sh 'mvn jar:jar spring-boot:repackage -P prod'
}
}
}
stage("Delivering artifact to AWS") {
steps {
echo 'Delivering artifact to remote server...'
sshagent(['jenkinsAWSssh']) {
sh 'scp ./target/*.jar ubuntu@enumerable-entity.link:/home/ubuntu/app/financy'
}
}
}
stage("SpringBoot runner restarting") {
steps {
script {
echo 'Deploying...'
sshagent(credentials: ['jenkinsAWSssh']) {
sh """ ssh ubuntu@enumerable-entity.link << EOF
docker restart SpringAppFinancy
exit
EOF
"""
}
}
}
}
}
}