-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile.old
74 lines (61 loc) · 1.93 KB
/
Jenkinsfile.old
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
67
68
69
70
71
72
73
74
#!/usr/bin/env groovy
// triggered by GitHub in Jenkins-Pipeline
// global variables
def REGISTRY_URL='https://dockerregistry.eigenbaumarkt.com'
def REGISTRY_USER='dockerregistry-login'
def IMAGE_NAME='mesqualito/jhipster_de'
def IMAGE_TAG='latest'
// def CONTAINER_HTTP_PORT='8080'
node {
stage('checkout') {
checkout scm
}
docker.image('jhipster/jhipster:v6.4.1').inside('-u jhipster -e GRADLE_USER_HOME=.gradle') {
stage('check java') {
sh "java -version"
}
stage('clean') {
sh "chmod +x gradlew"
sh "./gradlew clean --no-daemon"
}
stage('npm install') {
sh "./gradlew npm_install -PnodeInstall --no-daemon"
}
stage('backend tests') {
try {
sh "./gradlew test -PnodeInstall --no-daemon"
} catch(err) {
throw err
} finally {
junit '**/build/**/TEST-*.xml'
}
}
stage('frontend tests') {
try {
sh "./gradlew npm_run_test -PnodeInstall --no-daemon"
} catch(err) {
throw err
} finally {
junit '**/build/test-results/TESTS-*.xml'
}
}
stage('packaging') {
sh "./gradlew --no-daemon -i -x test -Pprod -PnodeInstall -Pwar clean bootWar"
archiveArtifacts artifacts: '**/build/libs/*.war', fingerprint: true
}
}
def dockerImage
stage('build docker') {
sh "cp -Rvvv src/main/docker build/"
sh "cp -vvv build/libs/*.war build/docker/"
dockerImage = docker.build("$IMAGE_NAME:$IMAGE_TAG", "build/docker")
}
stage('publish docker') {
docker.withRegistry("$REGISTRY_URL", "$REGISTRY_USER") {
dockerImage.push "$IMAGE_TAG"
}
}
stage('Remove Unused docker image') {
sh "docker rmi $IMAGE_NAME:$IMAGE_TAG"
}
}