开发者

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

开发者 https://www.devze.com 2023-04-10 08:16 出处:网络
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

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.


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
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号