You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
Jun 18 13:44:35 puppet-server-01 webhook-go[3046986]: time="2024-06-18T13:44:35-07:00" level=error msg="failed to execute local command `[/opt/puppetlabs/puppet/bin/r10k deploy environment TICKET-1234 --config=/etc/puppetlabs/r10k/r10k.yaml --verbose --generate-types --modules]` with error: `exit status 1`
<snipped>
ERROR\t -> Environment(s) 'TICKET_1234' cannot be found in any source and will not be deployed.\n
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 the feature_TICKET_1234 environment.
Looking through the source code, it appears the behavior is caused by this:
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:
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:
webhook-go/lib/parsers/github.go
Line 26 in fef55c8
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.The text was updated successfully, but these errors were encountered: