Jenkins - how to build a specific branch

It is not as simple as a parameterized assembly. I already have a specific build process that will build and deploy when any of these branches are ported to GitHub:

enter image description here

So, if I just clicked develop and it was successfully created, how can I start manual assembly and pull out feature/my-new-feature (without doing git push )? I tried to enable a parameterized assembly by adding a new line called branch , and then adding a new */$branch specifier. Then I started the assembly and set branch to feature/my-new-feature and still pulled it from develop .

I would be grateful for any help!

+58
git github jenkins
Aug 20 '15 at 1:57
source share
5 answers

A better solution might be:

By adding a new row parameter to an existing job enter image description here

Then, in the Source Code Management section, update Branches to build to use the string parameter defined enter image description here

This will allow the jenkins task to use the default branch as master , and for manual collections it will ask you to enter branch information (FYI: by default it is set to master ) enter image description here

+47
Nov 03 '16 at 15:27
source share

I don’t think that you are both part of the same jenkins work, you need to set up a new jenkins task that will have access to your github to retrieve the branches, and then you can choose which one will be manually created.

Just mark it as a parameterized assembly, specify the name and parameter configured as git parameter

enter image description here

and now you can configure git options:

enter image description here

+5
Sep 25 '16 at 0:27
source share

To verify a branch through Jenkins scripts, use:

 stage('Checkout SCM') { git branch: 'branchName', credentialsId: 'your_credentials', url: "giturlrepo" } 
+3
Sep 26 '17 at 11:32 on
source share

This is an extension of the answer provided by Ranjith

I would suggest you select the assembly of the selection options and specify the branches that you would like to build. Active selection option

And after that you can specify branches for assembly. Assembly line

Now, when you will build your project, you will be provided with "Build with Parameters", where you can select the branch for the assembly "

You can also write a groovy script to get all your branches in the active select parameter.

0
Aug 23 '17 at 11:18 on
source share

enter image description here

An option will appear in the Build Triggers settings.

Check out the github branches

A hook will be created, and then you can build any branch you like from Jenkins when you select github branches enter image description here

Hope this helps :)

0
Mar 28 '18 at 4:58
source share



All Articles