我们有一个使用 Jenkins 配置的自动构建系统,与 Gerrit 集成。今天的瓶颈之一是,由于存储库的大小,Jenkins 需要大约 3.5 分钟才能完成每个构建的“git 克隆”。使用“git archive”进行相同的 checkout 大约需要 12 秒。
Jenkins 的 gerrit 插件可以配置为使用“git archive”吗?这将显着减少我们的构建时间。
最佳答案
虽然使用未修改版本的 Git 插件似乎不可能,但我确实分两步完成了:
1) Change SCM to "None" for the particular job.
2) Add a build step at the beginning to checkout using "git archive"
这是第 2 步的示例)。
git archive --format=tar --remote=git://host/repo ${GERRIT_REFSPEC} > ${BUILD_ID}.tar && tar xvf ${BUILD_ID}.tar && rm ${BUILD_ID}.tar
关于git - 你如何配置 Jenkins 使用 git archive 而不是 git clone 和 Gerrit?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7629885/