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

Commit 090ee01

Browse files
authored
Add build results support in Run Command step and skipped task logs link in table (#354)
* add build table to command step and link to skipped logs * add skipped log link in status as well * fix pipeline failure * temp commit for checkout * update as per review comments * remove MatlabBuild.java and update tests * temp commit for checkout * update as per review * fix pipeline failure * format code * remove teardown method overriding * add super to method calls
1 parent 3480719 commit 090ee01

File tree

50 files changed

+423
-409
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+423
-409
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,6 @@ src/main/resources/matlab-script-generator.zip
77
src/main/resources/**/run-matlab-command*
88
src/main/resources/license.txt
99

10+
.idea/
11+
1012
**/.DS_Store

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

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
package com.mathworks.ci;
22

3+
/**
4+
* Copyright 2024 The MathWorks, Inc.
5+
*
6+
*/
7+
38
import hudson.FilePath;
49
import hudson.model.Action;
510
import hudson.model.Run;
@@ -18,15 +23,13 @@
1823
import org.json.simple.parser.JSONParser;
1924
import org.json.simple.parser.ParseException;
2025

21-
2226
public class BuildArtifactAction implements Action {
2327
private Run<?, ?> build;
2428
private int totalCount;
2529
private int skipCount;
2630
private int failCount;
2731
private String actionID;
2832
private static final String ROOT_ELEMENT = "taskDetails";
29-
private static final String BUILD_ARTIFACT_FILE = "buildArtifact";
3033

3134
public BuildArtifactAction(Run<?, ?> build, String actionID) {
3235
this.build = build;
@@ -69,10 +72,10 @@ public List<BuildArtifactData> getBuildArtifact() throws ParseException, Interru
6972
FilePath fl;
7073
if(this.actionID == null){
7174
fl = new FilePath(new File(build.getRootDir().getAbsolutePath() + "/" +
72-
BUILD_ARTIFACT_FILE + ".json"));
75+
MatlabBuilderConstants.BUILD_ARTIFACT + ".json"));
7376
} else {
7477
fl = new FilePath(new File(build.getRootDir().getAbsolutePath() + "/" +
75-
BUILD_ARTIFACT_FILE + this.actionID + ".json"));
78+
MatlabBuilderConstants.BUILD_ARTIFACT + this.actionID + ".json"));
7679
}
7780
try (InputStreamReader reader = new InputStreamReader(new FileInputStream(new File(fl.toURI())), "UTF-8")) {
7881
Object obj = new JSONParser().parse(reader);
@@ -141,16 +144,15 @@ public void setOwner(Run owner) {
141144
this.build = owner;
142145
}
143146

144-
145147
private void setCounts() throws InterruptedException, ParseException {
146148
List<BuildArtifactData> artifactData = new ArrayList<BuildArtifactData>();
147149
FilePath fl;
148150
if(this.actionID == null){
149151
fl = new FilePath(new File(build.getRootDir().getAbsolutePath() + "/" +
150-
BUILD_ARTIFACT_FILE + ".json"));
152+
MatlabBuilderConstants.BUILD_ARTIFACT + ".json"));
151153
} else {
152154
fl = new FilePath(new File(build.getRootDir().getAbsolutePath() + "/" +
153-
BUILD_ARTIFACT_FILE + this.actionID + ".json"));
155+
MatlabBuilderConstants.BUILD_ARTIFACT + this.actionID + ".json"));
154156
}
155157
try (InputStreamReader reader = new InputStreamReader(new FileInputStream(new File(fl.toURI())), "UTF-8")) {
156158
Object obj = new JSONParser().parse(reader);

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
package com.mathworks.ci;
22

3+
/**
4+
* Copyright 2024 The MathWorks, Inc.
5+
*
6+
*/
7+
38
public class BuildArtifactData {
49

510
private String taskName;
@@ -12,7 +17,6 @@ public class BuildArtifactData {
1217
public BuildArtifactData() {
1318
}
1419

15-
1620
public String getTaskDuration() {
1721
return this.taskDuration;
1822
}

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
package com.mathworks.ci;
22

3+
/**
4+
* Copyright 2024 The MathWorks, Inc.
5+
*
6+
*/
7+
38
import com.google.common.base.Charsets;
49
import hudson.console.ConsoleLogFilter;
510
import hudson.console.LineTransformationOutputStream;

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
package com.mathworks.ci;
22

3+
/**
4+
* Copyright 2024 The MathWorks, Inc.
5+
*
6+
*/
7+
38
import com.google.common.annotations.VisibleForTesting;
49
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
510
import hudson.Extension;

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* This is Utility class which provides commonly used methods for form validations across builders
77
*
88
*/
9+
910
import java.util.List;
1011
import java.util.function.Function;
1112
import hudson.util.FormValidation;

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
package com.mathworks.ci;
2+
23
/*
34
* Copyright 2018 The MathWorks, Inc.
45
*/

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

Lines changed: 0 additions & 143 deletions
This file was deleted.

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
package com.mathworks.ci;
2+
23
/*
34
* Copyright 2019-2020 The MathWorks, Inc.
45
*/
@@ -32,6 +33,12 @@ public class MatlabBuilderConstants {
3233

3334
//Temporary MATLAB folder name in workspace
3435
public static final String TEMP_MATLAB_FOLDER_NAME = ".matlab";
36+
37+
// MATLAB default function/plugin paths
38+
public static final String DEFAULT_PLUGIN = "+ciplugins/+jenkins/getDefaultPlugins.m";
39+
public static final String BUILD_REPORT_PLUGIN = "+ciplugins/+jenkins/BuildReportPlugin.m";
40+
public static final String TASK_RUN_PROGRESS_PLUGIN = "+ciplugins/+jenkins/TaskRunProgressPlugin.m";
41+
public static final String BUILD_ARTIFACT = "buildArtifact";
3542

3643
public static final String NEW_LINE = System.getProperty("line.separator");
3744

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
package com.mathworks.ci;
22

3+
/**
4+
* Copyright 2021 The MathWorks, Inc.
5+
*
6+
*/
7+
38
import java.lang.Exception;
49

510
public class MatlabExecutionException extends Exception {

0 commit comments

Comments
 (0)