Skip to content
This repository was archived by the owner on Jan 5, 2019. It is now read-only.
Closed
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
16 changes: 1 addition & 15 deletions src/handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,6 @@ function resultFromRun(run) {
}
}

// Creates a log entry for Treeherder to retrieve and parse. This log is
// displayed on the Treeherder Log Viewer once parsed.
function createLogReference(queue, taskId, run) {
let logUrl = `https://queue.taskcluster.net/v1/task/${taskId}` +
`/runs/${run.runId}/artifacts/public/logs/live_backing.log`;

return {
// XXX: This is a magical name see 1147958 which enables the log viewer.
name: 'builds-4h',
url: logUrl,
};
}

// Filters the task routes for the treeherder specific route. Once found,
// the route is parsed into distinct parts used for constructing the
// Treeherder job message.
Expand Down Expand Up @@ -225,6 +212,7 @@ module.exports = class Handler {
timeScheduled: task.created,
jobKind: treeherderConfig.jobKind ? treeherderConfig.jobKind : 'other',
reason: treeherderConfig.reason || 'scheduled',
logs: [],
jobInfo: {
links: [],
summary: task.metadata.description,
Expand Down Expand Up @@ -316,7 +304,6 @@ module.exports = class Handler {

job.timeStarted = run.started;
job.timeCompleted = run.resolved;
job.logs = [createLogReference(this.queue, message.status.taskId, run)];
job = await addArtifactUploadedLinks(this.queue,
this.monitor,
message.status.taskId,
Expand All @@ -330,7 +317,6 @@ module.exports = class Handler {
let job = this.buildMessage(pushInfo, task, message.runId, message);
job.timeStarted = run.started;
job.timeCompleted = run.resolved;
job.logs = [createLogReference(this.queue, message.status.taskId, run)];
job = await addArtifactUploadedLinks(this.queue,
this.monitor,
message.status.taskId,
Expand Down
17 changes: 15 additions & 2 deletions src/transform/artifact_links.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
const path = require('path');
const taskcluster = require('taskcluster-client');

LOG_ARTIFACTS = {
// XXX: This is a magical name see 1147958 which enables the log viewer.
'public/logs/live_backing.log': 'builds-4h',
'public/logs/chain_of_trust.log': 'chain-of-trust',
}

module.exports = async function(queue, monitor, taskId, runId, job) {
let res;
try {
Expand Down Expand Up @@ -28,6 +34,14 @@ module.exports = async function(queue, monitor, taskId, runId, job) {
let seen = {};

let links = artifacts.map((artifact) => {
let url = `https://queue.taskcluster.net/v1/task/${taskId}` +
`/runs/${runId}/artifacts/${artifact.name}`;
if (artifact.name in LOG_ARTIFACTS) {
job.logs.push({
name: LOG_ARTIFACTS[artifact.name],
url: url,
});
}
let name = path.parse(artifact.name).base;
if (!seen[name]) {
seen[name] = [artifact.name];
Expand All @@ -38,8 +52,7 @@ module.exports = async function(queue, monitor, taskId, runId, job) {
let link = {
label: 'artifact uploaded',
linkText: name,
url: `https://queue.taskcluster.net/v1/task/${taskId}` +
`/runs/${runId}/artifacts/${artifact.name}`,
url: url,
};
return link;
});
Expand Down