Skip to content

Option to skip pull requests during branch & pullrequests discovery#9

Closed
szhem wants to merge 1 commit intojenkinsci:masterfrom
szhem:optional-pullrequests
Closed

Option to skip pull requests during branch & pullrequests discovery#9
szhem wants to merge 1 commit intojenkinsci:masterfrom
szhem:optional-pullrequests

Conversation

@szhem
Copy link

@szhem szhem commented Jun 28, 2016

Currently bitbucket source plugin when using with multibranch pipeline can create jobs for pull requests and target branches. In that case the same revision will be built twice - for the first time for the source branch of pull request, and for the second time - for the pull request itself.

This pullrequest adds an option to skip pull request discovery.

@amuniz
Copy link
Member

amuniz commented Jun 28, 2016

I'd like to implement something similar to this: jenkinsci/github-branch-source-plugin#60 which would cover the use case pointed in this PR.

@amuniz
Copy link
Member

amuniz commented Jun 28, 2016

Created JENKINS-36283 for it.

@ncadou
Copy link

ncadou commented Oct 6, 2016

Any chance for this to land in a release? Double builds caused by PRs are a blocker here. Or if you had instructions for building an hpi that includes this PR, that could be awesome, too.

@wbagdon
Copy link

wbagdon commented Oct 10, 2016

One workaround I've used is to add this regex for automatic branch triggering
^(?!PR\b)(.*)
The pull request can then only be manually built

@szhem
Copy link
Author

szhem commented Oct 11, 2016

I though a little regarding this PR, and it seems that it would be better to properly name discovered PR-s and exclude them by means of excludes field.

Currently it's hardly possible to exclude PR-s because they are registered with the branch name that we don't usually want to exclude, but the name of the job still remains not very informative, like PR-XX.

What do you think regarding

  1. Naming jobs for pull requests using the following scheme

    PR-<NUM> (<TITLE>)
    

    for example

    PR-12 (Option to skip pull requests during branch & pullrequests discovery)
    
  2. Registering jobs for pull requests using not the original branch name (the branch, the PR is created for), but, for example, using the following scheme

    PR-<NUM>-<BRANCH_NAME>
    

    for example

    PR-12-feature/skip-prs-during-discovery
    

In that case we will be able to exclude PR-s from discovering and building (second point) and if we don't like to do it, the name of the PR would be a little bit more informative.

If there will be a chance that these improvements can be included into some release I can create two separate PR-s for these features.

What do you think?

@ncadou
Copy link

ncadou commented Oct 11, 2016

Right now I don't have a use case for building PRs, as opposed to straight branches, but if I did, a more informative job name for PRs would be handy.

@amuniz
Copy link
Member

amuniz commented Oct 13, 2016

it seems that it would be better to properly name discovered PR-s and exclude them by means of excludes field.

No. It is possible to modify the code to apply the exclusion to job names (PR-XX) instead of forked branch names (which is a bug actually).

At any rate, as I said before in this PR, I want to have something similar to jenkinsci/github-branch-source-plugin#60.

@tknerr
Copy link

tknerr commented Nov 22, 2016

+1, also desperately in need for an option to disable the automatic PR builds.

@amuniz I suspect that #25 is exactly what you mean when you say "something similar to jenkinsci/github-branch-source-plugin#60"?

@tknerr
Copy link

tknerr commented Nov 22, 2016

@wbagdon I couldn't get your workaround with ^(?!PR\b)(.*) to work. Where exactly did you specify that?

The issue seems to be that you can't exlude PR-* because the PR builds are also matching by the underlying feature branch name...

@tknerr
Copy link

tknerr commented Nov 22, 2016

Honestly, I found absolutely no way to build only one of them.

  • building only PRs seems not possible
  • building only branches seems not possible

So it will always build twice?! Or am I missing something?

@wbagdon
Copy link

wbagdon commented Nov 22, 2016

@tknerr I'm using verison 1.5 of the plugin so my branches appear as such under the repo folder

names

I specify the regex in the Bitbucket branch folder like this

regex

@tknerr
Copy link

tknerr commented Nov 23, 2016

@wbagdon is this ("Automatic branch project triggering") a configuration option of bitbucket-branch-source-plugin in version 1.5?

I'm using Jenkins 2.19.1 LTS + bitbucket-branch-source-plugin v1.8 and it looks like this:

image

Still the ^(?!PR\b)(.*) regex does not help, because only the branch name in "Include branches" seems to relevant (ie the "PR-" jobs seem to be registered under the underlying feature branch name, so I can not filter for "PR-")

@szhem
Copy link
Author

szhem commented Nov 23, 2016

I can confirm (and have mentioned it earlier), than PRs are registered under branch names, so cannot be excluded by means of regexps by now.

@wbagdon
Copy link

wbagdon commented Nov 23, 2016

@tknerr this is a configuration item of "Bitbucket Team/Project" jobs
Setup:
setup

Configuration Options;
branch_triggering

@tknerr
Copy link

tknerr commented Nov 23, 2016

@wbagdon weird, I don't see that last item. The last one have is "Pipeline Libraries". This is Jenkins 2.19.1 LTS...

@amuniz
Copy link
Member

amuniz commented Nov 23, 2016

@tknerr make sure you have branch-api-plugin 1.9 or more.

@tknerr
Copy link

tknerr commented Nov 23, 2016

@amuniz I have branch-api-plugin 1.11.1, but just noticed it's a different issue:

I'm using JobDSL to set up a multibranchPipelineJob and use the BitbucketSCMSource in there. By manually creating a "Bitbucket Team/Project" I could verify that this is differnet than a "Multibranch Pipeline" and indeed has the setting in there.

Btw: one thing I'm missing compared to the GitSCMSource is the support for specifying a repo browser. Actually, I was expecting that links would be already rendered correctly, because we specify the bitbucketServerUrl. But links don't get rendered correctly. Any ideas on that one?

@tknerr
Copy link

tknerr commented Nov 23, 2016

P.S. created JENKINS-39982 for the latter

@ghost
Copy link

ghost commented Dec 18, 2016

For BitBucket team project, you may want to refer to PR: #27
it is based on this PR.

@amuniz
Copy link
Member

amuniz commented Jan 23, 2017

As I said before, #25 is the path forward (this is a subset of the features included in #25). Si 👎 to this.

@stephenc
Copy link
Member

Superseded by #53

@stephenc stephenc closed this Jun 12, 2017
fengxx pushed a commit to fengxx/bitbucket-branch-source-plugin that referenced this pull request Mar 13, 2018
…bPropertyImpl.DescriptorImpl.newInstance

JobPropertyDescriptor.newInstance can return null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants