voxpupuli / webhook-go

Puppet Webhook port in Golang
Apache License 2.0
16 stars 12 forks source link

Strange interpolation of name of the branch. #59

Closed sahaqaa closed 2 years ago

sahaqaa commented 2 years ago

Hello, we are using webhook-go (latest version) and we've faced next issue: one of our team members created branch on Bitbucket with name "EC_1767". For some reason "webhook-go" changed it to lower case and r10k failed to deploy the environment.

(production) root@puppet7:~$ systemctl status puppet-webhook.service
● puppet-webhook.service - Puppet Webhook writen in Go language
     Loaded: loaded (/etc/systemd/system/puppet-webhook.service; enabled; vendor preset: enabled)
     Active: active (running) since Tue 2022-06-07 13:55:30 UTC; 3 months 30 days ago
   Main PID: 994459 (webhook-go)
      Tasks: 8 (limit: 9103)
     Memory: 18.6M
     CGroup: /system.slice/puppet-webhook.service
             └─994459 /opt/bitbucket-webhook/webhook-go

Oct 06 14:25:50 puppet7.example.in webhook-go[994459]: time="2022-10-06T14:25:50Z" level=error msg="failed to execute local command `[r10k deploy environment ec_1767 --config=/etc/puppetlabs/r10k/r10k.yaml -v -m --generate-types]` with error: `exit status 1` `ERRO>
Oct 06 14:25:50 puppet7.example.in webhook-go[994459]: [GIN] 2022/10/06 - 14:25:50 | 500 |  1.987963031s |   18.246.31.232 | POST     "/api/v1/r10k/environment"
Oct 06 14:25:53 puppet7.example.in webhook-go[994459]: time="2022-10-06T14:25:53Z" level=error msg="failed to execute local command `[r10k deploy environment ec_1767 --config=/etc/puppetlabs/r10k/r10k.yaml -v -m --generate-types]` with error: `exit status 1` `ERRO>
Oct 06 14:25:53 puppet7.example.in webhook-go[994459]: [GIN] 2022/10/06 - 14:25:53 | 500 |  1.968956522s |   18.246.31.232 | POST     "/api/v1/r10k/environment"
Oct 06 14:26:55 puppet7.example.in webhook-go[994459]: time="2022-10-06T14:26:55Z" level=error msg="failed to execute local command `[r10k deploy environment ec_1767 --config=/etc/puppetlabs/r10k/r10k.yaml -v -m --generate-types]` with error: `exit status 1` `ERRO>
Oct 06 14:26:55 puppet7.example.in webhook-go[994459]: [GIN] 2022/10/06 - 14:26:55 | 500 |  2.578918497s |   18.246.31.225 | POST     "/api/v1/r10k/environment"
Oct 06 14:26:57 puppet7.example.in webhook-go[994459]: time="2022-10-06T14:26:57Z" level=error msg="failed to execute local command `[r10k deploy environment ec_1767 --config=/etc/puppetlabs/r10k/r10k.yaml -v -m --generate-types]` with error: `exit status 1` `ERRO>
Oct 06 14:26:57 puppet7.example.in webhook-go[994459]: [GIN] 2022/10/06 - 14:26:57 | 500 |  1.990403808s |   18.246.31.225 | POST     "/api/v1/r10k/environment"
Oct 06 14:27:00 puppet7.example.in webhook-go[994459]: time="2022-10-06T14:27:00Z" level=error msg="failed to execute local command `[r10k deploy environment ec_1767 --config=/etc/puppetlabs/r10k/r10k.yaml -v -m --generate-types]` with error: `exit status 1` `ERRO>
Oct 06 14:27:00 puppet7.example.in webhook-go[994459]: [GIN] 2022/10/06 - 14:27:00 | 500 |  1.980039263s |   18.246.31.225 | POST     "/api/v1/r10k/environment"
$ cat /var/log/syslog.1 | grep "webhook-go"
Oct  6 14:17:49 puppet7 webhook-go[994459]: time="2022-10-06T14:17:49Z" level=error msg="failed to execute local command `[r10k deploy environment ec_1767 --config=/etc/puppetlabs/r10k/r10k.yaml -v -m --generate-types]` with error: `exit status 1` `ERROR\t -> Environment(s) 'ec_1767' cannot be found in any source and will not be deployed.\n`"
Oct  6 14:17:49 puppet7 webhook-go[994459]: [GIN] 2022/10/06 - 14:17:49 | 500 |  2.472791878s |   18.246.31.232 | POST     "/api/v1/r10k/environment"
Oct  6 14:17:51 puppet7 webhook-go[994459]: time="2022-10-06T14:17:51Z" level=error msg="failed to execute local command `[r10k deploy environment ec_1767 --config=/etc/puppetlabs/r10k/r10k.yaml -v -m --generate-types]` with error: `exit status 1` `ERROR\t -> Environment(s) 'ec_1767' cannot be found in any source and will not be deployed.\n`"
Oct  6 14:17:51 puppet7 webhook-go[994459]: [GIN] 2022/10/06 - 14:17:51 | 500 |  1.962993185s |   18.246.31.232 | POST     "/api/v1/r10k/environment"

When i tried to deploy it manually by copy & pasting command from error message we received next:

(production) root@puppet7:~$ r10k deploy environment ec_1767 --config=/etc/puppetlabs/r10k/r10k.yaml -v -m --generate-types
ERROR    -> Environment(s) 'ec_1767' cannot be found in any source and will not be deployed.
(production) root@puppet7:~$ r10k deploy environment ec_1767 --config=/etc/puppetlabs/r10k/r10k.yaml -v -m --generate-types
ERROR    -> Environment(s) 'ec_1767' cannot be found in any source and will not be deployed.

But when we actually executed this command with proper name it all worked OK:

(production) root@puppet7:~$ r10k deploy environment EC_1767 --config=/etc/puppetlabs/r10k/r10k.yaml -v -m --generate-types
INFO     -> Deploying environment /etc/puppetlabs/code/environments/EC_1767
INFO     -> Environment EC_1767 is now at XXXXXXXXXXXXXXXXXXXXXXXXX

$ puppetserver --version puppetserver version: 7.9.0

$ r10k version r10k 3.15.0

dhollinger commented 2 years ago

What does your webhook.yml file look like?

There is an option under the r10k section called allow_uppercase. That defaults to false. Set it to true and try again.

sahaqaa commented 2 years ago

Thank you, didn't saw it :-)

dhollinger commented 2 years ago

Yeah, I need to finish working on the wiki. Just not sure when I'll have that done