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

PR for Docker Hub Automated Builds #661

Merged
merged 2 commits into from
Jul 25, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -723,6 +723,10 @@ <h3 id="miscellaneous"> Miscellaneous </h3>
<td><img src='https://img.shields.io/docker/pulls/mashape/kong.svg' alt=''/></td>
<td><code>https://img.shields.io/docker/pulls/mashape/kong.svg</code></td>
</tr>
<tr><th data-keywords='docker automated build'> Docker Automated build </th>
<td><img src='https://img.shields.io/docker/automated/jrottenberg/ffmpeg.svg' alt=''/></td>
<td><code>https://img.shields.io/docker/automated/jrottenberg/ffmpeg.svg</code></td>
</tr>
<tr><th data-keywords='imagelayers'> ImageLayers Size: </th>
<td><img src='https://img.shields.io/imagelayers/image-size/_/ubuntu/latest.svg' alt=''/></td>
<td><code>https://img.shields.io/imagelayers/image-size/_/ubuntu/latest.svg</code></td>
Expand Down
38 changes: 38 additions & 0 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -4471,6 +4471,44 @@ cache(function(data, match, sendBadge, request) {
});
}));


// Docker Hub automated integration.
camp.route(/^\/docker\/automated\/([^\/]+)\/([^\/]+)\.(svg|png|gif|jpg|json)$/,
cache(function(data, match, sendBadge, request) {
var user = match[1]; // eg, jrottenberg
var repo = match[2]; // eg, ffmpeg
var format = match[3];
if (user === '_') {
user = 'library';
}
var path = user + '/' + repo;
var url = 'https://registry.hub.docker.com/v2/repositories/' + path;
var badgeData = getBadgeData('docker build', data);
request(url, function(err, res, buffer) {
if (err != null) {
badgeData.text[1] = 'inaccessible';
sendBadge(format, badgeData);
return;
}
try {
var data = JSON.parse(buffer);
var is_automated = data.is_automated;
if (is_automated) {
badgeData.text[1] = 'automated';
badgeData.colorscheme = 'blue';
} else {
badgeData.text[1] = 'manual';
badgeData.colorscheme = 'yellow';
}
badgeData.colorB = '#008bb8';
sendBadge(format, badgeData);
} catch(e) {
badgeData.text[1] = 'invalid';
sendBadge(format, badgeData);
}
});
}));

// Twitter integration.
camp.route(/^\/twitter\/url\/([^\/]+)\/(.+)\.(svg|png|gif|jpg|json)$/,
cache(function(data, match, sendBadge, request) {
Expand Down
4 changes: 4 additions & 0 deletions try.html
Original file line number Diff line number Diff line change
Expand Up @@ -722,6 +722,10 @@ <h3 id="miscellaneous"> Miscellaneous </h3>
<td><img src='/docker/pulls/mashape/kong.svg' alt=''/></td>
<td><code>https://img.shields.io/docker/pulls/mashape/kong.svg</code></td>
</tr>
<tr><th data-keywords='docker automated build'> Docker Automated build </th>
<td><img src='/docker/automated/jrottenberg/ffmpeg.svg' alt=''/></td>
<td><code>https://img.shields.io/docker/automated/jrottenberg/ffmpeg.svg</code></td>
</tr>
<tr><th data-keywords='imagelayers'> ImageLayers Size: </th>
<td><img src='/imagelayers/image-size/_/ubuntu/latest.svg' alt=''/></td>
<td><code>https://img.shields.io/imagelayers/image-size/_/ubuntu/latest.svg</code></td>
Expand Down