-
Notifications
You must be signed in to change notification settings - Fork 2
/
Jenkinsfile
82 lines (73 loc) · 2.19 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
81
82
// Tell Jenkins how to build projects from this repository
pipeline {
parameters {
// DISTRIBUTION
booleanParam(defaultValue: false, description: 'Set to true if you want to create a release', name: 'RELEASE')
}
agent {
label 'node'
}
environment {
CI = 'true'
TEAMS_NOTIFICATION_URL = credentials('incquery-server-teams-notification-url')
}
options {
// Keep only the last 15 builds
buildDiscarder(logRotator(artifactNumToKeepStr: '3', numToKeepStr: '15'))
// Do not execute the same pipeline concurrently
disableConcurrentBuilds()
// Display timestamps in log
timestamps()
}
tools {
jdk 'AdoptOpenJDK 11'
}
stages {
stage('Clean') {
steps {
sh "./gradlew clean"
}
}
stage('Build') {
steps {
sh "./gradlew build"
}
}
stage('Release') {
when {
expression { params.RELEASE == true }
}
steps {
sh "./gradlew clean collectGithubRelease "
withCredentials([usernamePassword(
credentialsId: 'github-access-token',
passwordVariable: 'GITHUB_RELEASE_TOKEN',
usernameVariable: 'GITHUB_USER')]) {
sh "./gradlew githubRelease -Prelease=true -PgithubToken=${GITHUB_RELEASE_TOKEN}"
}
}
}
}
post {
always {
script {
archiveArtifacts '**/build/distributions/**, **/build/libs/**'
}
}
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}"
}
}
}