• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java BuildData类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



BuildData类属于hudson.plugins.git.util包,在下文中一共展示了BuildData类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: tryGetRemoteImage

import hudson.plugins.git.util.BuildData; //导入依赖的package包/类
@Override
public Optional<String> tryGetRemoteImage(PushPublisher publisher, SpoonBuild build) {
    Optional<String> organization = Optional.absent();
    if (publisher.isOverwriteOrganization()) {
        organization = Optional.fromNullable(publisher.getOrganization());
    }

    PushCause cause = build.getCause(PushCause.class);
    if (cause != null) {
        return Optional.of(RemoteImageGenerator.fromPush(cause, organization));
    }

    BuildData buildData = build.getAction(BuildData.class);
    if (buildData != null) {
        return Optional.of(RemoteImageGenerator.fromPull(buildData, organization));
    }

    return Optional.absent();
}
 
开发者ID:spoonapps,项目名称:jenkins,代码行数:20,代码来源:PushPublisher.java


示例5: validate

import hudson.plugins.git.util.BuildData; //导入依赖的package包/类
@Override
public void validate(PushPublisher publisher, SpoonBuild build) {
    super.validate(publisher, build);

    if (publisher.isOverwriteOrganization()) {
        checkState(Patterns.isNullOrSingleWord(publisher.getOrganization()), REQUIRE_SINGLE_WORD_OR_NULL_SP,
                "Organization", publisher.getOrganization());
    }

    PushCause webHookCause = build.getCause(PushCause.class);
    if (webHookCause != null) {
        return;
    }

    BuildData pullGitCause = build.getAction(BuildData.class);
    if (pullGitCause != null) {
        return;
    }

    throw new IllegalStateException("Build has not been caused by a web hook event or pulling SCM");
}
 
开发者ID:spoonapps,项目名称:jenkins,代码行数:22,代码来源:PushPublisher.java


示例6: 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


示例7: createProject

import hudson.plugins.git.util.BuildData; //导入依赖的package包/类
private AbstractProject<?,?> createProject(String... shas) {
  AbstractBuild build = mock(AbstractBuild.class);
  List<BuildData> buildDatas = new ArrayList<BuildData>();
  for(String sha : shas) {
    BuildData buildData = createBuildData(sha);
    buildDatas.add(buildData);
  }

  when(build.getAction(BuildData.class)).thenReturn(buildDatas.get(0));
  when(build.getActions(BuildData.class)).thenReturn(buildDatas);

  AbstractProject<?, ?> project = mock(AbstractProject.class);
  when(build.getProject()).thenReturn(project);

  RunList list = mock(RunList.class);
  when(list.iterator()).thenReturn(Arrays.asList(build).iterator());
  when(project.getBuilds()).thenReturn(list);

  return project;
}
 
开发者ID:jenkinsci,项目名称:gitlab-plugin,代码行数:21,代码来源:BuildUtilTest.java


示例8: createBuildData

import hudson.plugins.git.util.BuildData; //导入依赖的package包/类
private BuildData createBuildData(String sha) {
  
  BuildData buildData = mock(BuildData.class);
  Revision revision = mock(Revision.class);
  when(revision.getSha1String()).thenReturn(sha);
  when(buildData.getLastBuiltRevision()).thenReturn(revision);

  Build gitBuild = mock(Build.class);
  when(gitBuild.getMarked()).thenReturn(revision);
  when(buildData.getLastBuild(any(ObjectId.class))).thenReturn(gitBuild);
  when(gitBuild.getRevision()).thenReturn(revision);
  when(gitBuild.isFor(sha)).thenReturn(true);
  buildData.lastBuild = gitBuild;

  return buildData;
}
 
开发者ID:jenkinsci,项目名称:gitlab-plugin,代码行数:17,代码来源:BuildUtilTest.java


示例9: findRelevantBuildDataImpl

import hudson.plugins.git.util.BuildData; //导入依赖的package包/类
/***
 * Returns the relevant BuildDatas from the supplied list of BuildDatas.
 *
 * @param logger PrintStream logger
 * @param buildDatas The list of BuildDatas
 * @param repoName The expanded repoName
 * @return The relevant BuildDatas
 */
