Closed LinkBenjamin closed 5 years ago
It looks like the plugin will always return a success, and doesn't return a step result. Instead it fails the entire build.
(the plugin repo has issues disabled)
@rottebds I believe this is a Detect Jenkins inquiry, can you help out @LinkBenjamin
@LinkBenjamin @johnmccabe unfortunately the Detect Jenkins plugin is, at its core, a Jenkins Recorder and will set the status of the build when run. It simply is Jenkins native rather than being Pipeline native, and cannot send information (such as exit codes) to the pipeline plugin.
Detect does, however, offer some means of manipulating the exit code (there is a property, for example, to force detect to quit with exit code 0 when it cannot connect to help prevent CI jobs from failing when connection to BlackDuck is interrupted temporarily)
If that is not sufficient, you can invoke the shell script directly from within Jenkins to have finer grained access to the exit codes returned.
Hope that helps!
Thanks for the information!
Hello,
I'm new to BlackDuck and I've been looking over the docs on the Confluence, but I haven't figured out how to make this work. I have a Jenkinsfile where I'm currently calling hub_detect (latest version) as follows:
hub_detect pluginOptions
This works (in order to generically succeed/fail a build), but I'd like to catch the exit code and react differently depending on which code returns, something like this:
switch(hub_detect pluginOptions) { ... }
If I do exactly what I show above, I only ever get 'null' in the switch condition. I tried wrapping the hub_detect call in sh() and adding the return status boolean but that won't work either since it's not a shell call. How can I interrogate my hub_detect call to get the exit code?