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

Multibranch plugin: Modified properties do not propagate to existing branches

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Minor
    • Resolution: Unresolved
    • Component/s: branch-api-plugin
    • Labels:
      None
    • Environment:
      Jenkins: 1.612
      Workflow (all): 1.10-beta-1
      Workflow multibranch: 1.9-beta-2
    • Similar Issues:

      Description

      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

        Attachments

        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

          Issue Links

            Activity

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

            Show
            scm_issue_link 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.
            Hide
            scm_issue_link 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

            Show
            scm_issue_link 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
            Hide
            djviking 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
            }
            
            Show
            djviking 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 }
            Hide
            stephenconnolly Stephen Connolly added a comment -

            Jesse Glick is this still in progress or is it done?

            Show
            stephenconnolly Stephen Connolly added a comment - Jesse Glick is this still in progress or is it done?
            Hide
            tknerr Torben Knerr added a comment - - edited

            Stephen Connolly Jesse Glick 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

            Show
            tknerr Torben Knerr added a comment - - edited Stephen Connolly Jesse Glick 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

              People

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

                Dates

                • Created:
                  Updated: