[Snap-CI] Replace with error message (#1468)
* Depreciated Snap CI * Updated badge color to light gray
This commit is contained in:
35
server.js
35
server.js
@@ -6360,37 +6360,14 @@ cache(function(data, match, sendBadge, request) {
|
||||
});
|
||||
}));
|
||||
|
||||
// Snap CI build integration.
|
||||
// https://snap-ci.com/snap-ci/snap-deploy/branch/master/build_image
|
||||
// Snap CI build integration - no longer available.
|
||||
camp.route(/^\/snap(-ci?)\/([^/]+\/[^/]+)(?:\/(.+))\.(svg|png|gif|jpg|json)$/,
|
||||
cache(function(data, match, sendBadge, request) {
|
||||
var userRepo = match[2];
|
||||
var branch = match[3];
|
||||
var format = match[4];
|
||||
var url = 'https://snap-ci.com/' + userRepo + '/branch/' + branch + '/build_image.svg';
|
||||
|
||||
var badgeData = getBadgeData('build', data);
|
||||
fetchFromSvg(request, url, function(err, res) {
|
||||
if (err != null) {
|
||||
badgeData.text[1] = 'inaccessible';
|
||||
sendBadge(format, badgeData);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
badgeData.text[1] = res.toLowerCase();
|
||||
if (res === 'Passed') {
|
||||
badgeData.colorscheme = 'brightgreen';
|
||||
badgeData.text[1] = 'passing';
|
||||
} else if (res === 'Failed') {
|
||||
badgeData.colorscheme = 'red';
|
||||
}
|
||||
sendBadge(format, badgeData);
|
||||
|
||||
} catch(e) {
|
||||
badgeData.text[1] = 'invalid';
|
||||
sendBadge(format, badgeData);
|
||||
}
|
||||
});
|
||||
const format = match[4];
|
||||
const badgeData = getBadgeData('snap CI', data);
|
||||
badgeData.colorscheme = 'lightgray';
|
||||
badgeData.text[1] = 'no longer available';
|
||||
sendBadge(format, badgeData);
|
||||
}));
|
||||
|
||||
// Visual Studio Team Services build integration.
|
||||
|
||||
Reference in New Issue
Block a user