当前位置: 首页>>代码示例>>Java>>正文


Java BuildData.getLastBuiltRevision方法代码示例

本文整理汇总了Java中hudson.plugins.git.util.BuildData.getLastBuiltRevision方法的典型用法代码示例。如果您正苦于以下问题:Java BuildData.getLastBuiltRevision方法的具体用法?Java BuildData.getLastBuiltRevision怎么用?Java BuildData.getLastBuiltRevision使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在hudson.plugins.git.util.BuildData的用法示例。


在下文中一共展示了BuildData.getLastBuiltRevision方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getCommitRepoMap

import hudson.plugins.git.util.BuildData; //导入方法依赖的package包/类
public Map<String, URIish> getCommitRepoMap() throws Exception {
    List<RemoteConfig> repoList = this.gitScm.getRepositories();
    if (repoList.size() != 1) {
        throw new Exception("None or multiple repos");
    }

    HashMap<String, URIish> commitRepoMap = new HashMap<String, URIish>();
    BuildData buildData = build.getAction(BuildData.class);
    if (buildData == null || buildData.getLastBuiltRevision() == null) {
        logger.warning("Build data could not be found");
    } else {
        commitRepoMap.put(buildData.getLastBuiltRevision().getSha1String(), repoList.get(0).getURIs().get(0));
    }

    return commitRepoMap;
}
 
开发者ID:jenkinsci,项目名称:bitbucket-build-status-notifier-plugin,代码行数:17,代码来源:GitScmAdapter.java

示例2: getCandidateRevisions

import hudson.plugins.git.util.BuildData; //导入方法依赖的package包/类
/**
 * Get failing build revision if this is a deflake build, otherwise use the default build chooser
 */
@Override
public Collection<Revision> getCandidateRevisions(boolean isPollCall, String singleBranch,
    GitClient git,
    TaskListener listener, BuildData buildData,
    BuildChooserContext context)
    throws GitException, IOException, InterruptedException {

  AbstractBuild build = context.actOnBuild(new GetBuild());
  // Not sure why it cannot be inferred and we have to put cast here
  DeflakeCause cause = (DeflakeCause) build.getCause(DeflakeCause.class);

  if (cause != null) {
    BuildData gitBuildData = gitSCM.getBuildData(cause.getUpstreamRun(), true);
    Revision revision = gitBuildData.getLastBuiltRevision();
    if (revision != null) {
      return Collections.singletonList(revision);
    }
  }

  // If it is not a deflake run, then use the default git checkout strategy
  defaultBuildChooser.gitSCM = this.gitSCM;
  return defaultBuildChooser
      .getCandidateRevisions(isPollCall, singleBranch, git, listener, buildData, context);
}
 
开发者ID:jenkinsci,项目名称:flaky-test-handler-plugin,代码行数:28,代码来源:DeflakeGitBuildChooser.java

示例3: SingleTestFlakyStatsWithRevision

import hudson.plugins.git.util.BuildData; //导入方法依赖的package包/类
/**
 * Construct a SingleTestFlakyStatsWithRevision object with {@link SingleTestFlakyStats} and
 * build information.
 *
 * @param stats Embedded {@link SingleTestFlakyStats} object
 * @param build The {@link hudson.model.AbstractBuild} object to get SCM information from.
 */
public SingleTestFlakyStatsWithRevision(SingleTestFlakyStats stats, AbstractBuild build) {
  this.stats = stats;
  revision = Integer.toString(build.getNumber());

  SCM scm = build.getProject().getScm();
  if (scm != null && scm instanceof GitSCM) {
    GitSCM gitSCM = (GitSCM) scm;
    BuildData buildData = gitSCM.getBuildData(build);
    if (buildData != null) {
      Revision gitRevision = buildData.getLastBuiltRevision();
      if (gitRevision != null) {
        revision = gitRevision.getSha1String();
      }
    }
  }
}
 
开发者ID:jenkinsci,项目名称:flaky-test-handler-plugin,代码行数:24,代码来源:HistoryAggregatedFlakyTestResultAction.java

示例4: getBuildRevision

import hudson.plugins.git.util.BuildData; //导入方法依赖的package包/类
private static String getBuildRevision(Run<?, ?> build) {
    GitLabWebHookCause cause = build.getCause(GitLabWebHookCause.class);
    if (cause != null) {
        return cause.getData().getLastCommit();
    }

    BuildData action = build.getAction(BuildData.class);
    if (action == null) {
        throw new IllegalStateException("No (git-plugin) BuildData associated to current build");
    }
    Revision lastBuiltRevision = action.getLastBuiltRevision();

    if (lastBuiltRevision == null) {
        throw new IllegalStateException("Last build has no associated commit");
    }

    return action.getLastBuild(lastBuiltRevision.getSha1()).getMarked().getSha1String();
}
 
开发者ID:jenkinsci,项目名称:gitlab-plugin,代码行数:19,代码来源:CommitStatusUpdater.java

示例5: getGitSourceCommit

import hudson.plugins.git.util.BuildData; //导入方法依赖的package包/类
private String getGitSourceCommit() {
    // depend on git plugin
    for (BuildData data : getJenkinsBuild().getActions(BuildData.class)) {
        Revision revision = data.getLastBuiltRevision();
        if (revision != null) {
            return revision.getSha1String();
        }
    }

    return null;
}
 
开发者ID:Microsoft,项目名称:vsts-jenkins-build-integration-sample,代码行数:12,代码来源:TfsBuildFacadeImpl.java

示例6: onCompleted

import hudson.plugins.git.util.BuildData; //导入方法依赖的package包/类
public void onCompleted(AbstractBuild<?, ?> build, TaskListener listener) {
    GhprcCause c = Ghprc.getCause(build);
    if (c == null) {
        return;
    }

    // remove the BuildData action that we may have added earlier to avoid
    // having two of them, and because the one we added isn't correct
    // @see GhprcTrigger
    BuildData fakeOne = null;
    for (BuildData data : build.getActions(BuildData.class)) {
        if (data.getLastBuiltRevision() != null && !data.getLastBuiltRevision().getSha1String().equals(c.getCommit())) {
            fakeOne = data;
            break;
        }
    }
    if (fakeOne != null) {
        build.getActions().remove(fakeOne);
    }

    for (GhprcExtension ext : Ghprc.getJobExtensions(trigger, GhprcCommitStatus.class)) {
        if (ext instanceof GhprcCommitStatus) {
            try {
                ((GhprcCommitStatus) ext).onBuildComplete(build, listener, repo.getGitHubRepo());
            } catch (GhprcCommitStatusException e) {
                repo.commentOnFailure(build, listener, e);
            }
        }
    }

    GHCommitState state;
    state = Ghprc.getState(build);

    commentOnBuildResult(build, listener, c);
    // close failed pull request automatically
    if (state == GHCommitState.FAILURE && trigger.isAutoCloseFailedPullRequests()) {
        closeFailedRequest(listener, c);
    }
}
 
开发者ID:bratchenko,项目名称:jenkins-github-pull-request-comments,代码行数:40,代码来源:GhprcBuilds.java

示例7: fromPull

import hudson.plugins.git.util.BuildData; //导入方法依赖的package包/类
public static String fromPull(BuildData buildData, Optional<String> organization) {
    Set<String> remoteUrls = buildData.getRemoteUrls();

    checkArgument(!remoteUrls.isEmpty(), "buildData does not contain any remote URLs");

    Revision lastBuiltRevision = buildData.getLastBuiltRevision();
    Collection<hudson.plugins.git.Branch> scmBranches = lastBuiltRevision.getBranches();

    checkArgument(!scmBranches.isEmpty(), "buildData last revision does not contain any branches");

    String firstRemoteUrl = remoteUrls.iterator().next();
    Repository repository = new Repository(firstRemoteUrl);

    hudson.plugins.git.Branch firstScmBranch = scmBranches.iterator().next();
    Branch branch = new Branch(firstScmBranch);

    return generateRemoteImageName(organization, repository, branch);
}
 
开发者ID:spoonapps,项目名称:jenkins,代码行数:19,代码来源:RemoteImageGenerator.java


注:本文中的hudson.plugins.git.util.BuildData.getLastBuiltRevision方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。