-
-
Notifications
You must be signed in to change notification settings - Fork 107
JENKINS-59110: enable logging globally for pipeline jobs #93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 6 commits
0d03696
f30024b
eb6e8b2
c32179c
8b7daa9
a5484ba
4a0058a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,6 +24,7 @@ | |
|
|
||
| package jenkins.plugins.logstash.persistence; | ||
|
|
||
| import java.io.Serializable; | ||
| import java.util.Calendar; | ||
| import java.util.List; | ||
|
|
||
|
|
@@ -36,7 +37,9 @@ | |
| * @author Rusty Gerard | ||
| * @since 1.0.0 | ||
| */ | ||
| public abstract class AbstractLogstashIndexerDao implements LogstashIndexerDao { | ||
| public abstract class AbstractLogstashIndexerDao implements LogstashIndexerDao, Serializable { | ||
|
|
||
| private static final long serialVersionUID = 1L; | ||
|
||
|
|
||
| @Override | ||
| public JSONObject buildPayload(BuildData buildData, String jenkinsUrl, List<String> logLines) { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -48,6 +48,7 @@ | |
|
|
||
| import static java.util.logging.Level.WARNING; | ||
| import java.io.IOException; | ||
| import java.io.Serializable; | ||
| import java.lang.invoke.MethodHandles; | ||
| import net.sf.json.JSONObject; | ||
|
|
||
|
|
@@ -62,15 +63,19 @@ | |
| * @author Rusty Gerard | ||
| * @since 1.0.0 | ||
| */ | ||
| public class BuildData { | ||
| public class BuildData implements Serializable { | ||
| private static final long serialVersionUID = 1L; | ||
|
||
|
|
||
| // ISO 8601 date format | ||
| private final static Logger LOGGER = Logger.getLogger(MethodHandles.lookup().lookupClass().getCanonicalName()); | ||
| public static class TestData { | ||
| public static class TestData implements Serializable { | ||
| private static final long serialVersionUID = 1L; | ||
|
||
| private final int totalCount, skipCount, failCount, passCount; | ||
| private final List<FailedTest> failedTestsWithErrorDetail; | ||
| private final List<String> failedTests; | ||
|
|
||
| public static class FailedTest { | ||
| public static class FailedTest implements Serializable { | ||
| private static final long serialVersionUID = 1L; | ||
| private final String fullName, errorDetails; | ||
| public FailedTest(String fullName, String errorDetails) { | ||
| super(); | ||
|
|
@@ -160,6 +165,8 @@ public List<String> getFailedTests() | |
| private String url; | ||
| private String buildHost; | ||
| private String buildLabel; | ||
| private String stageName; | ||
| private String agentName; | ||
| private int buildNum; | ||
| private long buildDuration; | ||
| private transient String timestamp; // This belongs in the root object | ||
|
|
@@ -212,9 +219,11 @@ public BuildData(AbstractBuild<?, ?> build, Date currentTime, TaskListener liste | |
| } | ||
|
|
||
| // Pipeline project build | ||
| public BuildData(Run<?, ?> build, Date currentTime, TaskListener listener) { | ||
| public BuildData(Run<?, ?> build, Date currentTime, TaskListener listener, String stageName, String agentName) { | ||
| initData(build, currentTime); | ||
|
|
||
| this.agentName = agentName; | ||
| this.stageName = stageName; | ||
| rootProjectName = projectName; | ||
| rootFullProjectName = fullProjectName; | ||
| rootProjectDisplayName = displayName; | ||
|
|
@@ -262,14 +271,15 @@ private void initData(Run<?, ?> build, Date currentTime) { | |
|
|
||
| public void updateResult() | ||
| { | ||
| if (result == null && build.getResult() != null) | ||
| { | ||
| Result result = build.getResult(); | ||
| this.result = result == null ? null : result.toString(); | ||
| } | ||
| Action testResultAction = build.getAction(AbstractTestResultAction.class); | ||
| if (testResults == null && testResultAction != null) { | ||
| testResults = new TestData(testResultAction); | ||
| if (build != null) { | ||
| if (result == null && build.getResult() != null) { | ||
| Result result = build.getResult(); | ||
| this.result = result == null ? null : result.toString(); | ||
| } | ||
| Action testResultAction = build.getAction(AbstractTestResultAction.class); | ||
| if (testResults == null && testResultAction != null) { | ||
| testResults = new TestData(testResultAction); | ||
| } | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -443,4 +453,20 @@ public TestData getTestResults() { | |
| public void setTestResults(TestData testResults) { | ||
| this.testResults = testResults; | ||
| } | ||
|
|
||
| public String getStageName() { | ||
| return stageName; | ||
| } | ||
|
|
||
| public void setStageName(String stageName) { | ||
| this.stageName = stageName; | ||
| } | ||
|
|
||
| public String getAgentName() { | ||
| return agentName; | ||
| } | ||
|
|
||
| public void setAgentName(String agentName) { | ||
| this.agentName = agentName; | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same thing about serials