How do you configure Jenkins to use git archive instead of git clone with Gerrit?

We have an automated build system configured using Jenkins, integrate with Gerrit. One of the bottlenecks today is that it takes ~3.5 minutes for Jenkins to complete a “git clone” for each build, due to repository size. The same check-out using “git archive” takes approx 12 seconds.

Can the gerrit plugin for Jenkins be configured to use “git archive”? This will significantly reduce our build time.

  • Jenkins, parameterized builds and the ability to select the required subprojects and child nodes based on variables
  • False Dependency in Gerrit after a git pull
  • Allow review for a Change only from authors that are added explicitly
  • Obtain the latest refspec on a Gerrit Change
  • Use of gerrit REST APIs
  • How can I add my github repo to local gerrit server?
  • Rebase all branches without switching to them
  • Build operation failed without specifying any errors for React Native XCode project
  • heroku: Gemfile.lock is required issue
  • How to go to previous commits in eclipse and egit
  • Exclude Files When Deploying from Git to Azure Websites
  • Git subtree - subtree up-to-date but can't push
  • One Solution collect form web for “How do you configure Jenkins to use git archive instead of git clone with Gerrit?”

    Although it doesn’t appear to be possible using an unmodified version of the Git plugin, I did accomplish this in two steps:

    1) Change SCM to "None" for the particular job.
    2) Add a build step at the beginning to checkout using "git archive"
    

    Here is a sample for step 2).

    git archive --format=tar --remote=git://host/repo ${GERRIT_REFSPEC} > ${BUILD_ID}.tar && tar xvf ${BUILD_ID}.tar && rm ${BUILD_ID}.tar
    
    Git Baby is a git and github fan, let's start git clone.