Java Code Examples for hudson.model.AbstractBuild#getAction()
The following examples show how to use
hudson.model.AbstractBuild#getAction() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FlakyTestResultAction.java From flaky-test-handler-plugin with Apache License 2.0 | 6 votes |
/** * Construct a FlakyTestResultAction object with Run and BuildListener * * @param build this build * @param listener listener of this build */ public FlakyTestResultAction(AbstractBuild build, Launcher launcher, TaskListener listener) throws IOException, InterruptedException { this.build = build; // TODO consider the possibility that there is >1 such action AbstractTestResultAction action = build.getAction(AbstractTestResultAction.class); if (action != null) { Object latestResult = action.getResult(); if (latestResult != null && latestResult instanceof TestResult) { VirtualChannel channel = launcher.getChannel(); if(channel == null) { throw new InterruptedException("Could not get channel to run a program remotely."); } FlakyTestResult flakyTestResult = channel.call(new FlakyTestResultCollector((TestResult) latestResult)); flakyTestResult.freeze(action, build); FlakyRunStats stats = new FlakyRunStats(flakyTestResult.getTestFlakyStatsMap()); setFlakyRunStats(stats, listener); } } else { logger.log(Level.WARNING, "No test result found, please publish junit report first"); } }
Example 2
Source File: PhabricatorBuildWrapper.java From phabricator-jenkins-plugin with MIT License | 5 votes |
@VisibleForTesting static String getAbortOnRevisionId(AbstractBuild build) { ParametersAction parameters = build.getAction(ParametersAction.class); if (parameters != null) { ParameterValue parameterValue = parameters.getParameter( PhabricatorPlugin.ABORT_ON_REVISION_ID_FIELD); if (parameterValue != null) { return (String) parameterValue.getValue(); } } return null; }
Example 3
Source File: PhabricatorBuildWrapper.java From phabricator-jenkins-plugin with MIT License | 5 votes |
@VisibleForTesting static Run<?, ?> getUpstreamRun(AbstractBuild build) { CauseAction action = build.getAction(hudson.model.CauseAction.class); if (action != null) { Cause.UpstreamCause upstreamCause = action.findCause(hudson.model.Cause.UpstreamCause.class); if (upstreamCause != null) { return upstreamCause.getUpstreamRun(); } } return null; }
Example 4
Source File: AWSDeviceFarmUtils.java From aws-device-farm-jenkins-plugin with Apache License 2.0 | 5 votes |
/** * Returns the AWS Device Farm test run action from the most recent build. * * @param project The Jenkins project which contains builds/runs to examine. * @return The previous Device Farm build result action. */ public static AWSDeviceFarmTestResultAction previousAWSDeviceFarmBuildAction(AbstractProject<?, ?> project) { AbstractBuild<?, ?> build = AWSDeviceFarmUtils.previousAWSDeviceFarmBuild(project); if (build == null) { return null; } return build.getAction(AWSDeviceFarmTestResultAction.class); }
Example 5
Source File: AWSDeviceFarmUtils.java From aws-device-farm-jenkins-plugin with Apache License 2.0 | 5 votes |
/** * 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; }
Example 6
Source File: AWSDeviceFarmUtils.java From aws-device-farm-jenkins-plugin with Apache License 2.0 | 5 votes |
/** * 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; }