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. log
          2 kB
          Jesse Glick
        2. build.xml
          6 kB
          Jesse Glick
        3. Jenkinsfile
          0.1 kB
          Jesse Glick
        4. config.xml
          3 kB
          Jesse Glick
        5. config.xml
          3 kB
          Jesse Glick
        6. Selection_384.png
          36 kB
          Branton Horsley

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

          Branton Horsley created issue -
          Jesse Glick made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]

          Jesse Glick added a comment -

          Wrote a functional test for this but it passes as expected. Will check to see if I can reproduce manually in the stated combination of software versions.

          Jesse Glick added a comment - Wrote a functional test for this but it passes as expected. Will check to see if I can reproduce manually in the stated combination of software versions.
          Jesse Glick made changes -
          Remote Link New: This issue links to "PR 199 (Web Link)" [ 13134 ]

          Jesse Glick added a comment -

          Nope, working fine for me. Created Git repo with Jenkinsfile as attached. Installed 1.612, enabled experimental UC, added Workflow: Aggregator 1.10-beta-1 and Workflow: Multibranch 1.9-beta-2, restarted. Also added Git plugin (did not otherwise get selected). Created a multibranch workflow, will attach configuration, as well as generated master branch project configuration. The first build ran automatically, and printed the expected result based on the parameter default; will attach build metadata and log.

          Jesse Glick added a comment - Nope, working fine for me. Created Git repo with Jenkinsfile as attached. Installed 1.612, enabled experimental UC, added Workflow: Aggregator 1.10-beta-1 and Workflow: Multibranch 1.9-beta-2, restarted. Also added Git plugin (did not otherwise get selected). Created a multibranch workflow, will attach configuration, as well as generated master branch project configuration. The first build ran automatically, and printed the expected result based on the parameter default; will attach build metadata and log.
          Jesse Glick made changes -
          Resolution New: Cannot Reproduce [ 5 ]
          Status Original: In Progress [ 3 ] New: Resolved [ 5 ]

          Jesse Glick added a comment -

          All relevant files from my failed attempt to reproduce interactively. Compare your files with these and look for significant differences.

          Jesse Glick added a comment - All relevant files from my failed attempt to reproduce interactively. Compare your files with these and look for significant differences.
          Jesse Glick made changes -
          Attachment New: log [ 30575 ]
          Attachment New: build.xml [ 30576 ]
          Attachment New: Jenkinsfile [ 30577 ]
          Attachment New: config.xml [ 30578 ]
          Attachment New: config.xml [ 30579 ]

          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-plugin/b19985d062703304ba317a8f82743187469a4f27
          Log:
          JENKINS-30206 WorkflowParameterDefinitionBranchProperty working fine from a test at least.

          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-plugin/b19985d062703304ba317a8f82743187469a4f27 Log: JENKINS-30206 WorkflowParameterDefinitionBranchProperty working fine from a test at least.

          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-plugin/2c148f146a8f8cf5c4bde9bf70978d6cc3983e8c
          Log:
          Merge pull request #199 from jglick/multibranch-param-JENKINS-30206

          JENKINS-30206 Testing WorkflowParameterDefinitionBranchProperty more

          Compare: https://github.com/jenkinsci/workflow-plugin/compare/cc3469c132f0...2c148f146a8f

          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-plugin/2c148f146a8f8cf5c4bde9bf70978d6cc3983e8c Log: Merge pull request #199 from jglick/multibranch-param- JENKINS-30206 JENKINS-30206 Testing WorkflowParameterDefinitionBranchProperty more Compare: https://github.com/jenkinsci/workflow-plugin/compare/cc3469c132f0...2c148f146a8f

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

              Created:
              Updated: