-
Notifications
You must be signed in to change notification settings - Fork 1
/
Jenkinsfile
133 lines (131 loc) · 5.08 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#!groovy
// SPDX-FileCopyrightText: © 2020 Alias Developers
// SPDX-FileCopyrightText: © 2016 SpectreCoin Developers
//
// SPDX-License-Identifier: MIT
pipeline {
agent {
label 'bootstrap-updater'
}
options {
timestamps()
timeout(time: 2, unit: 'HOURS')
buildDiscarder(logRotator(numToKeepStr: '30', artifactNumToKeepStr: '1'))
disableConcurrentBuilds()
}
triggers {
cron('H 2 * * *')
}
environment {
DISCORD_WEBHOOK = credentials('DISCORD_WEBHOOK')
}
stages {
stage('Notification') {
steps {
// Using result state 'ABORTED' to mark the message on discord with a white border.
// Makes it easier to distinguish job-start from job-finished
discordSend(
description: "Started build #$env.BUILD_NUMBER",
image: '',
//link: "$env.BUILD_URL",
successful: true,
result: "ABORTED",
thumbnail: 'https://wiki.jenkins-ci.org/download/attachments/2916393/headshot.png',
title: "$env.JOB_NAME",
webhookURL: DISCORD_WEBHOOK
)
}
}
stage('Create and install bootstrap archive') {
steps {
sh(
script: """
./updateBootstrap.sh -u
"""
)
}
}
stage('Create and install bootstrap archive (testnet)') {
steps {
sh(
script: """
./updateBootstrap.sh -t -u
"""
)
}
}
}
post {
success {
script {
if (!hudson.model.Result.SUCCESS.equals(currentBuild.getPreviousBuild()?.getResult())) {
emailext(
subject: "GREEN: '${env.JOB_NAME} [${env.BUILD_NUMBER}]'",
body: '${JELLY_SCRIPT,template="html"}',
recipientProviders: [[$class: 'DevelopersRecipientProvider'], [$class: 'RequesterRecipientProvider']],
// to: "to@be.defined",
// replyTo: "to@be.defined"
)
}
discordSend(
description: "Build #$env.BUILD_NUMBER successfully created and uploaded Alias bootstrap archive",
image: '',
//link: "$env.BUILD_URL",
successful: true,
thumbnail: 'https://wiki.jenkins-ci.org/download/attachments/2916393/headshot.png',
title: "$env.JOB_NAME",
webhookURL: DISCORD_WEBHOOK
)
}
}
unstable {
emailext(
subject: "YELLOW: '${env.JOB_NAME} [${env.BUILD_NUMBER}]'",
body: '${JELLY_SCRIPT,template="html"}',
recipientProviders: [[$class: 'DevelopersRecipientProvider'], [$class: 'RequesterRecipientProvider']],
// to: "to@be.defined",
// replyTo: "to@be.defined"
)
discordSend(
description: "Build #$env.BUILD_NUMBER finished unstable",
image: '',
//link: "$env.BUILD_URL",
successful: true,
result: "UNSTABLE",
thumbnail: 'https://wiki.jenkins-ci.org/download/attachments/2916393/headshot.png',
title: "$env.JOB_NAME",
webhookURL: DISCORD_WEBHOOK
)
}
failure {
emailext(
subject: "RED: '${env.JOB_NAME} [${env.BUILD_NUMBER}]'",
body: '${JELLY_SCRIPT,template="html"}',
recipientProviders: [[$class: 'DevelopersRecipientProvider'], [$class: 'RequesterRecipientProvider']],
// to: "to@be.defined",
// replyTo: "to@be.defined"
)
discordSend(
description: "Build #$env.BUILD_NUMBER failed!",
image: '',
//link: "$env.BUILD_URL",
successful: false,
thumbnail: 'https://wiki.jenkins-ci.org/download/attachments/2916393/headshot.png',
title: "$env.JOB_NAME",
webhookURL: DISCORD_WEBHOOK
)
}
aborted {
discordSend(
description: "Build #$env.BUILD_NUMBER was aborted",
image: '',
//link: "$env.BUILD_URL",
successful: true,
result: "ABORTED",
thumbnail: 'https://wiki.jenkins-ci.org/download/attachments/2916393/headshot.png',
title: "$env.JOB_NAME",
webhookURL: DISCORD_WEBHOOK
)
}
}
}