-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
62 additions
and
9 deletions.
There are no files selected for viewing
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
31 changes: 31 additions & 0 deletions
31
src/main/java/io/jenkins/plugins/launchable/GraphListenerImpl.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,31 @@ | ||
package io.jenkins.plugins.launchable; | ||
|
||
import hudson.Extension; | ||
import org.jenkinsci.plugins.workflow.flow.GraphListener; | ||
import org.jenkinsci.plugins.workflow.graph.FlowNode; | ||
|
||
import javax.inject.Inject; | ||
import java.io.IOException; | ||
import java.util.logging.Level; | ||
import java.util.logging.Logger; | ||
|
||
@Extension | ||
public class GraphListenerImpl implements GraphListener { | ||
@Inject | ||
Ingester ingester; | ||
|
||
@Override | ||
public void onNewHead(FlowNode node) { | ||
try { | ||
if (node.getDisplayFunctionName().equals("junit")) {// TODO: probably not the most robust check | ||
// owner is actually WorkflowRun | ||
ingester.slurp(node.getExecution().getOwner().getRootDir()); | ||
} | ||
} catch (IOException e) { | ||
// Priority #1: Do no harm to people's build | ||
LOGGER.log(Level.WARNING, "Failed to send JUnit result to Launchable", e); | ||
} | ||
} | ||
|
||
private static final Logger LOGGER = Logger.getLogger("io.jenkins.plugins.launchable.GraphListenerImpl"); | ||
} |
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