Multibranch Pipeline git events on PR

已查看 34 次
跳至第一个未读帖子

Gautam, Rishi

未读,
2021年2月10日 05:31:392021/2/10
收件人 jenkins...@googlegroups.com
I was trying to carry out git operations on any other branch than the PR source/destination branch in a jenkins multibranch pipeline.
When I scanned the branches inside the PR build job, I didn't see any other branches. I only got below branches on git branch -a command on pipeline:
* PR-2
  remotes/origin/PR-2
  remotes/upstream/stage

There are other branches like test,master. Are there any workarounds to this?

Gautam, Rishi

未读,
2021年2月15日 04:49:212021/2/15
收件人 jenkins...@googlegroups.com
anyone has any idea please

Dirk Heinrichs

未读,
2021年2月15日 04:59:302021/2/15
收件人 jenkins...@googlegroups.com
Am Mittwoch, den 10.02.2021, 16:16 +0545 schrieb Gautam, Rishi:

I was trying to carry out git operations on any other branch than the PR source/destination branch in a jenkins multibranch pipeline.
When I scanned the branches inside the PR build job, I didn't see any other branches. I only got below branches on git branch -a command on pipeline:
* PR-2
  remotes/origin/PR-2
  remotes/upstream/stage

Any chance the job configuration contains a branch filter?

HTH...

Dirk
-- 
Dirk Heinrichs
Senior Systems Engineer, Delivery Pipeline
OpenText ™ Discovery | Recommind
Recommind GmbH, Von-Liebig-Straße 1, 53359 Rheinbach
Vertretungsberechtigte Geschäftsführer Gordon Davies, Madhu Ranganathan, Christian Waida, Registergericht Amtsgericht Bonn, Registernummer HRB 10646
This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden
Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail sind nicht gestattet.
signature.asc

Ivan Fernandez Calvo

未读,
2021年2月15日 14:57:012021/2/15
收件人 Jenkins Users
Check if you have set git references on the job, IIRC the git plugin always make a `git fetch —all`

Mark Waite

未读,
2021年2月15日 15:41:142021/2/15
收件人 Jenkins Users
The multibranch pipeline implementation on one or more of the branch providers intentionally narrows the refspec of the repository while cloning it into the workspace.  The narrowed refspec usually includes only a single branch so that git does not waste effort retrieving changes that are not related to the branch being built.  That narrow refspec 

If you need more branches available in the workspace, you may need to use a checkout scm step within your pipeline definition that specifically chooses to use the wider refspec that you need for the additional branches you're trying to access.

Refspecs are described in the "repostories" section of the git plugin documentation and in the command line git documentation.

Example checkout steps can be generated with the Pipeline Syntax snippet generator from your Jenkins controller.  A brief video clip on using the snippet generator is linked from the git plugin documentation.

Mark Waite

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/691d1a51-5ae2-4004-8e56-7c3fa3f6a17an%40googlegroups.com.

Gautam, Rishi

未读,
2021年3月14日 23:58:112021/3/14
收件人 jenkins...@googlegroups.com
This was finally solved by doing unshallow clone of git repositories.
Configure Multibranch Pipeline Job > Branch Sources > Behaviours > Add > Advanced clone behaviours > uncheck shallow clone 
image.png

Thank you everyone for the help.

回复全部
回复作者
转发
0 个新帖子