Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-8009

Groovy script to add conditions to the parameterized trigger

      In our company, we are using a custom version of the Parameterized Trigger plug-in that includes a Groovy script condition additionally to the result condition. It allows to create more complex trigger conditions, based on the build or on external criteria. For example, we use this script, among other things, to trigger another project build at night only (see attached screenshot).

      Adding this feature is very easy and I think it could be nice to add it to the main branch of development.

      I provide also a diff that illustrates how we added this new feature to the 2.4 code. Please note that this adds an additional dependency on JDK1.6 for the scripting support. And on Groovy of course.

          [JENKINS-8009] Groovy script to add conditions to the parameterized trigger

          glundh added a comment -

          Awesome idea.

          Just my 2 cents: It would be nice to add an extension point to the Parameterized Trigger, which allows other plug-ins to add various methods of controlling the trigger logic. Just to keep the UI as uncluttred as possible. And also to allow other means of controlling the trigger mechanism (someone would probably like to add a similar feature like this, but using BASH or other scripts).

          glundh added a comment - Awesome idea. Just my 2 cents: It would be nice to add an extension point to the Parameterized Trigger, which allows other plug-ins to add various methods of controlling the trigger logic. Just to keep the UI as uncluttred as possible. And also to allow other means of controlling the trigger mechanism (someone would probably like to add a similar feature like this, but using BASH or other scripts).

          cjo9900 added a comment -

          Could be resolved by using pull 17 which uses the Run condition plugin, instead of the default build status
          https://github.com/jenkinsci/parameterized-trigger-plugin/pull/17

          And then writing a new plugin implementing the Run condition extension to run the groovy code.

          cjo9900 added a comment - Could be resolved by using pull 17 which uses the Run condition plugin, instead of the default build status https://github.com/jenkinsci/parameterized-trigger-plugin/pull/17 And then writing a new plugin implementing the Run condition extension to run the groovy code.

          ikedam added a comment -

          Using Flexible Publisher plugin, you can control triggers using shell script or windows batch.
          Consider contribute to Run Condition plugin if you want to use Groovy to write controlling scripts.

          ikedam added a comment - Using Flexible Publisher plugin , you can control triggers using shell script or windows batch. Consider contribute to Run Condition plugin if you want to use Groovy to write controlling scripts.

            huybrechts huybrechts
            dcoraboe dcoraboe
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: