Package io.fabric8.jenkins.openshiftsync
Class BuildSyncRunListener
- java.lang.Object
-
- hudson.model.listeners.RunListener<Run>
-
- io.fabric8.jenkins.openshiftsync.BuildSyncRunListener
-
- All Implemented Interfaces:
ExtensionPoint
@Extension public class BuildSyncRunListener extends RunListener<Run>
Listens to Jenkins Job buildRun
start and stop then ensure there's a suitableBuild
object in OpenShift thats updated correctly with the current status, logsURL and metrics
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
-
Field Summary
-
Fields inherited from class hudson.model.listeners.RunListener
LISTENERS, targetType
-
-
Constructor Summary
Constructors Constructor Description BuildSyncRunListener()
BuildSyncRunListener(long pollPeriodMs)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static String
asJSON(Object obj)
protected void
checkTimerStarted()
static String
joinPaths(String... strings)
Joins all the given strings, ignoring nulls so that they form a URL with / between the paths without a // if the previous path ends with / and the next path starts with / unless a path item is blankvoid
onCompleted(Run run, TaskListener listener)
void
onDeleted(Run run)
void
onFinalized(Run run)
void
onStarted(Run run, TaskListener listener)
protected void
pollLoop()
protected boolean
pollRun(Run run)
protected boolean
shouldPollRun(Run run)
Returns true if we should poll the status of this run-
Methods inherited from class hudson.model.listeners.RunListener
all, fireCompleted, fireDeleted, fireFinalized, fireInitialize, fireStarted, onInitialize, register, setUpEnvironment, unregister
-
-
-
-
Method Detail
-
joinPaths
public static String joinPaths(String... strings)
Joins all the given strings, ignoring nulls so that they form a URL with / between the paths without a // if the previous path ends with / and the next path starts with / unless a path item is blank- Parameters:
strings
- the sequence of strings to join- Returns:
- the strings concatenated together with / while avoiding a double // between non blank strings.
-
onStarted
public void onStarted(Run run, TaskListener listener)
- Overrides:
onStarted
in classRunListener<Run>
-
checkTimerStarted
protected void checkTimerStarted()
-
onCompleted
public void onCompleted(Run run, @Nonnull TaskListener listener)
- Overrides:
onCompleted
in classRunListener<Run>
-
onDeleted
public void onDeleted(Run run)
- Overrides:
onDeleted
in classRunListener<Run>
-
onFinalized
public void onFinalized(Run run)
- Overrides:
onFinalized
in classRunListener<Run>
-
pollLoop
protected void pollLoop()
-
pollRun
protected boolean pollRun(Run run)
-
asJSON
protected static String asJSON(Object obj) throws com.fasterxml.jackson.core.JsonProcessingException
- Throws:
com.fasterxml.jackson.core.JsonProcessingException
-
shouldPollRun
protected boolean shouldPollRun(Run run)
Returns true if we should poll the status of this run- Parameters:
run
- the Run to test against- Returns:
- true if the should poll the status of this build run
-
-