-
Notifications
You must be signed in to change notification settings - Fork 1
/
Jenkinsfile
43 lines (36 loc) · 1.55 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
#!/usr/bin/env groovy
node {
stage('checkout') {
checkout scm
}
stage('check java') {
sh "java -version"
}
stage('clean') {
sh "chmod +x mvnw"
sh "mvn clean"
}
stage('backend tests') {
try {
sh "mvn test"
} catch(err) {
throw err
} finally {
junit '**/target/surefire-reports/TEST-*.xml'
}
}
stage('packaging') {
sh "mvn verify -Pprod -DskipTests"
archiveArtifacts artifacts: '**/target/*.war', fingerprint: true
}
stage('upload package to instance 2'){
sh "ssh -i 'gateway.pem' ec2-user@ec2-35-174-136-82.compute-1.amazonaws.com sudo service insuranceMicroservice stop"
sh "scp -i 'gateway.pem' '../Insurance Microservice/target/insurance-microservice-0.0.1-SNAPSHOT.war' ec2-user@ec2-35-174-136-82.compute-1.amazonaws.com:/home/ec2-user/app/insuranceMicroservice/"
sh "ssh -i 'gateway.pem' ec2-user@ec2-35-174-136-82.compute-1.amazonaws.com sudo service insuranceMicroservice start"
}
stage('upload package to instance 1'){
sh "ssh -i 'gateway.pem' ec2-user@ec2-54-172-53-119.compute-1.amazonaws.com sudo service insuranceMicroservice stop"
sh "scp -i 'gateway.pem' '../Insurance Microservice/target/insurance-microservice-0.0.1-SNAPSHOT.war' ec2-user@ec2-54-172-53-119.compute-1.amazonaws.com:/home/ec2-user/app/insuranceMicroservice/"
sh "ssh -i 'gateway.pem' ec2-user@ec2-54-172-53-119.compute-1.amazonaws.com sudo service insuranceMicroservice start"
}
}