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

feat(brigade.js): Add brigade.js #1

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Pair back what the brigade.js does.
Signed off by: M Butcher <[email protected]>
technosophos committed Aug 12, 2018
commit 51782d975cfbc5365187a7c2af77815a09ff6b7d
45 changes: 19 additions & 26 deletions brigade.js
Original file line number Diff line number Diff line change
@@ -6,9 +6,9 @@ events.on("check_run:rerequested", runSuite);

function runSuite(e, p) {
runDCO(e, p);
runTests(e, p);
runDocs(e, p);
runAnalytics(e, p);
//runTests(e, p);
//runDocs(e, p);
//runAnalytics(e, p);
}

// Run tests and fail if the tests do not pass.
@@ -54,45 +54,40 @@ function runAnalytics(e, p) {
}

// Not as cool as runDMC.
function runDCO(e, p) {
function runDCO(e, p) {
console.log(e.payload);
const ghData = JSON.parse(e.payload);
var dco = new Notification("dco", e, p);
dco.title = "Developer Certificate of Origin (DCO)"

// TODO: this should be a regexp.
const signedOff = ghData.check_suite.head_commit.message.indexOf("Signed off by:")
const signedOff = ghData.body.check_suite.head_commit.message.indexOf("Signed off by:")
if (signedOff == -1){
dco.summary = "DCO check failed: Not signed off."
dco.text = "This commit is inelligible for merging until it is signed off. https://developercertificate.org/";
dco.conclusion = "failure";

console.log(dco.summary);
return dco.run();
} else {
dco.summary = "DCO check succeeded";
dco.conclusion = "succeeded";
}
dco.summary = "DCO check succeeded";
dco.conclusion = "succeeded";


console.log(dco.summary);
return dco.run();
}

class Notification {
// One of: "succeeded", "failure", "neutral", "canceled", or "timed_out".
conclusion = "neutral";
name = "brigade";
title = "running check";
summary = "";
text = "";
detailsURL = "";
exterrnalID = "";
proj = {};
payload = {};

constructor(name, e, p) {
this.proj = p;
this.payload = e.payload;
this.name = name;
this.externalID = e.buildID;
this.detailsURL = `https://azure.github.com/kashti/builds/${ e.buildID }`;

// One of: "succeeded", "failure", "neutral", "canceled", or "timed_out".
this.conclusion = "neutral";
this.title = "runninc check";
this.text = "";
this.summary = ""
}

// Send a new notification, and return a Promise<result>.
@@ -113,15 +108,13 @@ class Notification {
}

class GoJob extends Job {
e = {};
project = {};
constructor(name, e, project) {
super(name, "golang:1.9");

construct(name, e, project) {
this.e = e;
this.project = project;
const gopath = "/go"
const localPath = gopath + "/src/github.com/" + project.repo.name;
super(name, "golang:1.9");
this.tasks = [
"go get github.com/golang/dep/cmd/dep",
"mkdir -p " + localPath,