-
Notifications
You must be signed in to change notification settings - Fork 148
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
[JENKINS-39284] Set build description to failure cause #72
base: master
Are you sure you want to change the base?
[JENKINS-39284] Set build description to failure cause #72
Conversation
JENKINS-39284 Add an option to the BFA configuration that, when enabled, sets the build description to the failure cause.
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.
Good idea!
One small inline comment + please tests for this.
Should be easy to add some tests for this to BuildFailureScannerHudsonTest
src/main/java/com/sonyericsson/jenkins/plugins/bfa/BuildFailureScanner.java
Outdated
Show resolved
Hide resolved
…ng BFA categories and causes.
…ot as complete as I'd like because I'm not sure how to manipulate the build description before BFA scans the build. I'd like to test functionality with a build description already set such as might happen from another plugin.
Thanks for the suggestions (this is my first OSS pull request so I'm learning how this works). I've appended to the build description instead of overwriting it. I've also added some tests. The tests are not as complete as I'd like because I'm not sure how to manipulate the build description before BFA scans the build. I'd like to test functionality with a build description already set such as might happen from another plugin. If you have some suggestion on how I might do that in the tests, I'd be happy to improve the tests. |
You can either add a custom You do something like the following to add the test builder: project.getBuildersList().add(new TestBuilder() {
@Override
boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException {
build.setDescription("Hello World")
return true;
}
}); |
Hello, is there any chance this can be re-reviewed and integrated with the project? I'm looking for the exact same functionality to solve my use case and would love it if the plugin supported it out of the box and I didn't have to do a post build script in groovy to achieve this. |
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.
Sorry for the review delay, I thought someone else was actively reviewing it.
src/main/java/com/sonyericsson/jenkins/plugins/bfa/BuildFailureScanner.java
Outdated
Show resolved
Hide resolved
src/main/java/com/sonyericsson/jenkins/plugins/bfa/PluginImpl.java
Outdated
Show resolved
Hide resolved
src/main/java/com/sonyericsson/jenkins/plugins/bfa/BuildFailureScanner.java
Outdated
Show resolved
Hide resolved
src/test/java/com/sonyericsson/jenkins/plugins/bfa/BuildFailureScannerHudsonTest.java
Outdated
Show resolved
Hide resolved
src/test/java/com/sonyericsson/jenkins/plugins/bfa/BuildFailureScannerHudsonTest.java
Outdated
Show resolved
Hide resolved
src/test/java/com/sonyericsson/jenkins/plugins/bfa/BuildFailureScannerHudsonTest.java
Show resolved
Hide resolved
I like the idea but I would prefer to append-to-description option instead of overriding current value. |
Also, this functionality should only be offered after enabling a global config checkbox. Changing the default behaviour without action is never a good idea. |
JENKINS-39284 Add an option to the BFA configuration that, when enabled, sets the build description to the failure cause.
…ng BFA categories and causes.
…ot as complete as I'd like because I'm not sure how to manipulate the build description before BFA scans the build. I'd like to test functionality with a build description already set such as might happen from another plugin.
…ion_to_failure_cause' into JENKINS-39284_Set_build_description_to_failure_cause
…nalyzer-plugin into JENKINS-39284_Set_build_description_to_failure_cause
src/main/java/com/sonyericsson/jenkins/plugins/bfa/PluginImpl.java
Outdated
Show resolved
Hide resolved
src/main/resources/com/sonyericsson/jenkins/plugins/bfa/PluginImpl/config.jelly
Show resolved
Hide resolved
src/main/java/com/sonyericsson/jenkins/plugins/bfa/BuildFailureScanner.java
Outdated
Show resolved
Hide resolved
# Conflicts: # src/main/java/com/sonyericsson/jenkins/plugins/bfa/BuildFailureScanner.java
…lure_cause # Conflicts: # src/main/java/com/sonyericsson/jenkins/plugins/bfa/BuildFailureScanner.java
…java Co-authored-by: Robert Sandell <[email protected]>
…eScanner.java Co-authored-by: Robert Sandell <[email protected]>
…ion_to_failure_cause' into JENKINS-39284_Set_build_description_to_failure_cause # Conflicts: # src/main/java/com/sonyericsson/jenkins/plugins/bfa/PluginImpl.java
… line numbers as they may change frequently.
…rder to have an unstable build with failure causes identified in order to make sure the Build Description is not applied if the setting is disabled.
Thank you for your time reviewing this PR. I've tried to address the suggestions given. Thank you. I am still learning how to do plugin development for Jenkins so I appreciate the feedback. |
# Conflicts: # src/main/java/com/sonyericsson/jenkins/plugins/bfa/BuildFailureScanner.java
Was looking to release notes and other random stuff when I arrived here. Just in case it helps to anybody... we are using here since some good months ago this script, launched every X minutes via job... that exactly addresses this (set build description to the BFA causes found). We launch it via library, although I imagine that it can be embed without problem in a pipeline script. This s how we launch it:
You can see it in action @ https://ci.moodle.org/job/W.03.05%20-%20Behat%20-%20Chrome%20+%20Oracle/ (for example, because with Oracle, heh, is where we get more random/failures detected by BFA). Hope it helps, ciao :-) |
JENKINS-39284
Add an option to the BFA configuration that, when enabled, sets the build description to the failure cause.