We have a test-application with webhook(bitbucket scm source hook) configured in repository settings.
We want to check if bitbucket Pull Request is open or not from a branch to master branch based on bitbucket environment variable values in Jenkins.
But we get the values of bitbucket environment variables as null in the jenkins console logs, even though the PR is open.
There is a Pull Request section in Jenkins Job that shows PR with it’s ID, there I am able to see the PR-14(head) and PR-14(merge), where 14 is the PR ID. But then why is the value of ${env.BITBUCKET_PULL_REQUEST_ID} coming out to be null?
Can some one please help me with this?
Jenkinsfile build stage code :-
/* Development zone */
stage('Build') {
steps{
echo "Value of env.BITBUCKET_PULL_REQUEST_ID is ${env.BITBUCKET_PULL_REQUEST_ID}"
echo "Value of env.BITBUCKET_SOURCE_BRANCH is ${env.BITBUCKET_SOURCE_BRANCH}"
echo "Value of env.BITBUCKET_TARGET_BRANCH is ${env.BITBUCKET_TARGET_BRANCH}"
echo "Value of env.BRANCH_NAME is ${env.BRANCH_NAME}"
echo "Value of env.CHANGE_ID is ${env.CHANGE_ID}"
}
}