Closed adoom42 closed 3 months ago
Should be merged. I'll get a release out later
@dhollinger Do we have any idea when a release with this change might be coming out?
@fffialho Sorry, for some reason I thought I had already triggered a release. I'll get that done soon
After upgrading the puppet-r10k module, I had to migrate from the built-in webhook to webhook-go. After doing so, r10k stopped working for some branches.
If the branch name contains one or more slashes, webhook-go only handles the part after the final slash. Ex. when the branch is named
feature/TICKET-1234
, the webhook-go systemd log shows this:It is common to use slashes in branch names. This post has several good examples. r10k itself handles slashes by replacing them with underscores like it does with hyphens, ex. the
feature/TICKET-1234
branch becomes known to Puppet agents as thefeature_TICKET_1234
environment.Looking through the source code, it appears the behavior is caused by this: https://github.com/voxpupuli/webhook-go/blob/fef55c882e825f130d63b68308604e1dbd53ae5e/lib/parsers/github.go#L26
From the Go documentation:
This is a major regression from the webhook daemon that used to be included in the puppet-r10k module and is effectively a blocker for me. Looking at the logs from the old Ruby webhook daemon, it runs r10k like this, retaining the full branch name:
This is how the old webhook determined the branch name: https://github.com/voxpupuli/puppet-r10k/blob/b565bd104ee9826e443b5461dad1075404774b75/templates/webhook.bin.erb#L168-L176
It stripped 'refs/heads/' from the string.
Please parse the branch name with something other than
path.Base()
, or at least provide a configuration option to do so.