Class BaseFiniteStateRecorder

All Implemented Interfaces:
ExtensionPoint, Describable<Publisher>, BuildStep, SimpleBuildStep
Direct Known Subclasses:
FiniteStateAnalyzeBinaryRecorder, FiniteStateSBOMImportRecorder, FiniteStateThirdPartyImportRecorder

public abstract class BaseFiniteStateRecorder extends Recorder implements SimpleBuildStep
Abstract base class for all Finite State recorders. Contains common functionality shared across different analysis types.

All analysis runs through the public v0 REST API, described per analysis type via configureRequest(FiniteStateScanRequest) and driven by FiniteStateExecutionFramework. Binary uploads use the mb-api upload façade (POST /scans/upload), a single contract served by both the legacy backend (natively) and the current backend (as a façade), so one published plugin works against either backend with no job configuration change. See HELIX-422.

  • Field Details

    • DEFAULT_POLL_TIMEOUT_MINUTES

      public static final int DEFAULT_POLL_TIMEOUT_MINUTES
      Default poll timeout (minutes) when waiting for scan completion (FR-7).
      See Also:
    • subdomain

      protected String subdomain
    • apiTokenCredentialsId

      protected String apiTokenCredentialsId
    • projectName

      protected String projectName
    • projectVersion

      protected String projectVersion
    • externalizableId

      protected Boolean externalizableId
    • preRelease

      protected Boolean preRelease
    • waitForCompletion

      protected Boolean waitForCompletion
    • pollTimeoutMinutes

      protected Integer pollTimeoutMinutes
  • Constructor Details

    • BaseFiniteStateRecorder

      protected BaseFiniteStateRecorder()
  • Method Details

    • getSubdomain

      public String getSubdomain()
    • getApiTokenCredentialsId

      public String getApiTokenCredentialsId()
    • getProjectName

      public String getProjectName()
    • getProjectVersion

      public String getProjectVersion()
    • getExternalizableId

      public boolean getExternalizableId()
    • getPreRelease

      public boolean getPreRelease()
    • getWaitForCompletion

      public boolean getWaitForCompletion()
    • getPollTimeoutMinutes

      public int getPollTimeoutMinutes()
    • setSubdomain

      public void setSubdomain(String subdomain)
    • setApiTokenCredentialsId

      @DataBoundSetter public void setApiTokenCredentialsId(String apiTokenCredentialsId)
      Setter to allow Pipeline usage like: apiTokenCredentialsId: 'my-secret-text-id'
    • setProjectName

      public void setProjectName(String projectName)
    • setProjectVersion

      @DataBoundSetter public void setProjectVersion(String projectVersion)
    • 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)
    • getFileFromWorkspace

      protected FilePath getFileFromWorkspace(FilePath workspace, String relativeFilePath, TaskListener listener) throws IOException, InterruptedException
      Get file from workspace - common utility method (pipeline and freestyle)
      Throws:
      IOException
      InterruptedException
    • getSecretTextValue

      protected String getSecretTextValue(Run<?,?> run, String credentialId)
      Get secret values from credentials - common utility method (pipeline and freestyle)
    • parseVersion

      protected String parseVersion(Run<?,?> run, String projectVersion)
      Parse version based on externalizableId setting
    • validateCommonFields

      protected boolean validateCommonFields(TaskListener listener)
      Validate common required fields
    • logCommonInfo

      protected void logCommonInfo(Run<?,?> run, TaskListener listener, String filePath)
      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

      protected abstract void configureRequest(FiniteStateScanRequest request)
      Populate the type-specific portion of the scan request (kind + per-analysis fields) for the public v0 REST transport. The framework fills the common fields (subdomain, token, project, version, polling, etc.).
    • getAnalysisType

      protected abstract String getAnalysisType()
      Get the analysis type name for logging and results
    • getFilePathFieldName

      protected abstract String getFilePathFieldName()
      Get the file path field name for validation
    • getFilePathValue

      protected abstract String getFilePathValue()
      Get the file path value
    • perform

      public void perform(Run<?,?> run, FilePath workspace, EnvVars env, Launcher launcher, TaskListener listener) throws InterruptedException, IOException
      Preferred entry point including environment variables. Marks build as failed on error.
      Specified by:
      perform in interface SimpleBuildStep
      Throws:
      InterruptedException
      IOException