forked from yggdrash/yggdrash
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
52 lines (44 loc) · 1.3 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
#!/usr/bin/env groovy
node {
stage('checkout') {
checkout scm
}
docker.image('openjdk:8').inside('-u root -e GRADLE_USER_HOME=.gradle') {
stage('check java') {
sh "java -version"
}
stage('clean') {
sh "chmod +x gradlew"
sh "./gradlew clean --no-daemon"
}
stage('backend tests') {
try {
sh "./gradlew test --no-daemon"
} catch(err) {
throw err
} finally {
junit '**/build/**/TEST-*.xml'
}
}
stage('packaging') {
sh "./gradlew build -x test -PspringProfiles=prod --no-daemon"
archiveArtifacts artifacts: '**/build/libs/*.jar', fingerprint: true
}
stage('quality analysis') {
withSonarQubeEnv('Sonar') {
sh "./gradlew sonarqube --no-daemon"
}
}
}
def dockerImage
stage('build docker') {
sh "cp -R docker build/"
sh "cp build/libs/*.jar build/docker/"
dockerImage = docker.build('yggdrash/yggdrash-node', 'build/docker')
}
stage('publish docker') {
docker.withRegistry('https://registry.hub.docker.com', 'docker-login') {
dockerImage.push 'latest'
}
}
}