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

Parameterized plugin BlockableBuildTriggerConfig "block" should be optional in Job DSL

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • job-dsl-plugin
    • None
    • Jenkins version 2.457
      job-dsl-plugin version 1.87
      Parameterized Trigger plugin Version 806.vf6fff3e28c3e

      I've attempted to this as a post-build step in a `mavenJob` to trigger other projects based on a bool, and with the "block" checkbox checked.
      This checkbox is optional, and set to default unchecked in the UI, but the Job DSL implementation makes this mandatory, so it is always selected:

      postBuildSteps('SUCCESS') {
          singleConditionalBuilder {
              buildStep {
                  triggerBuilder {
                      configs {
                          blockableBuildTriggerConfig {
                              // A comma separated list of projects to build
                                projects('')
                              // When activating this option, triggered builds will be run synchronously.
                              block { // required
                                  buildStepFailureThreshold('')
                                  unstableThreshold('')
                                  failureThreshold('')
                              }
                              //configFactories {}
                              configs {}
                          }
                      }
                  }
              }
              condition {
                booleanCondition {
                  token('${TRIGGER_DOWNSTREAM_SERVICE_BUILDS}')
                }
              }
              // If the evaluation of a run condition fails, should the build fail, be marked unstable, run the build step ...
              runner {
                fail()
              }
          }
      } 

      This "block", (ahem), block, should really be optional to match the plugin behavior.

      I believe that, at first glance, the elvis operator here may be setting a new instance of the block if it hasn't been set: https://github.com/jenkinsci/job-dsl-plugin/blob/master/job-dsl-core/src/main/groovy/javaposse/jobdsl/dsl/helpers/step/DownstreamTriggerContext.groovy#L24

      If I get time I will try to see if I can make this optional, test and submit a PR.

            jamietanna Jamie Tanna
            bendenney Ben
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: