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.
This commit is contained in:
Patrick Fallberg
2018-05-04 09:38:24 +02:00
committed by Mikael Falkvidd
parent 153850de80
commit d9e05eb39c
5 changed files with 98 additions and 78 deletions
+10 -10
View File
@@ -65,7 +65,7 @@ def buildMySensorsMicro(config, sketches, String key) {
if (currentBuild.currentResult == 'UNSTABLE') { if (currentBuild.currentResult == 'UNSTABLE') {
config.pr.setBuildStatus(config, 'ERROR', 'Toll gate (MySensorsMicro - '+key+')', 'Warnings found', '${BUILD_URL}warnings2Result/new') config.pr.setBuildStatus(config, 'ERROR', 'Toll gate (MySensorsMicro - '+key+')', 'Warnings found', '${BUILD_URL}warnings2Result/new')
if (config.is_pull_request) { if (config.is_pull_request) {
error 'Termiated due to warnings found' error 'Terminated due to warnings found'
} }
} else if (currentBuild.currentResult == 'FAILURE') { } else if (currentBuild.currentResult == 'FAILURE') {
config.pr.setBuildStatus(config, 'FAILURE', 'Toll gate (MySensorsMicro - '+key+')', 'Build error', '${BUILD_URL}') config.pr.setBuildStatus(config, 'FAILURE', 'Toll gate (MySensorsMicro - '+key+')', 'Build error', '${BUILD_URL}')
@@ -101,7 +101,7 @@ def buildMySensorsGw(config, sketches, String key) {
if (currentBuild.currentResult == 'UNSTABLE') { if (currentBuild.currentResult == 'UNSTABLE') {
config.pr.setBuildStatus(config, 'ERROR', 'Toll gate (MySensorsGW - '+key+')', 'Warnings found', '${BUILD_URL}warnings2Result/new') config.pr.setBuildStatus(config, 'ERROR', 'Toll gate (MySensorsGW - '+key+')', 'Warnings found', '${BUILD_URL}warnings2Result/new')
if (config.is_pull_request) { if (config.is_pull_request) {
error 'Termiated due to warnings found' error 'Terminated due to warnings found'
} }
} else if (currentBuild.currentResult == 'FAILURE') { } else if (currentBuild.currentResult == 'FAILURE') {
config.pr.setBuildStatus(config, 'FAILURE', 'Toll gate (MySensorsGW - '+key+')', 'Build error', '${BUILD_URL}') config.pr.setBuildStatus(config, 'FAILURE', 'Toll gate (MySensorsGW - '+key+')', 'Build error', '${BUILD_URL}')
@@ -134,7 +134,7 @@ def buildArduinoUno(config, sketches, String key) {
if (currentBuild.currentResult == 'UNSTABLE') { if (currentBuild.currentResult == 'UNSTABLE') {
config.pr.setBuildStatus(config, 'ERROR', 'Toll gate (Arduino Uno - '+key+')', 'Warnings found', '${BUILD_URL}warnings2Result/new') config.pr.setBuildStatus(config, 'ERROR', 'Toll gate (Arduino Uno - '+key+')', 'Warnings found', '${BUILD_URL}warnings2Result/new')
if (config.is_pull_request) { if (config.is_pull_request) {
error 'Termiated due to warnings found' error 'Terminated due to warnings found'
} }
} else if (currentBuild.currentResult == 'FAILURE') { } else if (currentBuild.currentResult == 'FAILURE') {
config.pr.setBuildStatus(config, 'FAILURE', 'Toll gate (Arduino Uno - '+key+')', 'Build error', '${BUILD_URL}') config.pr.setBuildStatus(config, 'FAILURE', 'Toll gate (Arduino Uno - '+key+')', 'Build error', '${BUILD_URL}')
@@ -167,7 +167,7 @@ def buildArduinoMega(config, sketches, String key) {
if (currentBuild.currentResult == 'UNSTABLE') { if (currentBuild.currentResult == 'UNSTABLE') {
config.pr.setBuildStatus(config, config, 'ERROR', 'Toll gate (Arduino Mega - '+key+')', 'Warnings found', '${BUILD_URL}warnings2Result/new') config.pr.setBuildStatus(config, config, 'ERROR', 'Toll gate (Arduino Mega - '+key+')', 'Warnings found', '${BUILD_URL}warnings2Result/new')
if (config.is_pull_request) { if (config.is_pull_request) {
error 'Termiated due to warnings found' error 'Terminated due to warnings found'
} }
} else if (currentBuild.currentResult == 'FAILURE') { } else if (currentBuild.currentResult == 'FAILURE') {
config.pr.setBuildStatus(config, 'FAILURE', 'Toll gate (Arduino Mega - '+key+')', 'Build error', '${BUILD_URL}') config.pr.setBuildStatus(config, 'FAILURE', 'Toll gate (Arduino Mega - '+key+')', 'Build error', '${BUILD_URL}')
@@ -200,7 +200,7 @@ def buildSTM32F1(config, sketches, String key) {
if (currentBuild.currentResult == 'UNSTABLE') { if (currentBuild.currentResult == 'UNSTABLE') {
config.pr.setBuildStatus(config, 'ERROR', 'Toll gate (STM32F1 - '+key+')', 'Warnings found', '${BUILD_URL}warnings2Result/new') config.pr.setBuildStatus(config, 'ERROR', 'Toll gate (STM32F1 - '+key+')', 'Warnings found', '${BUILD_URL}warnings2Result/new')
if (config.is_pull_request) { if (config.is_pull_request) {
error 'Termiated due to warnings found' error 'Terminated due to warnings found'
} }
} else if (currentBuild.currentResult == 'FAILURE') { } else if (currentBuild.currentResult == 'FAILURE') {
config.pr.setBuildStatus(config, 'FAILURE', 'Toll gate (STM32F1 - '+key+')', 'Build error', '${BUILD_URL}') config.pr.setBuildStatus(config, 'FAILURE', 'Toll gate (STM32F1 - '+key+')', 'Build error', '${BUILD_URL}')
@@ -239,7 +239,7 @@ def buildEsp8266(config, sketches, String key) {
if (currentBuild.currentResult == 'UNSTABLE') { if (currentBuild.currentResult == 'UNSTABLE') {
config.pr.setBuildStatus(config, 'ERROR', 'Toll gate (ESP8266 - '+key+')', 'Warnings found', '${BUILD_URL}warnings2Result/new') config.pr.setBuildStatus(config, 'ERROR', 'Toll gate (ESP8266 - '+key+')', 'Warnings found', '${BUILD_URL}warnings2Result/new')
if (config.is_pull_request) { if (config.is_pull_request) {
error 'Termiated due to warnings found' error 'Terminated due to warnings found'
} }
} else if (currentBuild.currentResult == 'FAILURE') { } else if (currentBuild.currentResult == 'FAILURE') {
config.pr.setBuildStatus(config, 'FAILURE', 'Toll gate (ESP8266 - '+key+')', 'Build error', '${BUILD_URL}') config.pr.setBuildStatus(config, 'FAILURE', 'Toll gate (ESP8266 - '+key+')', 'Build error', '${BUILD_URL}')
@@ -287,7 +287,7 @@ def buildEsp32(config, sketches, String key) {
if (currentBuild.currentResult == 'UNSTABLE') { if (currentBuild.currentResult == 'UNSTABLE') {
config.pr.setBuildStatus(config, 'ERROR', 'Toll gate (ESP32 - '+key+')', 'Warnings found', '${BUILD_URL}warnings2Result/new') config.pr.setBuildStatus(config, 'ERROR', 'Toll gate (ESP32 - '+key+')', 'Warnings found', '${BUILD_URL}warnings2Result/new')
if (config.is_pull_request) { if (config.is_pull_request) {
error 'Termiated due to warnings found' error 'Terminated due to warnings found'
} }
} else if (currentBuild.currentResult == 'FAILURE') { } else if (currentBuild.currentResult == 'FAILURE') {
config.pr.setBuildStatus(config, 'FAILURE', 'Toll gate (ESP32 - '+key+')', 'Build error', '${BUILD_URL}') config.pr.setBuildStatus(config, 'FAILURE', 'Toll gate (ESP32 - '+key+')', 'Build error', '${BUILD_URL}')
@@ -328,7 +328,7 @@ def buildnRF5(config, sketches, String key) {
if (currentBuild.currentResult == 'UNSTABLE') { if (currentBuild.currentResult == 'UNSTABLE') {
config.pr.setBuildStatus(config, 'ERROR', 'Toll gate (nRF5 - '+key+')', 'Warnings found', '${BUILD_URL}warnings2Result/new') config.pr.setBuildStatus(config, 'ERROR', 'Toll gate (nRF5 - '+key+')', 'Warnings found', '${BUILD_URL}warnings2Result/new')
if (config.is_pull_request) { if (config.is_pull_request) {
error 'Termiated due to warnings found' error 'Terminated due to warnings found'
} }
} else if (currentBuild.currentResult == 'FAILURE') { } else if (currentBuild.currentResult == 'FAILURE') {
config.pr.setBuildStatus(config, 'FAILURE', 'Toll gate (nRF5 - '+key+')', 'Build error', '${BUILD_URL}') config.pr.setBuildStatus(config, 'FAILURE', 'Toll gate (nRF5 - '+key+')', 'Build error', '${BUILD_URL}')
@@ -352,7 +352,7 @@ def buildnRF52832(config, sketches, String key) {
if (currentBuild.currentResult == 'UNSTABLE') { if (currentBuild.currentResult == 'UNSTABLE') {
config.pr.setBuildStatus(config, 'ERROR', 'Toll gate (nRF52832 - '+key+')', 'Warnings found', '${BUILD_URL}warnings2Result/new') config.pr.setBuildStatus(config, 'ERROR', 'Toll gate (nRF52832 - '+key+')', 'Warnings found', '${BUILD_URL}warnings2Result/new')
if (config.is_pull_request) { if (config.is_pull_request) {
error 'Termiated due to warnings found' error 'Terminated due to warnings found'
} }
} else if (currentBuild.currentResult == 'FAILURE') { } else if (currentBuild.currentResult == 'FAILURE') {
config.pr.setBuildStatus(config, 'FAILURE', 'Toll gate (nRF52832 - '+key+')', 'Build error', '${BUILD_URL}') config.pr.setBuildStatus(config, 'FAILURE', 'Toll gate (nRF52832 - '+key+')', 'Build error', '${BUILD_URL}')
@@ -376,7 +376,7 @@ def buildnRF51822(config, sketches, String key) {
if (currentBuild.currentResult == 'UNSTABLE') { if (currentBuild.currentResult == 'UNSTABLE') {
config.pr.setBuildStatus(config, 'ERROR', 'Toll gate (nRF51822 - '+key+')', 'Warnings found', '${BUILD_URL}warnings2Result/new') config.pr.setBuildStatus(config, 'ERROR', 'Toll gate (nRF51822 - '+key+')', 'Warnings found', '${BUILD_URL}warnings2Result/new')
if (config.is_pull_request) { if (config.is_pull_request) {
error 'Termiated due to warnings found' error 'Terminated due to warnings found'
} }
} else if (currentBuild.currentResult == 'FAILURE') { } else if (currentBuild.currentResult == 'FAILURE') {
config.pr.setBuildStatus(config, 'FAILURE', 'Toll gate (nRF51822 - '+key+')', 'Build error', '${BUILD_URL}') config.pr.setBuildStatus(config, 'FAILURE', 'Toll gate (nRF51822 - '+key+')', 'Build error', '${BUILD_URL}')
+20 -16
View File
@@ -1,6 +1,6 @@
#!groovy #!groovy
def call(config) { def call(config) {
config.pr.setBuildStatus(config, 'PENDING', 'Toll gate (Gitler)', 'Checking...', '${BUILD_URL}flowGraphTable/') config.pr.setBuildStatus(config, 'PENDING', 'Toll gate (Butler)', 'Checking...', '${BUILD_URL}flowGraphTable/')
if (env.CHANGE_TARGET == 'master' && if (env.CHANGE_TARGET == 'master' &&
(env.CHANGE_AUTHOR != 'bblacey' && env.CHANGE_AUTHOR != 'd00616' && (env.CHANGE_AUTHOR != 'bblacey' && env.CHANGE_AUTHOR != 'd00616' &&
env.CHANGE_AUTHOR != 'fallberg' && env.CHANGE_AUTHOR != 'henrikekblad' && env.CHANGE_AUTHOR != 'fallberg' && env.CHANGE_AUTHOR != 'henrikekblad' &&
@@ -9,7 +9,7 @@ def call(config) {
env.CHANGE_AUTHOR != 'tekka007' && env.CHANGE_AUTHOR != 'user2684' && env.CHANGE_AUTHOR != 'tekka007' && env.CHANGE_AUTHOR != 'user2684' &&
env.CHANGE_AUTHOR != 'Yveaux')) env.CHANGE_AUTHOR != 'Yveaux'))
{ {
config.pr.setBuildStatus(config, 'FAILURE', 'Toll gate (Gitler)', 'This pull request targets master. That is not permitted for '+env.CHANGE_AUTHOR, '') 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, '')
error "This pull request targets master. That is not permitted!" error "This pull request targets master. That is not permitted!"
} }
else if (env.CHANGE_TARGET == 'master') else if (env.CHANGE_TARGET == 'master')
@@ -48,7 +48,7 @@ def call(config) {
]) ])
} }
config.pr.setBuildStatus(config, 'SUCCESS', 'Toll gate (Gitler)', 'Pass', '') config.pr.setBuildStatus(config, 'SUCCESS', 'Toll gate (Butler)', 'Pass - Well done Master!', '')
config.pr.setBuildStatus(config, 'SUCCESS', 'Toll gate (Release changelog)', '', '${BUILD_URL}execution/node/3/ws/MySensors/ReleaseNotes.md/*view*/') config.pr.setBuildStatus(config, 'SUCCESS', 'Toll gate (Release changelog)', '', '${BUILD_URL}execution/node/3/ws/MySensors/ReleaseNotes.md/*view*/')
return return
} }
@@ -115,31 +115,35 @@ def call(config) {
ret = sh(returnStatus: true, ret = sh(returnStatus: true,
script:"""#!/bin/bash script:"""#!/bin/bash
cd ${config.repository_root}/.ci cd ${config.repository_root}/.ci
./gitler.sh""") ./butler.sh""")
if (fileExists(config.repository_root+'restyling.patch')) { if (fileExists(config.repository_root+'restyling.patch')) {
emailext ( emailext (
subject: "Job '${env.JOB_NAME} #${env.BUILD_NUMBER} [PR#${env.CHANGE_ID}]' failed due to bad code styling", subject: "PR#${env.CHANGE_ID} - ${env.CHANGE_TITLE} has unfortunate code styling",
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> body: """<p>Greetings Sir!<p>
A patch to rectify the errors is attached. You apply the patch using:<br> I am afraid your pull request does not follow the MySensors standards with respect to coding style.</p>
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>
To assist you, I have prepared a patch for you that will reformat the code according to the coding style required.<br>
The patch is attached. You may apply the patch using:<br>
git apply restyling.patch<p> git apply restyling.patch<p>
If you disagree to this, please discuss it <a href="${env.CHANGE_URL}">here</a>.<p> If you disagree with me, please discuss it <a href="${env.CHANGE_URL}">here</a>.<p>
Yours sincerely, Gitler, on behalf of Jenkins""", --<br>
mimeType: 'text/html', to: '${env.CHANGE_AUTHOR_EMAIL}', Yours sincerely, The Butler, serving the MySensors community""",
mimeType: 'text/html', to: env.CHANGE_AUTHOR_EMAIL,
attachLog: false, compressLog: false, attachmentsPattern: config.repository_root+'restyling.patch' attachLog: false, compressLog: false, attachmentsPattern: config.repository_root+'restyling.patch'
) )
} }
publishHTML([allowMissing: true, alwaysLinkToLastBuild: false, keepAll: true, publishHTML([allowMissing: true, alwaysLinkToLastBuild: false, keepAll: true,
reportDir: config.repository_root, reportDir: config.repository_root,
reportFiles: 'gitler.html', reportName: 'Gitler report', reportTitles: '']) reportFiles: 'butler.html', reportName: 'The Butler report', reportTitles: ''])
if (ret == 1) { if (ret == 1) {
config.pr.setBuildStatus(config, 'FAILURE', 'Toll gate (Gitler)', 'Commit(s) does not meet coding standards', '${BUILD_URL}Gitler_report/gitler.html') 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')
currentBuild.currentResult == 'FAILURE' currentBuild.currentResult == 'FAILURE'
echo "Termiated due to Gitler assert" // For BFA echo "Terminated due to Butler assert" // For BFA
echo "You can read the detailed error report here: "+env.BUILD_URL+"Gitler_report/" echo "You can read the detailed error report here: "+env.BUILD_URL+"The_20Butler_20report/"
error 'Termiated due to Gitler assert' error 'Terminated due to Butler assert'
} else { } else {
config.pr.setBuildStatus(config, 'SUCCESS', 'Toll gate (Gitler)', 'Pass', '') config.pr.setBuildStatus(config, 'SUCCESS', 'Toll gate (Butler)', 'Pass - Well done Sir!', '${BUILD_URL}The_20Butler_20report/butler.html')
} }
} }
+36 -37
View File
@@ -9,6 +9,7 @@ echo "No subjects with leading lower case characters<br>" > leading_lowercases.t
echo "No subjects with trailing periods<br>" > trailing_periods.txt echo "No subjects with trailing periods<br>" > trailing_periods.txt
echo "No body lines are too wide<br>" > too_long_body_lines.txt echo "No body lines are too wide<br>" > too_long_body_lines.txt
echo "No keywords are missing in keywords.txt<br>" > missing_keywords.txt echo "No keywords are missing in keywords.txt<br>" > missing_keywords.txt
echo "No occurences of the deprecated boolean data type<br>" >> booleans.txt
too_long_subjects=`awk 'length > 72' subjects.txt` too_long_subjects=`awk 'length > 72' subjects.txt`
if [ -n "$too_long_subjects" ]; then if [ -n "$too_long_subjects" ]; then
@@ -48,56 +49,54 @@ if [ -n "$missing_keywords" ]; then
result=1 result=1
fi fi
# Evaluate if there exists booleans in the code tree (not counting this file)
if git grep -q boolean -- `git ls-files | grep -v butler.sh`; then
echo "<b>You have added at least one occurence of the deprecated boolean data type. Please use bool instead.</b><br>" > booleans.txt
result=1
fi
printf "%s" "<html>" > gitler.html printf "%s" "<html>" > butler.html
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 echo "Greetings Sir! Here is my evaluation of your pull request:<br>" >> butler.html
echo "<br>" >> gitler.html 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
echo "<br>" >> butler.html
if [ $result -ne 0 ]; then if [ $result -ne 0 ]; then
echo "You should follow <a href="http://chris.beams.io/posts/git-commit">this guide</a> when writing your commit messages.<br>" >> gitler.html echo "<b>I am afraid there are some issues with your commit messages and/or use of keywords.</b><br>" >> butler.html
echo "<br>" >> gitler.html 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
echo "To change the commit message for a single-commit pull request:<br>" >> gitler.html 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
echo "git checkout &lt;your_branch&gt;<br>" >> gitler.html echo "<br>" >> butler.html
echo "git commit --amend<br>" >> gitler.html echo "I can help guide you in how to change the commit message for a single-commit pull request:<br>" >> butler.html
echo "git push origin HEAD:&lt;your_branch_on_github&gt; -f<br>" >> gitler.html echo "git checkout &lt;your_branch&gt;<br>" >> butler.html
echo "<br>" >> gitler.html echo "git commit --amend<br>" >> butler.html
echo "To change the commit messages for a multiple-commit pull request:<br>" >> gitler.html echo "git push origin HEAD:&lt;your_branch_on_github&gt; -f<br>" >> butler.html
echo "git checkout &lt;your_branch&gt;<br>" >> gitler.html echo "<br>" >> butler.html
echo "git rebase -i &lt;sha_of_parent_to_the_earliest_commit_you_want_to_change&gt;<br>" >> gitler.html echo "To change the commit messages for a multiple-commit pull request:<br>" >> butler.html
echo "Replace \"pick\" with \"r\" or \"reword\" on the commits you need to change message for<br>" >> gitler.html echo "git checkout &lt;your_branch&gt;<br>" >> butler.html
echo "git push origin HEAD:&lt;your_branch_on_github&gt; -f<br>" >> gitler.html echo "git rebase -i &lt;sha_of_parent_to_the_earliest_commit_you_want_to_change&gt;<br>" >> butler.html
echo "<br>" >> gitler.html echo "Replace \"pick\" with \"r\" or \"reword\" on the commits you need to change message for<br>" >> butler.html
echo "git push origin HEAD:&lt;your_branch_on_github&gt; -f<br>" >> butler.html
echo "<br>" >> butler.html
fi fi
# Evaluate coding style # Evaluate coding style
astyle --options=.mystools/astyle/config/style.cfg -nq --recursive "*.h" "*.c" "*.cpp" astyle --options=.mystools/astyle/config/style.cfg -nq --recursive "*.h" "*.c" "*.cpp"
git diff > restyling.patch git diff > restyling.patch
if [ -s restyling.patch ]; then if [ -s restyling.patch ]; then
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 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
echo "You apply the patch using:<br>" >> gitler.html echo "You can apply the patch using:<br>" >> butler.html
echo "git apply restyling.patch<br>" >> gitler.html echo "git apply restyling.patch<br>" >> butler.html
echo "<br>" >> gitler.html echo "<br>" >> butler.html
result=1 result=1
else else
echo "This commit is meeting the coding standards, congratulations!<br>" >> gitler.html echo "This commit is meeting the coding standards, well done Sir!<br>" >> butler.html
echo "<br>" >> gitler.html echo "<br>" >> butler.html
rm restyling.patch rm restyling.patch
fi fi
# Evaluate if there exists booleans in the code tree (not counting this file)
if git grep -q boolean -- `git ls-files | grep -v gitler.sh`
then
echo "<b>This repository currently contain the boolean keyword. This should be avoided.</b><br>" >> gitler.html
echo "<br>" >> gitler.html
result=1
else
echo "This repository does not contain any boolean keywords. This is good.<br>" >> gitler.html
echo "<br>" >> gitler.html
fi
if [ $result -ne 0 ]; then if [ $result -ne 0 ]; then
echo "<b>If you disagree to this, please discuss it in the GitHub pull request thread.</b><br>" >> gitler.html 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
echo "<br>" >> gitler.html echo "<b>If you disagree to this, please discuss it in the GitHub pull request thread.</b><br>" >> butler.html
echo "<br>" >> butler.html
fi fi
echo "Yours sincerely, Gitler, on behalf of Jenkins<br>" >> gitler.html echo "Yours sincerely, The Butler, serving the MySensors community<br>" >> butler.html
printf "%s" "</html>" >> gitler.html printf "%s" "</html>" >> butler.html
exit $result exit $result
+3 -3
View File
@@ -34,7 +34,7 @@ def buildSerial(config) {
buildLinux(config, '--my-debug=disable --my-transport=none --my-gateway=serial', 'Serial') buildLinux(config, '--my-debug=disable --my-transport=none --my-gateway=serial', 'Serial')
if (currentBuild.currentResult == 'UNSTABLE') { if (currentBuild.currentResult == 'UNSTABLE') {
config.pr.setBuildStatus(config, 'ERROR', 'Toll gate (Linux builds - Serial GW)', 'Warnings found', '${BUILD_URL}warnings28Result/new') config.pr.setBuildStatus(config, 'ERROR', 'Toll gate (Linux builds - Serial GW)', 'Warnings found', '${BUILD_URL}warnings28Result/new')
error 'Termiated due to warnings found' error 'Terminated due to warnings found'
} else if (currentBuild.currentResult == 'FAILURE') { } else if (currentBuild.currentResult == 'FAILURE') {
config.pr.setBuildStatus(config, 'FAILURE', 'Toll gate (Linux builds - Serial GW)', 'Build error', '${BUILD_URL}') config.pr.setBuildStatus(config, 'FAILURE', 'Toll gate (Linux builds - Serial GW)', 'Build error', '${BUILD_URL}')
} else { } else {
@@ -47,7 +47,7 @@ def buildEthernet(config) {
buildLinux(config, '--my-debug=enable --my-transport=rs485 --my-gateway=ethernet', 'Ethernet') buildLinux(config, '--my-debug=enable --my-transport=rs485 --my-gateway=ethernet', 'Ethernet')
if (currentBuild.currentResult == 'UNSTABLE') { if (currentBuild.currentResult == 'UNSTABLE') {
config.pr.setBuildStatus(config, 'ERROR', 'Toll gate (Linux builds - Ethernet GW)', 'Warnings found', '${BUILD_URL}warnings28Result/new') config.pr.setBuildStatus(config, 'ERROR', 'Toll gate (Linux builds - Ethernet GW)', 'Warnings found', '${BUILD_URL}warnings28Result/new')
error 'Termiated due to warnings found' error 'Terminated due to warnings found'
} else if (currentBuild.currentResult == 'FAILURE') { } else if (currentBuild.currentResult == 'FAILURE') {
config.pr.setBuildStatus(config, 'FAILURE', 'Toll gate (Linux builds - Ethernet GW)', 'Build error', '${BUILD_URL}') config.pr.setBuildStatus(config, 'FAILURE', 'Toll gate (Linux builds - Ethernet GW)', 'Build error', '${BUILD_URL}')
} else { } else {
@@ -60,7 +60,7 @@ def buildMQTT(config) {
buildLinux(config, '--my-debug=disable --my-transport=none --my-gateway=mqtt', 'MQTT') buildLinux(config, '--my-debug=disable --my-transport=none --my-gateway=mqtt', 'MQTT')
if (currentBuild.currentResult == 'UNSTABLE') { if (currentBuild.currentResult == 'UNSTABLE') {
config.pr.setBuildStatus(config, 'ERROR', 'Toll gate (Linux builds - MQTT GW)', 'Warnings found', '${BUILD_URL}warnings28Result/new') config.pr.setBuildStatus(config, 'ERROR', 'Toll gate (Linux builds - MQTT GW)', 'Warnings found', '${BUILD_URL}warnings28Result/new')
error 'Termiated due to warnings found' error 'Terminated due to warnings found'
} else if (currentBuild.currentResult == 'FAILURE') { } else if (currentBuild.currentResult == 'FAILURE') {
config.pr.setBuildStatus(config, 'FAILURE', 'Toll gate (Linux builds - MQTT GW)', 'Build error', '${BUILD_URL}') config.pr.setBuildStatus(config, 'FAILURE', 'Toll gate (Linux builds - MQTT GW)', 'Build error', '${BUILD_URL}')
} else { } else {
+29 -12
View File
@@ -12,7 +12,7 @@ def call(Closure body) {
if (env.CHANGE_ID) { if (env.CHANGE_ID) {
config.is_pull_request = true config.is_pull_request = true
echo "Building pull request: #"+env.CHANGE_ID+"\nTarget branch: "+env.CHANGE_TARGET echo "Building pull request: #"+env.CHANGE_ID+"\nTarget branch: "+env.CHANGE_TARGET+"\nAuthor: "+env.CHANGE_AUTHOR+" ("+env.CHANGE_AUTHOR_EMAIL+")"
config.git_sha = sh(returnStdout: true, config.git_sha = sh(returnStdout: true,
script: """#!/bin/bash script: """#!/bin/bash
cd ${config.repository_root} cd ${config.repository_root}
@@ -30,9 +30,9 @@ def call(Closure body) {
try { try {
ansiColor('xterm') { ansiColor('xterm') {
if (config.is_pull_request) { if (config.is_pull_request) {
def gitler = load(config.repository_root+'.ci/gitler.groovy') def butler = load(config.repository_root+'.ci/butler.groovy')
stage('Gitler') { stage('Butler') {
gitler(config) butler(config)
} }
} }
@@ -174,20 +174,37 @@ def call(Closure body) {
config.pr.setBuildStatus(config, 'ERROR', 'Toll gate', 'Failed', '${BUILD_URL}flowGraphTable/') config.pr.setBuildStatus(config, 'ERROR', 'Toll gate', 'Failed', '${BUILD_URL}flowGraphTable/')
if (config.is_pull_request) { if (config.is_pull_request) {
slackSend color: 'danger', slackSend color: 'danger',
message: "Job '${env.JOB_NAME} <${env.BUILD_URL}|#${env.BUILD_NUMBER}> <${env.CHANGE_URL}|PR#${env.CHANGE_ID} - ${env.CHANGE_TITLE}>' failed with result ${currentBuild.result}." message: "Failed to build <${env.CHANGE_URL}|PR#${env.CHANGE_ID} - ${env.CHANGE_TITLE}>. Job <${env.BUILD_URL}|${env.JOB_NAME} #${env.BUILD_NUMBER}> ended with ${currentBuild.result}."
emailext ( emailext (
subject: "Job '${env.JOB_NAME} #${env.BUILD_NUMBER}' failed", subject: "PR#${env.CHANGE_ID} - ${env.CHANGE_TITLE} failed to build",
body: """Job '${env.JOB_NAME} <a href="${env.BUILD_URL}">#${env.BUILD_NUMBER}</a> (<a href="${env.CHANGE_URL}">PR#${env.CHANGE_ID} - ${env.CHANGE_TITLE}</a>)' ended with result ${currentBuild.result}. body: '''Greetings Sir!<p>
<br>Check attached console output or <a href="${env.BUILD_URL}">here</a> for a hint on what the problem might be.""", I am The Butler. My task is to help you create a pull request that fit the MySensors organizations coding style and builds for all supported platforms.<p>
I am afraid I failed to validate your pull request. Result was '''+currentBuild.result+'''.
<br>Please check the attached build log or <a href="${BUILD_URL}">here</a> for a hint on what the problem might be.<p>
If you have difficulties determining the cause for the failure, feel free to ask questions <a href="${CHANGE_URL}">here</a>.<p>
Changes:<br>
${CHANGES}<p>
Notable build log lines:<br>
${BUILD_LOG_REGEX, regex="^.*?Terminated.*?$", linesBefore=0, linesAfter=0, maxMatches=5, showTruncatedLines=false, escapeHtml=true}<p>
My personal evaluation of your pull request is available <a href="${BUILD_URL}The_20Butler_20report/butler.html">here</a>.<p>
--<br>
Yours sincerely, The Butler, serving the MySensors community''',
mimeType: 'text/html', to: env.CHANGE_AUTHOR_EMAIL, attachLog: true, compressLog: false mimeType: 'text/html', to: env.CHANGE_AUTHOR_EMAIL, attachLog: true, compressLog: false
) )
} else { } else {
slackSend color: 'danger', slackSend color: 'danger',
message: "Job '${env.JOB_NAME} <${env.BUILD_URL}|#${env.BUILD_NUMBER}> ${env.BRANCH_NAME}]' failed with result ${currentBuild.result}." message: "Failed to build branch ${env.BRANCH_NAME}. Job <${env.BUILD_URL}|${env.JOB_NAME} #${env.BUILD_NUMBER}> ended with ${currentBuild.result}."
emailext ( emailext (
subject: "Job '${env.JOB_NAME} #${env.BUILD_NUMBER} ${env.BRANCH_NAME}' failed", subject: "MySensors branch ${env.BRANCH_NAME} failed to build",
body: """Job '${env.JOB_NAME} <a href="${env.BUILD_URL}">#${env.BUILD_NUMBER}</a> (${env.BRANCH_NAME})' ended with result ${currentBuild.result}. body: '''Sir, I am afraid I failed to build branch ${BRANCH_NAME}. Result was '''+currentBuild.result+'''.
<br>Check attached console output or <a href="${env.BUILD_URL}">here</a> for a hint on what the problem might be.""", <br>Please check the attached build log or <a href="${BUILD_URL}">here</a> for a hint on what the problem might be.<p>
Changes:<br>
${CHANGES}<p>
Notable build log lines:<br>
${BUILD_LOG_REGEX, regex="^.*?Terminated.*?$", linesBefore=0, linesAfter=0, maxMatches=5, showTruncatedLines=false, escapeHtml=true}<p>
My personal evaluation of your pull request is available <a href="${BUILD_URL}The_20Butler_20report/butler.html">here</a>.<p>
--<br>
Yours sincerely, The Butler, serving the MySensors community''',
mimeType: 'text/html', to: 'builds@mysensors.org', attachLog: true, compressLog: false mimeType: 'text/html', to: 'builds@mysensors.org', attachLog: true, compressLog: false
) )
} }