-
Suggestion
-
Resolution: Unresolved
-
None
-
None
HI Team
We are using Bitbucket enterprise server version v8.19.7 and Jenkins version 2.462.1.
Our requirement is in Jenkins pipeline job (not in multi branch pipeline) when multiple developers opened multiple PRs, pipeline should run with all PR branches one by one.
Also in same pipeline script we want include sonar analysis as well, this analysis should run according to PR branch and PR number.
Here the challenges we are facing is how to use environmental variables of Bitbucket like PR_NUMBERS, BRANCH_NAME, TARGET_BRANCH and SOURCE_BRANCH for PRs could you please suggest which bitbucket plugin is useable.
We trying to use different plugins.
Webhooks : Webhooks only working with master branch also Bitbucket environmental variables are not working.
atlassian-bitbucket-server-integration : this plugin need Register Bitbucket Server as a consumer and Bitbucket server instance setup and env variables not available.
bitbucket-pullrequest-builder-plugin : According to this environmental variables are available but in document they mentioned Repo URL with .org only works and it is old plugin.
Please see below sample script, we are using this in our jenkins pipeline with GitHub plugins.
-Dsonar.projectKey=pullrequest_demonstration \
-Dsonar.sources=src \
-Dsonar.java.binaries=target/ \
-Dsonar.pullrequest.key=${env.GITHUB_PR_NUMBER} \
-Dsonar.pullrequest.branch=${env.GITHUB_PR_SOURCE_BRANCH} \
-Dsonar.pullrequest.base=${env.GITHUB_PR_TARGET_BRANCH }"
Note : If merge takes place, same pipeline should run with master branch.
Best Regards,
Sureshkumar.