Shields: Docker Hub Automated Build Status

Created on 19 Aug 2014  路  25Comments  路  Source: badges/shields

There's already an implementation made by @cpuguy83, but it would be great if shields added support.

service-badge

Most helpful comment

Pretty small contribution, but I added the ability to report current status of last build. Thanks @pl31 for the statuses!

10 = passing
< 0 = Failing
0-9 = Pending

screen shot 2017-01-14 at 8 56 55 am

All 25 comments

I didn't notice at first, but this is an HTML scraper: https://github.com/cpuguy83/docker-hub-buildtag/blob/master/fetcher.go#L89.

I could give in to that, but only if there is absolutely no way around it. There is no promise made from hub.docker.com that the DOM structure won't change. I would feel much happier with an API whose structure I can rely on.

This seems to hold some information at first glance: https://docs.docker.com/reference/api/docker-io_api/.

There isn't currently a public api to grab this, but it is planned.

@cpuguy83 Good to know. Thanks! I'll wait for it to implement this.

Just wanted to mention that there's a similar thing at @wblankenship's dockeri.co... Though it appears that just HTML-scrapes as well.

Thanks for the mention @hairyhenderson. Yeah, there isn't any other way to get to the data so I'm using screen scraping. The docker website is fairly stable though, hasn't broken yet.

That being said, looking forward to when there is a nice endpoint for metadata though :smile: :whale2:

Any updates on this issue?

No new api's on the hub yet.

+1

Do we have an example user/repo which is automated?

This kind of endpoint seems promising, but ubuntu isn't automated, I think: https://registry.hub.docker.com/v2/repositories/library/ubuntu/

They have been silently rolling out some metadata endpoints.

Example: https://registry.hub.docker.com/v2/repositories/wblankenship/dockeri.co/stars/count/

You can actually do a lot with it. https://registry.hub.docker.com/v2/repositories/wblankenship/dockeri.co/stars/

The docs are _partially_ here: http://docs.docker.com/reference/api/docker-io_api/, but they don't fully cover the /v2/repositories/(repo)/ endpoint (mention of GET is missing...). I don't know if this means the API isn't public, or what... @cpuguy83?

Some other interesting endpoints:

{
  "count": 1,
  "tags": [
    "latest"
  ]
}

Just emailed support for documentation, will post back here with reply.

Still nothing?

It's not really documented yet, however some data is there now.
Hub 2.0 uses a pure client-side frontend, so all the api's the frontend needs to construct the page should be there.
Was able to find build history here:

curl -sSL -H 'Content-Type: application/json' https://hub.docker.com/v2/repositories/cpuguy83/ubuntu/buildhistory/

Looks like a build status of 10 is OK, -1 is some failure, I don't know the in-betweens yet.
This should be better documented soon.
I wouldn't rely on this information for shields yet as it is undocumented, and now that Hub 2.0 is finally out, we'll start to see these API's exposed more.

Also

curl -sSL -H 'Content-Type: application/json' https://hub.docker.com/v2/repositories/cpuguy83/ubuntu/autobuild/

Thanks for this update!

+1

I found (using browser debug mode):

  • tags and then tags/<name>
  • build or autobuild
  • dockerfile
  • comments
  • buildhistory and then buildhistory/<build_code> <-- (includes logs and dockerfile)
  • links
  • collaborators
  • groups
  • stars
  • buildtrigger (401) and buildtrigger/history (401)
  • webhooks (401)

And extracted the status from the client.js:
S={"-2":"exception","-1":"error",0:"pending",1:"claimed",2:"started",3:"cloned",4:"readme",5:"dockerfile",6:"built",7:"bundled",8:"uploaded",9:"pushed",10:"done"}

@pl31 - nice!

Has anyone started on a PR for this?

:+1:

Good work!

Unless someone makes a PR before then, I'll do this when I've processed the 60 remaining issues & PRs I haven't responded to yet.

@cpuguy83 I'm seeing status values of 3 for a build in progress and 0 for a build which is queued.

Pretty small contribution, but I added the ability to report current status of last build. Thanks @pl31 for the statuses!

10 = passing
< 0 = Failing
0-9 = Pending

screen shot 2017-01-14 at 8 56 55 am

Resolved via #856.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lukeeey picture lukeeey  路  3Comments

AlexWayfer picture AlexWayfer  路  3Comments

kerolloz picture kerolloz  路  3Comments

calebcartwright picture calebcartwright  路  3Comments

najeeb-ur-rehman picture najeeb-ur-rehman  路  3Comments