Java Code Examples for hudson.model.Run#setResult()
The following examples show how to use
hudson.model.Run#setResult() .
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: LambdaUploadBuildStep.java From aws-lambda-jenkins-plugin with MIT License | 6 votes |
public void perform(LambdaUploadBuildStepVariables lambdaUploadBuildStepVariables, Run<?, ?> run, FilePath workspace, Launcher launcher, TaskListener listener) { try { LambdaUploadBuildStepVariables executionVariables = lambdaUploadBuildStepVariables.getClone(); executionVariables.expandVariables(run.getEnvironment(listener)); DeployConfig deployConfig = executionVariables.getUploadConfig(); LambdaClientConfig lambdaClientConfig = executionVariables.getLambdaClientConfig(); DeployCallable deployCallable = new DeployCallable(listener, workspace, deployConfig, lambdaClientConfig); Boolean lambdaSuccess = launcher.getChannel().call(deployCallable); if (!lambdaSuccess) { run.setResult(Result.FAILURE); } run.addAction(new LambdaUploadAction(executionVariables.getFunctionName(), lambdaSuccess)); } catch (Exception e) { throw new RuntimeException(e); } }
Example 2
Source File: LambdaPublishBuildStep.java From aws-lambda-jenkins-plugin with MIT License | 6 votes |
public void perform(LambdaPublishBuildStepVariables lambdaPublishBuildStepVariables, Run<?, ?> run, Launcher launcher, TaskListener listener) { try { LambdaPublishBuildStepVariables executionVariables = lambdaPublishBuildStepVariables.getClone(); executionVariables.expandVariables(run.getEnvironment(listener)); PublishConfig publishConfig = executionVariables.getPublishConfig(); LambdaClientConfig clientConfig = executionVariables.getLambdaClientConfig(); PublishCallable publishCallable = new PublishCallable(listener, publishConfig, clientConfig); LambdaPublishServiceResponse lambdaSuccess = launcher.getChannel().call(publishCallable); if(!lambdaSuccess.getSuccess()){ run.setResult(Result.FAILURE); } run.addAction(new LambdaPublishAction(lambdaSuccess.getFunctionVersion(), lambdaSuccess.getFunctionAlias(), lambdaSuccess.getSuccess())); } catch(Exception exc) { throw new RuntimeException(exc); } }
Example 3
Source File: LambdaInvokeBuildStep.java From aws-lambda-jenkins-plugin with MIT License | 6 votes |
public void perform(LambdaInvokeBuildStepVariables lambdaInvokeBuildStepVariables,Run<?, ?> run, Launcher launcher, TaskListener listener) { try { LambdaInvokeBuildStepVariables executionVariables = lambdaInvokeBuildStepVariables.getClone(); executionVariables.expandVariables(run.getEnvironment(listener)); LambdaClientConfig clientConfig = executionVariables.getLambdaClientConfig(); InvokeConfig invokeConfig = executionVariables.getInvokeConfig(); InvokeCallable invokeCallable = new InvokeCallable(listener, invokeConfig, clientConfig); LambdaInvocationResult invocationResult = launcher.getChannel().call(invokeCallable); if(!invocationResult.isSuccess()){ run.setResult(Result.FAILURE); } for (Map.Entry<String,String> entry : invocationResult.getInjectables().entrySet()) { run.addAction(new LambdaOutputInjectionAction(entry.getKey(), entry.getValue())); } run.getEnvironment(listener); run.addAction(new LambdaInvokeAction(executionVariables.getFunctionName(), invocationResult.isSuccess())); } catch (Exception exc) { throw new RuntimeException(exc); } }
Example 4
Source File: LambdaEventSourceBuildStep.java From aws-lambda-jenkins-plugin with MIT License | 6 votes |
public void perform(LambdaEventSourceBuildStepVariables lambdaEventSourceBuildStepVariables, Run<?, ?> run, Launcher launcher, TaskListener listener) { try { LambdaEventSourceBuildStepVariables executionVariables = lambdaEventSourceBuildStepVariables.getClone(); executionVariables.expandVariables(run.getEnvironment(listener)); EventSourceConfig eventSourceConfig = executionVariables.getEventSourceConfig(); LambdaClientConfig clientConfig = executionVariables.getLambdaClientConfig(); EventSourceCallable eventSourceCallable = new EventSourceCallable(listener, eventSourceConfig, clientConfig); Boolean lambdaSuccess = launcher.getChannel().call(eventSourceCallable); if(!lambdaSuccess){ run.setResult(Result.FAILURE); } run.addAction(new LambdaEventSourceAction(executionVariables.getFunctionName(), lambdaSuccess)); } catch(Exception exc) { throw new RuntimeException(exc); } }
Example 5
Source File: AppCenterRecorder.java From appcenter-plugin with MIT License | 5 votes |
@Override public void perform(@Nonnull Run<?, ?> run, @Nonnull FilePath filePath, @Nonnull Launcher launcher, @Nonnull TaskListener taskListener) throws InterruptedException, IOException { final Result buildResult = run.getResult(); if (buildResult != null && buildResult.isWorseOrEqualTo(FAILURE)) { taskListener.getLogger().println(Messages.AppCenterRecorder_DescriptorImpl_errors_upstreamBuildFailure()); return; } if (uploadToAppCenter(run, filePath, taskListener)) { run.setResult(SUCCESS); } else { run.setResult(FAILURE); } }
Example 6
Source File: OpenShiftImageStreams.java From jenkins-plugin with Apache License 2.0 | 5 votes |
@Override public void checkout(Run<?, ?> build, Launcher launcher, FilePath workspace, TaskListener listener, File changelogFile, SCMRevisionState baseline) throws IOException, InterruptedException { boolean chatty = Boolean.parseBoolean(verbose); String bldName = null; if (build != null) bldName = build.getDisplayName(); if (chatty) listener.getLogger().println( "\n\nOpenShiftImageStreams checkout called for " + bldName); EnvVars env = build.getEnvironment(listener); lastCommitId = getCommitId(listener, env); if (lastCommitId == null) { String imageStream = getImageStreamName(env); String tag = getTag(env); listener.getLogger().println( String.format(MessageConstants.SCM_IMAGESTREAM_NOT_FOUND, imageStream, tag)); // We cannot yet throw an exception here because the calling code // will be interrupted and the SCM action // will not be added to the build job. // Just setting the build result here. An exception will be thrown // in the postCheckout method. build.setResult(Result.FAILURE); } }
Example 7
Source File: JUnitResultArchiver.java From junit-plugin with MIT License | 5 votes |
@Override public void perform(Run build, FilePath workspace, Launcher launcher, TaskListener listener) throws InterruptedException, IOException { TestResultAction action = parseAndAttach(this, null, build, workspace, launcher, listener); if (action != null && action.getResult().getFailCount() > 0) build.setResult(Result.UNSTABLE); }
Example 8
Source File: BuildListener.java From hubot-steps-plugin with Apache License 2.0 | 4 votes |
/** * Sends a message to given site. */ @SuppressFBWarnings private void sendMessage(Run<?, ?> run, TaskListener listener, Type type, final HubotSite site, final String roomName, final Config config) { if (site != null) { try { HubotSite cloneSite = site.clone(); if (Util.fixEmpty(roomName) != null) { cloneSite.setRoom(roomName); // To avoid using the room prefix for individual build events those explicitly specified the room name. cloneSite.setRoomPrefix(null); } HubotService service = new HubotService(cloneSite); final String buildUserName = Common .prepareBuildUserName(run.getCauses(), run.getEnvironment(listener)); final String buildUserId = Common .prepareBuildUserId(run.getCauses(), run.getEnvironment(listener)); final Map tokens = Common.expandMacros(config.getTokens(), run, null, listener); Message message = Message.builder().message(type.getStatus()) .ts(System.currentTimeMillis()).envVars(run.getEnvironment(listener)) .status(type.name()).tokens(tokens) .buildCause(Common.prepareBuildCause(run.getCauses())) .userId(buildUserId).userName(buildUserName).stepName(STEP.BUILD.name()).build(); listener.getLogger().println( "Hubot: Sending " + type.name() + " message to room: " + cloneSite.getRoom() + " of site: " + cloneSite.getName()); Common .logResponse(service.sendMessage(message), listener.getLogger(), site.isFailOnError()); } catch (Exception e) { listener.getLogger() .println("Unable to send message to Hubot: " + Common.getRootCause(e).getMessage()); if (site.isFailOnError()) { run.setResult(Result.FAILURE); } } } }
Example 9
Source File: PublisherErrorHandler.java From github-integration-plugin with MIT License | 4 votes |
public Result markBuildAfterError(Run<?, ?> run) { run.setResult(buildStatus); return buildStatus; }