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.
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