cli icon indicating copy to clipboard operation
cli copied to clipboard

Fix build download command required scopes

Open Inozuma opened this issue 9 months ago • 5 comments

Description

Hello, as I was trying to download the logs from one of my pipeline build, I encountered the following error:

❯ bk build download --pipeline my_pipeline build_number
Error: missing required scopes: read_buildsread_artifactsread_build_logs

After checking my token scopes and digging around, I found that the "requiredScopes" annotation of the build download command was missing the , separator.

As the fix was straightforward (and successfully downloaded my logs with this fix), I did not open any issue. Let me know if you want me to add anything.

Inozuma avatar Mar 18 '25 15:03 Inozuma

Thanks for the PR, @Inozuma! While it would fix this issue, I wonder should we implement a helper function to take in a list of scopes and return a string, given the solution in this PR would need iterating on if the permissions ever changed/increased.

mcncl avatar Mar 19 '25 06:03 mcncl

Yes, indeed. What do you think of a new type type Scopes []Scope with a String method?

It could also be useful for additional methods when manipulating multiple Scope.

Inozuma avatar Mar 19 '25 09:03 Inozuma

@Inozuma absolutely, sounds great. You're welcome to open a PR, or create a request via Issues.

mcncl avatar Mar 20 '25 03:03 mcncl

@mcncl, I amended the commit to add the changes. Maybe you wanted a new PR for this ?

Inozuma avatar Mar 20 '25 10:03 Inozuma

@Inozuma Thanks! I'll have a look at this in the morning and see if we can merge it in

mcncl avatar Mar 25 '25 10:03 mcncl