Skip to content
This repository has been archived by the owner on Oct 28, 2024. It is now read-only.

Commit

Permalink
Notify pipeline syntax/configuration errors (#1557)
Browse files Browse the repository at this point in the history
* Notify pipeline syntax/configuration errors

* reword the comment
  • Loading branch information
v1v authored Feb 17, 2022
1 parent 6183147 commit c82afd2
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
10 changes: 9 additions & 1 deletion resources/github-comment-markdown.template
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ ${errorStackTrace}
<% if (!buildStatus?.equals('ABORTED') && errorGithubPrCheckApproved) {%>
<% stepsErrors = stepsErrors << errorGithubPrCheckApproved %>
<%}%>
<% if (stepsErrors?.size() != 0 && !statusSuccess) {%>
<% if (!statusSuccess) {%>
<% if (stepsErrors?.size() != 0) {%>
### Steps errors [![${stepsErrors?.size()}](https://img.shields.io/badge/${stepsErrors?.size()}%20-red)](${jobUrl}/pipeline)
<details><summary>Expand to view the steps failures</summary>
<p>
Expand All @@ -112,4 +113,11 @@ ${description}
<%}%>
</p>
</details>
<%} else {%>
### Pipeline error [![1](https://img.shields.io/badge/1%20-red)](${env?.BUILD_URL}/console)
<p>
This error is likely related to the pipeline itself. Please go to the traditional console output <a href=\"${env?.BUILD_URL}/console\">here</a>"
You will see the error (either a wrong syntax or configuration)
</p>
<%}%>
<%}%>
19 changes: 19 additions & 0 deletions src/test/groovy/NotificationManagerStepTests.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,25 @@ class NotificationManagerStepTests extends ApmBasePipelineTest {
assertJobStatusSuccess()
}

@Test
void test_notify_pr_with_failure_and_no_failed_steps() throws Exception {
script.notifyPR(
build: readJSON(file: "build-info.json"),
buildStatus: "FAILURE",
changeSet: readJSON(file: "changeSet-info.json"),
statsUrl: "https://ecs.example.com/app/kibana",
stepsErrors: [],
testsErrors: [],
testsSummary: readJSON(file: "tests-summary.json"),
statusSuccess: false
)
printCallStack()
assertTrue(assertMethodCallContainsPattern('githubPrComment', 'Build Failed'))
assertTrue(assertMethodCallContainsPattern('githubPrComment', 'Pipeline error'))
assertTrue(assertMethodCallContainsPattern('githubPrComment', 'go to the traditional console output'))
assertJobStatusSuccess()
}

@Test
void test_notify_pr_with_unstable() throws Exception {
script.notifyPR(
Expand Down

0 comments on commit c82afd2

Please sign in to comment.