Forum: Cfengine Help
Subject: Re: Cfengine change management with git
Author: zzamboni
Link to topic: https://cfengine.com/forum/read.php?3,20023,20030#msg-20030

Good stuff Ben, thank you for sharing.

I have one suggestion for additional automation - how about instead of asking 
the user "Have you committed your changes?", simply check if the repository is 
clean, something like this:

# This would replace the 'read' and 'if [ "$ANSWER" == "y" ]' lines
GITST=`git status -u no --porcelain`
if [ -z "$GITST" ]; then
   # Repo is clean
   ... [ do the update ]
else
   echo "The repository is not clean. Please commit or stash all your changes 
before proceeding."
   echo "Use 'git branch' to view the current branch."
   ...
fi


For something as critical as deploying new cfengine policy files, I'm willing 
to impose the extra burden on the admin of having the git repository clean 
before doing anything, just to be sure they have to at least look at it before 
proceeding. Maybe even remove the "-u no" option to stop also in the presence 
of untracked files. This would stop someone from adding a new .cf file, 
reference it in promises.cf, and then forgetting to check in the new file, 
which would break everything.

I've been slowly (in my copious free time :) working on a scheme (and 
corresponding writeup) that is somewhat similar, but allowing me to have 
separate development, testing and production branches in the git repository.

_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to