Defining a "Trigger/call builds on other projects" build step with "Counter Parameter Factory" as follow:

      FROM = 1
      TO = $VARIABLE
      STEP = 1

      It should do nothing, I mean, do not build step, if $VARIABLE is zero but it is failing with following exception:

      FATAL: Counting with step size 0 will not terminate!
      java.lang.RuntimeException: Counting with step size 0 will not terminate!

          [JENKINS-13872] Counter Parameter Factory

          cjo9900 added a comment -

          The problem here is that checking of the from,to and step values are not validated in the config stage, it just checks that the input for each item is a valid number or a macro.

          So at run time the checking of the from, to and step is done.
          these checks are done so that there is no cases where an infinite amount of jobs are started.

          So this requires that START and END is an inclusive group when the step is applied

          examples:
          1. FROM=10 and TO=0 can be valid if STEP=-1(-ive)
          i.e Go in a negative direction.
          2. FROM=100 and TO=110 can be valid if STEP=1 (+ive)
          i.e Go in a negative direction.

          Invalid cases
          1. FROM=10 and TO=0 can be invalid if STEP=2 (+ive)
          i.e would never reach the value of 0 as would hit maximum value first and have an exception at this point.
          2. FROM=100 and TO=110 can be invalid if STEP=-1 (-ive)
          i.e would never reach the value of 110 as would hit minimum value first and have an exception at this point.

          The code that checks this just throws a Runtime Exception if these checks fail.
          There is a possibility that the factory could be modified with an option to not trigger these projects if the validation of the stepping fails.

          However that only covers one case, as it may also be required that the parameters are not used and not passed on in the
          failing cases. i.e. return no parameters.

          So I propose having an option that allows the three behaviours on stepping validation:
          Fail the build - RuntimeExecption (default current behaviour)
          Skip the triggering - DontTriggerException - no jobs triggered in this trigger(other project might be triggered is they have different configuration)
          Do not add parameters - return no parameters - projects still triggered without counter factory values.

          cjo9900 added a comment - The problem here is that checking of the from,to and step values are not validated in the config stage, it just checks that the input for each item is a valid number or a macro. So at run time the checking of the from, to and step is done. these checks are done so that there is no cases where an infinite amount of jobs are started. So this requires that START and END is an inclusive group when the step is applied examples: 1. FROM=10 and TO=0 can be valid if STEP=-1(-ive) i.e Go in a negative direction. 2. FROM=100 and TO=110 can be valid if STEP=1 (+ive) i.e Go in a negative direction. Invalid cases 1. FROM=10 and TO=0 can be invalid if STEP=2 (+ive) i.e would never reach the value of 0 as would hit maximum value first and have an exception at this point. 2. FROM=100 and TO=110 can be invalid if STEP=-1 (-ive) i.e would never reach the value of 110 as would hit minimum value first and have an exception at this point. The code that checks this just throws a Runtime Exception if these checks fail. There is a possibility that the factory could be modified with an option to not trigger these projects if the validation of the stepping fails. However that only covers one case, as it may also be required that the parameters are not used and not passed on in the failing cases. i.e. return no parameters. So I propose having an option that allows the three behaviours on stepping validation: Fail the build - RuntimeExecption (default current behaviour) Skip the triggering - DontTriggerException - no jobs triggered in this trigger(other project might be triggered is they have different configuration) Do not add parameters - return no parameters - projects still triggered without counter factory values.

          cjo9900 added a comment -

          cjo9900 added a comment - Pull request created https://github.com/jenkinsci/parameterized-trigger-plugin/pull/24

          Code changed in jenkins
          User: c3johnso
          Path:
          src/main/java/hudson/plugins/parameterizedtrigger/BuildTriggerConfig.java
          src/main/java/hudson/plugins/parameterizedtrigger/CounterBuildParameterFactory.java
          src/main/resources/hudson/plugins/parameterizedtrigger/CounterBuildParameterFactory/config.jelly
          src/main/resources/hudson/plugins/parameterizedtrigger/CounterBuildParameterFactory/help-validationFail.html
          src/main/resources/hudson/plugins/parameterizedtrigger/Messages.properties
          src/test/java/hudson/plugins/parameterizedtrigger/test/CounterBuildParameterFactoryUnitTest.java
          http://jenkins-ci.org/commit/parameterized-trigger-plugin/89a1d2365c6d6c750aeefb2a94de0ae2b96c8b93
          Log:
          Add behaviour options for counter factory in case of invalid options.

          [FIXED JENKINS-13872]
          Add the possibility of skipping the triggering, or ignoring the parameters when the
          to, from and step elements do not form a contained set.

          Corrected an issue in the BuildTriggerConfig class where if a factory returned no parameters
          meant that no projects would be triggered in certain cases.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: c3johnso Path: src/main/java/hudson/plugins/parameterizedtrigger/BuildTriggerConfig.java src/main/java/hudson/plugins/parameterizedtrigger/CounterBuildParameterFactory.java src/main/resources/hudson/plugins/parameterizedtrigger/CounterBuildParameterFactory/config.jelly src/main/resources/hudson/plugins/parameterizedtrigger/CounterBuildParameterFactory/help-validationFail.html src/main/resources/hudson/plugins/parameterizedtrigger/Messages.properties src/test/java/hudson/plugins/parameterizedtrigger/test/CounterBuildParameterFactoryUnitTest.java http://jenkins-ci.org/commit/parameterized-trigger-plugin/89a1d2365c6d6c750aeefb2a94de0ae2b96c8b93 Log: Add behaviour options for counter factory in case of invalid options. [FIXED JENKINS-13872] Add the possibility of skipping the triggering, or ignoring the parameters when the to, from and step elements do not form a contained set. Corrected an issue in the BuildTriggerConfig class where if a factory returned no parameters meant that no projects would be triggered in certain cases.

          Code changed in jenkins
          User: cjo9900
          Path:
          src/main/resources/hudson/plugins/parameterizedtrigger/FileBuildParameterFactory/help-noFilesFoundAction.html
          http://jenkins-ci.org/commit/parameterized-trigger-plugin/89e0f19f5d8840badbb75121eba1638826077f29
          Log:
          JENKINS-13872 Correct file factory help text

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: cjo9900 Path: src/main/resources/hudson/plugins/parameterizedtrigger/FileBuildParameterFactory/help-noFilesFoundAction.html http://jenkins-ci.org/commit/parameterized-trigger-plugin/89e0f19f5d8840badbb75121eba1638826077f29 Log: JENKINS-13872 Correct file factory help text

          Code changed in jenkins
          User: cjo9900
          Path:
          src/main/java/hudson/plugins/parameterizedtrigger/BuildTriggerConfig.java
          src/main/java/hudson/plugins/parameterizedtrigger/CounterBuildParameterFactory.java
          src/main/java/hudson/plugins/parameterizedtrigger/FileBuildParameterFactory.java
          src/main/resources/hudson/plugins/parameterizedtrigger/CounterBuildParameterFactory/config.jelly
          src/main/resources/hudson/plugins/parameterizedtrigger/CounterBuildParameterFactory/help-validationFail.html
          src/main/resources/hudson/plugins/parameterizedtrigger/FileBuildParameterFactory/config.jelly
          src/main/resources/hudson/plugins/parameterizedtrigger/FileBuildParameterFactory/help-noFilesFoundAction.html
          src/main/resources/hudson/plugins/parameterizedtrigger/FileBuildParameterFactory/help.html
          src/main/resources/hudson/plugins/parameterizedtrigger/Messages.properties
          src/test/java/hudson/plugins/parameterizedtrigger/test/CounterBuildParameterFactoryUnitTest.java
          src/test/java/hudson/plugins/parameterizedtrigger/test/FileBuildParameterFactoryTest.java
          http://jenkins-ci.org/commit/parameterized-trigger-plugin/e681c6924350457cd5db8c5e4c13aa1fda2a42ac
          Log:
          Merge branch 'JENKINS-13872' of git://github.com/cjo9900/parameterized-trigger-plugin into 2.17-RC

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: cjo9900 Path: src/main/java/hudson/plugins/parameterizedtrigger/BuildTriggerConfig.java src/main/java/hudson/plugins/parameterizedtrigger/CounterBuildParameterFactory.java src/main/java/hudson/plugins/parameterizedtrigger/FileBuildParameterFactory.java src/main/resources/hudson/plugins/parameterizedtrigger/CounterBuildParameterFactory/config.jelly src/main/resources/hudson/plugins/parameterizedtrigger/CounterBuildParameterFactory/help-validationFail.html src/main/resources/hudson/plugins/parameterizedtrigger/FileBuildParameterFactory/config.jelly src/main/resources/hudson/plugins/parameterizedtrigger/FileBuildParameterFactory/help-noFilesFoundAction.html src/main/resources/hudson/plugins/parameterizedtrigger/FileBuildParameterFactory/help.html src/main/resources/hudson/plugins/parameterizedtrigger/Messages.properties src/test/java/hudson/plugins/parameterizedtrigger/test/CounterBuildParameterFactoryUnitTest.java src/test/java/hudson/plugins/parameterizedtrigger/test/FileBuildParameterFactoryTest.java http://jenkins-ci.org/commit/parameterized-trigger-plugin/e681c6924350457cd5db8c5e4c13aa1fda2a42ac Log: Merge branch ' JENKINS-13872 ' of git://github.com/cjo9900/parameterized-trigger-plugin into 2.17-RC

            cjo9900 cjo9900
            jacojm Jacobo Jimenez
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: