문서의 선택한 두 판 사이의 차이를 보여줍니다.
양쪽 이전 판 이전 판 | 다음 판 양쪽 다음 판 | ||
ci:jenkins:pipeline [2018/11/28 15:44] kwon37xi |
ci:jenkins:pipeline [2018/11/28 16:08] kwon37xi [JUnit 테스트 결과 메일/Slack 발송] |
||
---|---|---|---|
줄 117: | 줄 117: | ||
</ | </ | ||
</ | </ | ||
+ | * 선언적 파이프라인 구성시에 최상단에('' | ||
+ | <code groovy> | ||
+ | import jenkins.model.* | ||
+ | import hudson.tasks.test.AbstractTestResultAction | ||
+ | |||
+ | String testResultMessage = ' | ||
+ | |||
+ | pipeline { | ||
+ | stages { | ||
+ | |||
+ | stage(' | ||
+ | steps { | ||
+ | junit ' | ||
+ | |||
+ | script { | ||
+ | AbstractTestResultAction testResultAction = currentBuild.rawBuild.getAction(AbstractTestResultAction.class) | ||
+ | if (testResultAction != null) { | ||
+ | def totalNumberOfTests = testResultAction.totalCount | ||
+ | def failedNumberOfTests = testResultAction.failCount | ||
+ | def failedDiff = testResultAction.failureDiffString | ||
+ | def skippedNumberOfTests = testResultAction.skipCount | ||
+ | def passedNumberOfTests = totalNumberOfTests - failedNumberOfTests - skippedNumberOfTests | ||
+ | testResultMessage = " | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | post { | ||
+ | failure { | ||
+ | slackSend(channel: | ||
+ | - 테스트 실패 : ${testResultMessage} | ||
+ | """ | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | </ | ||
===== 참조 ===== | ===== 참조 ===== | ||
* [[https:// | * [[https:// | ||