Skip to content

Commit c5d27e5

Browse files
committed
chore: Improve action docs+processing
1 parent deed8b3 commit c5d27e5

5 files changed

Lines changed: 412 additions & 300 deletions

File tree

fcli-core/fcli-app/src/main/resources/com/fortify/cli/app/actions/build-time/ci-doc.yaml

Lines changed: 92 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -263,10 +263,10 @@ formatters:
263263
vars:
264264
- names: TOOL_DEFINITIONS
265265
desc: >-
266-
URL or file path to custom tool definitions YAML file. This fcli environment variable controls
267-
where fcli retrieves tool version information for ScanCentral Client, Debricked CLI, and other
268-
tools. Useful for air-gapped environments or when using custom tool repositories. When set,
269-
fcli will use the specified tool definitions instead of downloading from the default GitHub location.
266+
Supporting tools like ScanCentral Client or Debricked CLI are by default downloaded from the URLs
267+
defined in the link:https://github.com/fortify/tool-definitions/tree/main/v1[default Fortify tool definitions].
268+
For airgapped environments, point this environment variable to an internally hosted custom tool definitions zip
269+
file to download these tools from an internal mirror.
270270
fod:
271271
- title: Authentication & Connection
272272
fragment: session
@@ -586,7 +586,9 @@ formatters:
586586
component: fortifySetup
587587
version: v2.1.x
588588
overview: |
589-
These environment variables control tool installation and initialization.
589+
The environment variables in this section allow you to customize bootstrapping behavior
590+
of fcli and supporting tools like ScanCentral Client. Note that this GitHub Action requires
591+
at least fcli v3.15.0 to function correctly.
590592
outputs:
591593
setup:
592594
filePattern: setup-action.adoc
@@ -596,7 +598,31 @@ formatters:
596598
title: fortify/github-action/setup
597599
description: Bootstrap fcli and Fortify tools for custom CI/CD workflows.
598600
overview: |
599-
This GitHub Action provides a setup component that bootstraps fcli and other Fortify tools for use in custom CI/CD workflows. This allows you to implement fully customized AST scan workflows or other automation workflows that interact with Fortify products.
601+
The `fortify/github-action/setup` action allows for setting up fcli and various other Fortify tools for use in custom CI/CD workflows.
602+
This allows you to implement fully customized AST scan workflows or other automation workflows that interact with Fortify products.
603+
604+
The Fortify tools to be installed are specified through action inputs, whereas optional bootstrapping behavior for fcli and supporting
605+
tools can be controlled through environment variables.
606+
607+
## Migrating from fortify/github-action/setup@v2
608+
609+
The `fortify/github-action/setup@v3` action supports the same action inputs as v2.x.y versions, so migrating should be straightforward.
610+
However, bootstrapping behavior for fcli has changed; please review the following table for details:
611+
612+
[cols="1,1,2", options="header"]
613+
|===
614+
|fortify/github-action/setup@v2
615+
|fortify/github-action/setup@v3
616+
|Recommended Action
617+
618+
|Undocumented `fcli: action_default` input to use internal, pinned fcli version
619+
|Documented `fcli: bootstrapped` input to use bootstrapped fcli version
620+
|Use `fcli: bootstrapped` to leverage bootstrapped fcli version based on `FCLI_BOOTSTRAP_*` environment variables, to avoid download of multiple fcli versions
621+
622+
|Uses `TOOL_DEFINITIONS` for fcli bootstrapping
623+
|Uses dedicated `FCLI_BOOTSTRAP_*` environment variables for fcli bootstrapping
624+
|If you used custom tool definitions with custom fcli download URLs, you'll need to configure `FCLI_BOOTSTRAP_URL` to point to the appropriate URL
625+
|===
600626
samples:
601627
quickstart:
602628
title: Quick Start Example
@@ -611,13 +637,17 @@ formatters:
611637
steps:
612638
- uses: actions/checkout@v4
613639
- uses: fortify/github-action/setup@v3
640+
with:
641+
fcli: bootstrapped # Set up bootstrapped fcli version. May also specify specific version, but
642+
# then fcli may be downloaded twice (bootstrap version and requested version).
643+
614644
env:
615-
FCLI_BOOTSTRAP_VERSION: v3.5.0 # Pin to specific version for stability
645+
FCLI_BOOTSTRAP_VERSION: v3.15.0 # Defaults to latest v3.x.y, pin to specific version for stability
616646
- name: Run custom fcli commands
617647
run: |
618-
fcli fod session login
648+
fcli fod session login ...
619649
# Your custom workflow here
620-
fcli fod session logout
650+
fcli fod session logout ...
621651
ciDocs:
622652
filePattern: ast-action-{product}.adoc
623653
formatter: ciSystemFullDoc
@@ -626,20 +656,44 @@ formatters:
626656
title: fortify/github-action
627657
description: Run OpenText Application Security Testing (AST) scans in GitHub Actions workflows
628658
overview:
629-
fod: |
630-
This GitHub Action provides seamless integration of ${productNames.fod}
631-
for automated Application Security Testing (AST) into your CI/CD
632-
workflows. The action leverages the ciOutputRef:setup action to set up
633-
fcli, then executes the fcli actionRef:generic:ci action to run the requested scans and
634-
related tasks, providing a unified yet customizable experience across your AST scan workflows
635-
on GitHub and other CI systems.
636-
ssc: |
637-
This GitHub Action provides seamless integration of ${productNames.ssc}
659+
shared: |
660+
This GitHub Action provides seamless integration of $eval{fortifyProductName}
638661
for automated Application Security Testing (AST) into your CI/CD
639662
workflows. The action leverages the ciOutputRef:setup action to set up
640663
fcli, then executes the fcli actionRef:generic:ci action to run the requested scans and
641664
related tasks, providing a unified yet customizable experience across your AST scan workflows
642665
on GitHub and other CI systems.
666+
667+
## Migrating from fortify/github-action@v2
668+
669+
Migrating from v2.x.y to v3.x.y versions of the `fortify/github-action` should be fairly
670+
straightforward, as most of the environment-based configuration remains the same. However,
671+
there are some important changes to be aware of:
672+
673+
[cols="1,1,2", options="header"]
674+
|===
675+
|fortify/github-action@v2
676+
|fortify/github-action@v3
677+
|Recommended Action
678+
679+
|Pinned to specific fcli release
680+
|Uses latest fcli v3.x.y release by default
681+
|Set `FCLI_BOOTSTRAP_VERSION` if you prefer stability over latest features
682+
683+
|Uses action inputs to specify scan types (e.g., `sast-scan: true`)
684+
|Uses environment variables (e.g., `DO_SAST_SCAN`)
685+
|Update workflow to use environment variables for scan configuration
686+
687+
|Supports deprecated `EXTRA_*_OPTS` variables
688+
|Only supports `*_EXTRA_OPTS` variables
689+
|Rename all `EXTRA_*_OPTS` to `*_EXTRA_OPTS` format
690+
691+
|Uses custom scripts for AST scan workflow
692+
|Uses standardized fcli `ci` action
693+
|Review environment variables against this documentation; behavior should be similar but variable names may differ slightly
694+
|===
695+
fod: $eval{outputDocMeta.overview.shared}
696+
ssc: $eval{outputDocMeta.overview.shared}
643697
samples:
644698
fod:
645699
quickstart:
@@ -723,31 +777,27 @@ formatters:
723777
envVarDescriptions:
724778
- names: FCLI_BOOTSTRAP_VERSION
725779
desc: >-
726-
Fcli version to bootstrap (e.g., 'v3', 'v3.14', 'v3.14.1', or without 'v' prefix: '3.14.1').
727-
When set to a full major.minor.patch version, GitHub Actions will use RUNNER_TOOL_CACHE for
728-
persistent caching across workflow runs. Partial versions (e.g., 'v3') or unset will use
729-
RUNNER_TEMP for job-specific temporary storage. Ignored if FCLI_BOOTSTRAP_URL is set.
780+
By default, the latest link:https://github.com/fortify/fcli/releases/v3[fcli v3.x.y release] is used for running the
781+
fcli-provided ci workflow, allowing you to always benefit from the latest features and fixes. If you prefer stability
782+
over automatic updates, you can pin to a specific minor or patch release like v3.15 or v3.15.0 by setting this
783+
environment variable to the desired version. Likewise, you can set this variable to an fcli
784+
link:https://github.com/fortify/fcli/releases?q=prerelease%3Atrue[pre-release tag] like `dev_v3.x` to experiment
785+
with upcoming changes provided by an fcli development version.
730786
- names: FCLI_BOOTSTRAP_PATH
731787
desc: >-
732-
Path to a pre-installed fcli executable. When set, fcli bootstrapping will use this binary instead
733-
of downloading fcli. The specified fcli must be version 3.14.0 or later. This allows CI integrations
734-
to control which fcli version is used and skip the download/verification process.
788+
Path to a pre-installed fcli executable. When set, fcli bootstrapping will use this binary instead of downloading fcli.
735789
- names: FCLI_BOOTSTRAP_URL
736790
desc: >-
737-
Custom URL for downloading the fcli archive. When set, this overrides FCLI_BOOTSTRAP_VERSION and
738-
the default GitHub release URL. Useful for air-gapped environments or internal mirrors. The URL
739-
should point to a platform-specific fcli archive (e.g., `fcli-linux.tgz`, `fcli-windows.zip`,
740-
`fcli-mac.tgz`).
791+
By default, fcli is downloaded from the official GitHub releases page. This environment variable allows you to specify a
792+
custom URL, for example pointing to an internal mirror in air-gapped environments. In those cases, you'll likely also
793+
want to set `TOOL_DEFINITIONS` to point to a custom tool definitions file to allow for downloading supporting tools
794+
like ScanCentral Client from the internal mirror.
741795
- names: FCLI_BOOTSTRAP_RSA_SHA256_URL
742796
desc: >-
743-
Custom URL for the fcli RSA SHA256 signature file. When set, this overrides the default signature
744-
URL (which is `FCLI_BOOTSTRAP_URL` + `.rsa_sha256`). Required when using a custom `FCLI_BOOTSTRAP_URL`
745-
with signature verification enabled.
797+
Custom URL for the fcli RSA SHA256 signature file. Defaults to `<FCLI_BOOTSTRAP_URL>.rsa_sha256`.
746798
- names: FCLI_BOOTSTRAP_VERIFY_SIGNATURE
747799
desc: >-
748-
Controls whether RSA SHA256 signature verification is performed when downloading fcli. Set to `false`
749-
to skip verification (not recommended). By default, signature verification is enabled to ensure
750-
the downloaded fcli binary has not been tampered with.
800+
Set to `false` to skip verification (not recommended) of the fcli download.
751801
752802
# ============================================================================
753803
# GENERIC DOCUMENT TEMPLATES (Stable structure)
@@ -869,7 +919,7 @@ formatters:
869919
870920
textCell:
871921
Environment Variable: ${(envVar.realNode!=null?envVar.realNode:envVar).names}
872-
Description: "${#docRenderer().text().render((envVar.realNode!=null?envVar.realNode:envVar).desc)}"
922+
Description: "${#action.docRenderer().text().render((envVar.realNode!=null?envVar.realNode:envVar).desc)}"
873923

