Skip to content
This repository was archived by the owner on Mar 27, 2025. It is now read-only.

Commit ae30902

Browse files
authored
Merge pull request #348 from mathworks/issue_345
Issue 345
2 parents e77d3ce + 8707596 commit ae30902

File tree

3 files changed

+31
-9
lines changed

3 files changed

+31
-9
lines changed

src/main/java/com/mathworks/ci/BuildArtifactAction.java

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public BuildArtifactAction(Run<?, ?> build, String actionID) {
4343
}
4444

4545
public String getActionID(){
46-
return this.actionID;
46+
return (this.actionID == null) ? "" : this.actionID;
4747
}
4848

4949
@CheckForNull
@@ -61,14 +61,19 @@ public String getDisplayName() {
6161
@CheckForNull
6262
@Override
6363
public String getUrlName() {
64-
return "buildresults" + this.actionID ;
64+
return (this.actionID == null) ? "buildresults" : "buildresults" + this.actionID ;
6565
}
6666

6767
public List<BuildArtifactData> getBuildArtifact() throws ParseException, InterruptedException, IOException {
6868
List<BuildArtifactData> artifactData = new ArrayList<BuildArtifactData>();
69-
70-
FilePath fl = new FilePath(new File(build.getRootDir().getAbsolutePath() + "/" +
71-
BUILD_ARTIFACT_FILE + this.actionID + ".json"));
69+
FilePath fl;
70+
if(this.actionID == null){
71+
fl = new FilePath(new File(build.getRootDir().getAbsolutePath() + "/" +
72+
BUILD_ARTIFACT_FILE + ".json"));
73+
} else {
74+
fl = new FilePath(new File(build.getRootDir().getAbsolutePath() + "/" +
75+
BUILD_ARTIFACT_FILE + this.actionID + ".json"));
76+
}
7277
try (InputStreamReader reader = new InputStreamReader(new FileInputStream(new File(fl.toURI())), "UTF-8")) {
7378
Object obj = new JSONParser().parse(reader);
7479
JSONObject jo = (JSONObject) obj;
@@ -139,7 +144,14 @@ public void setOwner(Run owner) {
139144

140145
private void setCounts() throws InterruptedException, ParseException {
141146
List<BuildArtifactData> artifactData = new ArrayList<BuildArtifactData>();
142-
FilePath fl = new FilePath(new File(build.getRootDir(), BUILD_ARTIFACT_FILE + this.actionID + ".json"));
147+
FilePath fl;
148+
if(this.actionID == null){
149+
fl = new FilePath(new File(build.getRootDir().getAbsolutePath() + "/" +
150+
BUILD_ARTIFACT_FILE + ".json"));
151+
} else {
152+
fl = new FilePath(new File(build.getRootDir().getAbsolutePath() + "/" +
153+
BUILD_ARTIFACT_FILE + this.actionID + ".json"));
154+
}
143155
try (InputStreamReader reader = new InputStreamReader(new FileInputStream(new File(fl.toURI())), "UTF-8")) {
144156
Object obj = new JSONParser().parse(reader);
145157
JSONObject jo = (JSONObject) obj;

src/main/resources/com/mathworks/ci/BuildArtifactAction/index.jelly

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,22 @@
5959
<j:forEach var="p" items="${it.buildArtifact}" varStatus="status">
6060
<tr>
6161
<td class="pane" align="left">
62-
<a href="../console#matlab-${p.taskName}-${it.actionID}">${p.taskName}</a>
62+
<j:if test="${it.actionID != ''}">
63+
<a href="../console#matlab-${p.taskName}-${it.actionID}">${p.taskName}</a>
64+
</j:if>
65+
<j:if test="${it.actionID == ''}">
66+
<a href="../console#matlab-${p.taskName}">${p.taskName}</a>
67+
</j:if>
6368
</td>
6469
<td class="pane" style="width:9em">
6570
<span class="${pst.cssClass}">
6671
<j:if test="${p.taskFailed != false}">
67-
<a href="../console#matlab-${p.taskName}-${it.actionID}"><font color="#EF2929"> FAILED </font> </a>
72+
<j:if test="${it.actionID != ''}">
73+
<a href="../console#matlab-${p.taskName}-${it.actionID}"><font color="#EF2929"> FAILED </font> </a>
74+
</j:if>
75+
<j:if test="${it.actionID == ''}">
76+
<a href="../console#matlab-${p.taskName}"><font color="#EF2929"> FAILED </font> </a>
77+
</j:if>
6878
</j:if>
6979
<j:if test="${p.taskFailed == false}">
7080
<j:if test="${p.taskSkipped == false}">

src/main/resources/com/mathworks/ci/BuildArtifactAction/summary.jelly

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
xmlns:f="/lib/form"
77
xmlns:i="jelly:fmt">
88
<t:summary icon="document.png">
9-
<p><a href="buildresults${it.actionID}">MATLAB Build Results</a></p>
9+
<p><a href="${it.urlName}">MATLAB Build Results</a></p>
1010
<span class="${pst.cssClass}">
1111
<j:if test="${it.totalCount == 0}">
1212
<font color="#EF2929"><h5>Unable to generate a build artifact. </h5></font>

0 commit comments

Comments
 (0)