6
2

More than 3 years have passed since last update.

GitLab CI/CD機能における出力ログ上限の超過対策

Posted at

はじめに

GitLab CI/CDにて、実行ジョブのログが大量である場合、上限設定に引っかかりログが消失する恐れがある。
そういったときの対策。

環境

  • CentOS 7.6
  • GitLab 12.9.2

事象

ジョブ実行結果の最後に下記のように表示され、全てのログが表示されていない。

 Job's log exceeded limit of 4194304 bytes.

理由

gitlab-runnerにおいて、ログの出力上限設定が存在するから。デフォルトの上限は4MBとなっている。

対策

単純。上限を引き上げれば良いだけ。
gitlab-runnerの設定ファイルにoutput_limit設定を追加し、キロバイト(KB)単位で任意の値を指定する。
恐らくデフォ状態では、パラメーター自体が存在しないはず。この場合、デフォルトの値である4MBが採用されている。

/etc/gitlab-runner/config.toml
[[runners]]
  name = "example-runner"
  url = "https://example.local"
  token = "example-token"
  output_limit = 40960  <-- コレ (この場合10倍に増やしている)
  executor = "docker"
  [runners.custom_build_dir]
  [runners.cache]
    [runners.cache.s3]
    [runners.cache.gcs]
  [runners.docker]
    tls_verify = false
    image = "example"
    privileged = false
    disable_entrypoint_overwrite = false
    oom_kill_disable = false
    disable_cache = false
    volumes = ["/cache"]
    shm_size = 0

再起動して適用。

systemctl restart gitlab-runner.service

参考

6
2
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
6
2