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

Multibranch plugin: Modified properties do not propagate to existing branches

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • branch-api-plugin
    • None
    • Jenkins: 1.612
      Workflow (all): 1.10-beta-1
      Workflow multibranch: 1.9-beta-2

      EDIT: see https://issues.jenkins-ci.org/browse/JENKINS-30206?focusedCommentId=235736&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-235736


      Steps to reproduce:

      1. Create a multi-branch workflow project
      2. Select a git repository as a branch source
      3. Set property strategy to "named branches get different properties"
      4. Add a parameter property (as the default or as an exception that matches the branch you're building. both seem to not work) of a string or boolean with a set default value
      5. Run a branch that attempts to use that property
      6. Property does not appear to be accessible from Jenkinsfile

      Example

      Set parameter property of 'test_parameter' with a default value

      Attempt to use the parameter

      def param = test_parameter
      
      node("nodejs && swarm") {
        checkout scm
        println(param)
      ...
      

      this exception gets thrown when the script is being executed.

      groovy.lang.MissingPropertyException: No such property: test_parameter for class: groovy.lang.Binding
      

      I've tried accessing

      • boolean and string parameters
      • As properties of the 'env' object or directly (The current tutorial for the workflow-plugin suggests that parameters are exported as variables in the global scope)

      And I can't seem to get it to work in any instance

        1. build.xml
          6 kB
        2. config.xml
          3 kB
        3. config.xml
          3 kB
        4. Jenkinsfile
          0.1 kB
        5. log
          2 kB
        6. Selection_384.png
          Selection_384.png
          36 kB

          [JENKINS-30206] Multibranch plugin: Modified properties do not propagate to existing branches

          Jesse Glick added a comment -

          Now that workflow-multibranch has switched to the properties step, this issue no longer affects Workflow.

          Jesse Glick added a comment - Now that workflow-multibranch has switched to the properties step, this issue no longer affects Workflow.

          Code changed in jenkins
          User: Jesse Glick
          Path:
          multibranch/src/test/java/org/jenkinsci/plugins/workflow/multibranch/WorkflowParameterDefinitionBranchPropertyTest.java
          http://jenkins-ci.org/commit/workflow-multibranch-plugin/9c7fab4f6ba57460e50f94ffc08d181111a1dee9
          Log:
          JENKINS-30206 WorkflowParameterDefinitionBranchProperty working fine from a test at least.
          Originally-Committed-As: b19985d062703304ba317a8f82743187469a4f27

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: multibranch/src/test/java/org/jenkinsci/plugins/workflow/multibranch/WorkflowParameterDefinitionBranchPropertyTest.java http://jenkins-ci.org/commit/workflow-multibranch-plugin/9c7fab4f6ba57460e50f94ffc08d181111a1dee9 Log: JENKINS-30206 WorkflowParameterDefinitionBranchProperty working fine from a test at least. Originally-Committed-As: b19985d062703304ba317a8f82743187469a4f27

          Code changed in jenkins
          User: Jesse Glick
          Path:
          multibranch/src/test/java/org/jenkinsci/plugins/workflow/multibranch/WorkflowParameterDefinitionBranchPropertyTest.java
          http://jenkins-ci.org/commit/workflow-multibranch-plugin/8e3c946b5cf47b59cc4eee8a7d0f39a679ac617d
          Log:
          Merge pull request #199 from jglick/multibranch-param-JENKINS-30206

          JENKINS-30206 Testing WorkflowParameterDefinitionBranchProperty more
          Originally-Committed-As: 2c148f146a8f8cf5c4bde9bf70978d6cc3983e8c

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: multibranch/src/test/java/org/jenkinsci/plugins/workflow/multibranch/WorkflowParameterDefinitionBranchPropertyTest.java http://jenkins-ci.org/commit/workflow-multibranch-plugin/8e3c946b5cf47b59cc4eee8a7d0f39a679ac617d Log: Merge pull request #199 from jglick/multibranch-param- JENKINS-30206 JENKINS-30206 Testing WorkflowParameterDefinitionBranchProperty more Originally-Committed-As: 2c148f146a8f8cf5c4bde9bf70978d6cc3983e8c

          Jesse Glick added a comment -

          Might affect Pipeline as of JENKINS-32396.

          Jesse Glick added a comment - Might affect Pipeline as of JENKINS-32396 .

          Code changed in jenkins
          User: Jesse Glick
          Path:
          src/test/java/org/jenkinsci/plugins/workflow/multibranch/JobPropertyStepTest.java
          http://jenkins-ci.org/commit/workflow-multibranch-plugin/a9b45d7d94ab27b1eba23fafb2672d72299c0ace
          Log:
          https://github.com/jenkinsci/pipeline-plugin/pull/209 in its final form did not actually try to reproduce JENKINS-30206.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: src/test/java/org/jenkinsci/plugins/workflow/multibranch/JobPropertyStepTest.java http://jenkins-ci.org/commit/workflow-multibranch-plugin/a9b45d7d94ab27b1eba23fafb2672d72299c0ace Log: https://github.com/jenkinsci/pipeline-plugin/pull/209 in its final form did not actually try to reproduce JENKINS-30206 .

          Code changed in jenkins
          User: Jesse Glick
          Path:
          src/main/java/org/jenkinsci/plugins/workflow/multibranch/WorkflowBranchProjectFactory.java
          src/test/java/org/jenkinsci/plugins/workflow/multibranch/NoTriggerBranchPropertyWorkflowTest.java
          http://jenkins-ci.org/commit/workflow-multibranch-plugin/18077ec14b79dc5a68c1b1ae3d853af6dee32255
          Log:
          JENKINS-30206 Fixed branch property propagation.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: src/main/java/org/jenkinsci/plugins/workflow/multibranch/WorkflowBranchProjectFactory.java src/test/java/org/jenkinsci/plugins/workflow/multibranch/NoTriggerBranchPropertyWorkflowTest.java http://jenkins-ci.org/commit/workflow-multibranch-plugin/18077ec14b79dc5a68c1b1ae3d853af6dee32255 Log: JENKINS-30206 Fixed branch property propagation.

          Code changed in jenkins
          User: Jesse Glick
          Path:
          pom.xml
          src/main/java/org/jenkinsci/plugins/workflow/multibranch/WorkflowBranchProjectFactory.java
          src/test/java/org/jenkinsci/plugins/workflow/multibranch/JobPropertyStepTest.java
          src/test/java/org/jenkinsci/plugins/workflow/multibranch/NoTriggerBranchPropertyWorkflowTest.java
          src/test/java/org/jenkinsci/plugins/workflow/multibranch/WorkflowMultiBranchProjectTest.java
          http://jenkins-ci.org/commit/workflow-multibranch-plugin/5574409ef9334fb1774137627fe73f60174da515
          Log:
          Merge pull request #12 from jglick/update-no-trigger-JENKINS-32396-JENKINS-30206

          JENKINS-30206 JENKINS-32396 Honor changes to NoTriggerBranchProperty

          Compare: https://github.com/jenkinsci/workflow-multibranch-plugin/compare/eb538b808ee8...5574409ef933

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: pom.xml src/main/java/org/jenkinsci/plugins/workflow/multibranch/WorkflowBranchProjectFactory.java src/test/java/org/jenkinsci/plugins/workflow/multibranch/JobPropertyStepTest.java src/test/java/org/jenkinsci/plugins/workflow/multibranch/NoTriggerBranchPropertyWorkflowTest.java src/test/java/org/jenkinsci/plugins/workflow/multibranch/WorkflowMultiBranchProjectTest.java http://jenkins-ci.org/commit/workflow-multibranch-plugin/5574409ef9334fb1774137627fe73f60174da515 Log: Merge pull request #12 from jglick/update-no-trigger- JENKINS-32396 - JENKINS-30206 JENKINS-30206 JENKINS-32396 Honor changes to NoTriggerBranchProperty Compare: https://github.com/jenkinsci/workflow-multibranch-plugin/compare/eb538b808ee8...5574409ef933

          Sverre Moe added a comment - - edited

          I had the same problem accessing the defined parameter. The parameter was not accessible an an environment parameter. I found an example that worked for me.

          def param = false
          if (getBinding().hasVariable("MY_PARAM")) {
              param = MY_PARAM
          }
          

          Sverre Moe added a comment - - edited I had the same problem accessing the defined parameter. The parameter was not accessible an an environment parameter. I found an example that worked for me. def param = false if (getBinding().hasVariable( "MY_PARAM" )) { param = MY_PARAM }

          jglick is this still in progress or is it done?

          Stephen Connolly added a comment - jglick is this still in progress or is it done?

          Torben Knerr added a comment - - edited

          stephenconnolly jglick I have seen the branch properties being successfully propagated to existing branch builds, looks like they become effective with the next branch scanning.

          However, I experienced a bug in the UI where only the "Suppress automatic SCM triggering" property was available, but none of the other branch properties. I could still add the others via editing the config.xml directly or using JobDSL. They were then shown in the UI as configured, but still not available from the dropdown if you wanted to add them via the UI. See also:
          https://issues.jenkins-ci.org/browse/JENKINS-30519?focusedCommentId=325601&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-325601

          This was with Jenkins 2.73.1 and branch-api-plugin 2.0.14

          Torben Knerr added a comment - - edited stephenconnolly jglick I have seen the branch properties being successfully propagated to existing branch builds, looks like they become effective with the next branch scanning. However, I experienced a bug in the UI where only the "Suppress automatic SCM triggering" property was available, but none of the other branch properties. I could still add the others via editing the config.xml directly or using JobDSL. They were then shown in the UI as configured, but still not available from the dropdown if you wanted to add them via the UI. See also: https://issues.jenkins-ci.org/browse/JENKINS-30519?focusedCommentId=325601&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-325601 This was with Jenkins 2.73.1 and branch-api-plugin 2.0.14

            Unassigned Unassigned
            notnarb Branton Horsley
            Votes:
            6 Vote for this issue
            Watchers:
            12 Start watching this issue

              Created:
              Updated: