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

[david] Support selecting a branch #4474

Open
umarcor opened this issue Dec 27, 2019 · 7 comments
Open

[david] Support selecting a branch #4474

umarcor opened this issue Dec 27, 2019 · 7 comments
Labels
service-badge Accepted and actionable changes, features, and bugs

Comments

@umarcor
Copy link

umarcor commented Dec 27, 2019

david-dm allows to specify a branch as an additional item in the URL. This can be combined with the path query parameter. For example: https://david-dm.org/umarcor/hwstudio/actions?path=app Unfortunately, this feature seems not to be supported in this repo: /david/:kind?/:user/:repo?path=packages%2Fbabel-core. I tried https://img.shields.io/david/umarcor/hwstudio/actions.svg?path=app&longCache=true&style=flat-square&label=app%20deps.

@calebcartwright
Copy link
Member

Do you know what the request to David would be to get the data?

The typical upstream endpoint Shields uses to get the data is:
https://david-dm.org/umarcor/hwstudio/info.json?path=app

Unfortunately David also returns an http 500 error for the "not found" use case (vs. the typical 404), and I'm getting that same http 500 error on the link you provided in the issue description:
https://david-dm.org/umarcor/hwstudio/actions?path=app

Is actions the branch you are targetting, and if so, does that branch actually exist in your repo?

@umarcor
Copy link
Author

umarcor commented Dec 28, 2019

@calebcartwright
Copy link
Member

That explains it then, thanks @umarcor! To address this we'd need to update the route for our David service to accept an optional branch parameter.

At the moment I'm not sure whether it'd be best to do so via a route param or query param. Generally Shields routes accept a branch value as an optional trailing route param (/:user/:repo/:branch?) but David has a leading optional kind route param as well that could make things a bit trickier than usual

@calebcartwright calebcartwright added the service-badge Accepted and actionable changes, features, and bugs label Dec 29, 2019
@alanshaw
Copy link
Contributor

FYI, in the new david status API the branch is a query string parameter called ref https://github.com/alanshaw/david-status-api#status-api

@umarcor
Copy link
Author

umarcor commented Jan 11, 2021

@alanshaw, I just tried https://david-dm.org/umarcor/hwstudio?ref=vue/threejs/main and it's returning:

FetchError: invalid json response body at https://project.david-dm.org/gh/umarcor/hwstudio reason: Unexpected token u in JSON at position 0
    at /home/node/app/node_modules/node-fetch/lib/body.js:48:31
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async Promise.all (index 0)
    at async Promise.all (index 0)

See https://github.com/umarcor/hwstudio/blob/vue/threejs/main/package.json. Am I missing something?

This seems to work, tho: https://status.david-dm.org/gh/umarcor/hwstudio.svg?ref=vue/threejs/main

@umarcor
Copy link
Author

umarcor commented Jan 11, 2021

@alanshaw let me know that I was missing the service specifier (gh) in the first URL. I don't know why his reply didn't show here... Now https://status.david-dm.org/gh/umarcor/hwstudio?ref=vue/threejs/main returns the expected JSON result, including status | "uptodate".

@calebcartwright would the new API work for supporting branches (ref) in shields.io?

@calebcartwright
Copy link
Member

@calebcartwright would the new API work for supporting branches (ref) in shields.io?

Yes, see #5968, but there's been some initial challenges with other portions of the API. It looks like the only remaining issue is that the API is returning 503 status codes in not found scenarios, and Shields treats upstream 500 responses in a very specific way given the reliance we have on those upstream services.

Hopefully the new API will get sorted to send 404 responses like the old/current API does

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
service-badge Accepted and actionable changes, features, and bugs
Projects
None yet
Development

No branches or pull requests

3 participants