Child pages
  • BuildResultTrigger Plugin
Skip to end of metadata
Go to start of metadata

Plugin Information

View BuildResultTrigger on the plugin site for more information.

This plugin is up for adoption. Want to help improve this plugin? Click here to learn more!

BuildResultTrigger makes it possible to monitor the build results of other jobs.

Features

When you you have two jobs jobA and jobB and you want Jenkins to schedule jobB after the jobA execution (whatever the build result of jobA), you can configure Jenkins to say that jobB is the downstream job of jobA. The drawback with this approach is that jobA has the knowledge of its dependencies.
With the BuildResultPlugin, you configure jobB to monitor jobA build result. A build is scheduled if there is a new build result matches your criteria (unstable, failure, ...)

Note: The plug-in uses only persistence in memory. There is no impact on the Jenkins infrastructure (no new files created).
This plugin provides a polling typology among the XTrigger Plugin.

Some use cases

* Having dedicated jobs (such as cleaning an environment, backing up a database, ...) that are scheduled if other jobs are in failure.
The other jobs don't depend on these dedicated jobs.
* Implementing a build pipeline (or a build chain) in which each step of the build pipeline is implemented with a Jenkins job.

Configuration

Comparison with other plugins

This plugin provides the inverse mechanism of the core feature (downstream/upstream) and the Parameterized Trigger Plugin.

Changelog

Release 0.17

  • Show upstream project in dependency graph

Release 0.16

Release 0.15

  • Fix JENKINS-18889 - BuildResultTrigger should not need to check for available nodes

Release 0.14

  • Fix JENKINS-18667 - NullPointerException when saving job config

Release 0.13

  • Fix JENKINS-18931 - Build is triggered incorrectly when a triggered build starts running

Release 0.12

Release 0.11

* Fix poll with at least two checked jobs

Release 0.10

* Fix JENKINS-17641 - Unknown field 'logEnabled' in org.jenkinsci.lib.xtrigger.XTriggerCause

Version 0.9

* Fix JENKINS-14580 - Configuration of Buildresult-Trigger remains unchanged, when saved.

Version 0.8 (Jenkins 1.461+)

* Fix JENKINS-13746 - Buildresult trigger plugin does not support hierachical folders
* Fix Security issues

Version 0.7

* Fix the restriction to READ elements

Version 0.6

* Fix JENKINS-13182 - Add parent job name to the list of multi-configuration project child jobs

Version 0.5

* Migrate to xtrigger-lib 0.8

Version 0.4

* Updated parent version to 1.409 so it can be used in a LTS version

Version 0.3

* Fix Button labels

Version 0.2

* Changed detection processing, based on build number

Version 0.1

* Initial version

