It will require some research / analysis but the suite of xtrigger plugins (eg: fstrigger) should be refactored to support Jenkins Workflow.

          [JENKINS-27301] Pipeline support for XTrigger

          Alex Johnson added a comment - - edited

          Most of these plugins are fairly old and inactive, but adding trigger compatibility will involve minimal code changes compared to other plugins. 

          xTrigger-lib:

          • update to be compatible with pipeline APIs
          • Add unit tests to confirm changes are correct
          • Bonus: speed up tests
            • Note: AbstractTriggerTest uses Thread.sleep(60000), possibly more efficient impl

          FSTrigger (thanks svanoort):

          • Implement EnvVars lookup that works for pipeline too (probably use a job or Jenkins level API)
          • Check compatibility of xtrigger-lib and FSTriggerCause
          • Create bridge methods for old method signatures & convert plugin signatures to new one
          • Add test that can trigger with pipelines
          • Manual test that file changes will trigger a pipeline build

          URLtrigger:

          • refactor to use pipeline compatible APIs
          • Add unit tests that triggers pipeline build from url response change
          • Manually test that a different response from a url will trigger a build

          Build result trigger:

          • Fix tests. errors after clone (I see slf4j in the stack trace ugh)
          • refactor to use pipeline compatible APIs
            • More work than URL and FS trigger to refactor, lots of uses of AbstractProject 
          • Add unit tests that triggers pipeline build from result
          • Manually test that the build result of a job can trigger a pipeline job

          Bonus:

          • Clean up code and docs. Add READMEs
          • addTrigger pipeline step

          I don't think ScriptTrigger (security issue; no longer distributed) or IvyTrigger (only 250 downloads) are worth looking at.

          Alex Johnson added a comment - - edited Most of these plugins are fairly old and inactive, but adding trigger compatibility will involve minimal code changes compared to other plugins.  xTrigger-lib: update to be compatible with pipeline APIs Add unit tests to confirm changes are correct Bonus: speed up tests Note: AbstractTriggerTest uses Thread.sleep(60000), possibly more efficient impl FSTrigger (thanks svanoort ): Implement EnvVars lookup that works for pipeline too (probably use a job or Jenkins level API) Check compatibility of xtrigger-lib and FSTriggerCause Create bridge methods for old method signatures & convert plugin signatures to new one Add test that can trigger with pipelines Manual test that file changes will trigger a pipeline build URLtrigger: refactor to use pipeline compatible APIs Add unit tests that triggers pipeline build from url response change Manually test that a different response from a url will trigger a build Build result trigger: Fix tests. errors after clone (I see slf4j in the stack trace ugh) refactor to use pipeline compatible APIs More work than URL and FS trigger to refactor, lots of uses of AbstractProject  Add unit tests that triggers pipeline build from result Manually test that the build result of a job can trigger a pipeline job Bonus: Clean up code and docs. Add READMEs addTrigger pipeline step I don't think ScriptTrigger (security issue; no longer distributed) or IvyTrigger (only 250 downloads) are worth looking at.

          Ryan Campbell added a comment -

          From a user POV, I should be able to write a pipeline script like this:

          pipeline {
              agent any
              triggers {
                  fstrigger('/ant/glob/**')
              }
              stages {...}
          }
          

          Ryan Campbell added a comment - From a user POV, I should be able to write a pipeline script like this: pipeline { agent any triggers { fstrigger( '/ant/glob/**' ) } stages {...} }

          Daniel Beland added a comment -

          I'm still using ScriptTrigger and would really appreciate if the new XTrigger plugin could support groovy scripts.

          Provide a groovy function expected to return true/false, set a frequency (cron) and possibly restrict on which node to execute.

          Then it should be possible to open the log of the last script execution and it's result from the project page.

           

          Daniel Beland added a comment - I'm still using ScriptTrigger and would really appreciate if the new XTrigger plugin could support groovy scripts. Provide a groovy function expected to return true/false, set a frequency (cron) and possibly restrict on which node to execute. Then it should be possible to open the log of the last script execution and it's result from the project page.  

          Curt Coleman added a comment -

          Is the associated PR (https://github.com/jenkinsci/xtrigger-lib/pull/7) dead in the water? The last activity was back on Sep 24, 2017.

          We'd really, really like to be able to leverage the URL Trigger plugin from within pipeline code. At present, we're having to stick freestyle jobs that use URL Trigger (watching specific paths in our Artifactory instance) in front of pipeline jobs, but it's pretty clunky and does not scale well.

          I'm not trying to be pushy - just trying to determine if we need to give up hoping for this issue (really JENKINS-33691) to be resolved and start looking into other avenues.

          Curt Coleman added a comment - Is the associated PR ( https://github.com/jenkinsci/xtrigger-lib/pull/7 ) dead in the water? The last activity was back on Sep 24, 2017. We'd really, really like to be able to leverage the URL Trigger plugin from within pipeline code. At present, we're having to stick freestyle jobs that use URL Trigger (watching specific paths in our Artifactory instance) in front of pipeline jobs, but it's pretty clunky and does not scale well. I'm not trying to be pushy - just trying to determine if we need to give up hoping for this issue (really  JENKINS-33691 ) to be resolved and start looking into other avenues.

          Chris Lindee added a comment - - edited

          New PRs available.  They were made small and independent to allow partial acceptance, such that, if one wasn't merged, a future PR wouldn't need to re-do all of the work (notice the similarities between #7#8).

          Chris Lindee added a comment - - edited New PRs available.  They were made small and independent to allow partial acceptance, such that, if one wasn't merged, a future PR wouldn't need to re-do all of the work (notice the similarities between #7 &  #8 ). https://github.com/jenkinsci/xtrigger-lib/pull/11 https://github.com/jenkinsci/xtrigger-lib/pull/12 https://github.com/jenkinsci/xtrigger-lib/pull/13 https://github.com/jenkinsci/xtrigger-lib/pull/14 https://github.com/jenkinsci/xtrigger-lib/pull/15

          Curt Coleman added a comment -

          It looks like all of the above pull requests have been merged. What's the next step for a downstream plugin like URL Trigger to get updated, such that there is support for pipeline jobs?

          Curt Coleman added a comment - It looks like all of the above pull requests have been merged. What's the next step for a downstream plugin like URL Trigger to get updated, such that there is support for pipeline jobs?

          Bhanu Pathak added a comment -

          Kinldy fix this issue if possible or atleast provide some pointers how it can be implemented

          Bhanu Pathak added a comment - Kinldy fix this issue if possible or atleast provide some pointers how it can be implemented

          Please, merge PRs from JENKINS-57078 with fixes from URL Trigger.

          Valentin Titov added a comment - Please, merge PRs from JENKINS-57078 with fixes from URL Trigger.

            alexbrjo Alex Johnson
            apemberton Andy Pemberton
            Votes:
            13 Vote for this issue
            Watchers:
            22 Start watching this issue

              Created:
              Updated: