diff --git a/.ci/arduino.groovy b/.ci/arduino.groovy index da74a5d..47a69f3 100644 --- a/.ci/arduino.groovy +++ b/.ci/arduino.groovy @@ -65,7 +65,7 @@ def buildMySensorsMicro(config, sketches, String key) { if (currentBuild.currentResult == 'UNSTABLE') { config.pr.setBuildStatus(config, 'ERROR', 'Toll gate (MySensorsMicro - '+key+')', 'Warnings found', '${BUILD_URL}warnings2Result/new') if (config.is_pull_request) { - error 'Termiated due to warnings found' + error 'Terminated due to warnings found' } } else if (currentBuild.currentResult == 'FAILURE') { 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') { config.pr.setBuildStatus(config, 'ERROR', 'Toll gate (MySensorsGW - '+key+')', 'Warnings found', '${BUILD_URL}warnings2Result/new') if (config.is_pull_request) { - error 'Termiated due to warnings found' + error 'Terminated due to warnings found' } } else if (currentBuild.currentResult == 'FAILURE') { 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') { config.pr.setBuildStatus(config, 'ERROR', 'Toll gate (Arduino Uno - '+key+')', 'Warnings found', '${BUILD_URL}warnings2Result/new') if (config.is_pull_request) { - error 'Termiated due to warnings found' + error 'Terminated due to warnings found' } } else if (currentBuild.currentResult == 'FAILURE') { 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') { config.pr.setBuildStatus(config, config, 'ERROR', 'Toll gate (Arduino Mega - '+key+')', 'Warnings found', '${BUILD_URL}warnings2Result/new') if (config.is_pull_request) { - error 'Termiated due to warnings found' + error 'Terminated due to warnings found' } } else if (currentBuild.currentResult == 'FAILURE') { 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') { config.pr.setBuildStatus(config, 'ERROR', 'Toll gate (STM32F1 - '+key+')', 'Warnings found', '${BUILD_URL}warnings2Result/new') if (config.is_pull_request) { - error 'Termiated due to warnings found' + error 'Terminated due to warnings found' } } else if (currentBuild.currentResult == 'FAILURE') { 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') { config.pr.setBuildStatus(config, 'ERROR', 'Toll gate (ESP8266 - '+key+')', 'Warnings found', '${BUILD_URL}warnings2Result/new') if (config.is_pull_request) { - error 'Termiated due to warnings found' + error 'Terminated due to warnings found' } } else if (currentBuild.currentResult == 'FAILURE') { 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') { config.pr.setBuildStatus(config, 'ERROR', 'Toll gate (ESP32 - '+key+')', 'Warnings found', '${BUILD_URL}warnings2Result/new') if (config.is_pull_request) { - error 'Termiated due to warnings found' + error 'Terminated due to warnings found' } } else if (currentBuild.currentResult == 'FAILURE') { 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') { config.pr.setBuildStatus(config, 'ERROR', 'Toll gate (nRF5 - '+key+')', 'Warnings found', '${BUILD_URL}warnings2Result/new') if (config.is_pull_request) { - error 'Termiated due to warnings found' + error 'Terminated due to warnings found' } } else if (currentBuild.currentResult == 'FAILURE') { 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') { config.pr.setBuildStatus(config, 'ERROR', 'Toll gate (nRF52832 - '+key+')', 'Warnings found', '${BUILD_URL}warnings2Result/new') if (config.is_pull_request) { - error 'Termiated due to warnings found' + error 'Terminated due to warnings found' } } else if (currentBuild.currentResult == 'FAILURE') { 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') { config.pr.setBuildStatus(config, 'ERROR', 'Toll gate (nRF51822 - '+key+')', 'Warnings found', '${BUILD_URL}warnings2Result/new') if (config.is_pull_request) { - error 'Termiated due to warnings found' + error 'Terminated due to warnings found' } } else if (currentBuild.currentResult == 'FAILURE') { config.pr.setBuildStatus(config, 'FAILURE', 'Toll gate (nRF51822 - '+key+')', 'Build error', '${BUILD_URL}') diff --git a/.ci/gitler.groovy b/.ci/butler.groovy similarity index 80% rename from .ci/gitler.groovy rename to .ci/butler.groovy index 00e4e79..3bfa97c 100644 --- a/.ci/gitler.groovy +++ b/.ci/butler.groovy @@ -1,6 +1,6 @@ #!groovy 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' && (env.CHANGE_AUTHOR != 'bblacey' && env.CHANGE_AUTHOR != 'd00616' && 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 != '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!" } 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*/') return } @@ -115,31 +115,35 @@ def call(config) { ret = sh(returnStatus: true, script:"""#!/bin/bash cd ${config.repository_root}/.ci - ./gitler.sh""") + ./butler.sh""") if (fileExists(config.repository_root+'restyling.patch')) { emailext ( - subject: "Job '${env.JOB_NAME} #${env.BUILD_NUMBER} [PR#${env.CHANGE_ID}]' failed due to bad code styling", - body: """
Job '${env.JOB_NAME} [PR#${env.CHANGE_ID} - ${env.CHANGE_TITLE}]' failed because code style does not follow the standards.
- A patch to rectify the errors is attached. You apply the patch using:Greetings Sir!
+ I am afraid your pull request does not follow the MySensors standards with respect to coding style.
+ That is ok, you are perhaps a first time committer to this repository. Please read the code contribution guidelines for help on how to format your code.
+ To assist you, I have prepared a patch for you that will reformat the code according to the coding style required.
+ The patch is attached. You may apply the patch using:
git apply restyling.patch
- If you disagree to this, please discuss it here.
- Yours sincerely, Gitler, on behalf of Jenkins""", - mimeType: 'text/html', to: '${env.CHANGE_AUTHOR_EMAIL}', + If you disagree with me, please discuss it here.
+ --
+ 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'
)
}
publishHTML([allowMissing: true, alwaysLinkToLastBuild: false, keepAll: true,
reportDir: config.repository_root,
- reportFiles: 'gitler.html', reportName: 'Gitler report', reportTitles: ''])
+ reportFiles: 'butler.html', reportName: 'The Butler report', reportTitles: ''])
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'
- echo "Termiated due to Gitler assert" // For BFA
- echo "You can read the detailed error report here: "+env.BUILD_URL+"Gitler_report/"
- error 'Termiated due to Gitler assert'
+ echo "Terminated due to Butler assert" // For BFA
+ echo "You can read the detailed error report here: "+env.BUILD_URL+"The_20Butler_20report/"
+ error 'Terminated due to Butler assert'
} 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')
}
}
diff --git a/.ci/gitler.sh b/.ci/butler.sh
similarity index 55%
rename from .ci/gitler.sh
rename to .ci/butler.sh
index 9c5a78d..d4deeaf 100755
--- a/.ci/gitler.sh
+++ b/.ci/butler.sh
@@ -9,6 +9,7 @@ echo "No subjects with leading lower case characters
" > leading_lowercases.t
echo "No subjects with trailing periods
" > trailing_periods.txt
echo "No body lines are too wide
" > too_long_body_lines.txt
echo "No keywords are missing in keywords.txt
" > missing_keywords.txt
+echo "No occurences of the deprecated boolean data type
" >> booleans.txt
too_long_subjects=`awk 'length > 72' subjects.txt`
if [ -n "$too_long_subjects" ]; then
@@ -48,56 +49,54 @@ if [ -n "$missing_keywords" ]; then
result=1
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 "You have added at least one occurence of the deprecated boolean data type. Please use bool instead.
" > booleans.txt
+ result=1
+fi
-printf "%s" "" > gitler.html
-awk 'FNR==1{print "
"}1' too_long_subjects.txt leading_lowercases.txt trailing_periods.txt too_long_body_lines.txt missing_keywords.txt >> gitler.html
-echo "
" >> gitler.html
+printf "%s" "" > butler.html
+echo "Greetings Sir! Here is my evaluation of your pull request:
" >> butler.html
+awk 'FNR==1{print "
"}1' too_long_subjects.txt leading_lowercases.txt trailing_periods.txt too_long_body_lines.txt missing_keywords.txt booleans.txt >> butler.html
+echo "
" >> butler.html
if [ $result -ne 0 ]; then
- echo "You should follow this guide when writing your commit messages.
" >> gitler.html
- echo "
" >> gitler.html
- echo "To change the commit message for a single-commit pull request:
" >> gitler.html
- echo "git checkout <your_branch>
" >> gitler.html
- echo "git commit --amend
" >> gitler.html
- echo "git push origin HEAD:<your_branch_on_github> -f
" >> gitler.html
- echo "
" >> gitler.html
- echo "To change the commit messages for a multiple-commit pull request:
" >> gitler.html
- echo "git checkout <your_branch>
" >> gitler.html
- echo "git rebase -i <sha_of_parent_to_the_earliest_commit_you_want_to_change>
" >> gitler.html
- echo "Replace \"pick\" with \"r\" or \"reword\" on the commits you need to change message for
" >> gitler.html
- echo "git push origin HEAD:<your_branch_on_github> -f
" >> gitler.html
- echo "
" >> gitler.html
+ echo "I am afraid there are some issues with your commit messages and/or use of keywords.
" >> butler.html
+ echo "I highly recommend reading this guide for tips on how to write a good commit message.
" >> butler.html
+ echo "More specifically, MySensors have some code contribution guidelines that I am afraid all contributers need to follow.
" >> butler.html
+ echo "
" >> butler.html
+ echo "I can help guide you in how to change the commit message for a single-commit pull request:
" >> butler.html
+ echo "git checkout <your_branch>
" >> butler.html
+ echo "git commit --amend
" >> butler.html
+ echo "git push origin HEAD:<your_branch_on_github> -f
" >> butler.html
+ echo "
" >> butler.html
+ echo "To change the commit messages for a multiple-commit pull request:
" >> butler.html
+ echo "git checkout <your_branch>
" >> butler.html
+ echo "git rebase -i <sha_of_parent_to_the_earliest_commit_you_want_to_change>
" >> butler.html
+ echo "Replace \"pick\" with \"r\" or \"reword\" on the commits you need to change message for
" >> butler.html
+ echo "git push origin HEAD:<your_branch_on_github> -f
" >> butler.html
+ echo "
" >> butler.html
fi
# Evaluate coding style
astyle --options=.mystools/astyle/config/style.cfg -nq --recursive "*.h" "*.c" "*.cpp"
git diff > restyling.patch
if [ -s restyling.patch ]; then
- echo "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.
" >> gitler.html
- echo "You apply the patch using:
" >> gitler.html
- echo "git apply restyling.patch
" >> gitler.html
- echo "
" >> gitler.html
+ echo "I am afraid your coding style is not entirely in line with the MySensors preffered style.
A mail with a patch has been sent to you that, if applied to your PR, will make it follow the MySensors coding standards.
" >> butler.html
+ echo "You can apply the patch using:
" >> butler.html
+ echo "git apply restyling.patch
" >> butler.html
+ echo "
" >> butler.html
result=1
else
- echo "This commit is meeting the coding standards, congratulations!
" >> gitler.html
- echo "
" >> gitler.html
+ echo "This commit is meeting the coding standards, well done Sir!
" >> butler.html
+ echo "
" >> butler.html
rm restyling.patch
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 "This repository currently contain the boolean keyword. This should be avoided.
" >> gitler.html
- echo "
" >> gitler.html
- result=1
-else
- echo "This repository does not contain any boolean keywords. This is good.
" >> gitler.html
- echo "
" >> gitler.html
-fi
-
if [ $result -ne 0 ]; then
- echo "If you disagree to this, please discuss it in the GitHub pull request thread.
" >> gitler.html
- echo "
" >> gitler.html
+ echo "If you have any questions, please first read the code contribution guidelines.
" >> butler.html
+ echo "If you disagree to this, please discuss it in the GitHub pull request thread.
" >> butler.html
+ echo "
" >> butler.html
fi
-echo "Yours sincerely, Gitler, on behalf of Jenkins
" >> gitler.html
-printf "%s" "" >> gitler.html
+echo "Yours sincerely, The Butler, serving the MySensors community
" >> butler.html
+printf "%s" "" >> butler.html
exit $result
diff --git a/.ci/linux.groovy b/.ci/linux.groovy
index 672a530..991fed1 100644
--- a/.ci/linux.groovy
+++ b/.ci/linux.groovy
@@ -34,7 +34,7 @@ def buildSerial(config) {
buildLinux(config, '--my-debug=disable --my-transport=none --my-gateway=serial', 'Serial')
if (currentBuild.currentResult == 'UNSTABLE') {
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') {
config.pr.setBuildStatus(config, 'FAILURE', 'Toll gate (Linux builds - Serial GW)', 'Build error', '${BUILD_URL}')
} else {
@@ -47,7 +47,7 @@ def buildEthernet(config) {
buildLinux(config, '--my-debug=enable --my-transport=rs485 --my-gateway=ethernet', 'Ethernet')
if (currentBuild.currentResult == 'UNSTABLE') {
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') {
config.pr.setBuildStatus(config, 'FAILURE', 'Toll gate (Linux builds - Ethernet GW)', 'Build error', '${BUILD_URL}')
} else {
@@ -60,7 +60,7 @@ def buildMQTT(config) {
buildLinux(config, '--my-debug=disable --my-transport=none --my-gateway=mqtt', 'MQTT')
if (currentBuild.currentResult == 'UNSTABLE') {
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') {
config.pr.setBuildStatus(config, 'FAILURE', 'Toll gate (Linux builds - MQTT GW)', 'Build error', '${BUILD_URL}')
} else {
diff --git a/.ci/pipeline.groovy b/.ci/pipeline.groovy
index e59d78a..8eb4761 100644
--- a/.ci/pipeline.groovy
+++ b/.ci/pipeline.groovy
@@ -12,7 +12,7 @@ def call(Closure body) {
if (env.CHANGE_ID) {
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,
script: """#!/bin/bash
cd ${config.repository_root}
@@ -30,9 +30,9 @@ def call(Closure body) {
try {
ansiColor('xterm') {
if (config.is_pull_request) {
- def gitler = load(config.repository_root+'.ci/gitler.groovy')
- stage('Gitler') {
- gitler(config)
+ def butler = load(config.repository_root+'.ci/butler.groovy')
+ stage('Butler') {
+ butler(config)
}
}
@@ -174,20 +174,37 @@ def call(Closure body) {
config.pr.setBuildStatus(config, 'ERROR', 'Toll gate', 'Failed', '${BUILD_URL}flowGraphTable/')
if (config.is_pull_request) {
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 (
- subject: "Job '${env.JOB_NAME} #${env.BUILD_NUMBER}' failed",
- body: """Job '${env.JOB_NAME} #${env.BUILD_NUMBER} (PR#${env.CHANGE_ID} - ${env.CHANGE_TITLE})' ended with result ${currentBuild.result}.
-
Check attached console output or here for a hint on what the problem might be.""",
+ subject: "PR#${env.CHANGE_ID} - ${env.CHANGE_TITLE} failed to build",
+ body: '''Greetings Sir!
+ 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.
+ I am afraid I failed to validate your pull request. Result was '''+currentBuild.result+'''.
+
Please check the attached build log or here for a hint on what the problem might be.
+ If you have difficulties determining the cause for the failure, feel free to ask questions here.
+ Changes:
+ ${CHANGES}
+ Notable build log lines:
+ ${BUILD_LOG_REGEX, regex="^.*?Terminated.*?$", linesBefore=0, linesAfter=0, maxMatches=5, showTruncatedLines=false, escapeHtml=true}
+ My personal evaluation of your pull request is available here.
+ --
+ Yours sincerely, The Butler, serving the MySensors community''',
mimeType: 'text/html', to: env.CHANGE_AUTHOR_EMAIL, attachLog: true, compressLog: false
)
} else {
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 (
- subject: "Job '${env.JOB_NAME} #${env.BUILD_NUMBER} ${env.BRANCH_NAME}' failed",
- body: """Job '${env.JOB_NAME} #${env.BUILD_NUMBER} (${env.BRANCH_NAME})' ended with result ${currentBuild.result}.
-
Check attached console output or here for a hint on what the problem might be.""",
+ subject: "MySensors branch ${env.BRANCH_NAME} failed to build",
+ body: '''Sir, I am afraid I failed to build branch ${BRANCH_NAME}. Result was '''+currentBuild.result+'''.
+
Please check the attached build log or here for a hint on what the problem might be.
+ Changes:
+ ${CHANGES}
+ Notable build log lines:
+ ${BUILD_LOG_REGEX, regex="^.*?Terminated.*?$", linesBefore=0, linesAfter=0, maxMatches=5, showTruncatedLines=false, escapeHtml=true}
+ My personal evaluation of your pull request is available here.
+ --
+ Yours sincerely, The Butler, serving the MySensors community''',
mimeType: 'text/html', to: 'builds@mysensors.org', attachLog: true, compressLog: false
)
}