-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
58 lines (49 loc) · 1.11 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
53
54
55
56
57
58
pipeline {
agent any
environment {
MAVEN_USER = credentials('jenkins-nexus-maven-user')
MAVEN_PASS = credentials('jenkins-nexus-maven-pass')
}
stages {
stage('Build') {
steps {
timeout(unit: 'MINUTES', time: 10) {
sh '''#!/bin/bash
if [[ "$GIT_BRANCH" = origin/tags/* ]]; then e
export VERSIONING_GIT_TAG=${GIT_BRANCH#origin/tags/};
else
export VERSIONING_GIT_BRANCH=${GIT_BRANCH#origin/};
fi'''
sh '''chmod +x gradlew
./gradlew build'''
}
}
}
stage('Test') {
steps {
timeout(unit: 'MINUTES', time: 10) {
sh '''./gradlew test'''
}
}
}
stage('Publishing') {
parallel {
stage('Gradle Publish') {
steps {
timeout(unit: 'MINUTES', time: 10) {
sh '''#!/bin/bash
if [[ "$GIT_BRANCH" != origin/pull/* ]]; then
./gradlew publish
fi'''
}
}
}
stage('Jenkins Archive') {
steps {
archiveArtifacts(artifacts: 'build/libs/*.jar', onlyIfSuccessful: true)
}
}
}
}
}
}