Skip to content

Commit 9a9cae9

Browse files
committed
feat: include srt-slurm git commit hash in lockfile metadata
1 parent 6b692a8 commit 9a9cae9

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

src/srtctl/core/lockfile.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,22 @@ def collect_slurm_context() -> dict[str, Any]:
7272
if srtctl_root:
7373
ctx["srtctl_root"] = srtctl_root
7474

75+
# srt-slurm git commit (what version of the tool generated this lockfile)
76+
try:
77+
import subprocess
78+
79+
result = subprocess.run(
80+
["git", "rev-parse", "HEAD"],
81+
capture_output=True,
82+
text=True,
83+
timeout=2,
84+
cwd=srtctl_root or None,
85+
)
86+
if result.returncode == 0:
87+
ctx["srtctl_commit"] = result.stdout.strip()
88+
except Exception:
89+
pass
90+
7591
return ctx
7692

7793

0 commit comments

Comments
 (0)