48 Comments

  1. I'm intrigued, but uncertain.

    Is this a time-of-upstream/downstream build trigger, or is there perhaps a cron component?

    I can cron a CVS poll, but what I can't cron is "do the projects I copy artifacts from have a newer build that the one I used last time?" & I'm wondering if your plugin covers that.

    1. BuildResultTrigger makes it possible to monitor the build results of other jobs.
      There is a dedicated cron tab.
      The objective is to poll other build job results.

      The plugin is the inverse of use upstreams/downstreams Jenkins feature.

  2. Very good plugin !

    It seems that more jobs monitored function as OR, it is possible to act as an AND?

    IF test1==SUCCESS & test2==SUCCESS THEN create_setup

    1. Thanks.
      Could you raise an enhancement in the Jenkins issue tracker for the 'buildresulttrigger' as component?
      I'll try to add this feature.

  3. S P

    (this question is from a jenkins support question, but I'll put it here because it may help others) http://groups.google.com/group/jenkinsci-users/browse_thread/thread/5a7aaacd3f0a4097

    I think it is exactly what I'm after. However... it didn't seem to work for me and I can't see what has gone wrong.

    A couple of questions I have regarding the plugin so I know I'm using it correctly,

    1. Can it manage results from a parent module build? 

    2. Is the cron entry when the plugin checks the job to monitor or is it doing that in the back ground continuously and the cron entry is simply when the buildResultTrigger will schedule the job to run if the monitored job has achieved the interested state.

    3. If the monitored job is in the state I'm interested (i.e Success) but from a historic build, will the pluggin continue to trigger my job or is it aware it has already triggered for that result? 

    I like the plugin but I haven't be able to get it to fire when it is monitoring for success of a jenkins job. I've tried with a specific cron time that passed without triggering and also with * * * * *.

    The job that the plugin is monitoring has run a number of times with a successful result each time (and has triggered Downstream projects using the default trigger "Build after other projects are built"). 

    I've even tried creating another job, which does nothing but report, "Finished: SUCCESS" but still no triggering of the plugin.

    Any idea where I can look to see what is going wrong? 
    Thanks 

    1. I'm sorry for not getting back to you sooner
      1) No
      2) The Build ResultTrigger plugin monitors Jenkins job according the cron expression value specified in the job configuration
      3) No, the job is only triggered once. The plugin keeps the last state but also the build number.

      For your last point, it may be a configuration job issue. Could you raise a bug report in the issue tracker and attach your your job figuration file?

      Thanks

      1. S P

        Thanks, 

        I've simplified the setup for the bug report,

        https://issues.jenkins-ci.org/browse/JENKINS-12427

  4. S P

    Hi gbois,

     It's gone very quiet here. Any chance you could look at the issue I raised?

    Thanks

  5. Could you please add the parent job name to the list of multi-configuration (matrix) jobs?

    In current implementation, it is impossible to distinguish one matrix child job from another matrix child job.

    For example, there is a matrix job "matrix1" with axis BROWSER=ie and another matrix job "matrix2" with similar axis BROWSER=ie.

    In the current implementation, the list of monitored jobs shows identical items:
    BROWSER=ie
    BROWSER=ie

    But it would be much useful, if identical child jobs were shown with the parent job name, like:
    matrix1,BROWSER=ie
    matrix2,BROWSER=ie

    Issue raised as https://issues.jenkins-ci.org/browse/JENKINS-13182

  6. We are using this plugin to trigger automatic tests after a successful build, and it works quite well, thanks a lot for the plugin.

    I have recently configured Jenkins to use LDAP for authentification and enabled project-based matrix authorization strategy. Then I removed all rights from the Anonymous user and assigned them to specific user groups.

    Since then, BuildResultTrigger stopped working. Nothing in logs, no exception, it just didn't do anything. After a lot of experimentation (I have also done other changes before we realized the plugin is not working), we found that we need to assign "job read" access right to the anonymous user to get plugin working again.

    This may even be related to http://jenkins.361315.n4.nabble.com/JIRA-JENKINS-12427-BuildResultTrigger-Plug-in-not-triggering-job-td4301609.html

    Is this expected behavior? If yes, it should be better documented (smile) . I hope it's not, and also hope it can be fixed (smile).

    Thanks again.

    1. Thanks to report this issue.

  7. S P

    Thanks Tomas, you are right. I gave anonymous user view rights to jobs and the pluggin worked.

  8. S P

    Hi Greg, any comment on Tomas's discovery?

    At my work we can't give anonymous access to all jobs as we need security in place, so a solution to problem would be well received

    Cheers

    1. I'm sorry to be late for my fix.
      Please upgrade to 0.7, it should fix the issue.

      1. S P

        HI,

         Thanks for the update.

         Unfortunately I hasn't resolved the problem for me. The job still fails to fire after the trigger job is run. 

         I have no further details sorry as there is no logging referring to the jobs, other than the initial job being run.

        Also, I allowed anonymous access to all jobs (as a retest) and now with version 0.7 this also failed to fire the job.

        Any ideas?

        1. It is OK on my context.
          Therefore, please report a bug and attach your job configuration file.

          1. S P

            Sadly there is no change from the last bug report I wrote up (https://issues.jenkins-ci.org/browse/JENKINS-12427) and then closed because you were unable to reproduce.

             I guess jenkins can be configured with so many pluggins and settings it is likely it is due to local configuration. 

             What would really help diagnose the problem is some output from the plugin while running. As Thomas says in his comment "BuildResultTrigger stopped working. Nothing in logs, no exception, it just didn't do anything".

             With your next release of the plugin would you be able to please add some logging information that would allow for some user debugging?

            Found some logging that mirrors Tomas's

            cat  /xxx/RAD-TEST-TRY/buildResultTrigger-polling.log
            Polling started on 16/05/2012 10:30:39 AM
            Polling for the job RAD-TEST-TRY
            Polling remotely on volcano2
            [ERROR] - SEVERE - Polling error null
            1. Reading through both logs I suspect the problem may be connected to the fact that the build machines are remote. Gregory, have you tested your change with remote build node? If not, can you try it, please?

              1. Any news on this issue? Any more information we can provide to help troubleshoot this? Any known workaround till it is fixed?

                Thanks

                1. please check version 0.8

        2. Hi,

          I can confirm the update did not fix the problem for me either. The job log contains the following:

          [BuildResultTrigger] - Monitor build results of other jobs
          Polling started on May 15, 2012 12:00:59 AM
          Polling for the job XXXXXX-test-linux32
          Searching a node to run the polling for the label 'ubuntu32'.
          Polling remotely on BM3-Ubuntu_10.04_32
          ERROR - SEVERE - Polling error null
          
          

          I haven't found anything else related in the jenkins system log. Any suggestions what else to try or check?

          1. Please check with version 0.8

            1. S P

              We are currently on a jenkins version too old to try your 0.8 version. Will try once we upgrade to jenkins 1.461 

              Thanks

              1. Yes, you have to upgrade to Jenkins 1.461+.
                Unfortunately, it is mandatory to solve security issue.

            2. We are starting the tests by the plugin every night, so the turn-around time is a bit slower, sorry. But there is definitely a change with 0.8:

              Polling started on Jun 26, 2012 12:00:39 AM
              Polling for the job XXXXXX-test-linux32
              Searching a node to run the polling for the label 'ubuntu32'.
              Polling remotely on BM3-Ubuntu_10.04_32
              Slave(s) were offline at startup or at previous poll.
              Recording environment context and waiting for next schedule to check if there are modifications.
              
              Polling complete. Took 3 ms.
              No changes.
              

              I will report tomorrow, if the next round did actually start the tests or not :-).

              1. Congratulations, it works fine for me. Thanks a lot.

                Polling started on Jun 27, 2012 12:00:39 AM
                Polling for the job XXXXXX-test-linux32
                Searching a node to run the polling for the label 'ubuntu32'.
                Polling remotely on BM3-Ubuntu_10.04_32
                Checking changes for job XXXXXX-build-linux64.
                There is at least one new build for the job XXXXXX-build-linux64. Checking expected job build results.
                Checking SUCCESS
                Last build result for the job XXXXXX-build-linux64 matches the expected result SUCCESS.
                
                Polling complete. Took 1 ms.
                Changes found. Scheduling a build.
                
                1. Hmmm, it is probably not connected to the previous error, but any reason the trigger fires only every second time it is scheduled? This morning, the tests were again not executed, and the log states no recorded state again, as the first time:

                  Polling started on Jun 28, 2012 12:00:57 AM
                  Polling for the job XXXXXX-test-linux32
                  Searching a node to run the polling for the label 'ubuntu32'.
                  Polling remotely on BM3-Ubuntu_10.04_32
                  Slave(s) were offline at startup or at previous poll.
                  Recording environment context and waiting for next schedule to check if there are modifications.
                  
                  Polling complete. Took 3 ms.
                  No changes.
                  

                  Where is the "environment context" recorded? How is it possible for it to be missing? We did restart Jenkins during yesterday, but other than that, I can't think of anything which could be causing this.

                  1. At the moment, if you restart Jenkins, the previous context is lost.
                    And even if the change was not made when Jenkins was off, due to the lost of context, Jenkins looses the trigger event.
                    Could you report a new bug?
                    Thanks

                    1. I am sorry I got back to you so late, I was on vacation :-). I just wanted to report a new bug as you suggested, but I see there is already one dealing exactly with this issue, JENKINS-13793.

                      Thank you for your work on this plugin and for your support.

                    2. Hi Gregory, I'm seeing this same error: ERROR - SEVERE - Polling error nullwith the FSTrigger Plugin as well.  I did some testing and I notice that it only happens with builds that are using the Matrix Tie Parent Plugin:

                      http://wiki.hudson-ci.org/display/HUDSON/Matrix+Tie+Parent+Plugin

                      Could you check into applying the same fix to the FSTrigger Plugin as well?  Should I log another bug report for this?

                      Thanks

                      1. Please report a bug for the fstrigger plugin only.

                        1. Hi Gregory, thanks for the quick response!  I've logged the following issue for the FSTrigger plugin: 

                          https://issues.jenkins-ci.org/browse/JENKINS-14446

                          Please let me know if you need further details.  Thanks again!

  9. Unknown User (dgoss)

    Is there a way to check for a specific Failure or error code? I'm looking for an ability to restart the same job if the slave node connection the job was running on was severed mid-execution, so that the job can attempt to rebuild on a different node/machine.

    Thanks

    1. I'm afraid this plugin doesn't meet your needs. A BuildResultTrigger only polls another job in order to check if there are new builds matching the configured criteria.

  10. Hi, i'm a bit confused how this plugin works.

    For Example:

    If i set a Result Build Trigger to monitor success of another job with cron "0 23 * * 1-5" i would expect the job to start at 11 PM Mo-Fr, but it doesnt.

    So i changed cron to "59 * * *  *" and the build starts 59 minutes after the monitored one. It seems that the cron expression is somehow handled in relation to the monitored job.

    I need a way to schedule a build job (heavy jmeter testing) at night but only if a previous build succeeded. Am i doing something wrong here ? 

    1. When you have two jobs jobA and jobB, you are able to configure jobB to monitor jobA at fixed rate (the cron expression).
      jobB is scheduled if there is a new build of jobA (between the current check and the previous poll) matching the scheduling criteria of jobA.

  11. Hi ,

    This plugin is taking up the first job name by default. If we are monitoring Job A to trigger Job B . where Job X is the first job in Hudson. If Job A is deleted Job starts to monitor Job X . which is not expected behavior. We are currently using 0.9 version of  this plugin.  Can you please confirm if this has been already addressed.

    1. This use case is not implemented for now.
      Please could you raise a new issue (with the improvement category).

  12. Hi,

        I have a scenerio which I can't figure out if it applies.  I have a bunch of unit tests running and I want to periodically run integration tests but only if all the unit test jobs are currently Success and at least one has run since last polling(cron time).  I've been working with this plugin and it seems that I can AND all the jobs with status Success but it will only run the job if every job has run since last polling.  Am I accurate in assuming that every job has to run since last polling?

    Thanks!

  13. I'm a little puzzled. I have job2 that I want to launch only if job1 is either Unstable or Success.  So in the configuration I set it to check for Unstable and Success of job1.  Then job1 runs at 8pm so I set the Schedule to do the check at 830pm.

    The build result was unstable but Job2 never launched.  Is the schedule just to check? Should you have another setting that sets the build to launch? (like the Build Periodically setting) - not very clear in the plugins info. 

    I figure I must have something configured wrong but not sure what.

    Thanks

  14. Hi,

      Is it possible to combine two build triggers here i.e. change is submitted to Gerrit, this job starts and it monitors multiple jobs comma separated and then if all job passed then it will vote  up or down?

    Thanks

  15. Would it be possible to add the following new functionnality:

    When you have two jobs jobA and jobB, you are able to configure jobB to monitor jobA at fixed rate (the cron expression).
    jobB is scheduled if there is a new build of jobA (between the current check and the previous poll) matching the scheduling criteria of jobA

    OR

    jobB is scheduled anyway as long as jobA is matching the job result criteria

    you could have a jobA that may or may not be executed on a daily basis and a jobB that *must* run on a daily basis but only if the last jobA was succesful/failed/whatever the criteria is, which apparently this plugin can't do today.

    Thanks

  16. I am getting this error on Windows 2012, 64bit, Jenkins ver. 1.638.

    Feb 10, 2016 12:04:47 PM hudson.util.DescribableList buildDependencyGraph
    SEVERE: Failed to build dependency graph for hudson.maven.MavenModuleSet@6ad66c[Total Fund/ALM/report-engine]
    java.lang.NullPointerException at org.jenkinsci.plugins.buildresulttrigger.BuildResultTrigger.buildDependencyGraph(BuildResultTrigger.java:80)
    Feb 10, 2016 12:04:47 PM hudson.util.DescribableList buildDependencyGraph

    SEVERE: Failed to build dependency graph for hudson.maven.MavenModuleSet@6ad66c[Total Fund/ALM/report-engine]

    java.lang.NullPointerException

    at org.jenkinsci.plugins.buildresulttrigger.BuildResultTrigger.buildDependencyGraph(BuildResultTrigger.java:80)

  17. An interesting plug-in and it almost works for my use case, but not quite.

    What I need to do is to condition a nightly load testing job on the SUCCESS of the last deployment job build. So, my cron expression would match once-a-day (nightly). There are two potential pitfalls in using BuildResultTrigger Plugin that I can see:

    1. I need to run nightly jobs even if there were no deployments in between (for example, on weekends). This helps to monitor environment, etc.
    2. I'm not sure but from reading these comments, I got an impression that BuildResultTrigger triggers on any successes in-between polling rather than on the last build result of jobA. If that's the case, I definitely need the ability to trigger based on the last build result only.

    What do you think? Shall I submit enhancements for these?