Skip to content

Commit

Permalink
LogParserAction now handles showGraphs as it implements SimpleBuildSt…
Browse files Browse the repository at this point in the history
…ep.LastBuildAction

Signed-off-by: Martin Reinhardt <contact@martinreinhardt-online.de>
  • Loading branch information
Marc van Kalmthout authored and hypery2k committed Jun 3, 2024
1 parent f517f9c commit dcc72a4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
16 changes: 11 additions & 5 deletions src/main/java/hudson/plugins/logparser/LogParserAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,22 +42,28 @@ public class LogParserAction implements Action, SimpleBuildStep.LastBuildAction

final private Run<?, ?> build;
final private LogParserResult result;
final private boolean showGraphs;

private static String urlName = "parsed_console";

@Deprecated
public LogParserAction(final AbstractBuild<?, ?> build, final LogParserResult result) {
this((Run<?, ?>) build, result);
public LogParserAction(final AbstractBuild<?, ?> build, final LogParserResult result, final boolean showGraphs) {
this((Run<?, ?>) build, result, showGraphs);

Check warning on line 51 in src/main/java/hudson/plugins/logparser/LogParserAction.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 51 is not covered by tests
}

public LogParserAction(final Run<?, ?> build, final LogParserResult result) {
public LogParserAction(final Run<?, ?> build, final LogParserResult result, final boolean showGraphs) {
this.build = build;
this.result = result;
this.showGraphs = showGraphs;
}

public Collection<? extends Action> getProjectActions() {
final Job<?, ?> job = build.getParent();
return Collections.singleton(new LogParserProjectAction(job));
if (showGraphs) {
final Job<?, ?> job = build.getParent();
return Collections.singleton(new LogParserProjectAction(job));
} else {
return Collections.emptyList();

Check warning on line 65 in src/main/java/hudson/plugins/logparser/LogParserAction.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered lines

Lines 61-65 are not covered by tests
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public void perform(Run<?, ?> build, FilePath workspace, Launcher launcher, Task
logger.log(Level.SEVERE, LogParserConsts.CANNOT_PARSE + build, NULL_PARSING_RULES);
result.setFailedToParseError(NULL_PARSING_RULES);
build.setResult(Result.ABORTED);
build.addAction(new LogParserAction(build, result));
build.addAction(new LogParserAction(build, result, showGraphs));
return;
} else {
parsingRulesFile = new FilePath(new File(parsingRulesPath));
Expand Down Expand Up @@ -139,7 +139,7 @@ public void perform(Run<?, ?> build, FilePath workspace, Launcher launcher, Task
}

// Add an action created with the above results
final LogParserAction action = new LogParserAction(build, result);
final LogParserAction action = new LogParserAction(build, result, showGraphs);
build.addAction(action);
}

Expand Down

0 comments on commit dcc72a4

Please sign in to comment.