cli icon indicating copy to clipboard operation
cli copied to clipboard

[Bug]: Organization name is lower-cased

Open greenled opened this issue 1 year ago • 2 comments

Contact details

https://forum.buildkite.community/u/greenled/summary

What happened?

I tried to use this tool create a pipeline for a repo in my organization (gridX). After running bk pipeline create I got a 404 error from Buildkite API with the message No organization found. The organization name is gridX (uppercase "X"), but the HTTP call was made using using gridx (lowercase "x").

I tried calling the API directly with the same token and the correct casing and it worked:

curl -H "Authorization: Bearer TOKEN"   -X GET "https://api.buildkite.com/v2/organizations/gridX"

Then tried the same call with the lowercase version and got a 404:

curl -H "Authorization: Bearer TOKEN"   -X GET "https://api.buildkite.com/v2/organizations/gridX"

{
  "message": "No organization found"
}

I checked ~/.config/bk.yaml (I'm using Ubuntu) and the name there is all-lowercase as well. I tried changing it to gridX, but got the same error after running bk pipeline create again.

I double-checked the correct case was used when running bk config add.

Version

3.4.1

What environment are you seeing the problem on?

Local Development

Relevant log output

Pipeline created:  
                    
Error: POST https://api.buildkite.com/v2/organizations/gridx/pipelines: 404 No organization found
Usage:
  bk pipeline create

Flags:
  -h, --help   help for create

greenled avatar Dec 18 '24 08:12 greenled

I noticed viper is used for configuration management. The organization name is used as a configuration key but viper doesn't support case-sensitive keys :sob:. As a result, organization name is lower-cased by viper before writing the config file, and lower-cased again when reading the config file.

greenled avatar Dec 19 '24 11:12 greenled

Thanks for raising this @greenled! We will take a look and work on it accordingly.

PriyaSudip avatar Dec 27 '24 00:12 PriyaSudip