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

UserCause does not get set properly by DSL plugin for conditional run steps.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Minor
    • Resolution: Fixed
    • Environment:
    • Similar Issues:

      Description

      The configuration created by the DSL plugin for the USER_CAUSE run condition 'exclusiveCause' parameter is not correct.

      You can see in the DSL_Code.png image I have attached that my DSL code is correct, and that this script is supposed to create a job that runs a shell script based on some conditions. One of those conditions is an OR condition with 3 conditions. One of those conditions is a "cause" condition. Currently, running this script as is produces a job that does not have any build steps.

      Looking more closely, I noticed that in the config.xml file that gets created, the xml element for the "exclusiveCause" option of the run condition is actually being incorrectly named "exclusiveCondition" instead of "exclusiveCause". This is causing the job to not be created correctly.

      Below I have posted a diff of the config file of a job that was manually created (config2.xml) to do the same thing, and the DSL config file (config.xml), grepping for 'cause'. You can clearly see that "<exclusiveCause>" is not listed for the DSL config file. Instead it appears as "<exclusiveCondition>", which is not correct.

      [Tue Nov 17 12:33:43] user ➤ domain ➔ ~
      $ diff config.xml config2.xml | grep -i cause
      > <condition class="org.jenkins_ci.plugins.run_condition.core.CauseCondition">
      > <buildCause>USER_CAUSE</buildCause>
      > <exclusiveCause>true</exclusiveCause>
      < <condition class='org.jenkins_ci.plugins.run_condition.core.CauseCondition'>
      < <buildCause>USER_CAUSE</buildCause>

        Attachments

          Activity

          Show
          daspilker Daniel Spilker added a comment - pull request: https://github.com/jenkinsci/job-dsl-plugin/pull/669
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Daniel Spilker
          Path:
          docs/Home.md
          job-dsl-core/src/main/groovy/javaposse/jobdsl/dsl/helpers/step/RunConditionContext.groovy
          job-dsl-core/src/test/groovy/javaposse/jobdsl/dsl/helpers/step/StepContextSpec.groovy
          http://jenkins-ci.org/commit/job-dsl-plugin/582c9c83c6b30b7bc851470b5c6f3be9b4416c36
          Log:
          fixed cause condition

          [FIXES JENKINS-31604]

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Daniel Spilker Path: docs/Home.md job-dsl-core/src/main/groovy/javaposse/jobdsl/dsl/helpers/step/RunConditionContext.groovy job-dsl-core/src/test/groovy/javaposse/jobdsl/dsl/helpers/step/StepContextSpec.groovy http://jenkins-ci.org/commit/job-dsl-plugin/582c9c83c6b30b7bc851470b5c6f3be9b4416c36 Log: fixed cause condition [FIXES JENKINS-31604]
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Daniel Spilker
          Path:
          docs/Home.md
          job-dsl-core/src/main/groovy/javaposse/jobdsl/dsl/helpers/step/RunConditionContext.groovy
          job-dsl-core/src/test/groovy/javaposse/jobdsl/dsl/helpers/step/StepContextSpec.groovy
          http://jenkins-ci.org/commit/job-dsl-plugin/9065548d11a7ebc8c33d7550c3501a89965b8c57
          Log:
          Merge pull request #669 from daspilker/JENKINS-31604

          JENKINS-31604 fixed cause condition

          Compare: https://github.com/jenkinsci/job-dsl-plugin/compare/4cf7c90c2747...9065548d11a7

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Daniel Spilker Path: docs/Home.md job-dsl-core/src/main/groovy/javaposse/jobdsl/dsl/helpers/step/RunConditionContext.groovy job-dsl-core/src/test/groovy/javaposse/jobdsl/dsl/helpers/step/StepContextSpec.groovy http://jenkins-ci.org/commit/job-dsl-plugin/9065548d11a7ebc8c33d7550c3501a89965b8c57 Log: Merge pull request #669 from daspilker/ JENKINS-31604 JENKINS-31604 fixed cause condition Compare: https://github.com/jenkinsci/job-dsl-plugin/compare/4cf7c90c2747...9065548d11a7

            People

            • Assignee:
              daspilker Daniel Spilker
              Reporter:
              thetaiter Ian Tait
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: