'Is there a Jenkins Plugin for creating a PR to BitBucket repo?

I have a repository on BitBucket, and I'm using a Jenkins pipeline script to build AMIs using packer.

Once the AMI is built successfully, I need to make changes to the code in the repository and raise a PR.

What is the simplest way to create a PR from Jenkins to a BitBucket repository?



Solution 1:[1]

From a Jenkins sh/bat step, you can use curl to call the BitBucket API and create a pull request

curl https://api.bitbucket.org/2.0/repositories/my-workspace/my-repository/pullrequests \
    -u my-username:my-password \
    --request POST \
    --header 'Content-Type: application/json' \
    --data '{
        "title": "My Title",
        "source": {
            "branch": {
                "name": "staging"
            }
        }
    }'

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 VonC