Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async onMessage(message) {
let {status} = message.payload;
// If task was canceled, we don't send a notification since this was a deliberate user action
if (status.state === 'exception') {
if (this.ignoreTaskReasonResolved.includes((_.last(status.runs) || {}).reasonResolved)) {
return null;
}
}
// Load task definition
let taskId = status.taskId;
let task = await this.queue.task(taskId);
let href = libUrls.ui(this.rootUrl, `tasks/${taskId}`);
let groupHref = libUrls.ui(this.rootUrl, `groups/${taskId}/tasks`);
let runCount = status.runs.length;
return Promise.all(message.routes.map(entry => {
let route = entry.split('.');
// convert from on- syntax to state. e.g. on-exception -> exception
let decider = _.join(_.slice(route[route.length - 1], 3), '');
if (decider !== 'any' && status.state !== decider) {
return null;
}
let ircMessage = `Task "${task.metadata.name}" complete with status '${status.state}'. Inspect: ${href}`;
switch (route[1]) {
case 'irc-user': {
if (_.has(task, 'extra.notify.ircUserMessage')) {
async onMessage(message) {
let {status} = message.payload;
// If task was canceled, we don't send a notification since this was a deliberate user action
if (status.state === 'exception') {
if (this.ignoreTaskReasonResolved.includes((_.last(status.runs) || {}).reasonResolved)) {
return null;
}
}
// Load task definition
let taskId = status.taskId;
let task = await this.queue.task(taskId);
let href = libUrls.ui(this.rootUrl, `tasks/${taskId}`);
let groupHref = libUrls.ui(this.rootUrl, `groups/${taskId}/tasks`);
let runCount = status.runs.length;
return Promise.all(message.routes.map(entry => {
let route = entry.split('.');
// convert from on- syntax to state. e.g. on-exception -> exception
let decider = _.join(_.slice(route[route.length - 1], 3), '');
if (decider !== 'any' && status.state !== decider) {
return null;
}
let ircMessage = `Task "${task.metadata.name}" complete with status '${status.state}'. Inspect: ${href}`;
switch (route[1]) {
case 'irc-user': {
export const getInspectTaskUrl = function getInspectTaskUrl(
taskId,
rootUrl,
timestamp,
) {
// 1573257600 is the timestamp for the 2019-11-09 taskcluster migration date
const _rootUrl = timestamp < 1573257600 ? 'https://taskcluster.net' : rootUrl;
return tcLibUrls.ui(_rootUrl, `tasks/${taskId}`);
};
taskId => {
this.setState({ triggering: false });
let message = 'Custom action request sent successfully:';
let url = tcLibUrls.ui(currentRepo.tc_root_url, `/tasks/${taskId}`);
// For the time being, we are redirecting specific actions to
// specific urls that are different than usual. At this time, we are
// only directing loaner tasks to the loaner UI in the tools site.
// It is possible that we may make this a part of the spec later.
const loaners = [
'docker-worker-linux-loaner',
'generic-worker-windows-loaner',
];
if (loaners.includes(action.name)) {
message = 'Visit Taskcluster site to access loaner:';
url = `${url}/connect`;
}
notify(message, 'success', { linkText: 'Open in Taskcluster', url });
this.close();
},
const taskGroupUI = (rootUrl, taskGroupId) =>
libUrls.ui(rootUrl, `${rootUrl === 'https://taskcluster.net' ? '' : '/tasks'}/groups/${taskGroupId}`);
const taskUI = (rootUrl, taskGroupId, taskId) =>
libUrls.ui(rootUrl, rootUrl === 'https://taskcluster.net' ? `/groups/${taskGroupId}/tasks/${taskId}/details` : `/tasks/${taskId}`);
const taskGroupUI = (rootUrl, taskGroupId) =>