From b0af2b30abc487caa7ab861e393e0ae222e5b49d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Corentin=20No=C3=ABl?= Date: Mon, 12 Feb 2024 10:51:47 +0100 Subject: [PATCH] ci_run_n_monitor: Allow the upstream format to not exist MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When pushing directly to a fork, the upstream branch does not exist and thus returns an empty string. Signed-off-by: Corentin Noël Part-of: --- bin/ci/ci_run_n_monitor.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/bin/ci/ci_run_n_monitor.py b/bin/ci/ci_run_n_monitor.py index 1ba70353988..264a71c0903 100755 --- a/bin/ci/ci_run_n_monitor.py +++ b/bin/ci/ci_run_n_monitor.py @@ -435,16 +435,17 @@ if __name__ == "__main__": branch_name, ]).decode('ascii').strip() - remote_rev = check_output([ - 'git', 'rev-parse', tracked_remote, - ]).decode('ascii').strip() + if tracked_remote: + remote_rev = check_output([ + 'git', 'rev-parse', tracked_remote, + ]).decode('ascii').strip() - if REV != remote_rev: - print( - f"Local HEAD commit {REV[:10]} is different than " - f"tracked remote HEAD commit {remote_rev[:10]}" - ) - print("Did you forget to `git push` ?") + if REV != remote_rev: + print( + f"Local HEAD commit {REV[:10]} is different than " + f"tracked remote HEAD commit {remote_rev[:10]}" + ) + print("Did you forget to `git push` ?") projects.append(get_gitlab_project(gl, args.project)) (pipe, cur_project) = wait_for_pipeline(projects, REV)