Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return JSON.stringify(value);
}
// Serialize data object
if (type == 'date') {
assert(
value instanceof Date,
"Value '" + value + "' must be an instance of Date object for " +
"property " + entry.property
);
return value;
}
// Serialize slug to uuid which azure tables can encode efficiently
if (type == 'slugid') {
assert(value, "Slugs can't be empty string!!!");
assert(value.length == 22, "Slugs should always be 22 chars long");
return slugid.decode(value);
}
throw new Error("Can't serialize unknown type: '" + type + "' for " +
"property: '" + entry.property + "'!");
};
// Chunks are often numbers type cast here so we don't need to enforce
// this everywhere...
if (typeof treeherder.symbol === 'number') {
treeherder.symbol = String(treeherder.symbol);
}
// Validation is useful primarily for use with kue viewer as you can easily
// see what failed during the validation.
let validate = Joi.validate(treeherder, SCHEMA);
if (validate.error) {
throw new Error(validate.error.annotate());
}
let config = validate.value;
let job = {
job_guid: `${slugid.decode(taskId)}/${run.runId}`,
build_system_type: 'taskcluster',
build_platform: config.build,
machine_platform: config.machine,
machine: config.machineId,
// Maximum job name length is 100 chars...
name: task.metadata.name.slice(0, 99),
reason: 'scheduled', // use reasonCreated or reasonResolved
job_symbol: config.symbol,
submit_timestamp: timestamp(task.created),
start_timestamp: (run.started ? timestamp(run.started) : undefined),
end_timestamp: (run.resolved ? timestamp(run.resolved) : undefined),
who: task.metadata.owner,
option_collection: config.collection
};
// Optional configuration details if these keys are present it has an effect
await project.postJobs(status.runs.map((run) => {
var result = {
project: project.project,
revision_hash: revisionHash,
job: {
job_guid: slugid.decode(status.taskId) + '/' + run.runId,
build_platform: {
platform: status.workerType,
os_name: '-',
architecture: '-'
},
machine_platform: {
platform: status.workerType,
os_name: '-',
architecture: '-'
},
name: task.metadata.name,
reason: 'scheduled', // use reasonCreated or reasonResolved
job_symbol: task.extra.treeherder.symbol,
group_name: task.extra.treeherder.groupName,
group_symbol: task.extra.treeherder.groupSymbol,
product_name: task.extra.treeherder.productName,
// Chunks are often numbers type cast here so we don't need to enforce
// this everywhere...
if (typeof treeherder.symbol === 'number') {
treeherder.symbol = String(treeherder.symbol);
}
// Validation is useful primarily for use with kue viewer as you can easily
// see what failed during the validation.
let validate = Joi.validate(treeherder, SCHEMA);
if (validate.error) {
throw new Error(validate.error.annotate());
}
let config = validate.value;
let job = {
job_guid: `${slugid.decode(taskId)}/${run.runId}`,
build_system_type: 'taskcluster',
build_platform: config.build,
machine_platform: config.machine,
machine: config.machineId,
// Maximum job name length is 100 chars...
name: task.metadata.name.slice(0, 99),
reason: 'scheduled', // use reasonCreated or reasonResolved
job_symbol: config.symbol,
submit_timestamp: timestamp(task.created),
start_timestamp: (run.started ? timestamp(run.started) : undefined),
end_timestamp: (run.resolved ? timestamp(run.resolved) : undefined),
who: task.metadata.owner,
option_collection: config.collection
};
// Optional configuration details if these keys are present it has an effect
function incomingTask(input) {
var record = TASK_FIELDS.reduce(function(record, key) {
record[key] = input[key];
return record;
}, {});
record.taskId = slugid.decode(record.taskId);
return record;
}
serialize: function(d) {
assert(d, "Slugs must be a string");
assert.equal(d.length, 22, "Slugs should always be 22 chars long");
return slugid.decode(d);
},
deserialize: function(r) {