puppet-r10k
puppet-r10k copied to clipboard
(Feature) Log the commit(s) that triggered the webhook invocation
Logging currently tells us the branch name that is involved in the webhook invocation, and shows the r10k output, but does not tell us which specific event the log entry is associated with.
[2016-03-01 14:54:39] DEBUG accept: X.X.X.X:52466
[2016-03-01 14:54:39] DEBUG Rack::Handler::WEBrick is invoked.
[2016-03-01 14:54:39] INFO authenticated: puppet
[2016-03-01 14:57:54] INFO message: triggered: umask 0022; r10k deploy environment garbage -pv
INFO -> Deploying environment /etc/puppetlabs/puppet/environments/garbage
INFO -> Deploying module /etc/puppetlabs/puppet/environments/garbage/modules/dhcp
...
branch: garbage
[2016-03-01 14:57:54] DEBUG close: X.X.X.X:52466
Webhook payloads appears to contain some commit information. GitHub and BitBucket Server appear to have different, but similar information - at least enough to let the webhook work with both.
Request: Include a commit hash, webhook event idea, or other identifying information associated with an event in the log, for better troubleshooting of webhook or git-server of problems.
To start with maybe even knowing if the post is for a branch being added, updated or deleted would be good.
For example. at the moment, when a branch is deleted, r10k returns an error because the branch doesn't exist. But it still deletes the environment.
[2017-05-10 09:21:42] ERROR message:
ERROR -> Environment(s) 'test_branch' cannot be found in any source and will not be deployed.
INFO -> Removing unmanaged path /etc/puppetlabs/code/environments/test_branch
So, the end result is good, but on slack I get a notification 'Failed to deploy test_branch' Perhaps I could add some logic in here somehow.