Commit f3b3c9dc authored by Johan Helsing's avatar Johan Helsing

Various improvements

parent 07770410
......@@ -668,6 +668,181 @@
"unpipe": "1.0.0"
}
},
"read-last-lines": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/read-last-lines/-/read-last-lines-1.4.0.tgz",
"integrity": "sha1-XY4BeJgiF8gWcvSMr95sVy3gGmY=",
"requires": {
"fs-promise": "0.5.0"
},
"dependencies": {
"any-promise": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz",
"integrity": "sha1-q8av7tzqUugJzcA3au0845Y10X8="
},
"balanced-match": {
"version": "0.4.2",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-0.4.2.tgz",
"integrity": "sha1-yz8+PHMtwPAe5wtAPzAuYddwmDg="
},
"brace-expansion": {
"version": "1.1.6",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.6.tgz",
"integrity": "sha1-cZfX6qm4fmSDkOph/GbIRCdCDfk=",
"requires": {
"balanced-match": "0.4.2",
"concat-map": "0.0.1"
}
},
"concat-map": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s="
},
"fs-extra": {
"version": "0.26.7",
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-0.26.7.tgz",
"integrity": "sha1-muH92UiXeY7at20JGM9C0MMYT6k=",
"requires": {
"graceful-fs": "4.1.11",
"jsonfile": "2.4.0",
"klaw": "1.3.1",
"path-is-absolute": "1.0.1",
"rimraf": "2.6.1"
}
},
"fs-promise": {
"version": "0.5.0",
"resolved": "https://registry.npmjs.org/fs-promise/-/fs-promise-0.5.0.tgz",
"integrity": "sha1-Q0fWv2JGVacGGkMZITw5MnatPvM=",
"requires": {
"any-promise": "1.3.0",
"fs-extra": "0.26.7",
"mz": "2.6.0",
"thenify-all": "1.6.0"
}
},
"fs.realpath": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8="
},
"glob": {
"version": "7.1.1",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.1.tgz",
"integrity": "sha1-gFIR3wT6rxxjo2ADBs31reULLsg=",
"requires": {
"fs.realpath": "1.0.0",
"inflight": "1.0.6",
"inherits": "2.0.3",
"minimatch": "3.0.3",
"once": "1.4.0",
"path-is-absolute": "1.0.1"
}
},
"graceful-fs": {
"version": "4.1.11",
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz",
"integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg="
},
"inflight": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
"integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",
"requires": {
"once": "1.4.0",
"wrappy": "1.0.2"
}
},
"inherits": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
"integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4="
},
"jsonfile": {
"version": "2.4.0",
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz",
"integrity": "sha1-NzaitCi4e72gzIO1P6PWM6NcKug=",
"requires": {
"graceful-fs": "4.1.11"
}
},
"klaw": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/klaw/-/klaw-1.3.1.tgz",
"integrity": "sha1-QIhDO0azsbolnXh4XY6W9zugJDk=",
"requires": {
"graceful-fs": "4.1.11"
}
},
"minimatch": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.3.tgz",
"integrity": "sha1-Kk5AkLlrLbBqnX3wEFWmKnfJt3Q=",
"requires": {
"brace-expansion": "1.1.6"
}
},
"mz": {
"version": "2.6.0",
"resolved": "https://registry.npmjs.org/mz/-/mz-2.6.0.tgz",
"integrity": "sha1-yLhSHZWN8KTydoAl22nHGe5O8c4=",
"requires": {
"any-promise": "1.3.0",
"object-assign": "4.1.1",
"thenify-all": "1.6.0"
}
},
"object-assign": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
"integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM="
},
"once": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
"integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
"requires": {
"wrappy": "1.0.2"
}
},
"path-is-absolute": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
"integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18="
},
"rimraf": {
"version": "2.6.1",
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.1.tgz",
"integrity": "sha1-wjOOxkPfeht/5cVPqG9XQopV8z0=",
"requires": {
"glob": "7.1.1"
}
},
"thenify": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/thenify/-/thenify-3.2.1.tgz",
"integrity": "sha1-JR/RyAr/blz1fLF5qx/LckJpvRE=",
"requires": {
"any-promise": "1.3.0"
}
},
"thenify-all": {
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/thenify-all/-/thenify-all-1.6.0.tgz",
"integrity": "sha1-GhkY1ALY/D+Y+/I02wvMjMEOlyY=",
"requires": {
"thenify": "3.2.1"
}
},
"wrappy": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="
}
}
},
"read-pkg": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz",
......
......@@ -5,9 +5,11 @@ const { reduce } = require('lodash');
const fs = require('fs');
const express = require('express');
const serveIndex = require('serve-index');
const { scheduleJob } = require('node-schedule');
const gerritHost = 'codereview.qt-project.org';
const gerritSshPort = 29418;
const readLastLines = require('read-last-lines');
const tests = [];
......@@ -62,7 +64,7 @@ function startDockerTest(test, callback) {
tests.push(test);
saveTests();
return testProcess;
return testProcess; //TODO: Maybe return a promise instead?
}
function postGerritComment(commit, comment, codeReview) {
......@@ -70,7 +72,7 @@ function postGerritComment(commit, comment, codeReview) {
if (codeReview) {
args.push('--code-review', codeReview);
}
console.log('ssh', args.join('\n'));
console.log('ssh', args.join(' '));
const p = spawn('ssh', args);
p.stdout.on('data', data => console.log(data));
p.stderr.on('data', data => console.log(data));
......@@ -101,7 +103,7 @@ function listenForGerritChanges() {
qtWaylandRev,
qt5Rev,
containerName,
title: `Change ${change.number} patch set #${patchSet.number} (${branch}) - ${subject} -`,
title: `Change ${change.number} patch set #${patchSet.number} (${branch}) - ${subject}`,
url
};
......@@ -109,11 +111,21 @@ function listenForGerritChanges() {
const testProcess = startDockerTest(test);
testProcess.on('close', code => {
const failed = code != 0; //TODO: Maybe it's only for code === 2 that the test actually failed?
const commit = `${change.number},${patchSet.number}`;
const message = 'Experimental QtWayland Bot: ' +
`Running headless tests ${commit} ${code ? 'failed' : 'succeeded'}`;
const codeReview = code && '-1';
postGerritComment(commit, message, codeReview);
var message = 'Experimental QtWayland Bot: ' +
`Running headless tests ${commit} ${failed ? 'failed' : 'succeeded'}`;
if (failed) {
const codeReview = '-1';
readLastLines.read(`logs/${containerName}.txt`, 10).then(lines => {
const messageWithLogTail = message + lines;
console.log(messageWithLogTail);
//postGerritComment(commit, messageWithLogTail, codeReview);
postGerritComment(commit, message, codeReview);
}).catch(reason => console.log('Couldn\'t get last lines of log file', reason));
} else {
postGerritComment(commit, message);
}
});
});
......@@ -164,9 +176,10 @@ function serveLogs() {
server.listen(8056);
}
function initTest() {
const initContainerName = 'gerrit-watcher-init-test-' + unixTimeStamp();
const initTest = startDockerTest({qtWaylandRev: '5.11', qt5Rev: '5.11', containerName: initContainerName});
function healthCheck(rev) {
const containerName = `gerrit-watcher-health-check-${rev}-${unixTimeStamp()}`
const title = `Health check ${rev} ${new Date().toISOString()}`;
startDockerTest({qtWaylandRev: rev, qt5Rev: rev, containerName, title });
}
if (!fs.existsSync('logs')){
......@@ -175,5 +188,14 @@ if (!fs.existsSync('logs')){
restoreTests();
listenForGerritChanges();
initTest();
scheduleJob({hour: 12, minute: 0}, () => {
console.log('Running daily checks');
healthCheck('5.11');
healthCheck('dev');
});
// Run initial tests
healthCheck('5.11');
healthCheck('dev');
serveLogs();
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment