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


Java AbstractProject.getLastBuild方法代码示例

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


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

示例1: doTestSubmitBuildRef

import hudson.model.AbstractProject; //导入方法依赖的package包/类
/**
 * A stub method, which emulates the submission of the image reference 
 * from the web interface
 * @param req Incoming request
 * @param rsp Response
 * @param imageId image id
 * @param jobName job name, to which the facet should be attached
 * @throws IOException Request processing error
 * @throws ServletException Servlet error
 */
public static void doTestSubmitBuildRef(StaplerRequest req, StaplerResponse rsp,
        @QueryParameter(required = true) String imageId,
        @QueryParameter(required = true) String jobName) throws IOException, ServletException {
    final Jenkins j = Jenkins.getInstance();
    if (j == null) {
        throw new IOException("Jenkins instance is not active");
    }
    j.checkPermission(Jenkins.ADMINISTER);
    
    final AbstractProject item = j.getItem(jobName, j, AbstractProject.class);
    final Run latest = item != null ? item.getLastBuild() : null;
    if (latest == null) {
        throw new IOException("Cannot find a project or run to modify"); 
    }
    
    DockerFingerprints.addFromFacet(null,imageId, latest);
    rsp.sendRedirect2(j.getRootUrl());
}
 
开发者ID:jenkinsci,项目名称:docker-traceability-plugin,代码行数:29,代码来源:FingerprintTestUtil.java

示例2: completed

import hudson.model.AbstractProject; //导入方法依赖的package包/类
public void completed(AbstractBuild r) {
    AbstractProject<?, ?> project = r.getProject();
    if(project == null) return;
    Result result = r.getResult();
    AbstractBuild<?, ?> previousBuild = project.getLastBuild();
    if(previousBuild == null) return;
    do {
        previousBuild = previousBuild.getPreviousCompletedBuild();
    } while (previousBuild != null && previousBuild.getResult() == Result.ABORTED);
    Result previousResult = (previousBuild != null) ? previousBuild.getResult() : Result.SUCCESS;
    if ((result == Result.ABORTED && notifier.getNotifyAborted())
            || (result == Result.FAILURE //notify only on single failed build
                && previousResult != Result.FAILURE
                && notifier.getNotifyFailure())
            || (result == Result.FAILURE //notify only on repeated failures
                && previousResult == Result.FAILURE
                && notifier.getNotifyRepeatedFailure())
            || (result == Result.NOT_BUILT && notifier.getNotifyNotBuilt())
            || (result == Result.SUCCESS
                && (previousResult == Result.FAILURE || previousResult == Result.UNSTABLE)
                && notifier.getNotifyBackToNormal())
            || (result == Result.SUCCESS && notifier.getNotifySuccess())
            || (result == Result.UNSTABLE && notifier.getNotifyUnstable())) {
        getTelegram(r).publish(getBuildStatusMessage(r, notifier.includeTestSummary(),
                notifier.getIncludeFailedTests(),notifier.includeCustomMessage()), getBuildColor(r));

    }
}
 
开发者ID:FluffyFairyGames,项目名称:jenkins-telegram-plugin,代码行数:29,代码来源:ActiveNotifier.java

示例3: getProjectAction

import hudson.model.AbstractProject; //导入方法依赖的package包/类
/**
 * Gets the StarWarsAction as the project action. This is applicable for
 * each job and only when there's at least one build in the job.
 * 
 * @param project
 * @return the project action
 */
@Override
public final Action getProjectAction(final AbstractProject<?, ?> project) {
	Action action = null;
	if (project.getLastBuild() != null) {
		Result result = project.getLastBuild().getResult();
		StarWarsResult starWarsResult = StarWarsResult.get(result);
		Quote quote = quotesGenerator.generate(starWarsResult);
		action = new StarWarsAction(starWarsResult, quote);
	}
	return action;
}
 
开发者ID:pedrolopesme,项目名称:starwars-plugin,代码行数:19,代码来源:StarWarsRecorder.java

示例4: notifyStart

import hudson.model.AbstractProject; //导入方法依赖的package包/类
private void notifyStart(AbstractBuild build, String attachmentMessage) {
	AbstractProject<?, ?> project = (build != null) ? build.getProject() : null;
	AbstractBuild<?, ?> previousBuild = (project != null && project.getLastBuild() != null) ? project.getLastBuild().getPreviousCompletedBuild() : null;
	String expandedCustomMessage = getExpandedCustomMessage(build);
	if (previousBuild == null) {
		getMattermost(build).publish(attachmentMessage, expandedCustomMessage, "good");
	} else {
		getMattermost(build).publish(attachmentMessage, expandedCustomMessage, getBuildColor(previousBuild));
	}
}
 
开发者ID:jovandeginste,项目名称:jenkins-mattermost-plugin,代码行数:11,代码来源:ActiveNotifier.java

示例5: completed

