Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tasks/acs*: don't fail when ACS is not configured #878

Closed

Conversation

chmeliik
Copy link
Contributor

@chmeliik chmeliik commented Mar 14, 2024

  • 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

Before you complete this pull request ...

Look for any open pull requests in the repository with the title "e2e-tests update" and
see if there are recent e2e-tests updates that will be applicable to your change.

@chmeliik chmeliik force-pushed the fix-acs-not-configured-behavior branch from a19bfdc to bb6c630 Compare March 14, 2024 12:17
@chmeliik
Copy link
Contributor Author

Seems to work more or less as intended

image
image

STEP-ANNOTATE-TASK
acs-image-scan idk2-on-push-btn86-acs-image-scan
taskrun.tekton.dev/idk2-on-push-btn86-acs-image-scan annotated
taskrun.tekton.dev/idk2-on-push-btn86-acs-image-scan annotated
taskrun.tekton.dev/idk2-on-push-btn86-acs-image-scan annotated
taskrun.tekton.dev/idk2-on-push-btn86-acs-image-scan annotated
taskrun.tekton.dev/idk2-on-push-btn86-acs-image-scan annotated

STEP-ROX-IMAGE-SCAN
rox API endpoint is not set, demo will exit with success
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'
{"result":"SKIPPED","timestamp":"1710419206","note":"Task idk2-on-push-btn86-acs-image-scan skipped: ACS API enpoint not specified","namespace":"default","successes":"0","failures":"0","warnings":"0"}

STEP-REPORT

@chmeliik chmeliik marked this pull request as ready for review March 14, 2024 12:32
@chmeliik chmeliik requested review from jduimovich and mmorhun March 14, 2024 12:33
@jduimovich
Copy link
Contributor

I assume the empty ACS_SCAN_OUTPUT causes the 0 values in the vulnerabilties ?

@chmeliik
Copy link
Contributor Author

chmeliik commented Mar 14, 2024

I assume the empty ACS_SCAN_OUTPUT causes the 0 values in the vulnerabilties ?

Probably yes. I don't see an easy way to avoid that

@chmeliik
Copy link
Contributor Author

/retest

@@ -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)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just for completeness: if we didn't write the empty result here, the pipeline would fail with

invalid pipelineresults [ACS_SCAN_OUTPUT], the referred results don't exist

And this failure is only visible directly in the OCP console. RHDH just shows all the tasks as green and the overall result as red

@chmeliik chmeliik force-pushed the fix-acs-not-configured-behavior branch from bb6c630 to b4d6fc3 Compare March 19, 2024 09:46
* 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]>
@chmeliik chmeliik force-pushed the fix-acs-not-configured-behavior branch from b4d6fc3 to 7ca57c1 Compare March 19, 2024 14:34
Copy link

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@chmeliik chmeliik marked this pull request as draft March 19, 2024 15:50
@chmeliik
Copy link
Contributor Author

From a discussion with John: the 0s in the vulnerabilities report are a problem, we'd like a better solution

maybe the solution is to have a pre-check task the extracts the secrets, validates access and if successful, the ACS tasks can run

The other solution which could work is not annotate if not successful. Of course when they fix pac, the annotations won't be lost

The other behaviour could to use the onError: continue so you can error but the pipeline succeeds overall and when you read the error message the "You have not configured your rox secret etc" can be printed

@chmeliik chmeliik closed this May 9, 2024
@chmeliik chmeliik deleted the fix-acs-not-configured-behavior branch May 9, 2024 11:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants