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

Multibranch plugin: Modified properties do not propagate to existing branches

    XMLWordPrintable

Details

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

    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

            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_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.

            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_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
            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
            }
            
            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 }

            jglick is this still in progress or is it done?

            stephenconnolly Stephen Connolly added a comment - jglick is this still in progress or is it done?
            tknerr 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

            tknerr 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

            People

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

              Dates

                Created:
                Updated: