public void addComponents() { //Set up actions. pauseAction = new PauseAction(); quitAction = new QuitAction(); scrollPane.getInputMap().put(KeyStroke.getKeyStroke("P"), "doPauseAction"); scrollPane.getActionMap().put("doPauseAction", pauseAction); scrollPane.getInputMap().put(KeyStroke.getKeyStroke("SPACE"), "doQuitAction"); scrollPane.getActionMap().put("doQuitAction", quitAction); scrollPane.setBackground(Color.BLACK); getContentPane().add(scrollPane); viewer.repaint(); }
private void postSettlement() { try { getPauseAction().remove(this); run.save(); } catch (IOException | InterruptedException | TimeoutException x) { LOGGER.log(Level.WARNING, "failed to remove InputAction from " + run, x); } finally { if (node != null) { try { PauseAction.endCurrentPause(node); } catch (IOException x) { LOGGER.log(Level.WARNING, "failed to end PauseAction in " + run, x); } } else { LOGGER.log(Level.WARNING, "cannot set pause end time for {0} in {1}", new Object[] {getId(), run}); } } }
pauseAction != null && pauseAction.getCause().equals("Input")) { return GenericStatus.PAUSED_PENDING_INPUT; } else {
FilePath workspace = lease.path; FlowNode flowNode = context.get(FlowNode.class); flowNode.addAction(new WorkspaceActionImpl(workspace, flowNode)); listener.getLogger().println("Running on " + computer.getDisplayName() + " in " + workspace); // TODO hyperlink context.newBodyInvoker()
EnvironmentAction a = b.getAction(EnvironmentAction.class); assertNotNull(a); assertEquals("custom2", a.getEnvironment().get("BUILD_TAG")); assertEquals("more", a.getEnvironment().get("STUFF")); assertNotNull(a.getEnvironment().get("PATH"));
FilePath workspace = lease.path; FlowNode flowNode = context.get(FlowNode.class); flowNode.addAction(new WorkspaceActionImpl(workspace, flowNode)); listener.getLogger().println("Running on " + computer.getDisplayName() + " in " + workspace); // TODO hyperlink context.newBodyInvoker()
public void addComponents() { //Set up actions. pauseAction = new PauseAction(); quitAction = new QuitAction(); scrollPane.getInputMap().put(KeyStroke.getKeyStroke("P"), "doPauseAction"); scrollPane.getActionMap().put("doPauseAction", pauseAction); scrollPane.getInputMap().put(KeyStroke.getKeyStroke("SPACE"), "doQuitAction"); scrollPane.getActionMap().put("doQuitAction", quitAction); scrollPane.setBackground(Color.BLACK); viewer.getContentPane().add(scrollPane); viewer.repaint(); }
@Override public void stop(Throwable cause) throws Exception { PauseAction.endCurrentPause(getContext().get(FlowNode.class)); SonarQubeWebHook.get().removeListener(this); getContext().onFailure(cause); }
flowNode.addAction(new WorkspaceActionImpl(workspace, flowNode)); getContext().get(TaskListener.class).getLogger().println("Running in " + workspace); getContext().newBodyInvoker()
@Override public boolean start() throws Exception { processStepParameters(); if (!checkTaskCompleted()) { getContext().get(FlowNode.class).addAction(new PauseAction("SonarQube analysis")); return false; } else { return true; } }
@Override public void onTaskCompleted(String taskId, String taskStatus, @Nullable String qgStatus) { if (taskId.equals(step.taskId)) { try { PauseAction.endCurrentPause(getContext().get(FlowNode.class)); SonarQubeWebHook.get().removeListener(this); log("SonarQube task '%s' status is '%s'", step.taskId, taskStatus); switch (taskStatus) { case WsClient.CETask.STATUS_SUCCESS: log("SonarQube task '%s' completed. Quality gate is '%s'", step.taskId, qgStatus); handleQGStatus(qgStatus); break; case WsClient.CETask.STATUS_FAILURE: case WsClient.CETask.STATUS_CANCELED: getContext().onFailure(new IllegalStateException("SonarQube analysis '" + step.getTaskId() + "' failed: " + taskStatus)); break; default: throw new IllegalStateException("Unexpected task status: " + taskStatus); } } catch (IOException | InterruptedException e) { LOGGER.log(Level.WARNING, "Error during WaitForQualityGateStep", e); } } } }
FlowNode flowNode = context.get(FlowNode.class); if (flowNode != null) { flowNode.addAction(new WorkspaceActionImpl(workspace, flowNode));
@Override public boolean start() throws Exception { // record this input getPauseAction().add(this); // This node causes the flow to pause at this point so we mark it as a "Pause Node". node.addAction(new PauseAction("Input")); String baseUrl = '/' + run.getUrl() + getPauseAction().getUrlName() + '/'; //JENKINS-40594 submitterParameter does not work without at least one actual parameter if (input.getParameters().isEmpty() && input.getSubmitterParameter() == null) { String thisUrl = baseUrl + Util.rawEncode(getId()) + '/'; listener.getLogger().printf("%s%n%s or %s%n", input.getMessage(), POSTHyperlinkNote.encodeTo(thisUrl + "proceedEmpty", input.getOk()), POSTHyperlinkNote.encodeTo(thisUrl + "abort", "Abort")); } else { // TODO listener.hyperlink(…) does not work; why? // TODO would be even cooler to embed the parameter form right in the build log (hiding it after submission) listener.getLogger().println(HyperlinkNote.encodeTo(baseUrl, "Input requested")); } return false; }
FlowDurabilityHint hint = (queueExec instanceof Run) ? DurabilityHintProvider.suggestedFor(((Run)queueExec).getParent()) : GlobalDefaultFlowDurabilityLevel.getDefaultDurabilityHint(); CpsFlowExecution exec = new CpsFlowExecution(script, true, owner, hint); exec.flowStartNodeActions.add(new WorkspaceActionImpl(acquiredDir, null)); return exec;
private void invokeBody(DockerTransientNode node, TaskListener listener) { this.nodeName = node.getNodeName(); FilePath ws = null; Computer computer = null; EnvVars env = null; try { // TODO workspace should be a volume ws = node.createPath(node.getRemoteFS() + "/workspace"); FlowNode flowNode = getContext().get(FlowNode.class); flowNode.addAction(new WorkspaceActionImpl(ws, flowNode)); computer = node.toComputer(); if (computer == null) throw new IllegalStateException("Agent not started"); env = computer.getEnvironment(); env.overrideExpandingAll(computer.buildEnvironment(listener)); env.put("NODE_NAME", computer.getName()); env.put("EXECUTOR_NUMBER", "0"); env.put("NODE_LABELS", Util.join(node.getAssignedLabels(), " ")); env.put("WORKSPACE", ws.getRemote()); } catch (IOException | InterruptedException e) { getContext().onFailure(e); } getContext().newBodyInvoker().withCallback(new Callback(node)).withContexts(computer, env, ws).start(); }