How to use the azure-devops-node-api/interfaces/BuildInterfaces.BuildResult.Succeeded 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 microsoft / azure-pipelines-tasks / Tasks / DownloadBuildArtifactsV0 / main.ts View on Github external
definitionId = String(definitions[0].id);
                console.log(tl.loc("DefinitionNameMatchFound", definitionIdSpecified, definitionId));
            }

            if (!definitionId) {
                reject(tl.loc("UnresolvedDefinitionId"));
                return;
            }
        }

        // verify that buildId belongs to the definition selected
        if (definitionId) {
            var build: Build;
            if (buildVersionToDownload != "specific" && !triggeringBuildFound) {
                var resultFilter = BuildResult.Succeeded;
                if (allowPartiallySucceededBuilds) {
                    resultFilter |= BuildResult.PartiallySucceeded;
                }
                var branchNameFilter = (buildVersionToDownload == "latest") ? null : branchName;

                // get latest successful build filtered by branch
                var buildsForThisDefinition = await executeWithRetries("getBuildId", () => buildApi.getBuilds(projectId, [parseInt(definitionId)], null, null, null, null, null, null, BuildStatus.Completed, resultFilter, tagFilters, null, null, null, null, null, BuildQueryOrder.FinishTimeDescending, branchNameFilter), retryLimit).catch((reason) => {
                    reject(reason);
                    return;
                });

                if (!buildsForThisDefinition || buildsForThisDefinition.length == 0) {
                    if (buildVersionToDownload == "latestFromBranch") reject(tl.loc("LatestBuildFromBranchNotFound", branchNameFilter));
                    else reject(tl.loc("LatestBuildNotFound"));
                    return;
                }
github openupm / openupm / scripts / jobs / build-release.js View on Github external
this.buildApi = await this.getBuildApi();
    // Start new build pipelines if need.
    let build = null;
    if (!this.release.build_id) {
      build = await this.CreateBuildPipelines();
      await this.release.update({ build_id: build.id + '' });
      await sleep(config.azureDevops.check.duration);
    }
    // Wait build pipelines to finish.
    build = await this.checkBuildPipelines();
    if (build === null) {
      // Pipelines timeout.
      await this.release.update({ state: ReleaseState.failed, reason: ReleaseReason.timeout });
      // Raise error to retry.
      throw new Error(`[id=${this.release.id}] [build_id=${this.release.build_id}] build pipelines timeout.`);
    } else if (build.status == BuildStatus.Completed && build.result == BuildResult.Succeeded) {
      // Pipelines succeeded.
      await this.release.update({ state: ReleaseState.succeeded });
      logger.info(`[id=${this.release.id}] [build_id=${this.release.build_id}] build pipelines succeeded.`);
    } else {
      // Pipelines failed.
      await this.release.update({ state: ReleaseState.failed });
      let reason = '';
      // Update publish_log.
      if (build.status == BuildStatus.Completed && build.result == BuildResult.Failed) {
        // Fetch build message.
        let publishLog = await this.getPublishLog();
        // Find reason.
        reason = this.getReasonFromPublishLog(publishLog);
        // Update to database.
        await this.release.update({ publish_log: publishLog, reason });
      }