Skip to content

Commit d9e05eb

Browse files
fallbergmfalkvidd
authored andcommitted
Kill Gitler and make way for The Butler (#1124)
The Butler is a more polite and helpful replacement to the grumpy old Gitler. The Butler will do his utmost to assist new (and old) contributors to the MySensors cause.
1 parent 153850d commit d9e05eb

File tree

5 files changed

+98
-78
lines changed

5 files changed

+98
-78
lines changed

.ci/arduino.groovy

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def buildMySensorsMicro(config, sketches, String key) {
6565
if (currentBuild.currentResult == 'UNSTABLE') {
6666
config.pr.setBuildStatus(config, 'ERROR', 'Toll gate (MySensorsMicro - '+key+')', 'Warnings found', '${BUILD_URL}warnings2Result/new')
6767
if (config.is_pull_request) {
68-
error 'Termiated due to warnings found'
68+
error 'Terminated due to warnings found'
6969
}
7070
} else if (currentBuild.currentResult == 'FAILURE') {
7171
config.pr.setBuildStatus(config, 'FAILURE', 'Toll gate (MySensorsMicro - '+key+')', 'Build error', '${BUILD_URL}')
@@ -101,7 +101,7 @@ def buildMySensorsGw(config, sketches, String key) {
101101
if (currentBuild.currentResult == 'UNSTABLE') {
102102
config.pr.setBuildStatus(config, 'ERROR', 'Toll gate (MySensorsGW - '+key+')', 'Warnings found', '${BUILD_URL}warnings2Result/new')
103103
if (config.is_pull_request) {
104-
error 'Termiated due to warnings found'
104+
error 'Terminated due to warnings found'
105105
}
106106
} else if (currentBuild.currentResult == 'FAILURE') {
107107
config.pr.setBuildStatus(config, 'FAILURE', 'Toll gate (MySensorsGW - '+key+')', 'Build error', '${BUILD_URL}')
@@ -134,7 +134,7 @@ def buildArduinoUno(config, sketches, String key) {
134134
if (currentBuild.currentResult == 'UNSTABLE') {
135135
config.pr.setBuildStatus(config, 'ERROR', 'Toll gate (Arduino Uno - '+key+')', 'Warnings found', '${BUILD_URL}warnings2Result/new')
136136
if (config.is_pull_request) {
137-
error 'Termiated due to warnings found'
137+
error 'Terminated due to warnings found'
138138
}
139139
} else if (currentBuild.currentResult == 'FAILURE') {
140140
config.pr.setBuildStatus(config, 'FAILURE', 'Toll gate (Arduino Uno - '+key+')', 'Build error', '${BUILD_URL}')
@@ -167,7 +167,7 @@ def buildArduinoMega(config, sketches, String key) {
167167
if (currentBuild.currentResult == 'UNSTABLE') {
168168
config.pr.setBuildStatus(config, config, 'ERROR', 'Toll gate (Arduino Mega - '+key+')', 'Warnings found', '${BUILD_URL}warnings2Result/new')
169169
if (config.is_pull_request) {
170-
error 'Termiated due to warnings found'
170+
error 'Terminated due to warnings found'
171171
}
172172
} else if (currentBuild.currentResult == 'FAILURE') {
173173
config.pr.setBuildStatus(config, 'FAILURE', 'Toll gate (Arduino Mega - '+key+')', 'Build error', '${BUILD_URL}')
@@ -200,7 +200,7 @@ def buildSTM32F1(config, sketches, String key) {
200200
if (currentBuild.currentResult == 'UNSTABLE') {
201201
config.pr.setBuildStatus(config, 'ERROR', 'Toll gate (STM32F1 - '+key+')', 'Warnings found', '${BUILD_URL}warnings2Result/new')
202202
if (config.is_pull_request) {
203-
error 'Termiated due to warnings found'
203+
error 'Terminated due to warnings found'
204204
}
205205
} else if (currentBuild.currentResult == 'FAILURE') {
206206
config.pr.setBuildStatus(config, 'FAILURE', 'Toll gate (STM32F1 - '+key+')', 'Build error', '${BUILD_URL}')
@@ -239,7 +239,7 @@ def buildEsp8266(config, sketches, String key) {
239239
if (currentBuild.currentResult == 'UNSTABLE') {
240240
config.pr.setBuildStatus(config, 'ERROR', 'Toll gate (ESP8266 - '+key+')', 'Warnings found', '${BUILD_URL}warnings2Result/new')
241241
if (config.is_pull_request) {
242-
error 'Termiated due to warnings found'
242+
error 'Terminated due to warnings found'
243243
}
244244
} else if (currentBuild.currentResult == 'FAILURE') {
245245
config.pr.setBuildStatus(config, 'FAILURE', 'Toll gate (ESP8266 - '+key+')', 'Build error', '${BUILD_URL}')
@@ -287,7 +287,7 @@ def buildEsp32(config, sketches, String key) {
287287
if (currentBuild.currentResult == 'UNSTABLE') {
288288
config.pr.setBuildStatus(config, 'ERROR', 'Toll gate (ESP32 - '+key+')', 'Warnings found', '${BUILD_URL}warnings2Result/new')
289289
if (config.is_pull_request) {
290-
error 'Termiated due to warnings found'
290+
error 'Terminated due to warnings found'
291291
}
292292
} else if (currentBuild.currentResult == 'FAILURE') {
293293
config.pr.setBuildStatus(config, 'FAILURE', 'Toll gate (ESP32 - '+key+')', 'Build error', '${BUILD_URL}')
@@ -328,7 +328,7 @@ def buildnRF5(config, sketches, String key) {
328328
if (currentBuild.currentResult == 'UNSTABLE') {
329329
config.pr.setBuildStatus(config, 'ERROR', 'Toll gate (nRF5 - '+key+')', 'Warnings found', '${BUILD_URL}warnings2Result/new')
330330
if (config.is_pull_request) {
331-
error 'Termiated due to warnings found'
331+
error 'Terminated due to warnings found'
332332
}
333333
} else if (currentBuild.currentResult == 'FAILURE') {
334334
config.pr.setBuildStatus(config, 'FAILURE', 'Toll gate (nRF5 - '+key+')', 'Build error', '${BUILD_URL}')
@@ -352,7 +352,7 @@ def buildnRF52832(config, sketches, String key) {
352352
if (currentBuild.currentResult == 'UNSTABLE') {
353353
config.pr.setBuildStatus(config, 'ERROR', 'Toll gate (nRF52832 - '+key+')', 'Warnings found', '${BUILD_URL}warnings2Result/new')
354354
if (config.is_pull_request) {
355-
error 'Termiated due to warnings found'
355+
error 'Terminated due to warnings found'
356356
}
357357
} else if (currentBuild.currentResult == 'FAILURE') {
358358
config.pr.setBuildStatus(config, 'FAILURE', 'Toll gate (nRF52832 - '+key+')', 'Build error', '${BUILD_URL}')
@@ -376,7 +376,7 @@ def buildnRF51822(config, sketches, String key) {
376376
if (currentBuild.currentResult == 'UNSTABLE') {
377377
config.pr.setBuildStatus(config, 'ERROR', 'Toll gate (nRF51822 - '+key+')', 'Warnings found', '${BUILD_URL}warnings2Result/new')
378378
if (config.is_pull_request) {
379-
error 'Termiated due to warnings found'
379+
error 'Terminated due to warnings found'
380380
}
381381
} else if (currentBuild.currentResult == 'FAILURE') {
382382
config.pr.setBuildStatus(config, 'FAILURE', 'Toll gate (nRF51822 - '+key+')', 'Build error', '${BUILD_URL}')

.ci/gitler.groovy renamed to .ci/butler.groovy

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!groovy
22
def call(config) {
3-
config.pr.setBuildStatus(config, 'PENDING', 'Toll gate (Gitler)', 'Checking...', '${BUILD_URL}flowGraphTable/')
3+
config.pr.setBuildStatus(config, 'PENDING', 'Toll gate (Butler)', 'Checking...', '${BUILD_URL}flowGraphTable/')
44
if (env.CHANGE_TARGET == 'master' &&
55
(env.CHANGE_AUTHOR != 'bblacey' && env.CHANGE_AUTHOR != 'd00616' &&
66
env.CHANGE_AUTHOR != 'fallberg' && env.CHANGE_AUTHOR != 'henrikekblad' &&
@@ -9,7 +9,7 @@ def call(config) {
99
env.CHANGE_AUTHOR != 'tekka007' && env.CHANGE_AUTHOR != 'user2684' &&
1010
env.CHANGE_AUTHOR != 'Yveaux'))
1111
{
12-
config.pr.setBuildStatus(config, 'FAILURE', 'Toll gate (Gitler)', 'This pull request targets master. That is not permitted for '+env.CHANGE_AUTHOR, '')
12+
config.pr.setBuildStatus(config, 'FAILURE', 'Toll gate (Butler)', 'Sir, This pull request targets master. I am afraid that is not permitted for '+env.CHANGE_AUTHOR, '')
1313
error "This pull request targets master. That is not permitted!"
1414
}
1515
else if (env.CHANGE_TARGET == 'master')
@@ -48,7 +48,7 @@ def call(config) {
4848
])
4949
}
5050

51-
config.pr.setBuildStatus(config, 'SUCCESS', 'Toll gate (Gitler)', 'Pass', '')
51+
config.pr.setBuildStatus(config, 'SUCCESS', 'Toll gate (Butler)', 'Pass - Well done Master!', '')
5252
config.pr.setBuildStatus(config, 'SUCCESS', 'Toll gate (Release changelog)', '', '${BUILD_URL}execution/node/3/ws/MySensors/ReleaseNotes.md/*view*/')
5353
return
5454
}
@@ -115,31 +115,35 @@ def call(config) {
115115
ret = sh(returnStatus: true,
116116
script:"""#!/bin/bash
117117
cd ${config.repository_root}/.ci
118-
./gitler.sh""")
118+
./butler.sh""")
119119

120120
if (fileExists(config.repository_root+'restyling.patch')) {
121121
emailext (
122-
subject: "Job '${env.JOB_NAME} #${env.BUILD_NUMBER} [PR#${env.CHANGE_ID}]' failed due to bad code styling",
123-
body: """<p>Job '${env.JOB_NAME} [<a href="${env.CHANGE_URL}">PR#${env.CHANGE_ID}</a> - ${env.CHANGE_TITLE}]' failed because code style does not follow the standards.</p>
124-
A patch to rectify the errors is attached. You apply the patch using:<br>
122+
subject: "PR#${env.CHANGE_ID} - ${env.CHANGE_TITLE} has unfortunate code styling",
123+
body: """<p>Greetings Sir!<p>
124+
I am afraid your pull request does not follow the MySensors standards with respect to coding style.</p>
125+
That is ok, you are perhaps a first time committer to this repository. Please read the <a href="https://www.mysensors.org/download/contributing">code contribution guidelines</a> for help on how to format your code.<p>
126+
To assist you, I have prepared a patch for you that will reformat the code according to the coding style required.<br>
127+
The patch is attached. You may apply the patch using:<br>
125128
git apply restyling.patch<p>
126-
If you disagree to this, please discuss it <a href="${env.CHANGE_URL}">here</a>.<p>
127-
Yours sincerely, Gitler, on behalf of Jenkins""",
128-
mimeType: 'text/html', to: '${env.CHANGE_AUTHOR_EMAIL}',
129+
If you disagree with me, please discuss it <a href="${env.CHANGE_URL}">here</a>.<p>
130+
--<br>
131+
Yours sincerely, The Butler, serving the MySensors community""",
132+
mimeType: 'text/html', to: env.CHANGE_AUTHOR_EMAIL,
129133
attachLog: false, compressLog: false, attachmentsPattern: config.repository_root+'restyling.patch'
130134
)
131135
}
132136
publishHTML([allowMissing: true, alwaysLinkToLastBuild: false, keepAll: true,
133137
reportDir: config.repository_root,
134-
reportFiles: 'gitler.html', reportName: 'Gitler report', reportTitles: ''])
138+
reportFiles: 'butler.html', reportName: 'The Butler report', reportTitles: ''])
135139
if (ret == 1) {
136-
config.pr.setBuildStatus(config, 'FAILURE', 'Toll gate (Gitler)', 'Commit(s) does not meet coding standards', '${BUILD_URL}Gitler_report/gitler.html')
140+
config.pr.setBuildStatus(config, 'FAILURE', 'Toll gate (Butler)', 'I am afraid the commit(s) needs some touchup, please check the details...', '${BUILD_URL}The_20Butler_20report/butler.html')
137141
currentBuild.currentResult == 'FAILURE'
138-
echo "Termiated due to Gitler assert" // For BFA
139-
echo "You can read the detailed error report here: "+env.BUILD_URL+"Gitler_report/"
140-
error 'Termiated due to Gitler assert'
142+
echo "Terminated due to Butler assert" // For BFA
143+
echo "You can read the detailed error report here: "+env.BUILD_URL+"The_20Butler_20report/"
144+
error 'Terminated due to Butler assert'
141145
} else {
142-
config.pr.setBuildStatus(config, 'SUCCESS', 'Toll gate (Gitler)', 'Pass', '')
146+
config.pr.setBuildStatus(config, 'SUCCESS', 'Toll gate (Butler)', 'Pass - Well done Sir!', '${BUILD_URL}The_20Butler_20report/butler.html')
143147
}
144148
}
145149

.ci/gitler.sh renamed to .ci/butler.sh

Lines changed: 36 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ echo "No subjects with leading lower case characters<br>" > leading_lowercases.t
99
echo "No subjects with trailing periods<br>" > trailing_periods.txt
1010
echo "No body lines are too wide<br>" > too_long_body_lines.txt
1111
echo "No keywords are missing in keywords.txt<br>" > missing_keywords.txt
12+
echo "No occurences of the deprecated boolean data type<br>" >> booleans.txt
1213

1314
too_long_subjects=`awk 'length > 72' subjects.txt`
1415
if [ -n "$too_long_subjects" ]; then
@@ -48,56 +49,54 @@ if [ -n "$missing_keywords" ]; then
4849
result=1
4950
fi
5051

52+
# Evaluate if there exists booleans in the code tree (not counting this file)
53+
if git grep -q boolean -- `git ls-files | grep -v butler.sh`; then
54+
echo "<b>You have added at least one occurence of the deprecated boolean data type. Please use bool instead.</b><br>" > booleans.txt
55+
result=1
56+
fi
5157

52-
printf "%s" "<html>" > gitler.html
53-
awk 'FNR==1{print "<br>"}1' too_long_subjects.txt leading_lowercases.txt trailing_periods.txt too_long_body_lines.txt missing_keywords.txt >> gitler.html
54-
echo "<br>" >> gitler.html
58+
printf "%s" "<html>" > butler.html
59+
echo "Greetings Sir! Here is my evaluation of your pull request:<br>" >> butler.html
60+
awk 'FNR==1{print "<br>"}1' too_long_subjects.txt leading_lowercases.txt trailing_periods.txt too_long_body_lines.txt missing_keywords.txt booleans.txt >> butler.html
61+
echo "<br>" >> butler.html
5562
if [ $result -ne 0 ]; then
56-
echo "You should follow <a href="http://chris.beams.io/posts/git-commit">this guide</a> when writing your commit messages.<br>" >> gitler.html
57-
echo "<br>" >> gitler.html
58-
echo "To change the commit message for a single-commit pull request:<br>" >> gitler.html
59-
echo "git checkout &lt;your_branch&gt;<br>" >> gitler.html
60-
echo "git commit --amend<br>" >> gitler.html
61-
echo "git push origin HEAD:&lt;your_branch_on_github&gt; -f<br>" >> gitler.html
62-
echo "<br>" >> gitler.html
63-
echo "To change the commit messages for a multiple-commit pull request:<br>" >> gitler.html
64-
echo "git checkout &lt;your_branch&gt;<br>" >> gitler.html
65-
echo "git rebase -i &lt;sha_of_parent_to_the_earliest_commit_you_want_to_change&gt;<br>" >> gitler.html
66-
echo "Replace \"pick\" with \"r\" or \"reword\" on the commits you need to change message for<br>" >> gitler.html
67-
echo "git push origin HEAD:&lt;your_branch_on_github&gt; -f<br>" >> gitler.html
68-
echo "<br>" >> gitler.html
63+
echo "<b>I am afraid there are some issues with your commit messages and/or use of keywords.</b><br>" >> butler.html
64+
echo "I highly recommend reading <a href="http://chris.beams.io/posts/git-commit">this guide</a> for tips on how to write a good commit message.<br>" >> butler.html
65+
echo "More specifically, MySensors have some <a href="https://www.mysensors.org/download/contributing">code contribution guidelines</a> that I am afraid all contributers need to follow.<br>" >> butler.html
66+
echo "<br>" >> butler.html
67+
echo "I can help guide you in how to change the commit message for a single-commit pull request:<br>" >> butler.html
68+
echo "git checkout &lt;your_branch&gt;<br>" >> butler.html
69+
echo "git commit --amend<br>" >> butler.html
70+
echo "git push origin HEAD:&lt;your_branch_on_github&gt; -f<br>" >> butler.html
71+
echo "<br>" >> butler.html
72+
echo "To change the commit messages for a multiple-commit pull request:<br>" >> butler.html
73+
echo "git checkout &lt;your_branch&gt;<br>" >> butler.html
74+
echo "git rebase -i &lt;sha_of_parent_to_the_earliest_commit_you_want_to_change&gt;<br>" >> butler.html
75+
echo "Replace \"pick\" with \"r\" or \"reword\" on the commits you need to change message for<br>" >> butler.html
76+
echo "git push origin HEAD:&lt;your_branch_on_github&gt; -f<br>" >> butler.html
77+
echo "<br>" >> butler.html
6978
fi
7079

7180
# Evaluate coding style
7281
astyle --options=.mystools/astyle/config/style.cfg -nq --recursive "*.h" "*.c" "*.cpp"
7382
git diff > restyling.patch
7483
if [ -s restyling.patch ]; then
75-
echo "<b>This commit is not meeting the coding standards, a mail with a patch has been sent to you that if applied to your PR, will make it meet the coding standards.</b><br>" >> gitler.html
76-
echo "You apply the patch using:<br>" >> gitler.html
77-
echo "git apply restyling.patch<br>" >> gitler.html
78-
echo "<br>" >> gitler.html
84+
echo "I am afraid your coding style is not entirely in line with the MySensors preffered style.<b><br>A mail with a patch has been sent to you that, if applied to your PR, will make it follow the MySensors coding standards.</b><br>" >> butler.html
85+
echo "You can apply the patch using:<br>" >> butler.html
86+
echo "git apply restyling.patch<br>" >> butler.html
87+
echo "<br>" >> butler.html
7988
result=1
8089
else
81-
echo "This commit is meeting the coding standards, congratulations!<br>" >> gitler.html
82-
echo "<br>" >> gitler.html
90+
echo "This commit is meeting the coding standards, well done Sir!<br>" >> butler.html
91+
echo "<br>" >> butler.html
8392
rm restyling.patch
8493
fi
8594

86-
# Evaluate if there exists booleans in the code tree (not counting this file)
87-
if git grep -q boolean -- `git ls-files | grep -v gitler.sh`
88-
then
89-
echo "<b>This repository currently contain the boolean keyword. This should be avoided.</b><br>" >> gitler.html
90-
echo "<br>" >> gitler.html
91-
result=1
92-
else
93-
echo "This repository does not contain any boolean keywords. This is good.<br>" >> gitler.html
94-
echo "<br>" >> gitler.html
95-
fi
96-
9795
if [ $result -ne 0 ]; then
98-
echo "<b>If you disagree to this, please discuss it in the GitHub pull request thread.</b><br>" >> gitler.html
99-
echo "<br>" >> gitler.html
96+
echo "If you have any questions, please first read the <a href="https://www.mysensors.org/download/contributing">code contribution guidelines</a>.</b><br>" >> butler.html
97+
echo "<b>If you disagree to this, please discuss it in the GitHub pull request thread.</b><br>" >> butler.html
98+
echo "<br>" >> butler.html
10099
fi
101-
echo "Yours sincerely, Gitler, on behalf of Jenkins<br>" >> gitler.html
102-
printf "%s" "</html>" >> gitler.html
100+
echo "Yours sincerely, The Butler, serving the MySensors community<br>" >> butler.html
101+
printf "%s" "</html>" >> butler.html
103102
exit $result

.ci/linux.groovy

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def buildSerial(config) {
3434
buildLinux(config, '--my-debug=disable --my-transport=none --my-gateway=serial', 'Serial')
3535
if (currentBuild.currentResult == 'UNSTABLE') {
3636
config.pr.setBuildStatus(config, 'ERROR', 'Toll gate (Linux builds - Serial GW)', 'Warnings found', '${BUILD_URL}warnings28Result/new')
37-
error 'Termiated due to warnings found'
37+
error 'Terminated due to warnings found'
3838
} else if (currentBuild.currentResult == 'FAILURE') {
3939
config.pr.setBuildStatus(config, 'FAILURE', 'Toll gate (Linux builds - Serial GW)', 'Build error', '${BUILD_URL}')
4040
} else {
@@ -47,7 +47,7 @@ def buildEthernet(config) {
4747
buildLinux(config, '--my-debug=enable --my-transport=rs485 --my-gateway=ethernet', 'Ethernet')
4848
if (currentBuild.currentResult == 'UNSTABLE') {
4949
config.pr.setBuildStatus(config, 'ERROR', 'Toll gate (Linux builds - Ethernet GW)', 'Warnings found', '${BUILD_URL}warnings28Result/new')
50-
error 'Termiated due to warnings found'
50+
error 'Terminated due to warnings found'
5151
} else if (currentBuild.currentResult == 'FAILURE') {
5252
config.pr.setBuildStatus(config, 'FAILURE', 'Toll gate (Linux builds - Ethernet GW)', 'Build error', '${BUILD_URL}')
5353
} else {
@@ -60,7 +60,7 @@ def buildMQTT(config) {
6060
buildLinux(config, '--my-debug=disable --my-transport=none --my-gateway=mqtt', 'MQTT')
6161
if (currentBuild.currentResult == 'UNSTABLE') {
6262
config.pr.setBuildStatus(config, 'ERROR', 'Toll gate (Linux builds - MQTT GW)', 'Warnings found', '${BUILD_URL}warnings28Result/new')
63-
error 'Termiated due to warnings found'
63+
error 'Terminated due to warnings found'
6464
} else if (currentBuild.currentResult == 'FAILURE') {
6565
config.pr.setBuildStatus(config, 'FAILURE', 'Toll gate (Linux builds - MQTT GW)', 'Build error', '${BUILD_URL}')
6666
} else {

0 commit comments

Comments
 (0)