@Override protected int run() throws Exception { Run r = getCurrentlyBuilding(); r.checkPermission(Run.UPDATE); r.setResult(result); return 0; } }
@Override public void perform(Run<?,?> build, FilePath workspace, Launcher launcher, TaskListener listener) throws InterruptedException { try { listener.getLogger().println(Messages.Fingerprinter_Recording()); Map<String,String> record = new HashMap<String,String>(); EnvVars environment = build.getEnvironment(listener); if(targets.length()!=0) { String expandedTargets = environment.expand(targets); record(build, workspace, listener, record, expandedTargets); } FingerprintAction fingerprintAction = build.getAction(FingerprintAction.class); if (fingerprintAction != null) { fingerprintAction.add(record); } else { build.addAction(new FingerprintAction(build,record)); } if (enableFingerprintsInDependencyGraph) { Jenkins.getInstance().rebuildDependencyGraphAsync(); } } catch (IOException e) { Functions.printStackTrace(e, listener.error(Messages.Fingerprinter_Failed())); build.setResult(Result.FAILURE); } // failing to record fingerprints is an error but not fatal }
setResult(job.run(listener));
public Result markBuildAfterError(Run<?, ?> run) { run.setResult(buildStatus); return buildStatus; }
public void superSetResult(Result r) { super.setResult(r); }
/** * Sets the result of the specified run to the associated value of this quality gate status. * * @param run the run to set the result for */ public void setResult(final Run<?, ?> run) { if (!isSuccessful()) { run.setResult(result); } } }
/** * Logs error to build console and changes build result * * @return true as of it terminating handler */ @Override public boolean handle(Exception e, @Nonnull Run<?, ?> run, @Nonnull TaskListener listener) { Result toSet = Result.fromString(trimToEmpty(result)); listener.error("[GitHub Commit Status Setter] - %s, setting build result to %s", e.getMessage(), toSet); run.setResult(toSet); return true; }
private String getSwitches() { String switches = this.switches; if (!gradleBuild.isUsesPlugin()) { try { initScriptPath = createInitScript(); switches += " --init-script " + initScriptPath; } catch (Exception e) { listener.getLogger().println("Error occurred while writing Gradle Init Script: " + e.getMessage()); build.setResult(Result.FAILURE); } } return switches; }
@Override protected int run() throws Exception { Run r = getCurrentlyBuilding(); r.checkPermission(Run.UPDATE); r.setResult(result); return 0; } }
private void failBuild(Run<?, ?> build, TaskListener listener, String errorMessage, String secondaryError) throws AbortException { this.codeBuildResult.setFailure(errorMessage, secondaryError); build.setResult(Result.FAILURE); LoggingHelper.log(listener, errorMessage, secondaryError); }
void provisionFailed(Exception cause) { if (executable instanceof Run) { ((Run) executable).setResult(Result.NOT_BUILT); } try { Jenkins.getActiveInstance().removeNode(this); } catch (IOException e) { e.printStackTrace(); } throw new OneShotExecutorProvisioningException(cause); }
void provisionFailed(Exception cause) { if (executable instanceof Run) { ((Run) executable).setResult(Result.NOT_BUILT); } try { Jenkins.getInstance().removeNode(this); } catch (IOException e) { e.printStackTrace(); } throw new OneShotExecutorProvisioningException(cause); }
@Override protected int run() throws Exception { Run r = getCurrentlyBuilding(); r.getParent().checkPermission(Item.BUILD); r.setResult(result); return 0; } }
@Override protected int run() throws Exception { Run r = getCurrentlyBuilding(); r.getParent().checkPermission(Item.BUILD); r.setResult(result); return 0; } }
@Override public void setResult(Result r) { initPython(); if (pexec.isImplemented(7)) { pexec.execPythonVoid("set_result", r); } else { super.setResult(r); } }
@Override protected int run() throws Exception { Run r = getCurrentlyBuilding(); r.getParent().checkPermission(Item.BUILD); r.setResult(result); return 0; } }
@Override protected int run() throws Exception { Run r = getCurrentlyBuilding(); r.getParent().checkPermission(Item.BUILD); r.setResult(result); return 0; } }
@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); }
private void exe(ArgumentListBuilder args) { boolean failed; try { int exitValue = launcher.launch().cmds(args).envs(extendedEnv).stdout(listener).pwd(ws).join(); failed = (exitValue != 0); } catch (Exception e) { listener.error("Couldn't execute gradle task. " + e.getMessage()); failed = true; } if (failed) { build.setResult(Result.FAILURE); throw new Run.RunnerAbortedException(); } }
private boolean RunMaven(Run<?, ?> build, Launcher launcher, TaskListener listener, EnvVars env, FilePath workDir, String[] cmds) throws InterruptedException, IOException { try { int exitValue = launcher.launch().cmds(cmds).envs(env).stdout(listener).pwd(workDir).join(); boolean success = (exitValue == 0); build.setResult(success ? Result.SUCCESS : Result.FAILURE); return success; } catch (IOException e) { Util.displayIOException(e, listener); e.printStackTrace(listener.fatalError("command execution failed")); return false; } finally { ActionableHelper.deleteFilePath(workDir, classworldsConfPath); } }