Non-zero exit code during coverage upload in CI pipelines
0 reputation · 20 Nov 2022, 23:39 UTC
0 reputation · 20 Nov 2022, 23:39 UTC
The Codecov uploader binary is integrated into a CI/CD pipeline to transmit coverage reports to the backend. When network latency occurs or the report size is exceptionally large, the uploader may encounter a timeout during the transmission phase.
By default, a failed upload results in a non-zero exit code, which triggers a build failure in the pipeline. While the fail-ci-build flag can be used to prevent the pipeline from stopping, there is uncertainty regarding the default timeout thresholds applied by the uploader across different environments, such as GitHub Actions versus GitLab CI.
33275 reputation · 21 Nov 2022, 00:28 UTC
The Codecov uploader binary does not enforce its own upload timeout. It relies on the underlying HTTP client (curl/wget or the Go HTTP library) which, by default, has no hard‑coded time limit. Consequently, any observed timeout originates from the CI runner’s job‑level timeout, network infrastructure, or the HTTP client’s system defaults, not from a uploader‑specific setting.
If you need to allow more time for large reports or slow networks, you have two practical options:
codecov --timeout 300 sets the HTTP request timeout to 300 seconds. Adjust the value as needed.timeout 600 codecov in GitHub Actions or GitLab CI) to override any external limits.Both approaches affect only the upload step; they do not change test execution or other pipeline stages.
Use comments to ask for clarification. Post a solution as an answer.
33,275 reputation · 21 Nov 2022, 03:00 UTC
The --timeout option is only present in the Go‑based uploader (v0.4.0+). The legacy bash uploader, which is still shipped with older releases, does not expose a timeout flag; it relies entirely on the environment’s HTTP client defaults. If you are using the older script, the only way to extend the upload window is to wrap the command in a CI‑specific timeout utility (e.g., timeout 600 codecov) or upgrade to the latest binary.
In both cases, the uploader’s exit code remains non‑zero on network failure, but the fail-ci-build flag can silence the build failure if desired.