Skip to content

Commit

Permalink
Merge pull request #488 from ACCESS-NRI/449-signing-git-commits
Browse files Browse the repository at this point in the history
Add warnings for signing runlog commits and re-attempt commit without signing
  • Loading branch information
jo-basevi committed Aug 20, 2024
2 parents e611bcc + 55f594a commit 8aa701e
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions payu/runlog.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import shlex
import subprocess
import sys
import warnings

# Third party
import requests
Expand Down Expand Up @@ -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 commit --no-gpg-sign -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)
Expand Down

0 comments on commit 8aa701e

Please sign in to comment.