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

[Snap-CI] Replace with error message #1468

Merged
merged 2 commits into from
Mar 4, 2018
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: 0 additions & 4 deletions lib/all-badge-examples.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,6 @@ const allBadgeExamples = [
title: 'Shippable branch',
previewUri: '/shippable/5444c5ecb904a4b21567b0ff/master.svg'
},
{
title: 'Snap CI branch',
previewUri: '/snap-ci/ThoughtWorksStudios/eb_deployer/master.svg'
},
{
title: 'Jenkins',
previewUri: '/jenkins/s/https/jenkins.qa.ubuntu.com/view/Precise/view/All%20Precise/job/precise-desktop-amd64_default.svg'
Expand Down
35 changes: 6 additions & 29 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -6411,37 +6411,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.
Expand Down
13 changes: 13 additions & 0 deletions service-tests/snap-ci.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
'use strict';

const ServiceTester = require('./runner/service-tester');

const t = new ServiceTester({ id: 'snap-ci', title: 'Snap CI' });
module.exports = t;

t.create('no longer available (previously build state)')
.get('/snap-ci/ThoughtWorksStudios/eb_deployer/master.json')
.expectJSON({
name: 'snap CI',
value: 'no longer available',
});