-
Notifications
You must be signed in to change notification settings - Fork 27
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
Prevent build from failing if error occurs #20
Comments
For async setup jobs this is "must have". For sync jobs it could be nice that the build did not fail, but instead gave the possibility to be unstable |
Failing the build job if something is wrong with your build environment is a common behavior and it is intended (#9). It is also a signal (to you or Jenkins admin) that there is something abnormal and that needs your attention. If you want to ignore errors and make the job go on, use a pipeline job, wrap the Declarative Pipeline example pipeline {
agent any
stages {
stage('dependencyTrackPublisher') {
steps {
withCredentials([string(credentialsId: '506ed685-4e2b-4d31-a44f-8ba8e67b6341', variable: 'API_KEY')]) {
script {
try {
dependencyTrackPublisher artifact: 'target/bom.xml', projectName: 'my-project', projectVersion: 'my-version', synchronous: true, dependencyTrackApiKey: API_KEY
} catch (e) {
echo 'failed'
}
}
}
}
}
}
}
Scripted Pipeline example: see README |
Thanks for that input. There is a lot of plugins for Jenkins supporting returning a response code when used, IMHO that would be much cleaner as this leaves the pipelines "in good shape" as you are able to create all you pipeline logic without a lot of try catches on different plugins. It could be as simple as returning the HTTP code. |
Hi @giacgbj I face the same issue, I fix the code on my fork (rvsoni@eee4259) I introduced an option on the global config advance section, also on job config, that can help you to just upload a BOM and not wait for the result, this would mark build success. Pl. build this code and test it, Pl. let me know if there are any improvements, Ravi |
It prints the below logs on Jenkins and does not wait to collect the result. ``` Waiting for Jenkins to finish collecting data Ravi |
Could you add an option in global, per-job and pipeline configurations to prevent the build from failing if an error occurs for whatever reason, for example during the communication with the Dependency-Track instance?
Failing a long build almost completed is very frustrating.
If you want to elaborate on it, you could add the option to select how to mark the build: success, unstable or failure (default, now).
The text was updated successfully, but these errors were encountered: