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] #1509 - Add Bitbucket Pipelines service #1510

Merged

Conversation

pstreule
Copy link
Contributor

@pstreule pstreule commented Feb 17, 2018

Adding support for Bitbucket Pipelines builds: #1509 .

The format is the same as for the other Bitbucket badges:
/bitbucket/pipelines/<user>/<repo>.svg
and
/bitbucket/pipelines/<user>/<repo>/<branch>.svg

The implementation is looking at the last completed build result (ignoring builds that are about to start or in progress). It supports all current Pipelines result states:

  • passing
  • failing
  • error
  • stopped
  • expired

The tests cover 100% of the added lines.

Let me know what you think, thanks a lot!

@shields-ci
Copy link

shields-ci commented Feb 17, 2018

Messages
📖

✨ Thanks for your contribution to Shields, @pstreule!

📖

Thanks for contributing to our documentation. We ❤️ our documentarians!

Generated by 🚫 dangerJS

Copy link
Member

@chris48s chris48s left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for submitting this contribution and for adding tests. This looks like it is in really good shape already but I've left a couple of minor comments.

server.js Outdated
var user = match[1]; // eg, atlassian
var repo = match[2]; // eg, adf-builder-javascript
var branch = match[3] || 'master'; // eg, development
var format = match[4];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When adding new code could you use the ES6 style let and const rather than var please.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do, thanks. I tried to stick to the existing style, but happy to use ES6.

server.js Outdated
if (err != null) {
badgeData.text[1] = 'inaccessible';
sendBadge(format, badgeData);
return;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This block here and the later sections where you're checking for if (res.statusCode !== 200) and if (res.statusCode === 404) are really common so we have now added a helper. You can simplify all that to:

shields/server.js

Lines 6515 to 6518 in 75503ec

if (checkErrorResponse(badgeData, err, res)) {
sendBadge(format, badgeData);
return;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, I'll use that. I'll make the changes later today.

@pstreule
Copy link
Contributor Author

I replaced the var declarations with const and I use the checkErrorResponse helper now.

Copy link
Member

@chris48s chris48s left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Brilliant - thanks. I think this is good to merge but one of the maintainers will need to do a final check + merge.

@RedSparr0w
Copy link
Member

Thanks for your contribution, Changes look good to me,
Merged!

Thanks @chris48s for reviewing!
😄

@pstreule
Copy link
Contributor Author

Thanks @chris48s and @RedSparr0w for taking care of this so quickly!

@pstreule
Copy link
Contributor Author

@RedSparr0w how often do you deploy? Do you have a rough ETA on when this would land in production?

@RedSparr0w
Copy link
Member

On mobile right now, but this comment here should provide some info:
#1538 (comment)

Hopefully shouldn't be too far off the next deployment though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants