LoginSignup
1
1

More than 3 years have passed since last update.

Jenkins経由でGit Checkoutがタイムアウトになって出来なかった時

Posted at

はじめに

JenkinsでGit Checkoutをしたところ下記のErrorが出ました。
結果的にはファイル容量が大きすぎてタイムアウトしてビルドが通らなかったのですが、その時の解決方法です。

ERROR: Timeout after 10 minutes
FATAL: Could not checkout git hash
Hudson.plugins.git.GitException: Command “/usr/local/bin/git checkout -f git hash” returned status code 143:
stdout:
Stderr: Filtering content: 22%(2/9), 70.42 MiB | 9.20 MiB/s
  at org.jenkinsci.plugins.gitclient.CliGitAPllmpl.launchCommandln(CliGitAPllmpl.java:2450)
  at org.jenkinsci.plugins.gitclient.CliGitAPllmpl.access$1100(CliGitAPllmpl.java:84)
  at org.jenkinsci.plugins.gitclient.CliGitAPllmpl$9.exeute(CliGitAPllmpl.java:2767)
Hudson.plugins.git.GitException: Could not checkout git hash
  at org.jenkinsci.plugins.gitclient.CliGitAPllmpl$9.exeute(CliGitAPllmpl.java:2791)
…
Performing Post build task…
Match found for :: True

解決策

Advanced clone behaviorsの設定を加えます。
Fetch tagsをTrue。
クローンとフェッチのタイムアウト(分)を30に設定
Shallow clone -> Shallow clone depth0に設定

sample.png

shallow cloneを使うことよりcheckoutの時間を短縮させますが、git logをしても過去のコミットを見ることはできません。
最新のリポジトリの状態でビルドしたいけど過去のコミットの情報は不要という場合に使用した方が良いです。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1