From ad0ee4adff717e0f344205576aba863f9e9aa4ed Mon Sep 17 00:00:00 2001 From: Jo Basevi Date: Fri, 16 Aug 2024 11:19:48 +1000 Subject: [PATCH 1/2] Add warnings for signing runlog commits --- payu/runlog.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/payu/runlog.py b/payu/runlog.py index 840cfaef..494ae23a 100644 --- a/payu/runlog.py +++ b/payu/runlog.py @@ -12,6 +12,7 @@ import shlex import subprocess import sys +import warnings # Third party import requests @@ -95,9 +96,18 @@ def commit(self): print(cmd) try: subprocess.check_call(shlex.split(cmd), stdout=f_null, - cwd=self.expt.control_path) + stderr=f_null, cwd=self.expt.control_path) except subprocess.CalledProcessError: - print('TODO: Check if commit is unchanged') + # Attempt commit without signing commits + cmd = f'git -c "commit.gpgsign=false" commit -am "{commit_msg}"' + print(cmd) + try: + subprocess.check_call(shlex.split(cmd), + stdout=f_null, + cwd=self.expt.control_path) + warnings.warn("Runlog commit was commited without git signing") + except subprocess.CalledProcessError: + warnings.warn("Error occured when attempting to commit runlog") # Save the commit hash self.expt.run_id = commit_hash(self.expt.control_path) From 55f594a860705fb6fbd62ac80f1ec921f4914624 Mon Sep 17 00:00:00 2001 From: Jo Basevi Date: Mon, 19 Aug 2024 10:32:37 +1000 Subject: [PATCH 2/2] Use --no-gpg-sign for reattempting runlog commits without signing --- payu/runlog.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/payu/runlog.py b/payu/runlog.py index 494ae23a..157c0135 100644 --- a/payu/runlog.py +++ b/payu/runlog.py @@ -99,7 +99,7 @@ def commit(self): stderr=f_null, cwd=self.expt.control_path) except subprocess.CalledProcessError: # Attempt commit without signing commits - cmd = f'git -c "commit.gpgsign=false" commit -am "{commit_msg}"' + cmd = f'git commit --no-gpg-sign -am "{commit_msg}"' print(cmd) try: subprocess.check_call(shlex.split(cmd),