本文整理了Java中hudson.model.AbstractBuild.getCauses()
方法的一些代码示例,展示了AbstractBuild.getCauses()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AbstractBuild.getCauses()
方法的具体详情如下:
包路径:hudson.model.AbstractBuild
类名称:AbstractBuild
方法名:getCauses
暂无
代码示例来源:origin: jenkinsci/jenkins
/**
* true if {@link AbstractBuild#hasParticipant} or {@link hudson.model.Cause.UserIdCause}
*/
private boolean relatedTo(@Nonnull AbstractBuild<?, ?> b) {
if (b.hasParticipant(this)) {
return true;
}
for (Cause cause : b.getCauses()) {
if (cause instanceof Cause.UserIdCause) {
String userId = ((Cause.UserIdCause) cause).getUserId();
if (userId != null && idStrategy().equals(userId, getId())) {
return true;
}
}
}
return false;
}
代码示例来源:origin: jenkinsci/debian-package-builder-plugin
@SuppressWarnings("rawtypes")
private boolean isTriggeredAutomatically (AbstractBuild build) {
for (Object cause: build.getCauses()) {
if (cause instanceof UserIdCause) {
return false;
}
}
return true;
}
代码示例来源:origin: jenkinsci/artifactory-plugin
private boolean isBuildFromM2ReleasePlugin(AbstractBuild<?, ?> build) {
List<Cause> causes = build.getCauses();
return !causes.isEmpty() && Iterables.any(causes, new Predicate<Cause>() {
public boolean apply(Cause input) {
return "org.jvnet.hudson.plugins.m2release.ReleaseCause".equals(input.getClass().getName());
}
});
}
代码示例来源:origin: jenkinsci/debian-package-builder-plugin
/**
* Returns message based on causes of the build
* @param build
* @return
*/
@SuppressWarnings("rawtypes")
private String getCausedMessage(AbstractBuild build) {
String firstPart = "Build #${BUILD_NUMBER}. ";
@SuppressWarnings("unchecked")
List<Cause> causes = build.getCauses();
List<String> causeMessages = FunctionalPrimitives.map(causes, new Functor<Cause, String>() {
@Override
public String execute(Cause value) {
return value.getShortDescription();
}
});
Set<String> uniqueCauses = new HashSet<String>(causeMessages);
return firstPart + FunctionalPrimitives.join(uniqueCauses, ". ") + ".";
}
代码示例来源:origin: org.hudsonci.plugins/run-condition
@Override
public boolean runPerform(final AbstractBuild<?, ?> build, final BuildListener listener) {
final String name = buildCause == null ? "N/A" : buildCause.displayName;
listener.getLogger().println(Messages.causeCondition_check(name));
final List<Cause> causes = build.getCauses();
if (buildCause != null) {
if (isExclusiveCause()) {
return causes.size() == 1 && buildCause.isCausedBy(causes.get(0).getClass().getName());
} else {
for (Cause cause : causes) {
if (buildCause.isCausedBy(cause.getClass().getName())) {
return true;
}
}
}
}
return false;
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
/** true if {@link AbstractBuild#hasParticipant} or {@link hudson.model.Cause.UserIdCause} */
private boolean relatedTo(@Nonnull AbstractBuild<?,?> b) {
if (b.hasParticipant(this)) {
return true;
}
for (Cause cause : b.getCauses()) {
if (cause instanceof Cause.UserIdCause) {
String userId = ((Cause.UserIdCause) cause).getUserId();
if (userId != null && idStrategy().equals(userId, getId())) {
return true;
}
}
}
return false;
}
代码示例来源:origin: Diabol/delivery-pipeline-plugin
@Override
public void triggerRebuild(String projectName, String buildId) {
AbstractProject project = ProjectUtil.getProject(projectName, Jenkins.getInstance());
if (!project.hasPermission(Item.BUILD)) {
throw new BadCredentialsException("Not authorized to trigger build");
}
AbstractBuild build = project.getBuildByNumber(Integer.parseInt(buildId));
@SuppressWarnings("unchecked")
List<Cause> prevCauses = build.getCauses();
List<Cause> newCauses = new ArrayList<>();
for (Cause cause : prevCauses) {
if (!(cause instanceof Cause.UserIdCause)) {
newCauses.add(cause);
}
}
newCauses.add(new Cause.UserIdCause());
CauseAction causeAction = new CauseAction(newCauses);
project.scheduleBuild2(project.getQuietPeriod(), (Cause) null, causeAction,
build.getAction(ParametersAction.class));
}
代码示例来源:origin: SonarSource/sonar-scanner-jenkins
List<Cause> causes = new ArrayList<>(build.getCauses());
代码示例来源:origin: jenkinsci/ci-game-plugin
accountableBuilds.add(build);
AbstractBuild upstreamBuild = getBuildByUpstreamCause(build.getCauses(), listener);
if(upstreamBuild!= null) {
accountableBuilds.add(upstreamBuild);
代码示例来源:origin: jenkinsci/promoted-builds-plugin
stack.push(build.getCauses());
代码示例来源:origin: org.hudsonci.plugins/rest-plugin-api
target.getCauses().addAll(causex.convert(source.getCauses()));
内容来源于网络,如有侵权,请联系作者删除!