diff --git a/Jenkinsfile b/Jenkinsfile index c47999578d..3a9ebb01aa 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() } @@ -73,12 +73,98 @@ 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' } + 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 + // 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 { + 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 + // 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