Triggering job within step with a property file

312 views
Skip to first unread message

Jean-Luc Pinardon

unread,
Nov 7, 2016, 7:49:04 AM11/7/16
to job-dsl-plugin
Dear all,

I try to set up a DSL script creating a job triggering jobs that take a property file within a build step.
The XML section would be :
  <builders>
...
    <hudson.plugins.parameterizedtrigger.TriggerBuilder plugin="parameterized-trigger@2.32">
      <configs>
        <hudson.plugins.parameterizedtrigger.BlockableBuildTriggerConfig>
          <configs>
            <hudson.plugins.parameterizedtrigger.CurrentBuildParameters/>
            <hudson.plugins.parameterizedtrigger.FileBuildParameters>
              <propertiesFile>myProduct.properties	</propertiesFile>
              <failTriggerOnMissing>true</failTriggerOnMissing>
              <useMatrixChild>false</useMatrixChild>
              <onlyExactRuns>false</onlyExactRuns>
            </hudson.plugins.parameterizedtrigger.FileBuildParameters>
          </configs>
          <projects>jobA,jobB,jobC</projects>
          <condition>ALWAYS</condition>
          <triggerWithNoParameters>false</triggerWithNoParameters>
...etc...
  </builders>

I cannot find a simple way to achieve that, or I cannot understand why the following code is node valid :
    steps {
      triggerBuilder{
        configs {
	  blockableBuildTriggerConfig {
	    projects('jobA','jobB','jobC')
              block{
		buildStepFailureThreshold('FAILED')
		unstableThreshold('UNSTABLE')
		failureThreshold('FAILED')
	      }
	      configs {
		currentBuildParameters()
		fileBuildParameters {
		  propertiesFile(propFilePath)
		  failTriggerOnMissing(true)
		  onlyExactRuns(false)
		  useMatrixChild(false)
		}
	      }
                   }
               }
          ... etc...

The seed job using this script fails with :
ERROR: (stopStart.groovy, line 25) the following options are required and must be specified: encoding, combinationFilter
Finished: FAILURE

I neither undesrtand why I should I encoding (not available from the WEB UI) and combinationFilter (as matrix is out of scope here)... nor I can imagine how to code these empty param.
For example, encoding() also fails though the DSL Reference says "If not specified, default encoding of the platform is used."


Thanks for your help.
J.L.P.

Matt Sheehan

unread,
Nov 7, 2016, 10:07:17 AM11/7/16
to job-dsl-plugin
It's because the plugin uses @DataBoundConstructor to init the FileBuildParameters class. See https://github.com/jenkinsci/parameterized-trigger-plugin/blob/7830161d307eb44b2f0fd91c1bcc92888e6743bb/src/main/java/hudson/plugins/parameterizedtrigger/FileBuildParameters.java#L55

All constructor arguments are required. The fix would be for the plugin to switch to @DataBoundSetter for optional params. But you should be able to work around it for now by setting the other params to an empty string.

On Mon, Nov 7, 2016 at 6:49 AM Jean-Luc Pinardon <jl.pi...@gmail.com> wrote:
Dear all,

I try to set up a DSL script creating a job triggering jobs that take a property file within a build step.
The XML section would be :
  <builders>
...
    <hudson.plugins.parameterizedtrigger.TriggerBuilder plugin="parameteri...@2.32">
      <configs>
        <hudson.plugins.parameterizedtrigger.BlockableBuildTriggerConfig>
          <configs>
            <hudson.plugins.parameterizedtrigger.CurrentBuildParameters/>
            <hudson.plugins.parameterizedtrigger.FileBuildParameters>
              <propertiesFile>myProduct.properties	</propertiesFile>
              <failTriggerOnMissing>true</failTriggerOnMissing>
              <useMatrixChild>false</useMatrixChild>
              <onlyExactRuns>false</onlyExactRuns>
            </hudson.plugins.parameterizedtrigger.FileBuildParameters>
          </configs>
          <projects>jobA,jobB,jobC</projects>
          <condition>ALWAYS</condition>
          <triggerWithNoParameters>false</triggerWithNoParameters>

--
You received this message because you are subscribed to the Google Groups "job-dsl-plugin" group.
To unsubscribe from this group and stop receiving emails from it, send an email to job-dsl-plugi...@googlegroups.com.
To post to this group, send email to job-dsl...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/job-dsl-plugin/b780f066-83b4-40c3-8568-0df223abca75%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jean-Luc Pinardon

unread,
Nov 7, 2016, 11:12:52 AM11/7/16
to job-dsl-plugin
Resolved, 
Thanks a lot !!!
I really wonder why I did not thought to such a simple solution... so "sorry for the noise".

Best Regards
J.L.P.
Reply all
Reply to author
Forward
0 new messages