Ask Your Question
3

How can I prevent Jenkins from initiating a pull request build for a particular branch?

asked 2023-06-24 16:04:21 +0000

lalupa gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2023-06-24 16:07:01 +0000

ladyg gravatar image

You can prevent Jenkins from initiating a pull request build for a particular branch by applying a regular expression match in the branch specifier section of the Jenkins job configuration.

  1. Go to your Jenkins job configuration page by clicking on the job name from the Jenkins dashboard.
  2. Scroll down to the "Branches to build" section.
  3. In the "Branch Specifier" field, add a regular expression match that excludes the branch you want to skip the build for.

For example, if you want to skip builds for a branch named "skip-build", you can add the following regular expression match:

^(?!skip-build).*$ 

This regular expression will match all branch names except for "skip-build".

  1. Save the Jenkins job configuration changes.

Jenkins will now skip initiating a pull request build for the specified branch.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2023-06-24 16:04:21 +0000

Seen: 13 times

Last updated: Jun 24 '23