CLI tool forces all-lowercase organization names

Hi! I think I found a bug in the CLI tool. It seems organization names in the API are case-sensitive, but the CLI tool is not (forces all-lowercase organization names).

I tried to use it to create a pipeline for a repo in my organization gridX. After running bk pipeline create I got this error:

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

Notice the organization name is gridX, but the HTTP call is using gridx.

I tried calling the API with the same token and the correct name 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.

Could you please look into this?

P.S.
The Pipeline created: line before the error is a bit misleading.

Hey @greenled :wave: welcome to the community, and thank you for raising this!

As long as the selected-orgs in the config bk.yaml is the correct slug it should respect the capitalization there.

Could I ask you to raise this same issue on the repository here:
Issues · buildkite/cli · GitHub so that we are able to track it and potentially address it with a fix?

I also agree that we can make that error message a bit clearer, so if you can include that in the issue as well we should be able to improve that messaging too :slight_smile:

Hey @jeremy! Thank you for the warm welcome. Sure, I’ll raise the issue in the repo.

There seems to be an error in the bug report issue template in this line. I think it doesn’t like the leading @ character in the key name. As a result, this template is not shown in the list when creating a new issue :slightly_frowning_face:.

Hey @greenled :wave:

We have rolled out a fix for bug report issue template, could you retry creating now?

Please reach out if any issues!

Cheers,

Hi @Priya! Thanks for the quick fix. I created this issue. I’m following up there.