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

Consider using/switching from imagelayers.io to microbadger.com for Docker layers badges #944

Closed
guikcd opened this issue Apr 17, 2017 · 9 comments
Labels
bug Bugs in badges and the frontend service-badge Accepted and actionable changes, features, and bugs

Comments

@guikcd
Copy link

guikcd commented Apr 17, 2017

As of microscaling/imagelayers-graph#94 / microscaling/imagelayers#26, imagelayers.io is broken since many months (at least June 2016). It continue to works with existing images but new images can't be fetched (maybe due to a Docker API change).

The service https://microbadger.com/ seems to offer same informations as imagelayers.io, please consider propose it in addition/replacement.

@guikcd guikcd changed the title Consider switching from imagelayers.io to microbadger.com for Docker layers badges Consider using/switching from imagelayers.io to microbadger.com for Docker layers badges Apr 17, 2017
@paulmelnikow
Copy link
Member

Hi, thanks for bringing this up.

When testing #706 I encountered badges which surprisingly returned zero. I incorrectly assumed this was a problem with the package. For example:

In that backlog of PRs is #794, which is replaces the imagelayer badge with a dockerhub badge. That may be an alternative fix for this issue. Would you have some time to test that to see if it's working appropriately?

@paulmelnikow paulmelnikow added bug Bugs in badges and the frontend service-badge Accepted and actionable changes, features, and bugs labels Apr 17, 2017
@guikcd
Copy link
Author

guikcd commented Apr 18, 2017

At first glance, there is a problem with the auth when requesting informations on public user image (although it works well with the ubuntu default example):

{ errors: 
   [ { code: 'UNAUTHORIZED',
       message: 'authentication required',
       detail: [Object] } ] }

I'll need to investigate more :)

@guikcd
Copy link
Author

guikcd commented Apr 18, 2017

Ok i've tested the wrong routes..., /docker/image/layers and /docker/image/size works as expected:

$ for route in docker/image/size docker/image/layers; do curl --include http://localhost:8080/$route/guidelacour/dnsenum/latest.svg; done
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Expires: Tue, 18 Apr 2017 22:38:13 GMT
Date: Tue, 18 Apr 2017 22:38:13 GMT
Content-Type: image/svg+xml;charset=utf-8
Connection: keep-alive
Transfer-Encoding: chunked

<svg xmlns="http://www.w3.org/2000/svg" width="110" height="20"><linearGradient id="b" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><mask id="a"><rect width="110" height="20" rx="3" fill="#fff"/></mask><g mask="url(#a)"><path fill="#555" d="M0 0h65v20H0z"/><path fill="#007ec6" d="M65 0h45v20H65z"/><path fill="url(#b)" d="M0 0h110v20H0z"/></g><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11"><text x="32.5" y="15" fill="#010101" fill-opacity=".3">image size</text><text x="32.5" y="14">image size</text><text x="86.5" y="15" fill="#010101" fill-opacity=".3">258MB</text><text x="86.5" y="14">258MB</text></g></svg>

HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Expires: Tue, 18 Apr 2017 22:38:13 GMT
Date: Tue, 18 Apr 2017 22:38:13 GMT
Content-Type: image/svg+xml;charset=utf-8
Connection: keep-alive
Transfer-Encoding: chunked

<svg xmlns="http://www.w3.org/2000/svg" width="64" height="20"><linearGradient id="b" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><mask id="a"><rect width="64" height="20" rx="3" fill="#fff"/></mask><g mask="url(#a)"><path fill="#555" d="M0 0h41v20H0z"/><path fill="#007ec6" d="M41 0h23v20H41z"/><path fill="url(#b)" d="M0 0h64v20H0z"/></g><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11"><text x="20.5" y="15" fill="#010101" fill-opacity=".3">layers</text><text x="20.5" y="14">layers</text><text x="51.5" y="15" fill="#010101" fill-opacity=".3">11</text><text x="51.5" y="14">11</text></g></svg>

@goozler
Copy link
Contributor

goozler commented Dec 5, 2017

Hi!

ImageLayers seems useless for new Docker images and it looks like docker hub version isn't in the production version of Shields, doesn't it? So, adding the support of microbadger.com looks worth it.

Could someone tell me what can be used to get an image size of a Docker container now, for example, _/ubuntu/latest? If there is no way to do it, is there any ready pull requests for adding something for that?

@paulmelnikow
Copy link
Member

I don't think anyone has started working on this, beyond the research above. Would you like to look into it a bit?

Here is the code that runs the imagelayers badge:

shields/server.js

Lines 6217 to 6260 in 342e71e

// ImageLayers.io integration.
camp.route(/^\/imagelayers\/(image-size|layers)\/([^/]+)\/([^/]+)\/([^/]*)\.(svg|png|gif|jpg|json)$/,
cache(function(data, match, sendBadge, request) {
var type = match[1];
var user = match[2];
var repo = match[3];
var tag = match[4];
var format = match[5];
if (user === '_') {
user = 'library';
}
var path = user + '/' + repo;
var badgeData = getBadgeData(type, data);
var options = {
method: 'POST',
json: true,
body: {
"repos": [{"name": path, "tag": tag}]
},
uri: 'https://imagelayers.io/registry/analyze'
};
request(options, function(err, res, buffer) {
if (err != null) {
badgeData.text[1] = 'inaccessible';
sendBadge(format, badgeData);
return;
}
try {
if (type == 'image-size') {
var size = metric(buffer[0].repo.size) + "B";
badgeData.text[0] = getLabel('image size', data);
badgeData.text[1] = size;
} else if (type == 'layers') {
badgeData.text[1] = buffer[0].repo.count;
}
badgeData.colorscheme = null;
badgeData.colorB = '#007ec6';
sendBadge(format, badgeData);
} catch(e) {
badgeData.text[1] = 'invalid';
sendBadge(format, badgeData);
}
});
}));

Of course no pressure if not!

@goozler
Copy link
Contributor

goozler commented Dec 5, 2017

@paulmelnikow According to the last opened issues in ImageLayers repository it looks dead. I can't even get the size of the image via the web interface or somehow else.

I'm trying to add the MicroBadger integration

@paulmelnikow
Copy link
Member

Great! We can finish the convo here, if any questions come up along the way.

@delfer
Copy link

delfer commented May 2, 2018

microbadger.com also not stable. Any alternatives?

@PyvesB
Copy link
Member

PyvesB commented Aug 12, 2018

As we have now implemented the MicroBadger alternative, I'm going to close this issue.

@delfer regarding stability, I'm assuming things have improved after I raised this issue on their upstream repository. Feel free to open a new issue if you are still facing problems. 😉

@PyvesB PyvesB closed this as completed Aug 12, 2018
dhoeric added a commit to dhoeric/concourse-tutorial that referenced this issue Jul 19, 2019
badges/shields#944
ImageLayers is no longer in maintained.
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 service-badge Accepted and actionable changes, features, and bugs
Projects
None yet
Development

No branches or pull requests

5 participants