Saltstack gitfs - how to retrieve git commit hash?

636 views Asked by At

Gitfs (dulwich) is configured as fileserver-backend in our saltstack with only one gitfs_remotes. I want to be able to retrieve the current git commit hash from the Gitfs when I run salt on the master so I can keep a log of which git commit is run on a minion at what time. salt.loaded.int.pillar.git_pillar seems to have that information, but not sure how I can get it from my salt python script. Appreciate your help!

1

There are 1 answers

0
heatherz On

There is a hash stored in /var/cache/salt/master/gitfs/remote_map.txt. Git checkout from Gitfs can be found under /var/cache/salt/master/gitfs/{hash}/.git directory. Once in that directory, git commit hash can be easily found using "git rev-parse --verify HEAD".