Multibranch Pipeline with Git-plugin - no PR support ?

109 views
Skip to first unread message

Torsten Reinhard

unread,
Jan 9, 2024, 5:22:29 AMJan 9
to Jenkins Users
Hi,

my Jenkins Multibranch jobs are currently based on Bitbucket, using the " cloudbees-bitbucket-branch-source" plugin. I was using a configuration with
- Discover branches
- Discover pull requests from origin
resulting in multiple tab views to run builds for Branches and PR´s.

Now we need to migrate the git repositories to Github and I´m running into 2 issues:

1.) Github plugin seems to only support User/pwd authentication - but I´m restricted to use ssh-key(s) only.
2.) Git plugin supports ssh-key(s) for authentication, but seems not to support "Discover pull-requests from origin".

The Git plugin only supports "Discover other refs"

Is there a way to handle the PR´s in any way with the Git plugin ?

Thx for any hints,

Torsten

Mark Waite

unread,
Feb 9, 2024, 6:27:28 AMFeb 9
to Jenkins Users
On Tuesday, January 9, 2024 at 3:22:29 AM UTC-7 Torsten wrote:
Hi,

my Jenkins Multibranch jobs are currently based on Bitbucket, using the " cloudbees-bitbucket-branch-source" plugin. I was using a configuration with
- Discover branches
- Discover pull requests from origin
resulting in multiple tab views to run builds for Branches and PR´s.

Now we need to migrate the git repositories to Github and I´m running into 2 issues:

1.) Github plugin seems to only support User/pwd authentication - but I´m restricted to use ssh-key(s) only.

That is a serious limitation that your organization has placed on you.  It will limit many uses of GitHub in Jenkins and elsewhere.  The GItHub API is only accessible over HTTP.  The HTTP authentication requires username / password authentication with a GitHub personal access token or other form of token.  The HTTP authentication does not accept private keys as far as I know.

Without access to the GitHub API, you're severely limited on the types of operations that can be performed.  The GitHub branch source plugin and the GitHub organization folder plugin use the GitHub API to perform many of their operations.  The GitHub API is what makes those plugins such an improvement over the Git plugin.  The same is true for the Bitbucket branch source plugin.

I assume that you were allowing HTTP authenticated requests with Bitbucket.  Similar requests are needed for GitHub.  The best choice is to persuade your organization that they need to allow token based authentication with GitHub.
 
2.) Git plugin supports ssh-key(s) for authentication, but seems not to support "Discover pull-requests from origin".

The Git plugin only supports "Discover other refs"

Is there a way to handle the PR´s in any way with the Git plugin ?

The git plugin uses command line git or JGit and limits itself to the concepts that are available from command line git.  Command line git does not have the concept of a pull request.  Command line git understands refs and branches.

If you can find the refspec that GitHub uses to store pull requests, you might be able to detect those pull request branches and create jobs for those pull request branches.  However, that is a much worse experience than the experience you'll have if you use the GitHub branch source plugin and the GitHub organization folder plugin and let them manage the creation and deletion of branches 

Mark Waite
 
Reply all
Reply to author
Forward
0 new messages