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

Multibranch pipeline does not handle correctly webhook of kind tag created

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • None
    • Jenkins ver. 2.107.2
      bitbucket-branch-source-plugin 2.2.11
    • 2.2.13

      When I create a tag on Bitbucket Cloud the webhook notify Jenkins for a new tag. But the jenkins plugin does not handle it has a SCM event of kind tag but as branch created event.

       

      The PushHookProcessor should be changed (line 165) to check of which kind of event is the notification.

      if (change.isClosed()) {
      	result.put(new BranchSCMHead(change.getOld().getName(), type), null);
      } else {
      	// created is true
      	Reference newChange = change.getNew();
      	SCMHead head = null;
      	if ("tag".equals(newChange.getType())) {
      		head = new BitbucketTagSCMHead(newChange.getName(), newChange.getDate().getTime(), type);
      	} else {
      		head = new BranchSCMHead(newChange.getName(), type);
      	}
      ...
      }
      

      It is also needed add date to the com.cloudbees.jenkins.plugins.bitbucket.api.BitbucketPushEvent.Reference.

      I also suggest to configure the ObjectMapper in payload parser (JsonParser) to use the ISO8601DateFormat that comes with jackson instead the custom.
      Use a specific deserialiser for BitbucketCloudRepository.updatedOn where BB sends an invalid ISO8601 date format (6 decimal for milliseconds field instead 3 that cause date parse error)

            nfalco Nikolas Falco
            nfalco Nikolas Falco
            Votes:
            9 Vote for this issue
            Watchers:
            15 Start watching this issue

              Created:
              Updated:
              Resolved: