From 2799a684fc1e0ed4d3b62ae21a1d9a6a20a38e68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=F0=9F=87=BA=F0=9F=87=A6=20Sviatoslav=20Sydorenko=20=28?= =?UTF-8?q?=D0=A1=D0=B2=D1=8F=D1=82=D0=BE=D1=81=D0=BB=D0=B0=D0=B2=20=D0=A1?= =?UTF-8?q?=D0=B8=D0=B4=D0=BE=D1=80=D0=B5=D0=BD=D0=BA=D0=BE=29?= Date: Wed, 15 Oct 2025 17:50:25 +0200 Subject: [PATCH] Explicitly notify Codecov about upload completion (#85968) This patch add an additional invocation of Codecov CLI that tells the backend that we're done uploading. It is supposed to stop Codecov from guessing whether to wait for more uploads for the CI or start processing them already. Upstream refs: * https://docs.codecov.com/docs/cli-options#send-notifications * https://docs.codecov.com/docs/notifications#preventing-notifications-until-youre-ready-to-send-notifications * https://docs.codecov.com/docs/codecovyml-reference#codecovnotifymanual_trigger * https://github.com/codecov/codecov-cli/pull/195 (https://github.com/getsentry/prevent-cli/commit/d634ebd8f21d2880df12f002d83afa499652ea25) * https://github.com/codecov/codecov-action/issues/1436 * https://github.com/codecov/engineering-team/issues/107 * https://github.com/codecov/roadmap/issues/20 * https://github.com/codecov/feedback/discussions/204#discussioncomment-8796433 * https://github.com/codecov/engineering-team/issues/1245 * https://github.com/codecov/engineering-team/issues/3 * https://github.com/codecov/worker/pull/14 (https://github.com/codecov/umbrella/commit/71626b6368a880d92f1d611917e6ec08598ef26b) --- .azure-pipelines/scripts/publish-codecov.py | 26 ++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/.azure-pipelines/scripts/publish-codecov.py b/.azure-pipelines/scripts/publish-codecov.py index e4e2303889c..828b9fd5e19 100755 --- a/.azure-pipelines/scripts/publish-codecov.py +++ b/.azure-pipelines/scripts/publish-codecov.py @@ -118,16 +118,40 @@ def upload_files(codecov_bin: pathlib.Path, config_file: pathlib.Path, files: t. run(*cmd) +def report_upload_completion( + codecov_bin: pathlib.Path, + config_file: pathlib.Path, + dry_run: bool = False, +) -> None: + """Notify Codecov backend that all reports we wanted are in.""" + cmd = [ + codecov_bin, + '--disable-telem', + f'--codecov-yml-path={config_file}', + 'send-notifications', + ] + + if dry_run: + cmd.append('--dry-run') + + run(*cmd) + + def main() -> None: args = parse_args() with tempfile.TemporaryDirectory(prefix='codecov-') as tmpdir: config_file = pathlib.Path(tmpdir) / 'config.yml' - config_file.write_text('') + # Refs: + # * https://docs.codecov.com/docs/codecovyml-reference#codecovnotifymanual_trigger + # * https://docs.codecov.com/docs/notifications#preventing-notifications-until-youre-ready-to-send-notifications + config_file.write_text('codecov:\n notify:\n manual_trigger: true') codecov_bin = install_codecov(pathlib.Path(tmpdir)) files = process_files(args.path) upload_files(codecov_bin, config_file, files, args.dry_run) + # Ref: https://docs.codecov.com/docs/cli-options#send-notifications + report_upload_completion(codecov_bin, config_file, args.dry_run) if __name__ == '__main__':