How to use the azure-devops-node-api/interfaces/BuildInterfaces.BuildStatus.Completed function in azure-devops-node-api

To help you get started, we’ve selected a few azure-devops-node-api 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 openupm / openupm / scripts / examples / build-azure-pipelines.js View on Github external
build_name: getBuildName('x', '@rotorz/unity3d-localized-strings', '1.0.3'),
          // 'system.debug': true,
          // 'agent.diagnostic': true,
        }
      )
  }, config.azureDevops.project);
  for (let i = 0; i < config.azureDevops.retries; i++) {
    await sleep(config.azureDevops.retryIntervalStep * (i + 1));
    build = await buildApi.getBuild(config.azureDevops.project, build.id);
    let statusName = BuildStatusEnum.getKeyOrThrow(build.status);
    let resultName = typeof build.result === 'undefined'
      ? 'undefined'
      : BuildResultEnum.getKeyOrThrow(build.result);
    console.log(`status: ${statusName}, result: ${resultName}`);
    switch (build.status) {
      case BuildStatus.Completed:
      case BuildStatus.Cancelling:
      case BuildStatus.Postponed:
        return build;
      case BuildStatus.None:
      case BuildStatus.InProgress:
      case BuildStatus.NotStarted:
        break;
      default:
        throw new Error(`Unknown build status ${build.status}`);
    }
  }
};