Last active
November 20, 2020 02:53
-
-
Save alanhg/b577d5a30ae5b16e9404cdf6624895b3 to your computer and use it in GitHub Desktop.
只有commit changelog,不包含具体文件修改
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
<STYLE> | |
BODY, TABLE, TD, TH, P { | |
font-family: Calibri, Verdana, Helvetica, sans serif; | |
font-size: 12px; | |
color: black; | |
} | |
.console { | |
font-family: Courier New; | |
} | |
.filesChanged { | |
width: 10%; | |
padding-left: 10px; | |
} | |
.section { | |
width: 100%; | |
border: thin black dotted; | |
} | |
.td-title-main { | |
color: white; | |
font-size: 200%; | |
padding-left: 5px; | |
font-weight: bold; | |
} | |
.td-title { | |
color: white; | |
font-size: 120%; | |
font-weight: bold; | |
padding-left: 5px; | |
text-transform: uppercase; | |
} | |
.td-title-tests { | |
font-weight: bold; | |
font-size: 120%; | |
} | |
.td-header-maven-module { | |
font-weight: bold; | |
font-size: 120%; | |
} | |
.td-maven-artifact { | |
padding-left: 5px; | |
} | |
.tr-title { | |
background-color: <%= (build.result == null || build.result.toString() == 'SUCCESS') ? '#27AE60' : build.result.toString() == 'FAILURE' ? '#E74C3C' : '#f4e242' %>; | |
} | |
.test { | |
padding-left: 20px; | |
} | |
.test-fixed { | |
color: #27AE60; | |
} | |
.test-failed { | |
color: #E74C3C; | |
} | |
.notification { | |
color: red; | |
font-weight:bold; | |
} | |
</STYLE> | |
<BODY> | |
<!-- BUILD RESULT --> | |
<table class="section"> | |
<tr class="tr-title"> | |
<td class="td-title-main" colspan=2> | |
BUILD ${build.result ?: 'COMPLETED'} | |
</td> | |
</tr> | |
<tr> | |
<td>URL:</td> | |
<td><A href="${rooturl}${build.url}">${rooturl}${build.url}</A></td> | |
</tr> | |
<tr> | |
<td>Project:</td> | |
<td>${project.name}</td> | |
</tr> | |
<tr> | |
<td>Date:</td> | |
<td>${it.timestampString}</td> | |
</tr> | |
<tr> | |
<td>Duration:</td> | |
<td>${build.durationString}</td> | |
</tr> | |
<tr> | |
<td>Cause:</td> | |
<td><% build.causes.each() { cause -> %> ${cause.shortDescription} <% } %></td> | |
</tr> | |
<tr> | |
<td>Notification:</td> | |
<td class='notification'>It takes time to deploy, please validate after 15 minutes later! | |
</td> | |
</tr> | |
</table> | |
<br/> | |
<!-- CHANGE SET --> | |
<% | |
def changeSets = build.changeSets | |
if(changeSets != null) { | |
def hadChanges = false %> | |
<table class="section"> | |
<tr class="tr-title"> | |
<td class="td-title" colspan="2">CHANGES</td> | |
</tr> | |
<% changeSets.each() { | |
cs_list -> cs_list.each() { | |
cs -> | |
hadChanges = true | |
cs.comment = org.apache.commons.lang.StringEscapeUtils.escapeHtml(cs.comment); | |
cs.comment = cs.comment.replaceFirst("(?<=(Fixes|Closes)\\s)(#)([0-9A-Z]+-\\d+)", "<a href=\"https://jira.1991421.cn/browse/\$3\">\$2\$3</a>"); | |
%> | |
<tr> | |
<td> | |
Revision | |
<%= cs.metaClass.hasProperty('commitId') ? cs.commitId : cs.metaClass.hasProperty('revision') ? cs.revision : cs.metaClass.hasProperty('changeNumber') ? cs.changeNumber : "" %> | |
by <B><%= cs.author %></B> | |
</td> | |
<td>${cs.comment}</td> | |
</tr> | |
<% cs.affectedFiles.each() { | |
p -> %> | |
<% } | |
} | |
} | |
if ( !hadChanges ) { %> | |
<% } %> | |
</table> | |
<br/> | |
<% } %> | |
<!-- ARTIFACTS --> | |
<% | |
def artifacts = build.artifacts | |
if ( artifacts != null && artifacts.size() > 0 ) { %> | |
<table class="section"> | |
<tr class="tr-title"> | |
<td class="td-title">BUILD ARTIFACTS</td> | |
</tr> | |
<% artifacts.each() { | |
f -> %> | |
<tr> | |
<td> | |
<a href="${rooturl}${build.url}artifact/${f}">${f}</a> | |
</td> | |
</tr> | |
<% } %> | |
</table> | |
<br/> | |
<% } %> | |
<!-- MAVEN ARTIFACTS --> | |
<% | |
try { | |
def mbuilds = build.moduleBuilds | |
if ( mbuilds != null ) { %> | |
<table class="section"> | |
<tr class="tr-title"> | |
<td class="td-title">BUILD ARTIFACTS</td> | |
</tr> | |
<% | |
try { | |
mbuilds.each() { | |
m -> %> | |
<tr> | |
<td class="td-header-maven-module">${m.key.displayName}</td> | |
</tr> | |
<% | |
m.value.each() { | |
mvnbld -> def artifactz = mvnbld.artifacts | |
if ( artifactz != null && artifactz.size() > 0) { %> | |
<tr> | |
<td class="td-maven-artifact"> | |
<% artifactz.each() { | |
f -> %> | |
<a href="${rooturl}${mvnbld.url}artifact/${f}">${f}</a><br/> | |
<% } %> | |
</td> | |
</tr> | |
<% } | |
} | |
} | |
} catch(e) { | |
// we don't do anything | |
} %> | |
</table> | |
<br/> | |
<% } | |
} catch(e) { | |
// we don't do anything | |
} %> | |
<!-- JUnit TEMPLATE --> | |
<% | |
def junitResultList = it.JUnitTestResult | |
try { | |
def cucumberTestResultAction = it.getAction("org.jenkinsci.plugins.cucumber.jsontestsupport.CucumberTestResultAction") | |
junitResultList.add( cucumberTestResultAction.getResult() ) | |
} catch(e) { | |
//cucumberTestResultAction not exist in this build | |
} | |
if ( junitResultList.size() > 0 ) { %> | |
<table class="section"> | |
<tr class="tr-title"> | |
<td class="td-title" colspan="5">${junitResultList.first().displayName}</td> | |
</tr> | |
<tr> | |
<td class="td-title-tests">Name</td> | |
<td class="td-title-tests">Failed</td> | |
<td class="td-title-tests">Passed</td> | |
<td class="td-title-tests">Skipped</td> | |
<td class="td-title-tests">Total</td> | |
</tr> | |
<% junitResultList.each { | |
junitResult -> junitResult.getChildren().each { | |
packageResult -> %> | |
<tr> | |
<td>${packageResult.getName()}</td> | |
<td>${packageResult.getFailCount()}</td> | |
<td>${packageResult.getPassCount()}</td> | |
<td>${packageResult.getSkipCount()}</td> | |
<td>${packageResult.getPassCount() + packageResult.getFailCount() + packageResult.getSkipCount()}</td> | |
</tr> | |
<% packageResult.getPassedTests().findAll({it.getStatus().toString() == "FIXED";}).each{ | |
test -> %> | |
<tr> | |
<td class="test test-fixed" colspan="5"> | |
${test.getFullName()} ${test.getStatus()} | |
</td> | |
</tr> | |
<% } %> | |
<% packageResult.getFailedTests().sort({a,b -> a.getAge() <=> b.getAge()}).each{ | |
failed_test -> %> | |
<tr> | |
<td class="test test-failed" colspan="5"> | |
${failed_test.getFullName()} (Age: ${failed_test.getAge()}) | |
</td> | |
</tr> | |
<% } | |
} | |
} %> | |
</table> | |
<br/> | |
<% } %> | |
<!-- CONSOLE OUTPUT --> | |
<% | |
if ( build.result == hudson.model.Result.FAILURE ) { %> | |
<table class="section" cellpadding="0" cellspacing="0"> | |
<tr class="tr-title"> | |
<td class="td-title">CONSOLE OUTPUT</td> | |
</tr> | |
<% build.getLog(100).each() { | |
line -> %> | |
<tr> | |
<td class="console">${org.apache.commons.lang.StringEscapeUtils.escapeHtml(line)}</td> | |
</tr> | |
<% } %> | |
</table> | |
<br/> | |
<% } %> | |
</BODY> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
这里我正则替换了issue number,增加了链接,打通了我工具链中的JIRA链接