-
Notifications
You must be signed in to change notification settings - Fork 50
/
.jenkinsfile
145 lines (143 loc) · 5.58 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
134
135
136
137
138
139
140
141
142
143
144
145
pipeline {
parameters{
booleanParam(
name: 'INCREMENT_FILEHOST_VERSION',
defaultValue: false,
description: '''If set to true, this build will copy the pdfs to the filehost with an incremented filehost version number
If set to false (default), this build will copy the pdfs to the filehost, replacing the latest filehost version''')
string(name: 'RELEASE_DESCRIPTION',
defaultValue: 'latest build',
description: 'The description to appear against the filehost version upload')
}
agent {
docker { image 'megatex' }
}
environment {
FH_API_KEY = credentials('filehost-api-key')
FH_ID_UG_COMPLBOOK = 'd668168c-1fef-4560-a530-77e9e237536d'
FH_ID_UG_BASICREF = '42d0f1f9-610a-45f9-bad1-9502f0e6eb7d'
FH_ID_UG_CHIPSET = '5d042029-d3c9-4dcb-9ba3-6690505418de'
FH_ID_UG_DEVGUIDE = 'ffd575e5-5d9c-47ff-b553-fcec80fd77a3'
FH_ID_UG_USERGUIDE = 'a5081244-a976-4a21-9153-27cca13fd613'
}
stages {
stage('Cleanup') {
steps {
sh 'make realclean'
}
}
stage('Build MEGA65 Book') {
steps {
catchError(buildResult: 'UNSTABLE', stageResult: 'FAILURE', catchInterruptions: false) {
sh "make REPOPATH=. mega65-book.pdf"
}
}
post {
always { // without the always, the failure won't be executed!
echo "end of build"
}
failure {
echo "removing failed build PDF"
sh "rm -vf mega65-book.pdf"
}
}
}
stage('Build MEGA65 BASIC65 Reference') {
steps {
catchError(buildResult: 'UNSTABLE', stageResult: 'FAILURE', catchInterruptions: false) {
sh "make REPOPATH=. mega65-basic65-reference.pdf"
}
}
post {
always { // without the always, the failure won't be executed!
echo "end of build"
}
failure {
echo "removing failed build PDF"
sh "rm -vf mega65-basic65-reference.pdf"
}
}
}
stage('Build MEGA65 Chipset Reference') {
steps {
catchError(buildResult: 'UNSTABLE', stageResult: 'FAILURE', catchInterruptions: false) {
sh "make REPOPATH=. mega65-chipset-reference.pdf"
}
}
post {
always { // without the always, the failure won't be executed!
echo "end of build"
}
failure {
echo "removing failed build PDF"
sh "rm -vf mega65-chipset-reference.pdf"
}
}
}
stage('Build MEGA65 Developer Guide') {
steps {
catchError(buildResult: 'UNSTABLE', stageResult: 'FAILURE', catchInterruptions: false) {
sh "make REPOPATH=. mega65-developer-guide.pdf"
}
}
post {
always { // without the always, the failure won't be executed!
echo "end of build"
}
failure {
echo "removing failed build PDF"
sh "rm -vf mega65-developer-guide.pdf"
}
}
}
stage('Build MEGA65 Userguide') {
steps {
catchError(buildResult: 'UNSTABLE', stageResult: 'FAILURE', catchInterruptions: false) {
sh "make REPOPATH=. mega65-userguide.pdf"
}
}
post {
always { // without the always, the failure won't be executed!
echo "end of build"
}
failure {
echo "removing failed build PDF"
sh "rm -vf mega65-userguide.pdf"
}
}
}
stage('Set build result') {
steps {
script {
def files = findFiles(glob: 'mega65-*.pdf')
// if we did not build any PDF successfully, we need to set the build result
if (files.length == 0) {
currentBuild.result = 'FAILURE'
}
}
}
}
}
post {
always {
archiveArtifacts artifacts: "mega65-*.pdf*",
fingerprint: true
}
success {
script {
fhaction = "replacekeepversion"
if (params.INCREMENT_FILEHOST_VERSION)
fhaction = "addversion"
withEnv(["FH_ACTION=${fhaction}"]) {
sh """
filehost-upload -i ${FH_ID_UG_COMPLBOOK} -a ${env.FH_ACTION} -I "${RELEASE_DESCRIPTION}" mega65-book.pdf
filehost-upload -i ${FH_ID_UG_BASICREF} -a ${env.FH_ACTION} -I "${RELEASE_DESCRIPTION}" mega65-basic65-reference.pdf
filehost-upload -i ${FH_ID_UG_CHIPSET} -a ${env.FH_ACTION} -I "${RELEASE_DESCRIPTION}" mega65-chipset-reference.pdf
filehost-upload -i ${FH_ID_UG_DEVGUIDE} -a ${env.FH_ACTION} -I "${RELEASE_DESCRIPTION}" mega65-developer-guide.pdf
filehost-upload -i ${FH_ID_UG_USERGUIDE} -a ${env.FH_ACTION} -I "${RELEASE_DESCRIPTION}" mega65-userguide.pdf
"""
}
}
}
}
}