public Queue.Item run(String stageName) { if (stageName == null || stageName.equals("")) { throw new IllegalStateException(Messages.RestartDeclarativePipelineAction_NullStageName()); } if (!run.hasPermission(Item.BUILD) || !run.getParent().isBuildable()) { throw new IllegalStateException(Messages.RestartDeclarativePipelineAction_ProjectNotBuildable(run.getParent().getFullName())); } if (run.isBuilding()) { throw new IllegalStateException(Messages.RestartDeclarativePipelineAction_OriginRunIncomplete(run.getFullDisplayName())); } ExecutionModelAction execAction = run.getAction(ExecutionModelAction.class); if (execAction == null) { throw new IllegalStateException(Messages.RestartDeclarativePipelineAction_OriginWasNotDeclarative(run.getFullDisplayName())); } if (!getRestartableStages().contains(stageName)) { throw new IllegalStateException(Messages.RestartDeclarativePipelineAction_StageNameNotPresent(stageName, run.getFullDisplayName())); } List<Action> actions = new ArrayList<>(); CpsFlowExecution execution = getExecution(); if (execution == null) { throw new IllegalStateException(Messages.RestartDeclarativePipelineAction_OriginRunMissingExecution(run.getFullDisplayName())); } actions.add(new RestartFlowFactoryAction(run.getExternalizableId())); actions.add(new CauseAction(new Cause.UserIdCause(), new RestartDeclarativePipelineCause(run, stageName))); return ParameterizedJobMixIn.scheduleBuild2(run.getParent(), 0, actions.toArray(new Action[actions.size()])); }
assertEquals(Messages.RestartDeclarativePipelineAction_OriginRunIncomplete(b.getFullDisplayName()), runFailure.getMessage());