Merge pull request #2807 from forslund/test/jenkins-update-comment
Add update comment logic to Jenkinspull/2954/head
commit
d1816f5933
|
@ -120,16 +120,33 @@ pipeline {
|
|||
}
|
||||
failure {
|
||||
script {
|
||||
def comment_text = 'Voight Kampff Integration Test Failed ([Results](https://reports.mycroft.ai/core/' + env.BRANCH_ALIAS + ')). ' +
|
||||
'\nMycroft logs are also available: ' +
|
||||
'[skills.log](https://reports.mycroft.ai/core/' + env.BRANCH_ALIAS + '/logs/skills.log), ' +
|
||||
'[audio.log](https://reports.mycroft.ai/core/' + env.BRANCH_ALIAS + '/logs/audio.log), ' +
|
||||
'[voice.log](https://reports.mycroft.ai/core/' + env.BRANCH_ALIAS + '/logs/voice.log), ' +
|
||||
'[bus.log](https://reports.mycroft.ai/core/' + env.BRANCH_ALIAS + '/logs/bus.log), ' +
|
||||
'[enclosure.log](https://reports.mycroft.ai/core/' + env.BRANCH_ALIAS + '/logs/enclosure.log)'
|
||||
|
||||
// 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 + ')). ' +
|
||||
'\nMycroft logs are also available: ' +
|
||||
'[skills.log](https://reports.mycroft.ai/core/' + env.BRANCH_ALIAS + '/logs/skills.log), ' +
|
||||
'[audio.log](https://reports.mycroft.ai/core/' + env.BRANCH_ALIAS + '/logs/audio.log), ' +
|
||||
'[voice.log](https://reports.mycroft.ai/core/' + env.BRANCH_ALIAS + '/logs/voice.log), ' +
|
||||
'[bus.log](https://reports.mycroft.ai/core/' + env.BRANCH_ALIAS + '/logs/bus.log), ' +
|
||||
'[enclosure.log](https://reports.mycroft.ai/core/' + env.BRANCH_ALIAS + '/logs/enclosure.log)')
|
||||
def found_comment = false
|
||||
for (comment in pullRequest.comments) {
|
||||
echo "Author: ${comment.user}"
|
||||
if (comment.user == "devops-mycroft" &&
|
||||
comment.body.contains("Voight Kampff")) {
|
||||
echo "Updating comment..."
|
||||
found_comment = true
|
||||
pullRequest.editComment(
|
||||
comment.id,
|
||||
comment_text
|
||||
)
|
||||
}
|
||||
}
|
||||
if (!found_comment) {
|
||||
echo 'Sending PR comment'
|
||||
pullRequest.comment(comment_text)
|
||||
}
|
||||
}
|
||||
}
|
||||
// Send failure email containing a link to the Jenkins build
|
||||
|
@ -184,8 +201,25 @@ 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 + '))')
|
||||
def comment_text = 'Voight Kampff Integration Test Succeeded ([Results](https://reports.mycroft.ai/core/' + env.BRANCH_ALIAS + '))'
|
||||
def found_comment = false
|
||||
for (comment in pullRequest.comments) {
|
||||
echo "Author: ${comment.user}"
|
||||
if (comment.user == "devops-mycroft" &&
|
||||
comment.body.contains("Voight Kampff")) {
|
||||
echo "Updating comment!"
|
||||
found_comment = true
|
||||
pullRequest.editComment(
|
||||
comment.id,
|
||||
comment_text
|
||||
)
|
||||
break
|
||||
}
|
||||
}
|
||||
if (!found_comment) {
|
||||
echo 'Sending PR comment'
|
||||
pullRequest.comment(comment_text)
|
||||
}
|
||||
}
|
||||
}
|
||||
// Send success email containing a link to the Jenkins build
|
||||
|
|
Loading…
Reference in New Issue