import hudson.model.AbstractProject; //导入方法依赖的package包/类
public void completed(AbstractBuild r) {
	AbstractProject<?, ?> project = r.getProject();
	Result result = r.getResult();
	AbstractBuild<?, ?> previousBuild = project.getLastBuild();
	if (previousBuild != null) {
		do {
			previousBuild = previousBuild.getPreviousCompletedBuild();
		} while (previousBuild != null && previousBuild.getResult() == Result.ABORTED);
	}
	Result previousResult = (previousBuild != null) ? previousBuild.getResult() : Result.SUCCESS;
	if ((result == Result.ABORTED && notifier.getNotifyAborted())
			|| (result == Result.FAILURE //notify only on single failed build
			&& previousResult != Result.FAILURE
			&& notifier.getNotifyFailure())
			|| (result == Result.FAILURE //notify only on repeated failures
			&& previousResult == Result.FAILURE
			&& notifier.getNotifyRepeatedFailure())
			|| (result == Result.NOT_BUILT && notifier.getNotifyNotBuilt())
			|| (result == Result.SUCCESS
			&& (previousResult == Result.FAILURE || previousResult == Result.UNSTABLE)
			&& notifier.getNotifyBackToNormal())
			|| (result == Result.SUCCESS && notifier.getNotifySuccess())
			|| (result == Result.UNSTABLE && notifier.getNotifyUnstable())) {
		String expandedCustomMessage = getExpandedCustomMessage(r);
		getMattermost(r).publish(getBuildStatusMessage(r, notifier.includeTestSummary(),
				notifier.includeCustomAttachmentMessage()), expandedCustomMessage, getBuildColor(r));
		if (notifier.getCommitInfoChoice().showAnything()) {
			getMattermost(r).publish(getCommitList(r), expandedCustomMessage, getBuildColor(r));
		}
	}
}
 
开发者ID:jovandeginste,项目名称:jenkins-mattermost-plugin,代码行数:32,代码来源:ActiveNotifier.java

示例6: previousAWSDeviceFarmBuild

import hudson.model.AbstractProject; //导入方法依赖的package包/类
/**
 * Returns the most recent build which contained an AWS Device Farm test run.
 *
 * @param project The Jenkins project which contains runs to examine.
 * @return The previous Device Farm build.
 */
public static AbstractBuild<?, ?> previousAWSDeviceFarmBuild(AbstractProject<?, ?> project) {
    AbstractBuild<?, ?> last = project.getLastBuild();
    while (last != null) {
        if (last.getAction(AWSDeviceFarmTestResultAction.class) != null) {
            break;
        }
        last = last.getPreviousBuild();
    }
    return last;
}
 
开发者ID:awslabs,项目名称:aws-device-farm-jenkins-plugin,代码行数:17,代码来源:AWSDeviceFarmUtils.java

示例7: previousAWSDeviceFarmBuilds

import hudson.model.AbstractProject; //导入方法依赖的package包/类
/**
 * Return collection of all previous builds of the given project which contain an AWS Device Farm test run.
 *
 * @param project The Jenkins project which contains runs to examine.
 * @return The previous Device Farm builds.
 */
public static ArrayList<AWSDeviceFarmTestResultAction> previousAWSDeviceFarmBuilds(AbstractProject<?, ?> project) {
    ArrayList<AWSDeviceFarmTestResultAction> actions = new ArrayList<AWSDeviceFarmTestResultAction>();

    AbstractBuild<?, ?> build = project.getLastBuild();
    while (build != null) {
        AWSDeviceFarmTestResultAction action = build.getAction(AWSDeviceFarmTestResultAction.class);
        if (action != null) {
            actions.add(action);
        }
        build = build.getPreviousBuild();
    }
    return actions;
}
 
开发者ID:awslabs,项目名称:aws-device-farm-jenkins-plugin,代码行数:20,代码来源:AWSDeviceFarmUtils.java

示例8: listProjects

import hudson.model.AbstractProject; //导入方法依赖的package包/类
public SlackTextMessage listProjects() {
    ACL.impersonate(ACL.SYSTEM);
    String response = "*Projects:*\n";

    List<AbstractProject> jobs =
        Jenkins.getInstance().getAllItems(AbstractProject.class);

    for (AbstractProject job : jobs) {
        if (job.isBuildable()) {
            AbstractBuild lastBuild = job.getLastBuild();
            String buildNumber = "TBD";
            String status = "TBD";
            if (lastBuild != null) {

                buildNumber = Integer.toString(lastBuild.getNumber());

                if (lastBuild.isBuilding()) {
                    status = "BUILDING";
                }

                Result result = lastBuild.getResult();

                if (result != null) {
                    status = result.toString();
                }
            }
            response += ">*"+job.getDisplayName() + "*\n>*Last Build:* #"+buildNumber+"\n>*Status:* "+status;
            response += "\n\n\n";
        }
    }

    if (jobs == null || jobs.size() == 0)
        response += ">_No projects found_";

    return new SlackTextMessage(response);
}
 
开发者ID:dpires,项目名称:jenkins-slack-webhook-plugin,代码行数:37,代码来源:WebhookEndpoint.java


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