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.

  • What does “You are in the middle of an am session” mean?
  • Commiter email address does not match in IntelliJ even changing it to correct one
  • Continuous integration for student assignments
  • Is it possible to have gerrit/phabricator(code review) running on one server and git repository on the other? and have them synced?
  • How to merge commit in Gerrit Code Review
  • Handling outdated dependencies in Gerrit
  • Git: Getting total numbers of uncomitted lines in a repo
  • What are the differences between .gitignore and .gitkeep?
  • Workflow for using Git SVN and a Remote Git Repository with multiple users
  • TeamCity getting stuck at “Updating sources” on one Git repo
  • Git serve: I would like it that simple
  • What does 'git commit' mean when it says 'create mode …' on stdout?
  • 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.