This repository has been archived by the owner on Sep 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Feature/email jenkins results #2530
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 [email protected]:~; | ||
ssh [email protected] "unzip -o ~/allure-report.zip"; | ||
ssh [email protected] "rm -rf /var/www/voight-kampff/${BRANCH_ALIAS}"; | ||
ssh [email protected] "mv allure-report /var/www/voight-kampff/${BRANCH_ALIAS}" | ||
ssh [email protected] "rm -rf /var/www/voight-kampff/core/${BRANCH_ALIAS}"; | ||
ssh [email protected] "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: """ | ||
<p> | ||
One or more integration tests failed. Use the | ||
resources below to identify the issue and fix | ||
the failing tests. | ||
</p> | ||
<br> | ||
<p> | ||
<a href='${BUILD_URL}'> | ||
Jenkins Build Details | ||
</a> | ||
 (Requires account on Mycroft's Jenkins instance) | ||
</p> | ||
<br> | ||
<p> | ||
<a href='https://reports.mycroft.ai/core/${BRANCH_ALIAS}'> | ||
Report of Test Results | ||
</a> | ||
</p> | ||
<br> | ||
<p>Console log is attached.</p>""", | ||
replyTo: '[email protected]', | ||
to: '[email protected]', | ||
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: """ | ||
<p> | ||
All integration tests passed. No further action required. | ||
</p> | ||
<br> | ||
<p> | ||
<a href='${BUILD_URL}'> | ||
Jenkins Build Details | ||
</a> | ||
 (Requires account on Mycroft's Jenkins instance) | ||
</p> | ||
<br> | ||
<p> | ||
<a href='https://reports.mycroft.ai/core/${BRANCH_ALIAS}'> | ||
Report of Test Results | ||
</a> | ||
</p>""", | ||
replyTo: '[email protected]', | ||
to: '[email protected]', | ||
recipientProviders: [ | ||
[$class: 'RequesterRecipientProvider'], | ||
[$class:'CulpritsRecipientProvider'], | ||
[$class:'DevelopersRecipientProvider'] | ||
] | ||
) | ||
} | ||
} | ||
} | ||
// Build a voight_kampff image for major releases. This will be used | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The non-breaking space doesn't render correctly in the e-mail
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you be more specific? I noticed a space in the link after the text but not sure how to get rid of it.