Skip to content

BBPPR configuration change in Jenkinsfile is not picked up by Multibranch pipeline's branch job if it was already built with older configuration #357

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
danielerepici opened this issue Jan 20, 2025 · 0 comments

Comments

@danielerepici
Copy link

To Reproduce

You have a BitBucket repo, with the webhook correctly configured and working.

The Jenkinsfile in your BitBucket repo contains some BBPPR-related configuration (this could be none, or some triggers), in some branch e.g. develop. Let's call it "configuration A".

Create a Multibranch Pipeline e.g. "My Pipeline".

As the develop branch of the pipeline is discovered, the Jenkinsfile's "configuration A" is picked up and sticks with the pipeline's branch. You can verify this by clicking on the Configuration section of the branch's job.

The branch job keeps behaving as expected (the job is triggered by whatever trigger you configured or the job is not triggered if "configuration A" is no configuration at all).

Now change the BBPPR configuration into a different one, let's call it "configuration B".

Commit your change, push it.

Wait for pipeline's branch's job to pick up the new commit for the Jenkinsfile change.

The new BBPPR configuration is never picked up. The develop branch job keeps behaving as in "configuration A".

Expected Behaviour

The new Jenkinsfile's BBPPR configuration is picked up by the branch job.

My Specific Case

In my specific case I had this configuration at the beginning of my Jenkinsfile:

properties([
  pipelineTriggers([
    [
      $class: 'BitBucketPPRTrigger',
      triggers : [
        [
          $class: 'BitBucketPPRPullRequestTriggerFilter',
          actionFilter: [ $class: 'BitBucketPPRPullRequestCreatedActionFilter' ]
        ],
        [
          $class: 'BitBucketPPRPullRequestTriggerFilter',
          actionFilter: [ $class: 'BitBucketPPRPullRequestUpdatedActionFilter' ]
        ],
        [
          $class: 'BitBucketPPRPullRequestTriggerFilter',
          actionFilter: [ $class: 'BitBucketPPRPullRequestMergedActionFilter' ]
        ]
      ]
    ]
  ])
])

And I had a Multibranch pipeline with a develop branch, which was our trunk, which kept building at each PR creation, update or merge.

Then I removed that whole properties code from the Jenkinsfile, but the develop branch of the pipeline kept building at each PR creation, update or merge.

Please note I have experienced this the other way around too. There was a repo started with no triggers in the Jenkinsfile, then the branch was discovered. Then I added triggers afterwards but the job never started triggering via the webhook (despite webook requests were all sent correctly). If seen from this perspective, it might seem that the BBPPR plugin doesn't work at all, but it's actually the same problem described above.

Workaround

The only workaround I found to make it pick up the new configuration was:

Navigate to the Multibranch Pipeline (not the child job). Click Configure. In the Branch Sources, REMOVE Discover branches. Then hit Save. This will "unconfigure" the pipeline. The pipeline will die. All branches and build history is lost. You will just see a message that invites you to configure it. Once you reconfigure it and add the Discover branches behaviour back, the pipeline will rediscover all branches, including the develop branch. It will reset the build count to 1. But finally the new BBPPR configuration will be picked up.

Please note that manually editing the configuration's XML on the box did not do the trick. If you just do that, the old BBPPR configuration will magically reapper (as if it's stored in some sort of Jenkins cache).

Found in versions

Jenkins 2.482
BBPPR 3.1.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant