Java Code Examples for hudson.model.Descriptor#FormException
The following examples show how to use
hudson.model.Descriptor#FormException .
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: DockerTemplate.java From docker-plugin with MIT License | 6 votes |
@Restricted(NoExternalUse.class) public DockerTransientNode provisionNode(DockerAPI api, TaskListener listener) throws IOException, Descriptor.FormException, InterruptedException { try { final InspectImageResponse image = pullImage(api, listener); final String effectiveRemoteFsDir = getEffectiveRemoteFs(image); try(final DockerClient client = api.getClient()) { return doProvisionNode(api, client, effectiveRemoteFsDir, listener); } } catch (IOException | Descriptor.FormException | InterruptedException | RuntimeException ex) { final DockerCloud ourCloud = DockerCloud.findCloudForTemplate(this); final long milliseconds = ourCloud == null ? 0L : ourCloud.getEffectiveErrorDurationInMilliseconds(); if (milliseconds > 0L) { // if anything went wrong, disable ourselves for a while final String reason = "Template provisioning failed."; final DockerDisabled reasonForDisablement = getDisabled(); reasonForDisablement.disableBySystem(reason, milliseconds, ex); setDisabled(reasonForDisablement); } throw ex; } }
Example 2
Source File: NomadSlave.java From jenkins-nomad with MIT License | 6 votes |
public NomadSlave( NomadCloud cloud, String name, String nodeDescription, NomadSlaveTemplate template, String labelString, Mode mode, hudson.slaves.RetentionStrategy retentionStrategy, List<? extends NodeProperty<?>> nodeProperties ) throws Descriptor.FormException, IOException { super( name, nodeDescription, template.getRemoteFs(), template.getNumExecutors(), mode, labelString, new JNLPLauncher(), retentionStrategy, nodeProperties ); this.cloud = cloud; }
Example 3
Source File: TemplateDrivenMultiBranchProject.java From multi-branch-project-plugin with MIT License | 6 votes |
/** * Sets various implementation-specific fields and forwards wrapped req/rsp objects on to the * {@link #template}'s {@link AbstractProject#doConfigSubmit(StaplerRequest, StaplerResponse)} method. * <br> * {@inheritDoc} */ @Override public void submit(StaplerRequest req, StaplerResponse rsp) throws ServletException, Descriptor.FormException, IOException { super.submit(req, rsp); makeDisabled(req.getParameter("disable") != null); template.doConfigSubmit( new TemplateStaplerRequestWrapper(req), new TemplateStaplerResponseWrapper(req.getStapler(), rsp)); ItemListener.fireOnUpdated(this); // notify the queue as the project might be now tied to different node Jenkins.getActiveInstance().getQueue().scheduleMaintenance(); // this is to reflect the upstream build adjustments done above Jenkins.getActiveInstance().rebuildDependencyGraphAsync(); }
Example 4
Source File: KafkaCloudSlave.java From remoting-kafka-plugin with MIT License | 5 votes |
public KafkaCloudSlave(@Nonnull KafkaKubernetesCloud cloud) throws Descriptor.FormException, IOException { super(getSlaveName(cloud.name), cloud.getDescription(), cloud.getWorkingDir(), KafkaKubernetesCloud.AGENT_NUM_EXECUTORS, cloud.getNodeUsageMode(), cloud.getLabel(), cloud.isEnableSSL() ? new KafkaComputerLauncher(cloud.getKafkaUsername(), cloud.getSslTruststoreLocation(), cloud.getSslKeystoreLocation()) : new KafkaComputerLauncher(), new CloudRetentionStrategy(Integer.parseInt(cloud.getIdleMinutes())), cloud.getNodeProperties() == null ? new ArrayList<>() : cloud.getNodeProperties()); this.cloudName = cloud.name; }
Example 5
Source File: KafkaCloudSlaveTest.java From remoting-kafka-plugin with MIT License | 5 votes |
@Test public void testAgentInitWithCloudOfNullArguments() throws Descriptor.FormException, IOException { final KafkaKubernetesCloud cloud = new KafkaKubernetesCloud("kafka-kubernetes"); cloud.setDescription(null); cloud.setWorkingDir(null); cloud.setNodeUsageMode(null); cloud.setIdleMinutes(null); cloud.setLabel(null); cloud.setNodeProperties(null); new KafkaCloudSlave(cloud); }
Example 6
Source File: DockerSwarmAgent.java From docker-swarm-plugin with MIT License | 5 votes |
public DockerSwarmAgent(final Queue.BuildableItem bi, final String labelString) throws Descriptor.FormException, IOException { super(labelString, "Docker swarm agent for building " + bi.task.getFullDisplayName(), DockerSwarmCloud.get().getLabelConfiguration(bi.task.getAssignedLabel().getName()).getWorkingDir(), 1, Mode.EXCLUSIVE, labelString, new DockerSwarmComputerLauncher(bi), new DockerSwarmAgentRetentionStrategy(1), Collections.emptyList()); LOGGER.log(Level.FINE, "Created docker swarm agent: {0}", labelString); }
Example 7
Source File: KubernetesSlave.java From kubernetes-plugin with Apache License 2.0 | 5 votes |
protected KubernetesSlave(String name, @Nonnull PodTemplate template, String nodeDescription, String cloudName, String labelStr, ComputerLauncher computerLauncher, RetentionStrategy rs) throws Descriptor.FormException, IOException { super(name, null, computerLauncher); setNodeDescription(nodeDescription); setNumExecutors(1); setMode(template.getNodeUsageMode() != null ? template.getNodeUsageMode() : Node.Mode.NORMAL); setLabelString(labelStr); setRetentionStrategy(rs); setNodeProperties(template.getNodeProperties()); this.cloudName = cloudName; this.template = template; }
Example 8
Source File: DockerProvisioningStrategyTest.java From yet-another-docker-plugin with MIT License | 5 votes |
@Test public void demandRetention() throws Descriptor.FormException { final DockerSlaveTemplate template = new DockerSlaveTemplate("id"); template.setRetentionStrategy(new RetentionStrategy.Demand(2L, 4L)); assertThat(notAllowedStrategy(template), is(false)); }
Example 9
Source File: DockerProvisioningStrategyTest.java From yet-another-docker-plugin with MIT License | 5 votes |
@Test public void otherRetentions() throws Descriptor.FormException { final DockerSlaveTemplate template = new DockerSlaveTemplate("id"); template.setRetentionStrategy(new DockerCloudRetentionStrategy(3)); assertThat(notAllowedStrategy(template), is(true)); }
Example 10
Source File: DockerTransientNode.java From docker-plugin with MIT License | 5 votes |
public DockerTransientNode(@Nonnull String nodeName, String containerId, String workdir, ComputerLauncher launcher) throws Descriptor.FormException, IOException { super(nodeName, workdir, launcher); this.containerId = containerId; setNumExecutors(1); setMode(Mode.EXCLUSIVE); setRetentionStrategy(new DockerOnceRetentionStrategy(10)); }
Example 11
Source File: KubernetesSlave.java From kubernetes-plugin with Apache License 2.0 | 5 votes |
/** * @deprecated Use {@link Builder} instead. */ @Deprecated @DataBoundConstructor // make stapler happy. Not actually used. public KubernetesSlave(PodTemplate template, String nodeDescription, String cloudName, String labelStr, RetentionStrategy rs) throws Descriptor.FormException, IOException { this(getSlaveName(template), template, nodeDescription, cloudName, labelStr, new KubernetesLauncher(), rs); }
Example 12
Source File: DockerSlaveSingle.java From yet-another-docker-plugin with MIT License | 5 votes |
public DockerSlaveSingle(@Nonnull String name, @Nonnull String nodeDescription, @Nonnull DockerSlaveConfig config, @Nonnull YADockerConnector connector, @Nonnull ProvisioningActivity.Id activityId) throws IOException, Descriptor.FormException { super(name, nodeDescription, config.getRemoteFs(), config.getNumExecutors(), config.getMode(), "", config.getLauncher(), config.getRetentionStrategy(), config.getNodeProperties()); this.connector = connector; this.activityId = activityId; this.config = config; }
Example 13
Source File: KubernetesSlaveTest.java From kubernetes-plugin with Apache License 2.0 | 5 votes |
@Test public void testGetPodRetention() { try { List<KubernetesSlaveTestCase<PodRetention>> cases = Arrays.asList( createPodRetentionTestCase(new Never(), new Default(), new Default()), createPodRetentionTestCase(new Never(), new Always(), new Always()), createPodRetentionTestCase(new Never(), new OnFailure(), new OnFailure()), createPodRetentionTestCase(new Never(), new Never(), new Never()), createPodRetentionTestCase(new OnFailure(), new Default(), new Default()), createPodRetentionTestCase(new OnFailure(), new Always(), new Always()), createPodRetentionTestCase(new OnFailure(), new OnFailure(), new OnFailure()), createPodRetentionTestCase(new OnFailure(), new Never(), new Never()), createPodRetentionTestCase(new Always(), new Default(), new Default()), createPodRetentionTestCase(new Always(), new Always(), new Always()), createPodRetentionTestCase(new Always(), new OnFailure(), new OnFailure()), createPodRetentionTestCase(new Always(), new Never(), new Never()) ); KubernetesCloud cloud = new KubernetesCloud("test"); r.jenkins.clouds.add(cloud); for (KubernetesSlaveTestCase<PodRetention> testCase : cases) { cloud.setPodRetention(testCase.getCloudPodRetention()); KubernetesSlave testSlave = testCase.buildSubject(cloud); assertEquals(testCase.getExpectedResult(), testSlave.getPodRetention(cloud)); } } catch(IOException | Descriptor.FormException e) { fail(e.getMessage()); } }
Example 14
Source File: KubernetesSlave.java From kubernetes-plugin with Apache License 2.0 | 4 votes |
/** * @deprecated Use {@link Builder} instead. */ @Deprecated public KubernetesSlave(PodTemplate template, String nodeDescription, KubernetesCloud cloud, Label label) throws Descriptor.FormException, IOException { this(template, nodeDescription, cloud.name, label.toString(), new OnceRetentionStrategy(cloud.getRetentionTimeout())) ; }
Example 15
Source File: DockerTraceabilityPlugin.java From docker-traceability-plugin with MIT License | 4 votes |
@Override public void configure(StaplerRequest req, JSONObject formData) throws IOException, ServletException, Descriptor.FormException { DockerTraceabilityPluginConfiguration _configuration = req.bindJSON(DockerTraceabilityPluginConfiguration.class, formData); configure(_configuration); }
Example 16
Source File: GlobalConfiguration.java From DotCi with MIT License | 4 votes |
@Override public boolean configure(StaplerRequest req, JSONObject json) throws Descriptor.FormException { req.bindJSON(this, json); save(); return true; }
Example 17
Source File: JenkinsConfiguratorCloudSupportTest.java From configuration-as-code-plugin with MIT License | 4 votes |
public Cloud3PretendSlave() throws IOException, Descriptor.FormException { super("testCloud", "remoteFS", null); }
Example 18
Source File: JenkinsConfiguratorCloudSupportTest.java From configuration-as-code-plugin with MIT License | 4 votes |
public Cloud1PretendSlave() throws IOException, Descriptor.FormException { super(); }
Example 19
Source File: JenkinsConfiguratorCloudSupportTest.java From configuration-as-code-plugin with MIT License | 4 votes |
public StaticPretendSlave() throws IOException, Descriptor.FormException { super(); }
Example 20
Source File: DashboardViewDescriptor.java From jenkins-deployment-dashboard-plugin with MIT License | 4 votes |
@Override public boolean configure(StaplerRequest req, JSONObject json) throws Descriptor.FormException { req.bindJSON(this, json.getJSONObject("deployment-dashboard")); save(); return true; }