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

Parameter Factories on Trigger parameterized build

    XMLWordPrintable

Details

    Description

      When configuring a build trigger build step one can specify a parameter factory, like the very useful "All Nodes for Label Factory" from Node and Label parameter plugin.

      It would be useful to have the same parameter factory options when configuring a trigger parameterized build post-build step.

      Attachments

        Activity

          this is feature to be added to the parameterized-trigger plugin

          domi Dominik Bartholdi added a comment - this is feature to be added to the parameterized-trigger plugin

          It has been a long time since there was activity on this issue. Last time I checked, there still wasn't a parameter factory option when configuring triggers for a parameterized build as a post-build step. Any idea as of when this will be added?
          Thank you.

          tebuch Esteban Cabrera added a comment - It has been a long time since there was activity on this issue. Last time I checked, there still wasn't a parameter factory option when configuring triggers for a parameterized build as a post-build step. Any idea as of when this will be added? Thank you.

          unfortunate, the parameterized-trigger-plugin does not (yet) use the factories in the post-build actions...
          ...PR's welcome

          domi Dominik Bartholdi added a comment - unfortunate, the parameterized-trigger-plugin does not (yet) use the factories in the post-build actions... ...PR's welcome

          The build trigger that supports ParameterFactory is BlockableBuildTriggerConfig which is a subclass of BuildTriggerConfig which (ironically) is the post-build trigger. Turns out it supports ParameterFactory too so it is trivial to add the jelly ui elements and move the DataBoundConstructor to the complete constructor.

          However, post-build triggers are added via the DependencyGraph (using ParameterizedDependency, a subclass of Dependency) and as far as I can tell there's no way to add a dynamic number dependencies to the DependencyGraph. Maybe I'm wrong here and I'd love to see a solution that still respected the DependencyGraph and learn more about Jenkins internals.

          A hacky solution would be to solve the feature the other way around: copy the buildresult condition from BuildTriggerConfig to BlockableBuildTriggerConfig. I feel like this isn't really what people want even if it closes the ticket and technically solves the issue in our environment.

          Anyways, if folks have advice, I'm happy to keep trying to solve this. Otherwise I hope this helps future people interested in this feature.

          medwards Michael Edwards added a comment - The build trigger that supports ParameterFactory is BlockableBuildTriggerConfig which is a subclass of BuildTriggerConfig which (ironically) is the post-build trigger. Turns out it supports ParameterFactory too so it is trivial to add the jelly ui elements and move the DataBoundConstructor to the complete constructor. However, post-build triggers are added via the DependencyGraph (using ParameterizedDependency, a subclass of Dependency) and as far as I can tell there's no way to add a dynamic number dependencies to the DependencyGraph. Maybe I'm wrong here and I'd love to see a solution that still respected the DependencyGraph and learn more about Jenkins internals. A hacky solution would be to solve the feature the other way around: copy the buildresult condition from BuildTriggerConfig to BlockableBuildTriggerConfig. I feel like this isn't really what people want even if it closes the ticket and technically solves the issue in our environment. Anyways, if folks have advice, I'm happy to keep trying to solve this. Otherwise I hope this helps future people interested in this feature.
          btb3 Martin Ba added a comment -

          I've hit this problem too today, as I wanted to add a ParameterFactories / All Nodes for Label Factory as a post-build step.

          In my case, it would appear I have a simple workaround, as I do not actually require it to be a post-build-step:

          Since it should only run when the build is stable and there are no other post-build steps, I can easily just add it as the last build step "Trigger/call builds on other projects" where the ParameterFactories is supported.

          btb3 Martin Ba added a comment - I've hit this problem too today, as I wanted to add a ParameterFactories / All Nodes for Label Factory as a post-build step. In my case, it would appear I have a simple workaround, as I do not actually require it to be a post-build-step: Since it should only run when the build is stable and there are no other post-build steps, I can easily just add it as the last build step "Trigger/call builds on other projects" where the ParameterFactories is supported.
          niyer Nirzari Iyer added a comment - - edited

          This can be done as a post-build action by using Post Build Script Plugin (https://wiki.jenkins-ci.org/display/JENKINS/PostBuildScript+Plugin)

          It supports writing builders (https://docs.openstack.org/infra/jenkins-job-builder/builders.html) which in turn allows parameters factories on trigger parameterized build.

          An example can be found here:  look for 'postbuildscript' in https://docs.openstack.org/infra/jenkins-job-builder/publishers.html 

          niyer Nirzari Iyer added a comment - - edited This can be done as a post-build action by using Post Build Script Plugin ( https://wiki.jenkins-ci.org/display/JENKINS/PostBuildScript+Plugin ) It supports writing builders ( https://docs.openstack.org/infra/jenkins-job-builder/builders.html ) which in turn allows parameters factories on trigger parameterized build. An example can be found here:  look for 'postbuildscript' in  https://docs.openstack.org/infra/jenkins-job-builder/publishers.html  

          People

            huybrechts huybrechts
            davide david e
            Votes:
            4 Vote for this issue
            Watchers:
            8 Start watching this issue

            Dates

              Created:
              Updated: