How to use taskcluster-client-web - 10 common examples

To help you get started, we’ve selected a few taskcluster-client-web examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mozilla / treeherder / ui / job-view / CustomJobActions.jsx View on Github external
} catch (e) {
        this.setState({ triggering: false });
        notify(`YAML Error: ${e.message}`, 'danger');
        return;
      }
      const valid = validate(input);
      if (!valid) {
        this.setState({ triggering: false });
        notify(ajv.errorsText(validate.errors), 'danger');
        return;
      }
    }

    TaskclusterModel.submit({
      action,
      actionTaskId: slugid(),
      decisionTaskId,
      taskId: originalTaskId,
      task: originalTask,
      input,
      staticActionVariables,
      currentRepo,
    }).then(
      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.
github mozilla / treeherder / ui / plugins / controller.js View on Github external
return tcactions.load(decisionTaskId, $scope.job).then((results) => {
                            const actionTaskId = slugid();
                            if (results) {
                                const backfilltask = _.find(results.actions, { name: 'backfill' });
                                // We'll fall back to actions.yaml if this isn't true
                                if (backfilltask) {
                                    return tcactions.submit({
                                        action: backfilltask,
                                        actionTaskId,
                                        decisionTaskId,
                                        taskId: results.originalTaskId,
                                        task: results.originalTask,
                                        input: {},
                                        staticActionVariables: results.staticActionVariables,
                                    }).then(function () {
                                        $scope.$apply(thNotify.send(`Request sent to backfill job via actions.json (${actionTaskId})`, 'success'));
                                    }, function (e) {
                                        // The full message is too large to fit in a Treeherder
github mozilla / treeherder / ui / js / controllers / tcjobactions.js View on Github external
} catch (e) {
                    $scope.triggering = false;
                    thNotify.send(`YAML Error: ${e.message}`, 'danger');
                    return;
                }
                const valid = validate(input);
                if (!valid) {
                    $scope.triggering = false;
                    thNotify.send(ajv.errorsText(validate.errors), 'danger');
                    return;
                }
            }

            tcactions.submit({
                action: $scope.input.selectedAction,
                actionTaskId: slugid(),
                decisionTaskId,
                taskId: originalTaskId,
                task: originalTask,
                input,
                staticActionVariables: $scope.staticActionVariables,
            }).then(function (taskId) {
                $scope.triggering = false;
                let message = 'Custom action request sent successfully:';
                let url = `https://tools.taskcluster.net/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.indexOf($scope.input.selectedAction.name) !== -1) {
github mozilla / treeherder / ui / js / models / resultset.js View on Github external
return taskclusterModel.load(decisionTaskId).then((results) => {
                        const actionTaskId = slugid();
                        // In this case we have actions.json tasks
                        if (results) {
                            const addjobstask = results.actions.find(action =>
                                action.name === 'add-new-jobs');
                            // We'll fall back to actions.yaml if this isn't true
                            if (addjobstask) {
                                return taskclusterModel.submit({
                                    action: addjobstask,
                                    actionTaskId,
                                    decisionTaskId,
                                    taskId: null,
                                    task: null,
                                    input: { tasks: tclabels },
                                    staticActionVariables: results.staticActionVariables,
                                }).then(() => `Request sent to trigger new jobs via actions.json (${actionTaskId})`);
                            }
github mozilla / treeherder / ui / js / models / resultset.js View on Github external
return taskclusterModel.load(decisionTaskId).then((results) => {
                    const actionTaskId = slugid();

                    // In this case we have actions.json tasks
                    if (results) {
                        const missingtask = results.actions.find(action =>
                            action.name === 'run-missing-tests');
                        // We'll fall back to actions.yaml if this isn't true
                        if (missingtask) {
                            return taskclusterModel.submit({
                                action: missingtask,
                                actionTaskId,
                                decisionTaskId,
                                taskId: null,
                                task: null,
                                input: {},
                                staticActionVariables: results.staticActionVariables,
                            }).then(() => `Request sent to trigger missing jobs via actions.json (${actionTaskId})`);
github taskcluster / taskcluster-tools / src / utils.js View on Github external
omit(
      [
        'taskGroupId',
        'routes',
        'dependencies',
        'requires',
        'scopes',
        'payload'
      ],
      cloneDeep(task)
    ),
    {
      retries: 0,
      deadline: fromNowJSON('12 hours'),
      created: fromNowJSON(),
      expires: fromNowJSON('7 days'),
      scopes: task.scopes.filter(scope => !/^docker-worker:cache:/.test(scope)), // Delete cache scopes
      payload: merge(omit(['artifacts', 'cache'], task.payload || {}), {
        maxRunTime: Math.max(
          task.payload && task.payload.maxRunTime,
          3 * 60 * 60
        ),
        features: {
          interactive: true
        },
        env: {
          TASKCLUSTER_INTERACTIVE: 'true'
        }
      })
    }
  );
github taskcluster / taskcluster-tools / src / utils.js View on Github external
merge(
    omit(
      [
        'taskGroupId',
        'routes',
        'dependencies',
        'requires',
        'scopes',
        'payload'
      ],
      cloneDeep(task)
    ),
    {
      retries: 0,
      deadline: fromNowJSON('12 hours'),
      created: fromNowJSON(),
      expires: fromNowJSON('7 days'),
      scopes: task.scopes.filter(scope => !/^docker-worker:cache:/.test(scope)), // Delete cache scopes
      payload: merge(omit(['artifacts', 'cache'], task.payload || {}), {
        maxRunTime: Math.max(
          task.payload && task.payload.maxRunTime,
          3 * 60 * 60
        ),
        features: {
          interactive: true
        },
        env: {
          TASKCLUSTER_INTERACTIVE: 'true'
        }
      })
    }
  );
github taskcluster / taskcluster-tools / src / utils.js View on Github external
export const parameterizeTask = task =>
  merge(
    omit(
      [
        'taskGroupId',
        'routes',
        'dependencies',
        'requires',
        'scopes',
        'payload'
      ],
      cloneDeep(task)
    ),
    {
      retries: 0,
      deadline: fromNowJSON('12 hours'),
      created: fromNowJSON(),
      expires: fromNowJSON('7 days'),
      scopes: task.scopes.filter(scope => !/^docker-worker:cache:/.test(scope)), // Delete cache scopes
      payload: merge(omit(['artifacts', 'cache'], task.payload || {}), {
        maxRunTime: Math.max(
          task.payload && task.payload.maxRunTime,
          3 * 60 * 60
        ),
        features: {
          interactive: true
        },
        env: {
          TASKCLUSTER_INTERACTIVE: 'true'
        }
      })
    }
github taskcluster / taskcluster-tools / src / auth / auth0.js View on Github external
export function userSessionFromAuthResult(authResult) {
  return UserSession.fromOIDC({
    oidcProvider: process.env.OIDC_PROVIDER,
    accessToken: authResult.accessToken,
    fullName: authResult.idTokenPayload.nickname,
    picture: authResult.idTokenPayload.picture,
    oidcSubject: authResult.idTokenPayload.sub,
    // per https://wiki.mozilla.org/Security/Guidelines/OpenID_connect#Session_handling
    renewAfter: fromNow('15 minutes')
  });
}
github taskcluster / taskcluster-tools / src / views / SecretsManager / SecretEditor.jsx View on Github external
async loadSecret(props) {
    // If there is a secretId, we load it. Otherwise we create a new secret
    if (!props.secretId) {
      const defaultSecret = { foo: 'bar' };

      return this.setState({
        secret: defaultSecret,
        secretValue: safeDump(defaultSecret, safeDumpOpts),
        expires: fromNow('1000 years'),
        editing: true,
        loading: false,
        error: null
      });
    }

    // indicate loading while the async secret fetch occurs
    this.setState({
      loading: true,
      error: null
    });

    try {
      const { secret, expires } = await props.secrets.get(props.secretId);

      this.setState({

taskcluster-client-web

[![Download](https://img.shields.io/badge/yarn-taskcluster--client--web-brightgreen)](https://yarnpkg.com/en/package/taskcluster-client-web) [![License](https://img.shields.io/badge/license-MPL%202.0-orange.svg)](http://mozilla.org/MPL/2.0)

MPL-2.0
Latest version published 10 days ago

Package Health Score

66 / 100
Full package analysis

Similar packages