Class Scanner
java.lang.Object
org.jenkinsci.plugins.cortexcloud.scanner.Scanner
- Direct Known Subclasses:
ImageScanner
Abstract base for Cortex CLI scanners.
This is the integration-layer analogue of the legacy plugin's Scanner: it
provisions the CLI, assembles the command, launches it on the build node via
the Jenkins Launcher, and turns the result into a ScanOutcome. The key
differences from the legacy implementation reflect the Cortex CLI contract:
- Authentication is injected as environment variables (CORTEX_API_BASE_URL,
CORTEX_API_KEY, CORTEX_API_KEY_ID) rather than a Base64 basic-auth blob.
- Gating is driven by the process exit code, not by re-deriving pass/fail from
the JSON, so it works even on CLI versions that don't emit JSON.
Subclasses build the concrete argument list (e.g. image scan) via buildCommand.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuildCommand(String cliPath) Builds the concrete CLI argument list given the resolved CLI path.protected abstract StringHuman-readable description of what is being scanned (for logs).protected abstract IntegerTimeout in seconds for the scan process, or null/non-positive for none.protected voidrun()Provisions the CLI, runs the scan, and returns its outcome.
-
Field Details
-
run
-
workspace
-
launcher
-
listener
-
config
-
-
Constructor Details
-
Scanner
protected Scanner(Run<?, ?> run, FilePath workspace, Launcher launcher, TaskListener listener, Config config)
-
-
Method Details
-
buildCommand
protected abstract List<String> buildCommand(String cliPath) throws IOException, InterruptedException Builds the concrete CLI argument list given the resolved CLI path. The first element must be the CLI executable path.- Throws:
IOExceptionInterruptedException
-
describeTarget
Human-readable description of what is being scanned (for logs). -
getTimeoutSeconds
Timeout in seconds for the scan process, or null/non-positive for none. -
run
Provisions the CLI, runs the scan, and returns its outcome.- Throws:
IOException- on I/O failureInterruptedException- if the build is aborted
-
log
-