How to use the azure-devops-node-api/interfaces/BuildInterfaces.BuildStatus.Cancelling 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
// '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}`);
    }
  }
};
github openupm / openupm / scripts / jobs / build-release.js View on Github external
async checkBuildPipelines() {
    logger.info(`[id=${this.release.id}] [build_id=${this.release.build_id}] check build pipelines`);
    for (let i = 0; i < config.azureDevops.check.retries; i++) {
      let build = await this.buildApi.getBuild(config.azureDevops.project, this.release.build_id);
      let statusName = BuildStatusEnum.getKeyOrThrow(build.status);
      let resultName = typeof build.result === 'undefined'
        ? 'undefined'
        : BuildResultEnum.getKeyOrThrow(build.result);
      logger.info(`[id=${this.release.id}] [build_id=${this.release.build_id}] status ${statusName}, result ${resultName}, retries ${i}`);
      if (build.status == BuildStatus.Completed || build.status == BuildStatus.Cancelling)
        return build;
      await sleep(config.azureDevops.check.retryIntervalStep * (i + 1));
    }
    return null;
  }