morning-builds-core
Version:
Core functionality for Morning Builds
40 lines • 1.96 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var BluebirdPromise = require("bluebird");
var fail_categories_1 = require("../fail-categories");
var Labels = /** @class */ (function () {
function Labels(clients) {
this.infrastructureErrorLabels = {
'vm-crash': fail_categories_1.categories.infrastructureError,
'selenium-firefox-flake': fail_categories_1.categories.infrastructureError,
'karma-chrome-flake': fail_categories_1.categories.infrastructureError,
'artifact-transfer-error': fail_categories_1.categories.infrastructureError,
'SSL-handshake-failure': fail_categories_1.categories.infrastructureError,
'incomplete-binary': fail_categories_1.categories.infrastructureError,
'npm-checksum-error': fail_categories_1.categories.infrastructureError,
'merge-conflict': fail_categories_1.categories.mergeConflict,
};
this.bambooClient = clients.bamboo;
}
Labels.prototype.assembleBuildsWithErrorInLabels = function (builds) {
var _this = this;
return BluebirdPromise
.map(builds, function (failingBuild) { return (_this.bambooClient
.fetchLabels({
planKey: failingBuild.planKey,
resultNumber: failingBuild.resultNumber,
})
.then(function (labels) {
var errorLabel = labels.find(function (label) { return Object.keys(_this.infrastructureErrorLabels).includes(label); });
return {
build: failingBuild,
failDetails: [errorLabel] || [],
failReason: errorLabel ? _this.infrastructureErrorLabels[errorLabel] : null,
};
})); })
.filter(function (buildWithFailDetails) { return buildWithFailDetails.failReason !== null; });
};
return Labels;
}());
exports.Labels = Labels;
//# sourceMappingURL=labels.js.map