-
Notifications
You must be signed in to change notification settings - Fork 2
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
feat: Option to fail the build when scan results cannot be downloaded #50
feat: Option to fail the build when scan results cannot be downloaded #50
Conversation
|
@lucaswilric Thanks for this PR. I apologise that I haven't seen this till now: that's on me. I will have a look and respond: please let me know if you're still happy to work on this! |
Hi @jamestelfer! I'm still happy to contribute on this one. I have some AFK time coming up, so it's possible one of my teammates may pitch in instead. Since I posted this PR, my team has thought it'd be helpful to use separate exit codes for "couldn't get results" and "got results and they're bad". This would provide a nice hook into Buildkite's |
Thank you!
Sounds good to me! This plugin runs in a post-checkout hook: we're generally using it as a follow up to a docker-compose plugin definition that pushes the container. If we retry the whole step, it will republish the image. However: it's definitely possible to run this plugin with a Depending on the use-case this would make sense, so I'm happy to see this go in (with the caveats documented). Main reasons for failures in my experience are:
For the "didn't get a report in time" issue, an ability to extend the timeout could be given. How are you using the plugin? Would retries help for your failure scenarios?
(from the PR description) Gotta say, I'm not sure how I'd like it tested either. I've toyed with the idea of factoring it around to enable this, but I'm really happy to listen to something that sounds simpler. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall LGTM.
Testing main
is currently not really there: I'd be happy for you to suggest what you'd like to see, either in this or another PR.
The exit_code
change would also be OK: feel free to use another PR if you'd like to. The current one has hung around for ages so it would be good to get this one moving.
> If blocking on configuration or retrieval failures is desired for use case, | ||
> consider submitting a PR to allow this to be configured. | ||
> If blocking on configuration or retrieval failures is desired for your use | ||
> case, see the `fail-build-on-plugin-failure` configuration item below. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: it would be nice for this to link, but not essential
This change adds a boolean configuration item
fail-build-on-plugin-failure
. It allows users to treat all errors in the plugin as build failures, as suggested in the README.fail-build-on-plugin-failure
isfalse
by default, preserving current behaviour.When
fail-build-on-plugin-failure
is set totrue
, any error returned fromrunCommand
will be treated as fatal.Note: Since the load-bearing part of this change is in
main.go
, I was not quite sure how you would prefer to have it tested. I'd love some feedback on that in particular :)