-
Notifications
You must be signed in to change notification settings - Fork 3
/
Jenkinsfile
48 lines (46 loc) · 1.63 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
pipeline {
agent none
options {
disableConcurrentBuilds()
}
stages {
stage('container') {
agent {
dockerfile {
args '--volume ${HOME}/.m2:/home/builder/.m2 --volume ${HOME}/.cache:/home/builder/.cachejournal/ --volume ${HOME}/bin:${HOME}/bin'
additionalBuildArgs '--build-arg BUILDER_UID=$(id -u)'
}
}
stages {
stage('clean') {
steps {
sh 'git reset --hard'
sh 'git clean --force --force -xd --exclude=web/node_modules'
}
}
stage('set_version_release') {
when { branch "main" }
steps {
withCredentials([usernamePassword(credentialsId: env.GIT_CREDENTIALS_ID, passwordVariable: 'GIT_PASSWORD', usernameVariable: 'GIT_USERNAME')]) {
sh './bumpversion.sh'
}
}
}
stage('build') {
steps {
sh 'yarn --version'
sh 'yarn --cwd web --frozen-lockfile'
sh 'mvn --batch-mode --threads 2 --define maven.test.skip=true clean package'
}
}
}
post {
success {
dir('app/target/') {
archiveArtifacts artifacts: '*.war', fingerprint: true, onlyIfSuccessful: true
}
}
}
}
}
}