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

Git SCM web hook not triggering builds for branches that contain a forward slash '/'

      Original reporter https://github.com/jpeletier

      Hi,

      First of all, thank you for this great plug-in

      I have configured the multi-branch plug-in with my Stash Git repository with the following relevant parameters:

      • Sync Branches Schedule: H/5 * * * *
      • [x] Allow anonymous trigger of branch sync
      • Git
      • Include Branches * (a * wildcard)
      • Exclude Branches <empty>

      I have configured Stash Git to trigger Jenkins every time a push is made to the repository, and it works. However, when the branch name contains a forward slash, such as "feature/new-cool-feature", the hook is ignored and the branch is not built. If I click the "Schedule Build", the build is scheduled and runs fine. So it is just the trigger that it is not working.

      I have read the plug-in has some issues with / in the names, but the issues described don't seem to match what is happening to us. My one and oly problem is the trigger coming from Stash being ignored.

      Does anybody know of a workaround?

      Thanks!
      /jpeletier

          [JENKINS-32235] Git SCM web hook not triggering builds for branches that contain a forward slash '/'

          Luca Giovenzana added a comment - - edited

          I've the same issue, I'm using Atlassian BitBucket (former Stash) with this plugin: https://marketplace.atlassian.com/plugins/com.nerdwin15.stash-stash-webhook-jenkins/server/overview
          to notify Jenkins when a new commit is pushed.

          This is the GET request that the plugin does :

          http://10.4.0.153:8080/git/notifyCommit?url=ssh%3A%2F%2Fgit%40bb.domain.com%3A7999%2F~luca%2Fsrc.git&branches=bugfix/test&sha1=35e55acb615c683c929a45b122e9d30eae797562"
          

          Unfortunately also changing the url replacing the / with %2F or %252F does not change anything.
          Instead a normal build with git SCM is properly notified.

          If you have any hint how to fix this and where to look I can try something...

          Luca Giovenzana added a comment - - edited I've the same issue, I'm using Atlassian BitBucket (former Stash) with this plugin: https://marketplace.atlassian.com/plugins/com.nerdwin15.stash-stash-webhook-jenkins/server/overview to notify Jenkins when a new commit is pushed. This is the GET request that the plugin does : http://10.4.0.153:8080/git/notifyCommit?url=ssh%3A%2F%2Fgit%40bb.domain.com%3A7999%2F~luca%2Fsrc.git&branches=bugfix/test&sha1=35e55acb615c683c929a45b122e9d30eae797562" Unfortunately also changing the url replacing the / with %2F or %252F does not change anything. Instead a normal build with git SCM is properly notified. If you have any hint how to fix this and where to look I can try something...

          I found a sort of workaround, I've removed the hash and branch name from the notification and added:
          > Sync Branches Triggers > Periodically if not otherwise run Interval = 30 minutes
          > Build Triggers > Pool SCM @hourly
          And now the right branch is triggered from the notification, probably bacuse the SCM pool is triggered and detects the new commits.

          Luca Giovenzana added a comment - I found a sort of workaround, I've removed the hash and branch name from the notification and added: > Sync Branches Triggers > Periodically if not otherwise run Interval = 30 minutes > Build Triggers > Pool SCM @hourly And now the right branch is triggered from the notification, probably bacuse the SCM pool is triggered and detects the new commits.

          Ben Bettridge added a comment -

          Can confirm this impacts the latest version of Jenkins (2.5).

          Luca's workaround puts the server under a lot of stress for repositories with a large amount of branches. Basically by removing the branch name and commit hash it's triggering a "Branch Sync" job without a branch name - forcing it to sync all branch configs. This puts my small Jenkins server under a fair amount of load.

          I've spent some time troubleshooting and attempting different workarounds but to no avail. This basically breaks Jenkins being used with any Jira manage branches as they all use / in the name.

          Ben Bettridge added a comment - Can confirm this impacts the latest version of Jenkins (2.5). Luca's workaround puts the server under a lot of stress for repositories with a large amount of branches. Basically by removing the branch name and commit hash it's triggering a "Branch Sync" job without a branch name - forcing it to sync all branch configs. This puts my small Jenkins server under a fair amount of load. I've spent some time troubleshooting and attempting different workarounds but to no avail. This basically breaks Jenkins being used with any Jira manage branches as they all use / in the name.

          The defect is 5 years old. Is it going to be fixed?

          Anvar Sosnitski added a comment - The defect is 5 years old. Is it going to be fixed?

            mjdetullio Matthew DeTullio
            mjdetullio Matthew DeTullio
            Votes:
            2 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: