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.
The plugin supports two transports, selected per build step via getPlatform():
- "legacy" (default) — the legacy platform: download and exec the Java CLT jar. Kept so existing jobs keep working unchanged after upgrading the plugin.
- "2026" — the 2026 platform release: direct calls to the public v0
REST API, described via
configureRequest(FiniteStateScanRequest).
FiniteStateExecutionFramework inspects the selected platform and drives the matching
flow. The default is the legacy platform so that a job saved before this field existed (no
platform in its persisted XML) deserializes to the legacy behavior — an upgrade never
silently retargets a job at the 2026 REST API. See HELIX-422.
-
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 Stringstatic final intDefault poll timeout (minutes) when waiting for scan completion (FR-7).protected Booleanprotected Stringstatic final String2026 platform release transport (direct public v0 REST API).static final StringLegacy platform transport (Java CLT jar download-and-exec).protected Integerprotected Booleanprotected Stringprotected Stringprotected Stringprotected BooleanFields 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 a minimal result (error/validation paths that have no scan metadata yet).protected voidaddConsolidatedResult(Run<?, ?> run, String analysisType, String projectName, String consoleOutput, String status, String url, String scanIds, String scanStatus) Add a successful/structured result (with scan metadata) to the consolidated results action.protected String[]buildCLTEnvironment(String apiToken) Build the environment variables required by the CLT for authentication and domain routing (legacy platform transport only).protected abstract voidconfigureRequest(FiniteStateScanRequest request) Populate the type-specific portion of the scan request (kind + per-analysis fields), used by the 2026 platform's v0 REST transport.protected abstract intexecuteAnalysis(FilePath cltPath, FilePath filePath, String projectName, String projectVersion, String apiToken, FilePath workspace, Launcher launcher, TaskListener listener) Execute the analysis via the legacy platform's CLT transport.protected 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 CLTManager (legacy platform transport only).booleanprotected 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 valueSelected transport.intbooleanprotected StringgetSecretTextValue(Run<?, ?> run, String credentialId) Get secret values from credentials - common utility method (pipeline and freestyle)booleanbooleanTrue when this step targets the 2026 platform's public v0 REST API instead of the legacy CLT.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) voidsetPlatform(String platform) voidsetPollTimeoutMinutes(int pollTimeoutMinutes) voidsetPreRelease(boolean preRelease) voidsetProjectName(String projectName) voidsetProjectVersion(String projectVersion) voidsetSubdomain(String subdomain) voidsetWaitForCompletion(boolean waitForCompletion) 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
-
DEFAULT_POLL_TIMEOUT_MINUTES
public static final int DEFAULT_POLL_TIMEOUT_MINUTESDefault poll timeout (minutes) when waiting for scan completion (FR-7).- See Also:
-
PLATFORM_LEGACY
Legacy platform transport (Java CLT jar download-and-exec). Default for backward compatibility.- See Also:
-
PLATFORM_2026
2026 platform release transport (direct public v0 REST API).- See Also:
-
subdomain
-
apiTokenCredentialsId
-
projectName
-
projectVersion
-
externalizableId
-
preRelease
-
waitForCompletion
-
pollTimeoutMinutes
-
platform
-
-
Constructor Details
-
BaseFiniteStateRecorder
protected BaseFiniteStateRecorder()
-
-
Method Details
-
getSubdomain
-
getApiTokenCredentialsId
-
getProjectName
-
getProjectVersion
-
getExternalizableId
public boolean getExternalizableId() -
getPreRelease
public boolean getPreRelease() -
getWaitForCompletion
public boolean getWaitForCompletion() -
getPollTimeoutMinutes
public int getPollTimeoutMinutes() -
getPlatform
Selected transport. Defaults toPLATFORM_LEGACYwhen unset (including jobs whose persisted config predates this field), so upgrading the plugin never changes an existing job's behavior. -
isRestApi
public boolean isRestApi()True when this step targets the 2026 platform's public v0 REST API instead of the legacy CLT. -
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) -
setWaitForCompletion
@DataBoundSetter public void setWaitForCompletion(boolean waitForCompletion) -
setPollTimeoutMinutes
@DataBoundSetter public void setPollTimeoutMinutes(int pollTimeoutMinutes) -
setPlatform
-
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 (legacy platform transport only).- Throws:
IOExceptionInterruptedException
-
buildCLTEnvironment
Build the environment variables required by the CLT for authentication and domain routing (legacy platform transport only). -
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, String scanIds, String scanStatus) Add a successful/structured result (with scan metadata) to the consolidated results action. -
addConsolidatedResult
protected void addConsolidatedResult(Run<?, ?> run, String analysisType, String projectName, String consoleOutput, String status, String url) Add a minimal result (error/validation paths that have no scan metadata yet). -
configureRequest
Populate the type-specific portion of the scan request (kind + per-analysis fields), used by the 2026 platform's v0 REST transport. The framework fills the common fields (subdomain, token, project, version, polling, etc.). -
executeAnalysis
protected abstract int executeAnalysis(FilePath cltPath, FilePath filePath, String projectName, String projectVersion, String apiToken, FilePath workspace, Launcher launcher, TaskListener listener) throws IOException, InterruptedException Execute the analysis via the legacy platform's CLT transport. Invoked byFiniteStateExecutionFrameworkonly whenisRestApi()isfalse.- Returns:
- CLT process exit code (0 = success, 1 = completed with findings, other = error)
- 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
-