Class AbstractReportPublisher
java.lang.Object
hudson.tasks.BuildStepCompatibilityLayer
hudson.tasks.Publisher
hudson.tasks.Recorder
de.tracetronic.jenkins.plugins.ecutest.report.AbstractReportPublisher
- All Implemented Interfaces:
ExtensionPoint,Describable<Publisher>,BuildStep,SimpleBuildStep
- Direct Known Subclasses:
AbstractToolPublisher,ATXPublisher,ETLogPublisher,TRFPublisher
Common base class for all report publishers.
-
Nested Class Summary
Nested classes/interfaces inherited from class hudson.tasks.Publisher
Publisher.DescriptorExtensionListImplNested classes/interfaces inherited from interface hudson.tasks.BuildStep
BuildStep.PublisherListNested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudsonNested classes/interfaces inherited from interface jenkins.tasks.SimpleBuildStep
SimpleBuildStep.LastBuildAction, SimpleBuildStep.LastBuildActionFactory -
Field Summary
Fields inherited from interface hudson.tasks.BuildStep
BUILDERS, PUBLISHERS -
Constructor Summary
ConstructorsConstructorDescriptionInstantiates a newAbstractReportPublisher.AbstractReportPublisher(boolean allowMissing, boolean runOnFailed, boolean archiving, boolean keepAll) Instantiates a newAbstractReportPublisher. -
Method Summary
Modifier and TypeMethodDescriptionprotected booleancanContinue(Result result) Returns whether this publisher can continue processing.protected ETInstallationconfigureToolInstallation(String toolName, Computer computer, TaskListener listener, EnvVars envVars) Configures the tool installation for functioning in the node and the environment.protected FilePathgetArchiveTarget(Run<?, ?> run) Gets the archive target.booleanEquivalent getter withbooleanreturn type.protected longgetDirectorySize(FilePath directory) Gets the total size of given directory recursively.protected longgetFileSize(FilePath file) Gets the size of given file.static FilePathgetFirstReportFile(FilePath reportDir) Gets the first TRF file found in given report directory.booleanEquivalent getter withbooleanreturn type.protected TTConsoleLoggerGets the logger instance.getProjectReportFiles(Run<?, ?> run, FilePath workspace, Launcher launcher) Builds a list of project report files for report generation.getReportDirs(Run<?, ?> run, FilePath workspace, Launcher launcher) Gets the report directories either from test environment actions or downstream workspace.getReportFiles(Run<?, ?> run, FilePath workspace, Launcher launcher) Builds a list of TRF files for report generation.getReportFiles(String includes, String excludes, Run<?, ?> run, FilePath workspace, Launcher launcher) Builds a list of report files for report generation.protected StringgetSettingsDir(Run<?, ?> run, FilePath workspace) Gets the settings directory, either previous ecu.test settings or default one.protected ETClientgetToolClient(String toolName, Run<?, ?> run, FilePath workspace, Launcher launcher, TaskListener listener) Configures an ecu.test client with given workspace settings.Gets the tool descriptor holding the installations.getToolInstallation(String toolName, EnvVars envVars) Gets the tool installation by descriptor and tool name.protected abstract StringGets the URL name that will be used for archiving and linking the reports.protected StringgetWorkspaceDir(Run<?, ?> run, FilePath workspace) Gets the workspace directory, either previous ecu.test workspace or default one.booleanReturns whether missing reports are allowed.Returns whether archiving artifacts is enabled.booleanReturns whether this publisher is part ofDownStreamPublisheractions.protected booleanisETRunning(Launcher launcher, TaskListener listener) Checks whether an ecu.test instance is still running.Returns whether artifacts are archived for all successful builds, otherwise only the most recent.booleanReturns whether this publisher can run for failed builds, too.protected booleanDetermines whether this publisher will be skipped depending on OS architecture and current build result.voidperform(Run<?, ?> run, FilePath workspace, Launcher launcher, TaskListener listener) protected abstract voidperformReport(Run<?, ?> run, FilePath workspace, Launcher launcher, TaskListener listener) Performs the report-specific post-build operations.static StringrandomId()Generates a random alphanumeric id to be used for linking reports.static voidremovePreviousReports(Run<?, ?> run, Class<? extends AbstractReportAction> clazz) Removes the report actions from all previous builds which published at project level.voidsetAllowMissing(boolean allowMissing) voidsetArchiving(boolean archiving) voidsetDownstream(boolean downstream) Transient setter to inform this publisher that it is part of aDownStreamPublisher.voidsetKeepAll(boolean keepAll) voidsetReportDir(String reportDir) Transient setter for the downstream report directory.voidsetRunOnFailed(boolean runOnFailed) voidsetWorkspace(String workspace) Transient setter for the downstream workspace.Methods inherited from class hudson.tasks.Publisher
all, getProjectAction, needsToRunAfterFinalized, prebuildMethods inherited from class hudson.tasks.BuildStepCompatibilityLayer
getProjectAction, getProjectActions, perform, perform, prebuildMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface hudson.tasks.BuildStep
getProjectAction, getProjectActions, perform, prebuildMethods inherited from interface jenkins.tasks.SimpleBuildStep
perform, perform, requiresWorkspace
-
Constructor Details
-
AbstractReportPublisher
public AbstractReportPublisher()Instantiates a newAbstractReportPublisher. -
AbstractReportPublisher
public AbstractReportPublisher(boolean allowMissing, boolean runOnFailed, boolean archiving, boolean keepAll) Instantiates a newAbstractReportPublisher.- Parameters:
allowMissing- specifies whether missing reports are allowedrunOnFailed- specifies whether this publisher even runs on a failed buildarchiving- specifies whether archiving artifacts is enabledkeepAll- specifies whether artifacts are archived for all successful builds, otherwise only the most recent
-
-
Method Details
-
getFirstReportFile
@CheckForNull public static FilePath getFirstReportFile(FilePath reportDir) throws IOException, InterruptedException Gets the first TRF file found in given report directory.- Parameters:
reportDir- the report directory- Returns:
- the first report file or
nullif not found - Throws:
IOException- signals that an I/O exception has occurredInterruptedException- if the build gets interrupted
-
removePreviousReports
public static void removePreviousReports(Run<?, ?> run, Class<? extends AbstractReportAction> clazz) throws IOExceptionRemoves the report actions from all previous builds which published at project level.- Parameters:
run- the runclazz- the report action class to remove- Throws:
IOException- signals that an I/O exception has occurred
-
isAllowMissing
public boolean isAllowMissing()Returns whether missing reports are allowed.- Returns:
trueif missing reports are allowed,falseotherwise
-
setAllowMissing
@DataBoundSetter public void setAllowMissing(boolean allowMissing) -
isRunOnFailed
public boolean isRunOnFailed()Returns whether this publisher can run for failed builds, too.- Returns:
trueif this publisher can run for failed builds,falseotherwise
-
setRunOnFailed
@DataBoundSetter public void setRunOnFailed(boolean runOnFailed) -
isArchiving
Returns whether archiving artifacts is enabled.- Returns:
trueif archiving artifacts is enabled,falseotherwise
-
getArchiving
public boolean getArchiving()Equivalent getter withbooleanreturn type.- Returns:
trueif archiving artifacts is enabled,falseotherwise- See Also:
-
setArchiving
@DataBoundSetter public void setArchiving(boolean archiving) -
isKeepAll
Returns whether artifacts are archived for all successful builds, otherwise only the most recent.- Returns:
trueif artifacts should be archived for all successful builds,falseotherwise
-
getKeepAll
public boolean getKeepAll()Equivalent getter withbooleanreturn type.- Returns:
trueif artifacts should be archived for all successful builds,falseotherwise- See Also:
-
setKeepAll
@DataBoundSetter public void setKeepAll(boolean keepAll) -
isDownstream
public boolean isDownstream()Returns whether this publisher is part ofDownStreamPublisheractions.- Returns:
true, if downstream-based,falseotherwise
-
setDownstream
public void setDownstream(boolean downstream) Transient setter to inform this publisher that it is part of aDownStreamPublisher.- Parameters:
downstream- the downstream flag
-
getWorkspace
-
setWorkspace
Transient setter for the downstream workspace.- Parameters:
workspace- the downstream workspace
-
getReportDir
-
setReportDir
Transient setter for the downstream report directory.- Parameters:
reportDir- the downstream report directory
-
perform
public void perform(@Nonnull Run<?, ?> run, @Nonnull FilePath workspace, @Nonnull Launcher launcher, @Nonnull TaskListener listener) throws InterruptedException, IOException- Specified by:
performin interfaceSimpleBuildStep- Throws:
InterruptedExceptionIOException
-
performReport
protected abstract void performReport(Run<?, ?> run, FilePath workspace, Launcher launcher, TaskListener listener) throws InterruptedException, IOException, ETPluginExceptionPerforms the report-specific post-build operations.- Parameters:
run- the runworkspace- the workspacelauncher- the launcherlistener- the listener- Throws:
InterruptedException- the interrupted exceptionIOException- signals that an I/O exception has occurredETPluginException- in case of report operation errors
-
getLogger
Gets the logger instance.- Returns:
- the logger
-
isSkipped
protected boolean isSkipped(boolean checkOS, Run<?, ?> run, Launcher launcher) throws ETPluginExceptionDetermines whether this publisher will be skipped depending on OS architecture and current build result.- Parameters:
checkOS- specifies whether to check OSrun- the runlauncher- the launcher- Returns:
truewhen to skip,falseotherwise- Throws:
ETPluginException- if Unix-based launcher
-
canContinue
Returns whether this publisher can continue processing. Returnstrueif the propertyrunOnFailedis set or if the build is not aborted or failed.- Parameters:
result- the run result- Returns:
trueif the build can continue
-
isETRunning
protected boolean isETRunning(Launcher launcher, TaskListener listener) throws IOException, InterruptedException Checks whether an ecu.test instance is still running.- Parameters:
launcher- the launcherlistener- the listener- Returns:
trueif ecu.test is running,falseotherwise- Throws:
IOException- signals that an I/O exception has occurredInterruptedException- the interrupted exception
-
getToolClient
protected ETClient getToolClient(String toolName, Run<?, ?> run, FilePath workspace, Launcher launcher, TaskListener listener) throws IOException, InterruptedException, ETPluginExceptionConfigures an ecu.test client with given workspace settings.- Parameters:
toolName- the tool namerun- the runworkspace- the workspacelauncher- the launcherlistener- the listener- Returns:
- the ecu.test client
- Throws:
IOException- signals that an I/O exception has occurredInterruptedException- the interrupted exceptionETPluginException- in case of a COM exception
-
configureToolInstallation
protected ETInstallation configureToolInstallation(String toolName, Computer computer, TaskListener listener, EnvVars envVars) throws IOException, InterruptedException, ETPluginException Configures the tool installation for functioning in the node and the environment.- Parameters:
toolName- the tool name identifying the specific toolcomputer- the computerlistener- the listenerenvVars- the environment variables- Returns:
- the tool installation
- Throws:
IOException- signals that an I/O exception has occurredInterruptedException- if the build gets interruptedETPluginException- if the selected tool installation is not configured
-
getToolInstallation
Gets the tool installation by descriptor and tool name.- Parameters:
toolName- the tool name identifying the specific toolenvVars- the environment variables- Returns:
- the tool installation
-
getToolDescriptor
Gets the tool descriptor holding the installations.- Returns:
- the tool descriptor
-
getWorkspaceDir
Gets the workspace directory, either previous ecu.test workspace or default one.- Parameters:
run- the runworkspace- the workspace- Returns:
- the workspace directory
-
getSettingsDir
Gets the settings directory, either previous ecu.test settings or default one.- Parameters:
run- the runworkspace- the workspace- Returns:
- the settings directory
-
getArchiveTarget
Gets the archive target.- Parameters:
run- the run- Returns:
- the archive target
-
getUrlName
Gets the URL name that will be used for archiving and linking the reports.- Returns:
- the URL name
-
getReportDirs
protected List<FilePath> getReportDirs(Run<?, ?> run, FilePath workspace, Launcher launcher) throws IOException, InterruptedExceptionGets the report directories either from test environment actions or downstream workspace.- Parameters:
run- the runworkspace- the workspacelauncher- the launcher- Returns:
- the report directories
- Throws:
IOException- signals that an I/O exception has occurred.InterruptedException- the interrupted exception
-
getReportFiles
protected List<FilePath> getReportFiles(Run<?, ?> run, FilePath workspace, Launcher launcher) throws IOException, InterruptedExceptionBuilds a list of TRF files for report generation. Includes the TRF files generated during separate sub-project execution.- Parameters:
run- the runworkspace- the workspacelauncher- the launcher- Returns:
- the list of report files
- Throws:
IOException- signals that an I/O exception has occurredInterruptedException- if the build gets interrupted
-
getReportFiles
protected List<FilePath> getReportFiles(String includes, String excludes, Run<?, ?> run, FilePath workspace, Launcher launcher) throws IOException, InterruptedExceptionBuilds a list of report files for report generation. Includes the report files generated during separate sub-project execution.- Parameters:
includes- the includesexcludes- the excludesrun- the runworkspace- the workspacelauncher- the launcher- Returns:
- the list of report files
- Throws:
IOException- signals that an I/O exception has occurredInterruptedException- if the build gets interrupted
-
getProjectReportFiles
protected List<FilePath> getProjectReportFiles(Run<?, ?> run, FilePath workspace, Launcher launcher) throws IOException, InterruptedExceptionBuilds a list of project report files for report generation. Includes the TRF files generated during separate sub-project execution and excludes all package report files.- Parameters:
run- the runworkspace- the workspacelauncher- the launcher- Returns:
- the list of project report files
- Throws:
IOException- signals that an I/O exception has occurredInterruptedException- if the build gets interrupted
-
getFileSize
Gets the size of given file.- Parameters:
file- the file- Returns:
- the file size
- Throws:
IOException- signals that an I/O exception has occurredInterruptedException- the interrupted exception
-
getDirectorySize
Gets the total size of given directory recursively.- Parameters:
directory- the directory- Returns:
- the directory size
- Throws:
IOException- signals that an I/O exception has occurredInterruptedException- the interrupted exception
-
randomId
Generates a random alphanumeric id to be used for linking reports.- Returns:
- the random id string
-
getRequiredMonitorService
- Specified by:
getRequiredMonitorServicein interfaceBuildStep
-
getDescriptor
- Specified by:
getDescriptorin interfaceDescribable<Publisher>- Overrides:
getDescriptorin classRecorder
-