How to use the taskcluster-client.Index function in taskcluster-client

To help you get started, we’ve selected a few taskcluster-client 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-b2g / mozilla-download / src / detecturl.js View on Github external
export default async function detectURL(options) {
  // Figure out the appropriate index namespace.
  let nsparts = ['buildbot', 'branches', options.branch];
  let buildname = buildinfo.buildname(options);
  nsparts.push(buildname);
  let ns = nsparts.join('.');

  // Find task in namespace.
  let index = new taskcluster.Index(TC_CLIENT_OPTS);
  let task = await index.findTask(ns);

  // List task artifacts.
  let queue = new taskcluster.Queue(TC_CLIENT_OPTS);
  let { artifacts } = await queue.listLatestArtifacts(task.taskId);

  // Default to downloading the build archive for our os.
  let os = options.os;
  let product = options.product;
  let suffix = !!options.fileSuffix ?
    options.fileSuffix :
    buildinfo.archiveFileSuffix(product, os);

  // Filter through namespace artifacts.
  let artifact = artifacts.find(art => art.name.indexOf(suffix) !== -1);
  if (!artifact) {
github taskcluster / taskcluster / infrastructure / tooling / src / smoketest / checks / indexTask.js View on Github external
workerType: 'succeed',
      created: (new Date()).toJSON(),
      deadline: taskcluster.fromNowJSON('2 minutes'),
      expires: taskcluster.fromNowJSON('60 minutes'),
      metadata: {
        name: "Smoketest indexTask-find",
        description: "built-in/succeed task created during smoketest",
        owner: "smoketest@taskcluster.net",
        source: "https://taskcluster.net",
      },
      payload: {},
      routes: [`index.${taskIndex}`],
    };
    utils.status({ message: 'indexTask-find taskId: ' + randomId });
    await queue.createTask(randomId, task);
    let index = new taskcluster.Index(taskcluster.fromEnvVars());
    let pollForStatusStart = new Date();
    while ((new Date() - pollForStatusStart) < 120000) {
      let status = await queue.status(randomId);
      if (status.status.state === 'pending' || status.status.state === 'running') {
        utils.status({
          message: 'Current task status: ' + status.status.state,
        });
      } else if (status.status.state === 'completed') {
        try {
          await index.findTask(taskIndex);
          return;
        }
        catch (err) {
          utils.status({
            message: 'waiting for the task to be indexed',
          });
github nss-dev / nss / automation / taskcluster / graph / src / image_builder.js View on Github external
async function findTaskWithImageArtifact(ns) {
  let index = new taskcluster.Index(taskcluster.fromEnvVars());
  let {taskId} = await index.findTask(ns);
  let has_image = await taskHasImageArtifact(taskId);
  return has_image ? taskId : null;
}
github taskcluster / taskcluster / services / web-server / src / clients.js View on Github external
module.exports = options => ({
  auth: new Auth(options),
  github: new Github(options),
  hooks: new Hooks(options),
  index: new Index(options),
  purgeCache: new PurgeCache(options),
  queue: new Queue(options),
  secrets: new Secrets(options),
  queueEvents: new QueueEvents(options),
  notify: new Notify(options),
  workerManager: new WorkerManager(options),
});
github sergey-cheperis / nss-nspr-windows / nss / automation / taskcluster / graph / src / image_builder.js View on Github external
async function findTaskWithImageArtifact(ns) {
  let index = new taskcluster.Index();
  let {taskId} = await index.findTask(ns);
  let has_image = await taskHasImageArtifact(taskId);
  return has_image ? taskId : null;
}
github nss-dev / nss / automation / taskcluster / graph / image_builder.js View on Github external
function asyncFindTaskWithImageArtifact(ns) {
  var index = new taskcluster.Index();

  return index.findTask(ns).then(function (result) {
    return asyncTaskHasImageArtifact(result.taskId).then(function (has_image) {
      return has_image ? result.taskId : null;
    });
  }, function () {
    return null;
  });
}