-
Bug
-
Resolution: Duplicate
-
Major
-
Jenkins 2.222.3
Git plugin 4.2.2
Pipeline: Multibranch 2.21
-
-
3.0.0
Using multibranch pipeline clones the entire repository on the master instead of just getting the Jenkinsfile with the lighweight method. The lightweight checkout is the default behaviour as far as I know, but it's not working in my case. The clone is repeated when the pipeline starts on a slave machine, of course. Here is my setup:
Branch Sources / Bitbucket server (connection is fine)
Behaviours:
Discover branches
Advanced clone behaviours:
- Fetch tags: unchecked
- Honor refspec on initial clone: checked
- Shallow clone: checked
- Shallow clone depth: 1
- Path to reference repo to use during clone: empty
- Timeout: empty
Build strategies: Skip initial build on first branch indexing
Build configuration:
- Mode: by Jenkinsfile
- Script path: build/jenkins/compile/Jenkinsfile
Please find the checkout log in the attachment.
- duplicates
-
JENKINS-63033 Implement Lightweight Checkout for Multibranch Pipeline Jobs
-
- Closed
-
Command line git does not provide a way to request a single file from a remote repository. The mode of operation is to fetch the remote repository locally and then checkout the needed file locally.
Lightweight checkout is most useful with higher level git providers like GitHub,, Bitbucket, GitLab, and Gitea. Those higher level providers use a different access technique to request the Jenkinsfile. The git plugin could use the GitRepositoryBrowser information which is optionally provided by the user to attempt to request a single file from a specific branch or revision. That would require writing the code to formulate the request for a single file to each of the repository browser providers and would require that the user must provide that repository browser URL in the job definition. That has not been done.
This is a good enhancement request, though it is not high priority on my list of enhancements.
Since you're using Bitbucket, I believe you could get the benefits of the Bitbucket API by using a multibranch pipeline for that repository, then define it to monitor only a single branch.