Skip to content

Commit 1ed2934

Browse files
authored
Merge pull request #14 from ccedric/master
Fix display Gatling Reports, close gatling/gatling#3154
2 parents 9523d2a + 29ba729 commit 1ed2934

File tree

2 files changed

+18
-12
lines changed

2 files changed

+18
-12
lines changed

src/main/java/io/gatling/jenkins/GatlingPublisher.java

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,22 @@ public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListen
6565
}
6666

6767
logger.println("Archiving Gatling reports...");
68-
List<BuildSimulation> sims = saveFullReports(build.getWorkspace(), build.getRootDir());
69-
if (sims.isEmpty()) {
70-
logger.println("No newer Gatling reports to archive.");
71-
return true;
72-
}
68+
FilePath workspace = build.getWorkspace();
69+
if (workspace != null) {
70+
List<BuildSimulation> sims = saveFullReports(workspace, build.getRootDir());
71+
if (sims.isEmpty()) {
72+
logger.println("No newer Gatling reports to archive.");
73+
return true;
74+
}
7375

74-
GatlingBuildAction action = new GatlingBuildAction(build, sims);
76+
GatlingBuildAction action = new GatlingBuildAction(build, sims);
7577

76-
build.addAction(action);
77-
return true;
78+
build.addAction(action);
79+
return true;
80+
} else {
81+
logger.println("Failed to access workspace, it may be on a non-connected slave.");
82+
return false;
83+
}
7884
}
7985

8086
@Override

src/main/resources/io/gatling/jenkins/GatlingBuildAction/report.jelly

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@
44
<l:layout title="Build #${it.build.number} : ${simName}">
55
<l:breadcrumb title="${simName}" href="."/>
66
<l:side-panel>
7-
<st:include it="${it.build}" page="sidepanel.jelly"/>
7+
<st:include it="${it.run}" page="sidepanel.jelly"/>
88
</l:side-panel>
99
<l:main-panel>
1010
<script type="text/javascript">
1111
function resizeReportFrame() {
12-
var frame = document.getElementById("reportFrame")
13-
frame.height = frame.contentWindow.document.body.scrollHeight + "px"
12+
var html = document.documentElement;
13+
document.getElementById("reportFrame").height = Math.max(html.clientHeight, html.scrollHeight, html.offsetHeight) - document.getElementById("page-head").scrollHeight - document.getElementById("menuSelector").scrollHeight - document.getElementById("newTab").scrollHeight;
1414
}
1515
</script>
16-
<h3>
16+
<h3 id="newTab">
1717
<a href="source" target="_blank">${%OpenNewPage}</a>
1818
</h3>
1919
<iframe id="reportFrame" src="source" width="100%" height="100%" frameborder="0"

0 commit comments

Comments
 (0)