private static Set<BuildData> findRelevantBuildDataImpl(PrintStream logger, List<BuildData> buildDatas, String repoName) {
    Set<BuildData> relevantBuildData = new HashSet<>();
    Set<String> revisions = new HashSet<>(); //Used to detect duplicates
    for (BuildData buildData : buildDatas) {
        if (buildData.lastBuild == null) continue;

        Branch buildBranch = buildData.lastBuild.revision.getBranches().iterator().next();

        String expandedRepository = repoName + "/"; // Assume no trailing slash in configuration
        if (buildBranch.getName().startsWith(expandedRepository)) { // Check integrationBranch matches integration repository
            String revisionSha = buildData.lastBuild.revision.getSha1String();
            boolean isDuplicateEntry = !revisions.add(revisionSha); // Check we haven't seen this changeset before
            if (isDuplicateEntry) {
                LOGGER.log(Level.INFO, String.format("Revision %s has a duplicate BuildData entry. Using first.", revisionSha));
            } else {
                relevantBuildData.add(buildData);
            }
        }
    }
    return relevantBuildData;
}
 
开发者ID:Praqma,项目名称:pretested-integration-plugin,代码行数:30,代码来源:PretestedIntegrationGitUtils.java


示例10: findPreviousBuildForPullId

import hudson.plugins.git.util.BuildData; //导入依赖的package包/类
/**
 * Find the previous BuildData for the given pull request number; this may return null
 */
private BuildData findPreviousBuildForPullId(StringParameterValue pullIdPv) {
	// find the previous build for this particular pull requet, it may not be the last build
	for (Run<?,?> r : job.getBuilds()) {
		ParametersAction pa = r.getAction(ParametersAction.class);
		if (pa != null) {
			for (ParameterValue pv : pa.getParameters()) {
				if (pv.equals(pullIdPv)) {
					for (BuildData bd : r.getActions(BuildData.class)) {
						return bd;
					}
				}
			}
		}
	}
	return null;
}
 
开发者ID:ds2wang,项目名称:ghprb-copy,代码行数:20,代码来源:GhprbTrigger.java


示例11: hasBeenBuilt

import hudson.plugins.git.util.BuildData; //导入依赖的package包/类
private boolean hasBeenBuilt(BuildData data, ObjectId sha1, String branch) {
	try {
        for(Map.Entry<String, Build> buildByBranchName : data.buildsByBranchName.entrySet()) {
            String branchName = buildByBranchName.getKey();
            if (branchName == null) {
                branchName = "";
            }
            Build build = buildByBranchName.getValue();

            if(branchName.equals(branch) && (build.revision.getSha1().equals(sha1) || build.marked.getSha1().equals(sha1)))
                return true;
        }

        return false;
	}
	catch(Exception ex) {
        return false;
	}
}
 
开发者ID:phemmer,项目名称:jenkins-git-chooser-build-branches,代码行数:20,代码来源:BuildBranchesChooser.java


示例12: 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


示例13: onCompleted

import hudson.plugins.git.util.BuildData; //导入依赖的package包/类
@Override
public void onCompleted(Run<?, ?> run, @Nonnull TaskListener listener) {
    GitHubPRTrigger trigger = ghPRTriggerFromRun(run);
    if (isNull(trigger)) {
        return;
    }

    GitHubPRCause cause = ghPRCauseFromRun(run);

    if (nonNull(cause)) {
        //remove all BuildData, because it doesn't work right with pull requests now
        //TODO rework after git-client patching about BuildData usage
        run.getActions().removeAll(run.getActions(BuildData.class));
    }
}
 
开发者ID:KostyaSha,项目名称:github-integration-plugin,代码行数:16,代码来源:GitHubPRBuildListener.java


示例14: checkBuildDataExistenceAfterBuild

import hudson.plugins.git.util.BuildData; //导入依赖的package包/类
@Test
public void checkBuildDataExistenceAfterBuild() throws Exception {
    FreeStyleProject p = j.createFreeStyleProject("test-job");
    p.getBuildersList().add(new BuildDataBuilder());

    FreeStyleBuild build = p.scheduleBuild2(0).get();
    j.waitUntilNoActivity();

    assertTrue(build.getActions(BuildData.class).size() > 0);
}
 
开发者ID:KostyaSha,项目名称:github-integration-plugin,代码行数:11,代码来源:GitHubPRTriggerTest.java


示例15: checkBuildDataAbsenceAfterBuild

