We run sudo /usr/local/bin/puppetserver-deploy-code via post-checkout, post-commit, and post-merge git hooks in the /srv/git/operations/puppet directory. This script takes care of atomically updating the puppetserver's view of ops/puppet.git when we update the local checkout. The script includes a check to decide if work should be done or not, and emits an ERROR: ... log message when it decides not not continue:
if [[ "$current_branch" != 'production' ]]; then printf 'ERROR: Current branch in /srv/git/operations/puppet is "%s", should be "production"\n' "$current_branch" 1>&2 printf 'ERROR: Exiting rather than deploying something surprising\n' 1>&2 exit 1 fi
This log message looks sort of scary when the git operation being performed is a rebase of the local cherry-picks on top of the latest upstream HEAD:
gitpuppet@deployment-puppetserver-1:/srv/git/operations/puppet$ git rebase --interactive origin/production ERROR: Current branch in /srv/git/operations/puppet is "", should be "production" ERROR: Exiting rather than deploying something surprising ERROR: Current branch in /srv/git/operations/puppet is "", should be "production" ERROR: Exiting rather than deploying something surprising ERROR: Current branch in /srv/git/operations/puppet is "", should be "production" ERROR: Exiting rather than deploying something surprising ERROR: Current branch in /srv/git/operations/puppet is "", should be "production" ERROR: Exiting rather than deploying something surprising ERROR: Current branch in /srv/git/operations/puppet is "", should be "production" ERROR: Exiting rather than deploying something surprising ERROR: Current branch in /srv/git/operations/puppet is "", should be "production" Successfully rebased and updated refs/heads/production.
Changing the log line label from ERROR: to INFO: might make things look less scary while still letting folks know what is happening. Alternately we could try to figure out within the script itself if the call is happening during a rebase. Or we could leave things as is knowing that this explanation of what is happening is now available to those who search Phabricator for the error message.