From 000c3533168ba7887fdae42bff056a8bfd358690 Mon Sep 17 00:00:00 2001 From: Chris Veilleux Date: Fri, 3 Apr 2020 15:59:50 -0500 Subject: [PATCH 1/4] minor refactor --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index c47999578d..b4c1ad8f28 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -23,7 +23,7 @@ pipeline { // play nice with this naming convention. Define an alias for the // branch name that can be used in these scenarios. BRANCH_ALIAS = sh( - script: 'echo $BRANCH_NAME | sed -e "s#/#_#g"', + script: 'echo $BRANCH_NAME | sed -e "s#/#-#g"', returnStdout: true ).trim() } From b848a1c7412ea1f534bd1c3b141d80187042fc79 Mon Sep 17 00:00:00 2001 From: Chris Veilleux Date: Fri, 3 Apr 2020 16:01:53 -0500 Subject: [PATCH 2/4] move allure reports from tests running in mycroft-core repo to a subdirectory to differentiate from tests run on the skill repository. --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index b4c1ad8f28..31dd4c9f42 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -73,8 +73,8 @@ pipeline { label: 'Publish Report to Web Server', script: '''scp allure-report.zip root@157.245.127.234:~; ssh root@157.245.127.234 "unzip -o ~/allure-report.zip"; - ssh root@157.245.127.234 "rm -rf /var/www/voight-kampff/${BRANCH_ALIAS}"; - ssh root@157.245.127.234 "mv allure-report /var/www/voight-kampff/${BRANCH_ALIAS}" + ssh root@157.245.127.234 "rm -rf /var/www/voight-kampff/core/${BRANCH_ALIAS}"; + ssh root@157.245.127.234 "mv allure-report /var/www/voight-kampff/core/${BRANCH_ALIAS}" ''' ) echo 'Report Published' From 53f2195023bd0484882b20ccd0bdd5f90c61be85 Mon Sep 17 00:00:00 2001 From: Chris Veilleux Date: Fri, 3 Apr 2020 16:02:18 -0500 Subject: [PATCH 3/4] Add email on failure or success. --- Jenkinsfile | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 31dd4c9f42..6f09ec7d03 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -79,6 +79,79 @@ pipeline { ) echo 'Report Published' } + failure { + // Send failure email containing a link to the Jenkins build + // the results report and the console log messages to Mycroft + // developers, the developers of the pull request and the + // developers that caused the build to fail. + echo 'Sending Failure Email' + emailext ( + attachLog: true, + subject: "FAILED - Core Integration Tests - Build ${BRANCH_NAME} #${BUILD_NUMBER}", + body: """ +

+ One or more integration tests failed. Use the + resources below to identify the issue and fix + the failing tests. +

+
+

+ + Jenkins Build Details + +  (Requires account on Mycroft's Jenkins instance) +

+
+

+ + Report of Test Results + +

+
+

Console log is attached.

""", + replyTo: 'devops@mycroft.ai', + to: 'dev@mycroft.ai', + recipientProviders: [ + [$class: 'RequesterRecipientProvider'], + [$class:'CulpritsRecipientProvider'], + [$class:'DevelopersRecipientProvider'] + ] + ) + } + success { + // Send success email containing a link to the Jenkins build + // and the results report to Mycroft developers, the developers + // of the pull request and the developers that caused the + // last failed build. + echo 'Sending Success Email' + emailext ( + subject: "SUCCESS - Core Integration Tests - Build ${BRANCH_NAME} #${BUILD_NUMBER}", + body: """ +

+ All integration tests passed. No further action required. +

+
+

+ + Jenkins Build Details + +  (Requires account on Mycroft's Jenkins instance) +

+
+

+ + Report of Test Results + +

""", + replyTo: 'devops@mycroft.ai', + to: 'dev@mycroft.ai', + recipientProviders: [ + [$class: 'RequesterRecipientProvider'], + [$class:'CulpritsRecipientProvider'], + [$class:'DevelopersRecipientProvider'] + ] + ) + } } } // Build a voight_kampff image for major releases. This will be used From a24e1ea70e95ff50ef6ec77bf0fecdc68f60e417 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=85ke=20Forslund?= Date: Wed, 8 Apr 2020 08:41:57 +0200 Subject: [PATCH 4/4] Send report to pull request through PR comment --- Jenkinsfile | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 6f09ec7d03..3a9ebb01aa 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -80,6 +80,13 @@ pipeline { echo 'Report Published' } failure { + script { + // Create comment for Pull Requests + if (env.CHANGE_ID) { + echo 'Sending PR comment' + pullRequest.comment('Voight Kampff Integration Test Failed ([Results](https://reports.mycroft.ai/core/' + env.BRANCH_ALIAS + '))') + } + } // Send failure email containing a link to the Jenkins build // the results report and the console log messages to Mycroft // developers, the developers of the pull request and the @@ -119,6 +126,12 @@ pipeline { ) } success { + script { + if (env.CHANGE_ID) { + echo 'Sending PR comment' + pullRequest.comment('Voight Kampff Integration Test Succeeded ([Results](https://reports.mycroft.ai/core/' + env.BRANCH_ALIAS + '))') + } + } // Send success email containing a link to the Jenkins build // and the results report to Mycroft developers, the developers // of the pull request and the developers that caused the