874924
asciiDocTable: |
875925
[%autowidth]
@@ -881,12 +931,12 @@ formatters:
881931
882932
asciiDocCell: |
883933
|${(envVar.realNode!=null?envVar.realNode:envVar).names.replaceAll('\\n', ' +\\\\n')}
884-
|${#docRenderer().asciidoc().currentProduct(product).render((envVar.realNode!=null?envVar.realNode:envVar).desc.replaceAll('\\n', ' +\\\\n'))}
934+
|${#action.docRenderer().asciidoc().currentProduct(product).render((envVar.realNode!=null?envVar.realNode:envVar).desc.replaceAll('\\n', ' +\\\\n'))}
885935
886936
asciiDocConfigSection: |
887937
=== ${sectionDef.title}
888938
889-
${#docRenderer().asciidoc().currentProduct(product).render(sectionDef.overview)}
939+
${#action.docRenderer().asciidoc().currentProduct(product).render(sectionDef.overview)}
890940
891941
[%autowidth]
892942
|===
@@ -898,7 +948,7 @@ formatters:
898948
${sectionDef.title}
899949
${'='.repeat(sectionDef.title.length())}
900950
901-
${#docRenderer().text().render(sectionDef.overview)}
951+
${#action.docRenderer().text().render(sectionDef.overview)}
902952
903953
${textTable}
904954
@@ -1119,7 +1169,7 @@ steps:
11191169
ciSystemDef: ${versionEntry.value}
11201170
setupDef: ${setupComponents[ciSystemDef.setup.component][ciSystemDef.setup.version]}
11211171
setupVersion: ${ciSystemDef.setup.version}
1122-
setupOverview: ${#docRenderer().asciidoc().ciContext(ciSystem, ciVersion, ciSystemDef.outputs).render(ciSystemDef.setup.overview)}
1172+
setupOverview: ${#action.docRenderer().asciidoc().ciContext(ciSystem, ciVersion, ciSystemDef.outputs).render(ciSystemDef.setup.overview)}
11231173

11241174
# Process each output type defined for this CI system version
11251175
- records.for-each:
@@ -1138,7 +1188,7 @@ steps:
11381188
outputFile: "${outputDef.filePattern.replaceAll('\\{ciSystem\\}', ciSystem).replaceAll('\\{version\\}', ciVersion)}"
11391189
fortifyProductName: ""
11401190
docTitle: ${outputDocMeta.title}
1141-
docOverview: ${#docRenderer().asciidoc().ciContext(ciSystem, ciVersion, ciSystemDef.outputs).render(outputDocMeta.overview)}
1191+
docOverview: ${#action.docRenderer().asciidoc().ciContext(ciSystem, ciVersion, ciSystemDef.outputs).render(outputDocMeta.overview)}
11421192

11431193
# Build sample sections if samples defined
11441194
- var.rm: [sampleSections]
@@ -1183,7 +1233,7 @@ steps:
11831233
module: ${product}
11841234
outputFile: "${outputDef.filePattern.replaceAll('\\{ciSystem\\}', ciSystem).replaceAll('\\{version\\}', ciVersion).replaceAll('\\{product\\}', product)}"
11851235
docTitle: ${outputDocMeta.title}
1186-
docOverview: ${#docRenderer().asciidoc().ciContext(ciSystem, ciVersion, ciSystemDef.outputs).currentProduct(product).render(outputDocMeta.overview[product])}
1236+
docOverview: ${#action.docRenderer().asciidoc().ciContext(ciSystem, ciVersion, ciSystemDef.outputs).currentProduct(product).render(outputDocMeta.overview[product])}
11871237

11881238
# Build sample sections for this product
11891239
- var.rm: [sampleSections]

fcli-core/fcli-common/src/main/java/com/fortify/cli/common/action/runner/ActionRunner.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public final Integer _run(String[] args) {
6060
var parameterValues = getParameterValues(args);
6161
try ( var ctx = createContext(progressWriter, parameterValues) ) {
6262
initializeCheckStatuses(ctx);
63-
ActionRunnerVars vars = new ActionRunnerVars(ctx.getSpelEvaluator(), ctx.getParameterValues());
63+
ActionRunnerVars vars = ctx.getVars();
6464
try {
6565
new ActionStepProcessorSteps(ctx, vars, config.getAction().getSteps()).process();
6666
} finally {

fcli-core/fcli-common/src/main/java/com/fortify/cli/common/action/runner/ActionRunnerContext.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
import lombok.Getter;
4444
import lombok.RequiredArgsConstructor;
4545
import lombok.Setter;
46+
import lombok.experimental.Accessors;
4647

4748
/**
4849
* This class holds action execution context
@@ -70,6 +71,8 @@ public class ActionRunnerContext implements AutoCloseable {
7071
/** Factory for creating the single {@link ISpelEvaluator} instance. By using a factory, we can
7172
* check for illegal access to the {@link ISpelEvaluator} during configuration phase. */
7273
@Getter(AccessLevel.NONE) private final ActionConfigSpelEvaluatorFactory spelEvaluatorFactory = new ActionConfigSpelEvaluatorFactory(this);
74+
/** Lazy-initialized action variables instance. Created on first access using context's spelEvaluator and parameterValues */
75+
@Getter(lazy=true) @Accessors(fluent=false) private final ActionRunnerVars vars = new ActionRunnerVars(getSpelEvaluator(), parameterValues);
7376

7477
public final ActionRunnerContext initialize() {
7578
config.getActionContextConfigurers().forEach(configurer->configurer.accept(this));

0 commit comments

Comments
 (0)