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

Git SCM-polling doesn't work when using a parametrized branch-name

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • git-plugin
    • None

      Setup:

      • Git Plugin 1.1.20
      • a parameterized build with parameter "Branch", default "**"
      • Git SCM with branch specifier "${Branch}"
      • SCM polling activated

      Intended behaviour:

      • if any branch changes, Jenkins checks out and builds this branch
      • when executed manually, the user enters the name of the branch to be built

      Actual behaviour:

      • no changes are detected (because the "${Branch}" value isn't resolved when polling)

          [JENKINS-14276] Git SCM-polling doesn't work when using a parametrized branch-name

          Martin E created issue -

          Martin E added a comment -

          WOrkaround: disable branch filtering if the branch-specifier contains variables (see patchfile)

          Martin E added a comment - WOrkaround: disable branch filtering if the branch-specifier contains variables (see patchfile)
          Martin E made changes -
          Attachment New: JENKINS-14276.patch [ 22068 ]
          Martin E made changes -
          Description Original: Setup:
          - Git Plugin 1.1.20
          - a parameterized build with parameter "Branch", default "**"
          - Git SCM with branch specifier "${Branch}"
          - SCM polling activated

          Intended behaviour:
          - if _any_ branch changes, Jenkins checkous out and builds this branch
          - when executed manually, the user enters the name of the branch to be built

          Actual behaviour:
          - no changes are detected (brcause the "${Branch}" value isn't resolved when polling)

          New: Setup:
          - Git Plugin 1.1.20
          - a parameterized build with parameter "Branch", default "**"
          - Git SCM with branch specifier "$\{Branch\}"
          - SCM polling activated

          Intended behaviour:
          - if _any_ branch changes, Jenkins checks out and builds this branch
          - when executed manually, the user enters the name of the branch to be built

          Actual behaviour:
          - no changes are detected (because the "$\{Branch\}" value isn't resolved when polling)

          tfnico added a comment -

          I'm experiencing a similar problem. I've described my use-case on the mailing list:

          https://groups.google.com/d/topic/jenkinsci-users/iqqUollgpKY/discussion

          My initial idea was to override the Git branch specifier with some environment variable, like GIT_OVERRIDE_BRANCH or something like that. Haven't look into the Git Plugin sources yet though.

          tfnico added a comment - I'm experiencing a similar problem. I've described my use-case on the mailing list: https://groups.google.com/d/topic/jenkinsci-users/iqqUollgpKY/discussion My initial idea was to override the Git branch specifier with some environment variable, like GIT_OVERRIDE_BRANCH or something like that. Haven't look into the Git Plugin sources yet though.

          I am facing the same problem; patch from Martin worked for me

          Dominik Bieringer added a comment - I am facing the same problem; patch from Martin worked for me

          You can't expect polling to work if you have branch set by a build parameter (where to pick up a value ?). Use a GitRevisionBuildParameters to set the revision/branch to build when you wan't to trigger the job from another one.

          Nicolas De Loof added a comment - You can't expect polling to work if you have branch set by a build parameter (where to pick up a value ?). Use a GitRevisionBuildParameters to set the revision/branch to build when you wan't to trigger the job from another one.
          Nicolas De Loof made changes -
          Resolution New: Won't Fix [ 2 ]
          Status Original: Open [ 1 ] New: Resolved [ 5 ]

          Why cannot I expect it to work? If parameter has a default value - then there is a value to use when polling. Anyway current problem is https://issues.jenkins-ci.org/browse/JENKINS-20427

          Tomasz Bartczak added a comment - Why cannot I expect it to work? If parameter has a default value - then there is a value to use when polling. Anyway current problem is https://issues.jenkins-ci.org/browse/JENKINS-20427

          Maciej Matys added a comment -

          @Tomasz did You managed to configure jenkins this way?

          Maciej Matys added a comment - @Tomasz did You managed to configure jenkins this way?

            markewaite Mark Waite
            martoe Martin E
            Votes:
            12 Vote for this issue
            Watchers:
            22 Start watching this issue

              Created:
              Updated:
              Resolved: