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

Commit b6c252d

Browse files
mw-kapilgnbhoski
andauthored
Dev main (#357)
* Added check for command textbox * Updated as per review comment * Updated as per review comment * 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 * Add skip reason for skipped tasks in build results table (#356) * Add skipReason in build results table * add skip reason texts * add test and bump Maven task * remove .idea from gitignore in this branch * update as per review comments * update as per review * update function name * update build results table * update test * update skip link * update status to succeeded * update data constructor --------- Co-authored-by: Nikhil Bhoski <[email protected]>
1 parent a66bd3a commit b6c252d

File tree

57 files changed

+564
-439
lines changed

Some content is hidden

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

57 files changed

+564
-439
lines changed

.gitignore

+2
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

azure-pipelines.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ trigger:
1919
- master
2020

2121
steps:
22-
- task: Maven@3
22+
- task: Maven@4
2323
inputs:
2424
mavenPomFile: 'pom.xml'
2525
mavenOptions: '-Xmx3072m -Dmaven.javadoc.skip=true'

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

+30-8
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);
@@ -204,7 +206,7 @@ private void setCounts() throws InterruptedException, ParseException {
204206
private void iterateAllTaskAttributes(Entry pair, BuildArtifactData data) {
205207
// Iterates across all task attributes and updates
206208
String key = pair.getKey().toString();
207-
switch(key.toLowerCase()){
209+
switch(key){
208210
case "duration":
209211
data.setTaskDuration(pair.getValue().toString());
210212
break;
@@ -220,6 +222,26 @@ private void iterateAllTaskAttributes(Entry pair, BuildArtifactData data) {
220222
case "skipped":
221223
data.setTaskSkipped((Boolean) pair.getValue());
222224
break;
225+
case "skipReason":
226+
String skipReasonKey = pair.getValue().toString();
227+
String skipReason;
228+
switch(skipReasonKey){
229+
case "UpToDate":
230+
skipReason = "up-to-date";
231+
break;
232+
case "UserSpecified":
233+
case "UserRequested":
234+
skipReason = "user requested";
235+
break;
236+
case "DependencyFailed":
237+
skipReason = "dependency failed";
238+
break;
239+
default:
240+
skipReason = skipReasonKey;
241+
break;
242+
}
243+
data.setSkipReason(skipReason);
244+
break;
223245
default :
224246
break;
225247
}

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

+14-1
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;
@@ -8,11 +13,11 @@ public class BuildArtifactData {
813

914
private String taskDescription;
1015
private boolean taskSkipped;
16+
private String skipReason;
1117

1218
public BuildArtifactData() {
1319
}
1420

15-
1621
public String getTaskDuration() {
1722
return this.taskDuration;
1823
}
@@ -37,6 +42,14 @@ public void setTaskSkipped(boolean taskSkipped) {
3742
this.taskSkipped = taskSkipped;
3843
}
3944

45+
public String getSkipReason() {
46+
return (this.skipReason == null) ? "" : this.skipReason;
47+
}
48+
49+
public void setSkipReason(String skipReason) {
50+
this.skipReason = skipReason;
51+
}
52+
4053
public boolean getTaskFailed() {
4154
return this.taskFailed;
4255
}

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

+5
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

+5
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

+1
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

+1
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

-143
This file was deleted.

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

+7
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

+5
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 {

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

-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
*
66
*/
77

8-
import java.io.FileNotFoundException;
9-
108
public class MatlabNotFoundError extends Error {
119

1210
private static final long serialVersionUID = 7918595075502022644L;

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

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
package com.mathworks.ci;
22

3-
import java.io.BufferedReader;
4-
53
/*
64
* Copyright 2019 The MathWorks, Inc. This Class provides MATLAB release information in the form of
75
* Version numbers. Class constructor requires MATLAB root as input parameter
86
*/
97

108
import java.io.InputStream;
119
import java.io.InputStreamReader;
10+
import java.io.BufferedReader;
1211
import java.nio.charset.StandardCharsets;
1312
import java.nio.file.NotDirectoryException;
1413
import java.util.HashMap;
@@ -26,7 +25,6 @@
2625
import org.w3c.dom.NodeList;
2726
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
2827
import hudson.FilePath;
29-
import org.xml.sax.SAXException;
3028

3129
public class MatlabReleaseInfo {
3230
private FilePath matlabRoot;

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

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
package com.mathworks.ci;
2+
23
/*
34
* Copyright 2019 The MathWorks, Inc.
45
*

0 commit comments

Comments
 (0)