import hudson.plugins.git.util.BuildData; //导入依赖的package包/类
@Test
public void checkBuildDataAbsenceAfterBuild() throws Exception {
    FreeStyleProject p = j.createFreeStyleProject("test-job");
    p.addProperty(new GithubProjectProperty("https://github.com/KostyaSha/test-repo"));
    p.addTrigger(defaultGitHubPRTrigger());
    p.getBuildersList().add(new BuildDataBuilder());

    GitHubPRCause cause = new GitHubPRCause("headSha", 1, true, "targetBranch", "srcBranch", "[email protected]",
            "title", new URL("http://www.example.com"), "repoOwner", new HashSet<String>(),
            null, false, "nice reason", "author name", "[email protected]", "open");
    FreeStyleBuild build = p.scheduleBuild2(0, cause).get();
    j.waitUntilNoActivity();

    assertTrue(build.getActions(BuildData.class).size() == 0);
}
 
开发者ID:KostyaSha,项目名称:github-integration-plugin,代码行数:16,代码来源:GitHubPRTriggerTest.java


示例16: findPreviousBuildForPullId

import hudson.plugins.git.util.BuildData; //导入依赖的package包/类
/**
 * Find the previous BuildData for the given pull request number; this may return null
 */
private BuildData findPreviousBuildForPullId(StringParameterValue pullIdPv) {
    // find the previous build for this particular pull request, it may not be the last build
    for (Run<?, ?> r : job.getBuilds()) {
        ParametersAction pa = r.getAction(ParametersAction.class);
        if (pa != null) {
            for (ParameterValue pv : pa.getParameters()) {
                if (pv.equals(pullIdPv)) {
                    Iterables.getFirst(r.getActions(BuildData.class), null);
                }
            }
        }
    }
    return null;
}
 
开发者ID:bratchenko,项目名称:jenkins-github-pull-request-comments,代码行数:18,代码来源:GhprcTrigger.java


示例17: 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


示例18: getBuildByBranch

import hudson.plugins.git.util.BuildData; //导入依赖的package包/类
public static Run<?, ?> getBuildByBranch(Job<?, ?> project, String branchName) {
    for (Run<?, ?> build : project.getBuilds()) {
        BuildData data = build.getAction(BuildData.class);
        MergeRecord merge = build.getAction(MergeRecord.class);
        if (hasLastBuild(data) && isNoMergeBuild(data, merge)) {    
            for (Branch branch : data.lastBuild.getRevision().getBranches()) {
                if (branch.getName().endsWith("/" + branchName)) {
                    return build;
                }
            }
        }
    }
    return null;
}
 
开发者ID:jenkinsci,项目名称:gitlab-plugin,代码行数:15,代码来源:BuildUtil.java


示例19: getBuildBySHA1WithoutMergeBuilds

import hudson.plugins.git.util.BuildData; //导入依赖的package包/类
public static Run<?, ?> getBuildBySHA1WithoutMergeBuilds(Job<?, ?> project, String sha1) {
    for (Run<?, ?> build : project.getBuilds()) {
        MergeRecord merge = build.getAction(MergeRecord.class);
        for(BuildData data : build.getActions(BuildData.class)) {
            if (hasLastBuild(data) && isNoMergeBuild(data, merge) && data.lastBuild.isFor(sha1)) {
                return build;
            }
        }
    }
    return null;
}
 
开发者ID:jenkinsci,项目名称:gitlab-plugin,代码行数:12,代码来源:BuildUtil.java


示例20: getBuildBySHA1IncludingMergeBuilds

import hudson.plugins.git.util.BuildData; //导入依赖的package包/类
public static Run<?, ?> getBuildBySHA1IncludingMergeBuilds(Job<?, ?> project, String sha1) {
    for (Run<?, ?> build : project.getBuilds()) {
        for(BuildData data : build.getActions(BuildData.class)) {
            if (data != null
                && data.lastBuild != null
                && data.lastBuild.getMarked() != null
                && data.lastBuild.getMarked().getSha1String().equals(sha1)) {
                return build;
            }
        }
    }
    return null;
}
 
开发者ID:jenkinsci,项目名称:gitlab-plugin,代码行数:14,代码来源:BuildUtil.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java RefreshSuperUserGroupsConfigurationRequestPBImpl类代码示例发布时间:2022-05-22
下一篇:
Java ActionMenuItemView类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap