Class CounterManager
java.lang.Object
com.tikal.jenkins.plugins.multijob.counters.CounterManager
A manager for the different counters that can exist in a phase.
A manager process the results of the jobs, the result of the phase and transforms the counters and their values in the data structure needed by the Multijob.injectEnvVars.
These are the variables that will be injected:
The variables related to the last phase execution:
- PHASE_RESULT: with the result (as string) of the previous phase.
- PHASE_SUCCESSFUL: the number of jobs with UNSTABLE or SUCCESS results.
- PHASE_STABLE: the number of jobs with SUCCESS results.
- PHASE_UNSTABLE: the number of jobs with UNSTABLE results.
- PHASE_FAILED: the number of jobs with FAILED results.
- PHASE_ABORTED: the number of jobs with ABORTED results.
- PHASE_SKIPPED: the number of jobs with has been skipped.
The variables related to the phase name (in the following example, TRALL is the phase name):
- TRALL_RESULT: with the result (as string) of the previous phase.
- TRALL_SUCCESSFUL: the number of jobs with UNSTABLE or SUCCESS results.
- TRALL_STABLE: the number of jobs with SUCCESS results.
- TRALL_UNSTABLE: the number of jobs with UNSTABLE results.
- TRALL_FAILED: the number of jobs with FAILED results.
- TRALL_ABORTED: the number of jobs with ABORTED results.
- TRALL_SKIPPED: the number of jobs with has been skipped.
The variables related to current multijob execution:
- MULTIJOB_RESULT: with the result (as string) of the previous phase.
- MULTIJOB_SUCCESSFUL: the number of jobs with UNSTABLE or SUCCESS results.
- MULTIJOB_STABLE: the number of jobs with SUCCESS results.
- MULTIJOB_UNSTABLE: the number of jobs with UNSTABLE results.
- MULTIJOB_FAILED: the number of jobs with FAILED results.
- MULTIJOB_ABORTED: the number of jobs with ABORTED results.
- MULTIJOB_SKIPPED: the number of jobs with has been skipped.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Name of the key that will be used to store, as an environment property, the result of the phase. -
Constructor Summary
-
Method Summary
-
Field Details
-
PHASE_RESULT
Name of the key that will be used to store, as an environment property, the result of the phase.We compute the result of the phase as the worse of the results of all triggered jobs.
- See Also:
-
-
Constructor Details
-
CounterManager
public CounterManager()
-
-
Method Details
-
process
Process the result of the job.The processing of the result of the job is an operation that involucres two steps:
- First, we increment all of the counters this result applies to.
- Second, we update the
phaseResult
variable if the result if worse than current.
- Parameters:
result
- the result of the job to be processed.
-
processSkipped
public void processSkipped()A convenient way to process a skipped job. -
processAborted
public void processAborted()A convenient way to process an aborted job. -
toMap
Returns a map with the variables and their values, to be injected.- Returns:
- a map with the variables related to phase and multijob.
-
toString
-