GithubHelp home page GithubHelp logo

Comments (9)

eiriarte-mendez avatar eiriarte-mendez commented on June 15, 2024 3

hi @mixMugz

here is a snippet working for me:

pipeline {

  agent any
  
  triggers {
    bitBucketTrigger([
      [
        // $class: 'BitBucketPPRPullRequestTriggerFilter', // use this class for BitBucket Cloud instead.
        $class: 'BitBucketPPRPullRequestServerTriggerFilter',
        triggers: [
          [
            $class: 'BitBucketPPRPullRequestServerTriggerFilter',
            actionFilter: [
              $class: 'BitBucketPPRPullRequestCreatedActionFilter',
            ]
          ],
          [
            $class: 'BitBucketPPRPullRequestServerTriggerFilter',
            actionFilter: [
              $class: 'BitBucketPPRPullRequestApprovedActionFilter',
            ]
          ],
          [
            $class: 'BitBucketPPRPullRequestServerTriggerFilter',
            actionFilter: [
              $class: 'BitBucketPPRPullRequestUpdatedActionFilter',
            ]
          ],
          [
            $class: 'BitBucketPPRPullRequestServerTriggerFilter',
            actionFilter: [
              $class: 'BitBucketPPRPullRequestMergedActionFilter',
            ]
          ],
          [
            $class: 'BitBucketPPRRepositoryTriggerFilter',
            actionFilter: [
              $class: 'BitBucketPPRRepositoryPushActionFilter',
              triggerAlsoIfNothingChanged: true,
              triggerAlsoIfTagPush: false,
              allowedBranches: ""
            ]
          ]
        ]
      ]
    ])
  }

  stages {
    stage('Stage 1') {
      steps {
        echo 'Building...'

        echo 'Env vars for cloud pull request...'
        echo "BITBUCKET_SOURCE_BRANCH ${env.BITBUCKET_SOURCE_BRANCH}"
        echo "BITBUCKET_TARGET_BRANCH ${env.BITBUCKET_TARGET_BRANCH}"
        echo "BITBUCKET_PULL_REQUEST_LINK ${env.BITBUCKET_PULL_REQUEST_LINK}"
        echo "BITBUCKET_PULL_REQUEST_ID ${env.BITBUCKET_PULL_REQUEST_ID}"
        echo "BITBUCKET_PAYLOAD ${env.BITBUCKET_PAYLOAD}"

        echo 'Env vars for cloud push...'
        echo "REPOSITORY_LINK ${env.REPOSITORY_LINK}"
        echo "BITBUCKET_SOURCE_BRANCH ${env.BITBUCKET_SOURCE_BRANCH}"
        echo "BITBUCKET_REPOSITORY_URL ${env.BITBUCKET_REPOSITORY_URL}"
        echo "BITBUCKET_PUSH_REPOSITORY_UUID ${env.BITBUCKET_PUSH_REPOSITORY_UUID}"
        echo "BITBUCKET_PAYLOAD ${env.BITBUCKET_PAYLOAD}"

        echo 'Env vars for server push...'
        echo "REPOSITORY_LINK ${env.REPOSITORY_LINK}"
        echo "BITBUCKET_SOURCE_BRANCH ${env.BITBUCKET_SOURCE_BRANCH}"
        echo "BITBUCKET_REPOSITORY_URL ${env.BITBUCKET_REPOSITORY_URL}"
        echo "BITBUCKET_PUSH_REPOSITORY_UUID ${env.BITBUCKET_PUSH_REPOSITORY_UUID}"
        echo "BITBUCKET_PAYLOAD ${env.BITBUCKET_PAYLOAD}"
      }
    }
  }
}

however I was forced to set a cron/interval-trigger in the multibranch root job, otherwise branches do not start automatically... @macghriogair is this intendend?

from bitbucket-push-and-pull-request-plugin.

B-Lukas avatar B-Lukas commented on June 15, 2024 2

I would also like an Update on this

from bitbucket-push-and-pull-request-plugin.

 avatar commented on June 15, 2024

I seem to have the same issue,

  • Multibranch Pipeline,
  • latest jenkins and plugin
  • BB Cloud

Tested multiple configurations. Everything is fine for branch builds. PR builds seem to be Skipped.

I've kinda tracked it down to the following discrepancy.

Job type for Multibranch Project is returned as: org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject

wheras the code here:

is checking for if it's an instance of MultiBranchProject. Which is actually the parent of WorkflowMultiBranchProject

scripted pipeline with the following config:

pipelineTriggers([
    bitBucketTrigger([
      [
        $class: 'BitBucketPPRRepositoryTriggerFilter',
        actionFilter: [
          $class: 'BitBucketPPRRepositoryPushActionFilter',
          allowedBranches: 'develop',
          triggerAlsoIfNothingChanged: false,
          triggerAlsoIfTagPush: false
        ]
      ],
      [
        $class: 'BitBucketPPRPullRequestTriggerFilter',
        actionFilter: [
          $class: 'BitBucketPPRPullRequestUpdatedActionFilter',
          allowedBranches: ''
        ]
      ],
      [
        $class: 'BitBucketPPRPullRequestTriggerFilter',
        actionFilter: [
          $class: 'BitBucketPPRPullRequestCreatedActionFilter',
          allowedBranches: ''
        ]
      ]
    ])
  ])

Log from the plugin, target branch name removed for being quite sensitive:

Job is of type: org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject
Bitbucket event is : push
Job Name : PR-134
sourceBranchName: null 
Skipping for job:PR-134

EDIT: Reading up on java instanceof behaviour, this doesn't seem to be the cause of the issue. Might be something else within that check 🤔

from bitbucket-push-and-pull-request-plugin.

emreakcan avatar emreakcan commented on June 15, 2024

Hello, any updates on this?

from bitbucket-push-and-pull-request-plugin.

stale avatar stale commented on June 15, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

from bitbucket-push-and-pull-request-plugin.

Sleepy-GH avatar Sleepy-GH commented on June 15, 2024

I think I accidentally filed a bug for the same issue, but I may have found the cause. See last comment in: #123 (comment)

from bitbucket-push-and-pull-request-plugin.

MikeKroell avatar MikeKroell commented on June 15, 2024

I am also having an issue trying to use this plugin for multi-branch.

from bitbucket-push-and-pull-request-plugin.

cdelmonte-zg avatar cdelmonte-zg commented on June 15, 2024

Solved with release 2.5.1

from bitbucket-push-and-pull-request-plugin.

shaktiug avatar shaktiug commented on June 15, 2024

I am still getting it null
echo env.BITBUCKET_TARGET_BRANCH
echo env.BRANCH_NAME
echo env.BITBUCKET_SOURCE_BRANCH

00-00-0000 00:00:04.269 null
00-00-0000 00:00:04.282 [Pipeline] echo
00-00-0000 00:00:04.286 feature/sprint-1
00-00-0000 00:00:04.309 [Pipeline] echo
00-00-0000 00:00:04.313 null

from bitbucket-push-and-pull-request-plugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.