Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bitbucket not completely finished workflow returns invalid response data #10137

Closed
ArcherEmiya05 opened this issue May 7, 2024 · 5 comments · Fixed by #10163
Closed

Bitbucket not completely finished workflow returns invalid response data #10137

ArcherEmiya05 opened this issue May 7, 2024 · 5 comments · Fixed by #10163
Labels
bug Bugs in badges and the frontend good first issue New contributors, join in! service-badge New or updated service badge

Comments

@ArcherEmiya05
Copy link

Are you experiencing an issue with...

shields.io

🐞 Description

We have a workflow that has success step but not complete due to manual trigger, the build status badge for Bitbucket returns invalid response data

🔗 Link to the badge

https://img.shields.io/bitbucket/pipelines/devsbitwise/cryptonian/master?label=📦%20CI%2FCD%20pipeline

💡 Possible Solution

No response

@ArcherEmiya05 ArcherEmiya05 added the question Support questions, usage questions, unconfirmed bugs, discussions, ideas label May 7, 2024
Copy link
Contributor

github-actions bot commented May 7, 2024

Badge tested using npm run badge https://img.shields.io/bitbucket/pipelines/devsbitwise/cryptonian/master?label=📦%20CI%2FCD%20pipeline
Output is available here

@chris48s
Copy link
Member

chris48s commented May 7, 2024

OK, so what's happening here is:

We call
https://api.bitbucket.org/2.0/repositories/devsbitwise/cryptonian/pipelines/?fields=values.state&page=1&pagelen=2&sort=-created_on&target.ref_type=BRANCH&target.ref_name=master

That returns

{
  "values": [
    {
      "state": {
        "name": "IN_PROGRESS",
        "type": "pipeline_state_in_progress",
        "stage": {
          "name": "PAUSED",
          "type": "pipeline_state_in_progress_paused"
        }
      }
    },
    {
      "state": {
        "name": "COMPLETED",
        "type": "pipeline_state_completed",
        "result": {
          "name": "SUCCESSFUL",
          "type": "pipeline_state_completed_successful"
        }
      }
    }
  ]
}

We fail validation with

"values[0].state.result" is required

so I guess we would need to make the result key optional in the schema and then adjust the code to handle the fact that property may or may not exist.

if (values.length > 0) {
return values[0].state.result.name
}

@chris48s chris48s added bug Bugs in badges and the frontend service-badge New or updated service badge good first issue New contributors, join in! and removed question Support questions, usage questions, unconfirmed bugs, discussions, ideas labels May 7, 2024
@ArcherEmiya05
Copy link
Author

ArcherEmiya05 commented May 22, 2024

Hi the build is now fully complete yet the status still invalid response, before it is working fine for fully complete builds. I think the recent fix break it?

@ArcherEmiya05
Copy link
Author

Any update on this? Thanks

@chris48s
Copy link
Member

fix for this is now merged and deployed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bugs in badges and the frontend good first issue New contributors, join in! service-badge New or updated service badge
Projects
None yet
2 participants