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

Job is not triggered after merging a branch

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Critical Critical
    • bitbucket-plugin
    • None

      The steps to re-produce the issue are:

      1. git checkout -b feature/test
      2. touch README.md
      3. git add README.md
      4. git commit -m "a change"
      5. git push origin feature/test
      6. git checkout feature/A
      7. git merge feature/test
      8. git push origin feature/A

      So when you merge `feature/test` Bitbucket is not reporting raw_node so it was producing the stacktrace below:

      ```
      Caused by: java.lang.ArrayIndexOutOfBoundsException: -1
      at java.util.ArrayList.elementData(ArrayList.java:400)
      at java.util.ArrayList.get(ArrayList.java:413)
      at net.sf.json.JSONArray.get(JSONArray.java:1881)
      at net.sf.json.JSONArray.getJSONObject(JSONArray.java:1970)
      at com.cloudbees.jenkins.plugins.BitbucketHookReceiver.processPayload(BitbucketHookReceiver.java:111)
      at com.cloudbees.jenkins.plugins.BitbucketHookReceiver.doIndex(BitbucketHookReceiver.java:60)
      ```

      The lines of the code below in BitBucketHookReceiver are not used and they are producing the above stacktrace.

      ```
      JSONArray commits = payload.getJSONArray("commits");
      int last = commits.size() - 1;
      String sha1 = commits.getJSONObject(last).getString("raw_node");
      String branch = commits.getJSONObject(last).getString("branch");
      ```

      Just need to delete them.

            fbelzunc Félix Belzunce Arcos
            fbelzunc Félix Belzunce Arcos
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: