-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathJenkinsfile
51 lines (51 loc) · 1.48 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
pipeline {
agent any
tools {
maven 'Apache Maven 3.5.2'
}
environment {
KEY = ''
}
stages {
stage('Checkout') {
steps {
git 'https://github.com/vyjorg/LPDM-Store'
}
}
stage('Tests') {
steps {
sh 'mvn test'
}
post {
always {
junit 'target/surefire-reports/**/*.xml'
}
failure {
error 'The tests failed'
}
}
}
stage('Push to DockerHub') {
steps {
sh 'mvn clean package'
}
}
stage('Load Key') {
steps {
script {
configFileProvider([configFile(fileId: '2bd4e734-a03f-4fce-9015-aca988614b4e', targetLocation: 'lpdm.key')]) {
lpdm_keys = readJSON file: 'lpdm.key'
KEY = lpdm_keys.lpdm
}
}
}
}
stage('Deploy') {
steps {
sh 'docker stop LPDM-StoreMS || true && docker rm LPDM-StoreMS || true'
sh 'docker pull vyjorg/lpdm-store:latest'
sh "docker run -d --name LPDM-StoreMS -p 28084:28084 --link LPDM-StoreDB --restart always --memory-swappiness=0 -e 'JAVA_TOOL_OPTIONS=-Djasypt.encryptor.password=$KEY' vyjorg/lpdm-store:latest"
}
}
}
}