branch name in Jenkins regular pipeline job
up vote
1
down vote
favorite
For a Jenkins pipeline job having web-hook trigger in Git/Bitbucket, each repo push triggers pipeline job.
How we can know branch name in pipeline job on which push/change is committed.
I need this branch name to execute pipeline job whenever push to specific branch happened (devel/master).
Note: Jenkins pipeline job is not s multibranch pipeline job.
git jenkins
add a comment |
up vote
1
down vote
favorite
For a Jenkins pipeline job having web-hook trigger in Git/Bitbucket, each repo push triggers pipeline job.
How we can know branch name in pipeline job on which push/change is committed.
I need this branch name to execute pipeline job whenever push to specific branch happened (devel/master).
Note: Jenkins pipeline job is not s multibranch pipeline job.
git jenkins
This question may be better suited for the DevOps SE, since it's not really a unix-specific question.
– jayhendren
Jan 10 at 17:31
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
For a Jenkins pipeline job having web-hook trigger in Git/Bitbucket, each repo push triggers pipeline job.
How we can know branch name in pipeline job on which push/change is committed.
I need this branch name to execute pipeline job whenever push to specific branch happened (devel/master).
Note: Jenkins pipeline job is not s multibranch pipeline job.
git jenkins
For a Jenkins pipeline job having web-hook trigger in Git/Bitbucket, each repo push triggers pipeline job.
How we can know branch name in pipeline job on which push/change is committed.
I need this branch name to execute pipeline job whenever push to specific branch happened (devel/master).
Note: Jenkins pipeline job is not s multibranch pipeline job.
git jenkins
git jenkins
edited Nov 25 at 14:13
Rui F Ribeiro
38.3k1475126
38.3k1475126
asked Jan 9 at 8:43
AVJ
182116
182116
This question may be better suited for the DevOps SE, since it's not really a unix-specific question.
– jayhendren
Jan 10 at 17:31
add a comment |
This question may be better suited for the DevOps SE, since it's not really a unix-specific question.
– jayhendren
Jan 10 at 17:31
This question may be better suited for the DevOps SE, since it's not really a unix-specific question.
– jayhendren
Jan 10 at 17:31
This question may be better suited for the DevOps SE, since it's not really a unix-specific question.
– jayhendren
Jan 10 at 17:31
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
This depends entirely on how you're triggering the jobs from Bitbucket. For instance, I am using the pull-request-notifier plugin for Bitbucket to trigger my jobs, and one of the parameters it offers is the branch that the pull request was created from. You can then feed this information into Jenkins however you want; one example would be to pass it as a parameter to a parameterized job. Different hooks or triggers will have different options available; some might not even offer the ability to pass the branch name.
However, I would highly recommend using the Bitbucket Branch Source plugin for Jenkins instead. It automatically creates Jenkins jobs for every branch and pull request of every project in a Bitbucket project. This makes it much, much easier to work in Jenkins with repositories that have multiple branches.
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
This depends entirely on how you're triggering the jobs from Bitbucket. For instance, I am using the pull-request-notifier plugin for Bitbucket to trigger my jobs, and one of the parameters it offers is the branch that the pull request was created from. You can then feed this information into Jenkins however you want; one example would be to pass it as a parameter to a parameterized job. Different hooks or triggers will have different options available; some might not even offer the ability to pass the branch name.
However, I would highly recommend using the Bitbucket Branch Source plugin for Jenkins instead. It automatically creates Jenkins jobs for every branch and pull request of every project in a Bitbucket project. This makes it much, much easier to work in Jenkins with repositories that have multiple branches.
add a comment |
up vote
0
down vote
This depends entirely on how you're triggering the jobs from Bitbucket. For instance, I am using the pull-request-notifier plugin for Bitbucket to trigger my jobs, and one of the parameters it offers is the branch that the pull request was created from. You can then feed this information into Jenkins however you want; one example would be to pass it as a parameter to a parameterized job. Different hooks or triggers will have different options available; some might not even offer the ability to pass the branch name.
However, I would highly recommend using the Bitbucket Branch Source plugin for Jenkins instead. It automatically creates Jenkins jobs for every branch and pull request of every project in a Bitbucket project. This makes it much, much easier to work in Jenkins with repositories that have multiple branches.
add a comment |
up vote
0
down vote
up vote
0
down vote
This depends entirely on how you're triggering the jobs from Bitbucket. For instance, I am using the pull-request-notifier plugin for Bitbucket to trigger my jobs, and one of the parameters it offers is the branch that the pull request was created from. You can then feed this information into Jenkins however you want; one example would be to pass it as a parameter to a parameterized job. Different hooks or triggers will have different options available; some might not even offer the ability to pass the branch name.
However, I would highly recommend using the Bitbucket Branch Source plugin for Jenkins instead. It automatically creates Jenkins jobs for every branch and pull request of every project in a Bitbucket project. This makes it much, much easier to work in Jenkins with repositories that have multiple branches.
This depends entirely on how you're triggering the jobs from Bitbucket. For instance, I am using the pull-request-notifier plugin for Bitbucket to trigger my jobs, and one of the parameters it offers is the branch that the pull request was created from. You can then feed this information into Jenkins however you want; one example would be to pass it as a parameter to a parameterized job. Different hooks or triggers will have different options available; some might not even offer the ability to pass the branch name.
However, I would highly recommend using the Bitbucket Branch Source plugin for Jenkins instead. It automatically creates Jenkins jobs for every branch and pull request of every project in a Bitbucket project. This makes it much, much easier to work in Jenkins with repositories that have multiple branches.
answered Jan 10 at 17:30
jayhendren
5,29221444
5,29221444
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f415759%2fbranch-name-in-jenkins-regular-pipeline-job%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
This question may be better suited for the DevOps SE, since it's not really a unix-specific question.
– jayhendren
Jan 10 at 17:31