badges / shields

Concise, consistent, and legible badges in SVG and raster format
https://shields.io
Creative Commons Zero v1.0 Universal
23.56k stars 5.49k forks source link

[Bitbucket Pipelines] “invalid response data” if manual steps not taken #6701

Open delan opened 3 years ago

delan commented 3 years ago

Are you experiencing an issue with...

shields.io

🐞 Description

When the default pipeline has manual steps, the shields.io badge breaks unless those manual steps have been attempted. This renders the badge unusable for repos that use manual steps for optional but rare tasks like releases. For example:

Looking at the code, my best guess is that the joi schema check fails, because PAUSED is not an acceptable .values[]­.state­.result.

🔗 Link to the badge

https://img.shields.io/bitbucket/pipelines/delan/nonymous/default

💡 Possible Solution

Updating the schema won’t be enough, because we later filter for builds with .values[]­.state of COMPLETED, which would exclude these builds because they are considered IN_PROGRESS.

Ideally we would treat the manual steps as optional, taking them into account iff they have been attempted, but otherwise generating the badge based on the non-manual steps. I’m not really sure how to do this though, and I found the provider’s API docs unhelpful (but tbf I also have zero experience with it).

chris48s commented 3 years ago

Hmm. We probably should accept IN_PROGRESS in any case. It is a value the API can return.

Specifically for pipelines with manual steps, it looks like even if we call https://api.bitbucket.org/2.0/repositories/delan/nonymous/pipelines/?fields=*&page=1&pagelen=2&sort=-created_on&target.ref_type=BRANCH&target.ref_name=default there is nothing in the API response that tells us if a build contains manual steps or not.

Given that, I think the best case for handling this would be which would be nicer than but still probably not useful if all your builds are considered paused/in progress (even if you consider the bits that matter "complete")