0

It seems like that the "Build now" runs a single branch, the default branch of the project, although I defined two branch specifiers in the configuration of "Source Code Management".

Is there any chance to get it to run several branches or a specific branch?

ScientiaEtVeritas
  • 5,158
  • 4
  • 41
  • 59

2 Answers2

1

You can make your job parameterized, add string parameter BRANCH and set "Branches to build" is equal $BRANCH

Branches to build

Mikhail Naletov
  • 285
  • 1
  • 2
  • 12
1

Is your build "parameterized"? If not, I suggest to add "branch" as a parameter and configure ${branch} in "Source Code Management" configuration.

Something like this :

enter image description here

On rebuild, you can specify which branch to build.

enter image description here

If you have set "concurrent build", multiple rebuilds can be triggered with different branches as parameter.

Community
  • 1
  • 1
saurabh14292
  • 1,281
  • 2
  • 10
  • 12
  • Thanks :) Can this work together with GitHub Hook Triggers? – ScientiaEtVeritas May 03 '18 at 17:47
  • I haven't used GitHub hooks. But if its like triggering a build remotely, say through a hook when a push happens, you can use something like this : "http: // JENKINS_SERVER_ADDRESS/job/YOUR_JOB_NAME/buildWithParameters?myparam=myparam_value" Refer more here : https://stackoverflow.com/questions/20359810/how-to-trigger-jenkins-builds-remotely-and-to-pass-parameters – saurabh14292 May 04 '18 at 17:06