| copyright |
|
||
|---|---|---|---|
| lastupdated | 2024-08-09 | ||
| keywords | DevSecOps, doi publish | ||
| subcollection | devsecops |
{{site.data.keyword.attribute-definition-list}}
{: #check-evidence-for-reuse}
The check-evidence-for-reuse script is used to determine if evidence can be reused based on the provided parameters. This script is a wrapper around the cocoa locker evidence reuse CLI command.
{: #check-evidence-reuse-cli-architecture}
The check-evidence-for-reuse functionality is available through two interfaces:
- Shell Script Wrapper (
check-evidence-for-reuse): Simplified interface for pipeline scripts - Direct CLI Command (
cocoa locker evidence reuse): Native CLI interface with full feature access
{: #check-evidence-reuse-version-toggle}
The shell script uses the same version toggle as collect-evidence via the collect-evidence-version environment property:
| Version | Implementation | Status | Description |
|---|---|---|---|
v1 |
Legacy | Available | Original implementation with full backward compatibility |
v2 |
CLI-based | Default | Modern implementation that wraps cocoa locker evidence reuse CLI command |
To use the new CLI-based implementation, set the environment property in your pipeline:
collect-evidence-version=v2{: codeblock}
{: #check-evidence-reuse-shell-usage}
-
--tool-typeID of the tool that provides evidence data. Examples: "owasp-zap-ui", "cra". -
--evidence-typeID of the evidence type. Examples: "com.ibm.cloud.image_vulnerability_scan", "com.ibm.unit_tests". -
--asset-keyKey in pipelinectl assets for commands load_artifact or load_repo. -
--asset-typeAsset type from pipelinectl. Can be one of the following: repo | artifact.
-
--output-pathFull path of the file where the reused evidence JSON output should be saved. If not specified, output will be directed to a default location. -
--metaArbitrary metadata to be validated against the evidence found for reuse. Accepts key=value pairs and can be specified multiple times.
check-evidence-for-reuse \
--tool-type "sonarqube" \
--evidence-type "com.ibm.static_scan" \
--asset-type "repo" \
--asset-key "app-repo" \{: codeblock}
-
0Evidence for reuse was found and saved successfully. -
1Evidence for reuse was not found.
success/failureIndicates the result of the reused evidence check.
{: #check-evidence-reuse-cli-direct}
cocoa locker evidence reuse \
--tool-type "detect-secrets" \
--evidence-type "com.ibm.detect_secrets" \
--assets "app-repo:repo" \
--pipeline-run-id "${PIPELINE_RUN_ID}" \
--pipeline-namespace "ci" \
--incident-org "my-org" \
--incident-repo "compliance-issues" \
--format "json"{: codeblock}
cocoa locker evidence reuse \
--tool-type "sonarqube" \
--evidence-type "com.ibm.static_scan" \
--assets "app-repo:repo" \
--attachment ./sonarqube-result.json \
--pipeline-run-id "${PIPELINE_RUN_ID}" \
--pipeline-namespace "ci" \
--incident-org "my-org" \
--incident-repo "compliance-issues" \
--format "json"{: codeblock}
The additional parameters:
--evidence-validity-period <hours>: Set custom validity period (default: 24, max: 720)--evidence-reuse-for-failure: Enable reuse of failed evidence--dry-run: Preview without actually reusing evidence--meta <key=value>: Additional metadata for validation
For complete CLI command reference and all available parameters, see cocoa locker evidence reuse.