Overview
The Fortify fcli component allows for setting up fcli for use in custom CI/CD workflows in GitLab. This allows you to implement fully customized AST scan workflows or other automation workflows that interact with Fortify products.
The GitLab integration consists of two components:
-
Fortify fcli component - Provides fcli installation and setup functionality. This component allows for setting up fcli for use in custom CI/CD workflows.
-
Fortify AST Scan component - Provides complete AST scanning workflow by including the fcli component and adding scan execution jobs.
The fcli component provides the following runnable jobs:
-
<job-name>-prepare: Download and install fcli -
<job-name>: Run arbitrary fcli commands from the jobscriptsection
In addition, several hidden jobs are defined (e.g., .<job-name>-vars-shared, .<job-name>-vars,
.<job-name>-vars-prepare, .fcli-install) which may be used to implement advanced use cases but
should not be directly customized.
Quick Start Example
Basic setup for custom workflows with fcli version pinning.
include:
- component: $CI_SERVER_FQDN/Fortify/components/fcli/linux@2
inputs:
job-name: fcli
fcli-version: v3 # Use latest fcli 3.x.y release
stage: test
stages: [test]
fcli:
image: my-build-tools:v1 # Optional: specify build environment
script:
- ${FCLI} -V # Verify fcli installation
- ${FCLI} fod session login ...
- # Your custom fcli commands here
- ${FCLI} fod session logout ...
Tips & Recommendations
Air-Gapped Environments
For air-gapped or restricted network environments, host custom tool definitions and tool bundles in an internal SCM repository or artifact registry. Configure the integration to use these internal resources:
-
Set
TOOL_DEFINITIONSto point to your internally hosted tool definitions file -
Set
FCLI_TGZ_URLto download fcli from your internal mirror
This ensures all required tools are accessible without external internet access.
Configuration
Component Inputs
The following component inputs can be specified when including the fcli component:
| Input | Description | Default |
|---|---|---|
|
Job name for the fcli script. This must be a valid file system path name and will be used to name the component-provided jobs. |
|
|
GitLab CI/CD stage in which to run the jobs provided by this component. This stage must be defined in your pipeline’s |
Required, no default |
|
Fcli version to install/use. Supports semantic versioning (e.g., |
|
Setup & Bootstrap
The environment variables in this section allow you to customize bootstrapping behavior
of fcli and supporting tools like ScanCentral Client. These variables can be configured
on the <job-name>-prepare job as needed.
|
Note
|
This GitLab Component requires a recent fcli v3.x.y version to function properly. |
Environment Variable |
Description |
FCLI_TGZ_URL |
By default, fcli is downloaded from the official GitHub releases page at |
FCLI_RSA_SHA256_URL |
URL for the fcli RSA SHA256 signature file. Defaults to |
FCLI |
Path to a pre-installed fcli executable. When set on the |
TOOL_DEFINITIONS |
Supporting tools like ScanCentral Client or Debricked CLI are by default downloaded from the URLs defined in the default Fortify tool definitions. For airgapped environments, point this environment variable to an internally hosted custom tool definitions zip file to download these tools from an internal mirror. |
PREINSTALLED |
Set to |
Advanced Customization
Customizing the <job-name> Job
By default, <job-name> will just run ${FCLI} -V to verify the fcli installation. You’ll typically want to define
a custom script section that runs fcli and other commands as needed. For Docker-based runners, you’ll usually also
want to define the image in which the script section is executed:
<job-name>:
image: my-build-tools:v1 # Optional: specify Docker image
script:
- ${FCLI} fod session login ...
- # Your custom fcli commands here
- ${FCLI} fod session logout ...
If needed, you can also customize the needs, variables, and/or extends instructions. If you override needs
or extends, make sure to keep the original contents:
<job-name>:
extends:
- .<job-name>-vars # Required: inherit fcli-related variables
- .my-custom-vars # Optional: inherit additional variables
variables:
MY_VAR: value # Optional: define extra variables
needs:
- <job-name>-prepare # Required: wait for fcli installation
- some-other-job # Optional: wait for other jobs
script:
- # Your commands here
Customizing the <job-name>-prepare Job
The <job-name>-prepare job can be customized to perform additional preparation tasks beyond fcli installation.
You can define additional script steps, optionally based on additional variables:
<job-name>-prepare:
extends:
- .<job-name>-vars-prepare # Required: inherit fcli installation variables
- .my-custom-vars # Optional: inherit additional variables
variables:
MY_VAR: value # Optional: define extra variables
script:
- !reference [ .fcli-install, script ] # Required: install fcli
- echo "Additional preparation steps" # Optional: your custom steps
Any artifacts that need to be shared with the main <job-name> job must be stored under the directory
identified by the ${FORTIFY_DIR} environment variable.
You can also customize the Docker image used for the preparation job. By default, alpine:latest is used:
<job-name>-prepare:
image: my.registry/alpine:latest # Use custom registry or different image
Using Multiple Component Configurations
You can include the fcli component multiple times with different configurations, as long as each include
specifies a different job-name. This allows for using multiple fcli versions within a single pipeline.
Each include must use the same component version to avoid conflicts.
include:
- component: $CI_SERVER_FQDN/Fortify/components/fcli/linux@2
inputs:
job-name: fcli-stable
fcli-version: v3.15.0
stage: test
- component: $CI_SERVER_FQDN/Fortify/components/fcli/linux@2
inputs:
job-name: fcli-dev
fcli-version: dev_v3.x
stage: test
fcli-stable:
script:
- ${FCLI} -V
fcli-dev:
script:
- ${FCLI} -V