-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathJenkinsfile
80 lines (78 loc) · 2.39 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
// Tell Jenkins how to build projects from this repository
pipeline {
agent {
label 'magicdraw19'
}
parameters {
string(name: 'RELEASE_VERSION', defaultValue: '',
description: 'Set this parameter to update the project version version accordingly, should be used to remove -SNAPSHOT from version numbers. Leave it empty to keep version from the repository.')
}
// Keep only the last 5 builds
options {
buildDiscarder(logRotator(numToKeepStr: '5'))
}
environment {
VERSION_STRINGS = " ${params.RELEASE_VERSION ? '-Pversion=' + params.RELEASE_VERSION : ''} "
TEAMS_NOTIFICATION_URL = credentials('v4md-teams-channel-url')
}
tools {
maven 'Maven 3.3.9'
jdk 'AdoptOpenJDK 8.0'
}
stages {
stage('Build Plug-in') {
steps {
withCredentials([usernamePassword(credentialsId: 'nexus-buildserver-deploy', passwordVariable: 'DEPLOY_PASSWORD', usernameVariable: 'DEPLOY_USER')]) {
dir ('com.incquerylabs.v4md'){
sh './gradlew clean'
sh './gradlew ${VERSION_STRINGS} assemble'
}
}
}
}
stage('Running Plug-in Tests') {
steps {
withCredentials([usernamePassword(credentialsId: 'nexus-buildserver-deploy', passwordVariable: 'DEPLOY_PASSWORD', usernameVariable: 'DEPLOY_USER')]) {
dir ('com.incquerylabs.v4md'){
wrap([$class: 'Xvnc']) {
sh './gradlew ${VERSION_STRINGS} runTest'
}
}
}
}
}
stage('Deploy Plugin') {
when {branch "master"}
steps {
withCredentials([usernamePassword(credentialsId: 'nexus-buildserver-deploy', passwordVariable: 'DEPLOY_PASSWORD', usernameVariable: 'DEPLOY_USER')]) {
script{
dir ('com.incquerylabs.v4md') {
sh './gradlew ${VERSION_STRINGS} publish'
}
}
}
}
}
}
post {
always {
archiveArtifacts artifacts: 'com.incquerylabs.v4md/build/distributions/*.zip', onlyIfSuccessful: true
junit testResults: 'com.incquerylabs.v4md/build/install/target/*.xml'
}
success {
office365ConnectorSend status: "Success",
color: "00db00",
webhookUrl: '${TEAMS_NOTIFICATION_URL}'
}
unstable {
office365ConnectorSend status: "Unstable",
color: "fcb019",
webhookUrl: '${TEAMS_NOTIFICATION_URL}'
}
failure {
office365ConnectorSend status: "Failure",
color: "f21607",
webhookUrl: '${TEAMS_NOTIFICATION_URL}'
}
}
}