Package io.jenkins.plugins.finitestate
Class BaseFiniteStateRecorder
java.lang.Object
hudson.tasks.BuildStepCompatibilityLayer
hudson.tasks.Publisher
hudson.tasks.Recorder
io.jenkins.plugins.finitestate.BaseFiniteStateRecorder
- All Implemented Interfaces:
ExtensionPoint,Describable<Publisher>,BuildStep,SimpleBuildStep
- Direct Known Subclasses:
FiniteStateAnalyzeBinaryRecorder,FiniteStateSBOMImportRecorder,FiniteStateThirdPartyImportRecorder
Abstract base class for all Finite State recorders.
Contains common functionality shared across different analysis types.
-
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
FieldsModifier and TypeFieldDescriptionprotected Stringprotected Booleanprotected Booleanprotected Stringprotected Stringprotected StringFields inherited from interface hudson.tasks.BuildStep
BUILDERS, PUBLISHERS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddConsolidatedResult(Run<?, ?> run, String analysisType, String projectName, String consoleOutput, String status, String url) Add result to consolidated results actionprotected String[]buildCLTEnvironment(String apiToken) Build the environment variables required by the CLT for authentication and domain routing.protected abstract intexecuteAnalysis(FilePath cltPath, FilePath filePath, String projectName, String projectVersion, String apiToken, FilePath workspace, Launcher launcher, TaskListener listener) Abstract method for executing the specific analysisprotected abstract StringGet the analysis type name for logging and resultsprotected FilePathgetCLTPath(FilePath workspace, String subdomain, String apiToken, TaskListener listener) Get CLT path using the shared CLTManagerbooleanprotected FilePathgetFileFromWorkspace(FilePath workspace, String relativeFilePath, TaskListener listener) Get file from workspace - common utility method (pipeline and freestyle)protected abstract StringGet the file path field name for validationprotected abstract StringGet the file path valuebooleanprotected StringgetSecretTextValue(Run<?, ?> run, String credentialId) Get secret values from credentials - common utility method (pipeline and freestyle)protected voidlogCommonInfo(Run<?, ?> run, TaskListener listener, String filePath) Log common informationprotected StringparseVersion(Run<?, ?> run, String projectVersion) Parse version based on externalizableId settingvoidPreferred entry point including environment variables.voidsetApiTokenCredentialsId(String apiTokenCredentialsId) Setter to allow Pipeline usage like: apiTokenCredentialsId: 'my-secret-text-id'voidsetExternalizableId(boolean externalizableId) voidsetPreRelease(boolean preRelease) voidsetProjectName(String projectName) voidsetProjectVersion(String projectVersion) voidsetSubdomain(String subdomain) protected booleanvalidateCommonFields(TaskListener listener) Validate common required fieldsMethods inherited from class hudson.tasks.Recorder
getDescriptorMethods 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, getRequiredMonitorService, perform, prebuildMethods inherited from interface jenkins.tasks.SimpleBuildStep
perform, perform, requiresWorkspace
-
Field Details
-
subdomain
-
apiTokenCredentialsId
-
projectName
-
projectVersion
-
externalizableId
-
preRelease
-
-
Constructor Details
-
BaseFiniteStateRecorder
protected BaseFiniteStateRecorder()
-
-
Method Details
-
getSubdomain
-
getApiTokenCredentialsId
-
getProjectName
-
getProjectVersion
-
getExternalizableId
public boolean getExternalizableId() -
getPreRelease
public boolean getPreRelease() -
setSubdomain
-
setApiTokenCredentialsId
Setter to allow Pipeline usage like: apiTokenCredentialsId: 'my-secret-text-id' -
setProjectName
-
setProjectVersion
-
setExternalizableId
@DataBoundSetter public void setExternalizableId(boolean externalizableId) -
setPreRelease
@DataBoundSetter public void setPreRelease(boolean preRelease) -
getFileFromWorkspace
protected FilePath getFileFromWorkspace(FilePath workspace, String relativeFilePath, TaskListener listener) throws IOException, InterruptedException Get file from workspace - common utility method (pipeline and freestyle)- Throws:
IOExceptionInterruptedException
-
getSecretTextValue
Get secret values from credentials - common utility method (pipeline and freestyle) -
getCLTPath
protected FilePath getCLTPath(FilePath workspace, String subdomain, String apiToken, TaskListener listener) throws IOException, InterruptedException Get CLT path using the shared CLTManager- Throws:
IOExceptionInterruptedException
-
parseVersion
Parse version based on externalizableId setting -
validateCommonFields
Validate common required fields -
logCommonInfo
Log common information -
addConsolidatedResult
protected void addConsolidatedResult(Run<?, ?> run, String analysisType, String projectName, String consoleOutput, String status, String url) Add result to consolidated results action -
buildCLTEnvironment
Build the environment variables required by the CLT for authentication and domain routing. -
executeAnalysis
protected abstract int executeAnalysis(FilePath cltPath, FilePath filePath, String projectName, String projectVersion, String apiToken, FilePath workspace, Launcher launcher, TaskListener listener) throws IOException, InterruptedException Abstract method for executing the specific analysis- Throws:
IOExceptionInterruptedException
-
getAnalysisType
Get the analysis type name for logging and results -
getFilePathFieldName
Get the file path field name for validation -
getFilePathValue
Get the file path value -
perform
public void perform(Run<?, ?> run, FilePath workspace, EnvVars env, Launcher launcher, TaskListener listener) throws InterruptedException, IOExceptionPreferred entry point including environment variables. Marks build as failed on error.- Specified by:
performin interfaceSimpleBuildStep- Throws:
InterruptedExceptionIOException
-