はじめに
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