-
Notifications
You must be signed in to change notification settings - Fork 145
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into feature/jcasc-compatibility
- Loading branch information
Showing
8 changed files
with
176 additions
and
73 deletions.
There are no files selected for viewing
124 changes: 70 additions & 54 deletions
124
src/main/java/com/sonyericsson/jenkins/plugins/bfa/BuildFailureScanner.java
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
src/main/java/com/sonyericsson/jenkins/plugins/bfa/ScanLogAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
package com.sonyericsson.jenkins.plugins.bfa; | ||
|
||
import hudson.model.Run; | ||
import java.io.File; | ||
import java.io.IOException; | ||
import java.nio.charset.StandardCharsets; | ||
import javax.annotation.Nonnull; | ||
import jenkins.model.RunAction2; | ||
import org.apache.commons.io.FileUtils; | ||
|
||
/** | ||
* The Action for adding a link to the analysis for each run. | ||
*/ | ||
public class ScanLogAction implements RunAction2 { | ||
|
||
/** | ||
* Log file name. | ||
*/ | ||
public static final String FILE_NAME = "com.sonyericsson.jenkins.plugins.bfa.ScanLogAction.log"; | ||
|
||
private transient Run run; | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
@Nonnull | ||
@Override | ||
public String getIconFileName() { | ||
return PluginImpl.getDefaultIcon(); | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
@Nonnull | ||
@Override | ||
public String getDisplayName() { | ||
return Messages.ScanLogAction_DisplayName(); | ||
} | ||
|
||
/** | ||
* The run associated with this action, called by jelly. | ||
* @return the run | ||
*/ | ||
public Run getRun() { | ||
return run; | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
@Nonnull | ||
@Override | ||
public String getUrlName() { | ||
return "failure-cause-scan-log"; | ||
} | ||
|
||
/** | ||
* Log text for the analysis. | ||
* @return the log text, lines are separated by \n | ||
* @throws IOException if the log can't be found | ||
*/ | ||
public String getLogText() throws IOException { | ||
return FileUtils.readFileToString(new File(run.getRootDir(), FILE_NAME), StandardCharsets.UTF_8); | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
@Override | ||
public void onAttached(Run<?, ?> r) { | ||
this.run = r; | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
@Override | ||
public void onLoad(Run<?, ?> r) { | ||
this.run = r; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
src/main/resources/com/sonyericsson/jenkins/plugins/bfa/ScanLogAction/index.jelly
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?jelly escape-by-default='true'?> | ||
<j:jelly xmlns:j="jelly:core" xmlns:l="/lib/layout" xmlns:st="jelly:stapler"> | ||
<l:layout title="Failure Cause Scan Log"> | ||
<st:include page="sidepanel.jelly" it="${it.run}"/> | ||
<l:main-panel> | ||
<h1> | ||
${%Failure Cause Scan Log} | ||
</h1> | ||
<pre>${it.getLogText()}</pre> | ||
</l:main-panel> | ||
</l:layout> | ||
</j:jelly> |