Skip to content

Conversation

kzantow
Copy link
Contributor

@kzantow kzantow commented Jul 21, 2025

This PR makes a few changes:

  • logs stderr to the actions log, so users are able to see errors
  • fails the build if grype returns nonzero unless the error returned is from --fail-on and fail-build: false
  • updates the failure message to be more accurate and fix a number of tests that were silently failing
  • removes the need to build test images, just using existing anchore/test_images instead

Fixes: #490

You can see some runs of this branch in different scenarios: vulns, other failures, success, etc. here: https://github.com/kzantow-anchore/scan-action-test/actions such as when a user references a vex document that doesn't exist

kzantow added 4 commits July 21, 2025 17:23
Signed-off-by: Keith Zantow <kzantow@gmail.com>
Signed-off-by: Keith Zantow <kzantow@gmail.com>
Signed-off-by: Keith Zantow <kzantow@gmail.com>
Signed-off-by: Keith Zantow <kzantow@gmail.com>
},
stderr(buffer) {
stderr += buffer.toString();
core.info(buffer.toString());
Copy link
Contributor Author

@kzantow kzantow Jul 22, 2025

Choose a reason for hiding this comment

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

This is the same thing sbom-action is doing and it is the only reliable way I was able to get the full stderr log. The behavior before, appending to a string that gets returned seemed to occur before some buffer got flushed and didn't have the full log, so the error at the end is lost ☹️

@kzantow kzantow merged commit b8370fa into anchore:main Jul 22, 2025
31 checks passed
@kzantow kzantow deleted the log-errors branch July 22, 2025 13:53
@kzantow kzantow linked an issue Jul 22, 2025 that may be closed by this pull request
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.

Errors not being printed to log, even in actions debug mode Action continues on non-vulnerability failures
2 participants