Skip to content

Commit

Permalink
tasks/acs*: don't fail when ACS is not configured
Browse files Browse the repository at this point in the history
* The report step in all tasks now cats the file only if it exists
* The image-scan task writes an empty SCAN_OUTPUT when skipped
  * Otherwise the pipeline fails because the ACS_SCAN_OUTPUT result
    references a non-existent task result

Signed-off-by: Adam Cmiel <[email protected]>
  • Loading branch information
chmeliik committed Mar 19, 2024
1 parent 0bebf0d commit 7ca57c1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
4 changes: 3 additions & 1 deletion task/acs-deploy-check/0.1/acs-deploy-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -133,4 +133,6 @@ spec:
mountPath: /workspace/repository
script: |
#!/usr/bin/env bash
cat /workspace/repository/acs-deploy-check.json
if [ -f /workspace/repository/acs-deploy-check.json ]; then
cat /workspace/repository/acs-deploy-check.json
fi
4 changes: 3 additions & 1 deletion task/acs-image-check/0.1/acs-image-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -127,4 +127,6 @@ spec:
mountPath: /steps-shared-folder
script: |
#!/usr/bin/env bash
cat /steps-shared-folder/acs-image-check.json
if [ -f /steps-shared-folder/acs-image-check.json ]; then
cat /steps-shared-folder/acs-image-check.json
fi
6 changes: 5 additions & 1 deletion task/acs-image-scan/0.1/acs-image-scan.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ spec:
echo "rox API endpoint is not set, demo will exit with success"
echo "TODO: configure the pipeline with your ACS server domain. Set your ACS endpoint under 'rox-api-endpoint' key in the secret specified in rox-secret-name parameter. For example: 'rox.stackrox.io:443'"
set_test_output_result SKIPPED "Task $(context.task.name) skipped: ACS API enpoint not specified"
touch $(results.SCAN_OUTPUT.path)
exit 0
fi
Expand All @@ -105,6 +106,7 @@ spec:
echo "rox API token is not set, demo will exit with success"
echo "TODO: configure the pipeline to have access to ROXCTL. Set you ACS token under 'rox-api-token' key in the secret specified in rox-secret-name parameter."
set_test_output_result SKIPPED "Task $(context.task.name) skipped: ACS API token not provided"
touch $(results.SCAN_OUTPUT.path)
exit 0
fi
Expand Down Expand Up @@ -166,4 +168,6 @@ spec:
mountPath: /steps-shared-folder
script: |
#!/usr/bin/env bash
cat /steps-shared-folder/acs-image-scan.json
if [ -f /steps-shared-folder/acs-image-scan.json ]; then
cat /steps-shared-folder/acs-image-scan.json
fi

0 comments on commit 7ca57c1

Please sign in to comment.