hudson.slaves.RetentionStrategy Java Examples
The following examples show how to use
hudson.slaves.RetentionStrategy.
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: DockerCloudRetentionStrategyTest.java From yet-another-docker-plugin with MIT License | 6 votes |
@LocalData @Test public void testConfig() { final Cloud cloud = jenkinsRule.getInstance().getCloud("ff"); assertThat(cloud, instanceOf(DockerCloud.class)); final DockerCloud dockerCloud = (DockerCloud) cloud; final DockerSlaveTemplate template = dockerCloud.getTemplate("image"); assertThat(template, notNullValue()); final RetentionStrategy retentionStrategy = template.getRetentionStrategy(); assertThat(retentionStrategy, instanceOf(DockerCloudRetentionStrategy.class)); final DockerCloudRetentionStrategy strategy = (DockerCloudRetentionStrategy) retentionStrategy; assertThat(strategy.getIdleMinutes(), is(30)); }
Example #2
Source File: NodeTest.java From appcenter-plugin with MIT License | 5 votes |
@Before public void setUp() throws Exception { freeStyleProject = jenkinsRule.createFreeStyleProject(); freeStyleProject.getBuildersList().add(TestUtil.createFile("three/days/xiola.apk")); final AppCenterRecorder appCenterRecorder = new AppCenterRecorder("at-this-moment-you-should-be-with-us", "janes-addiction", "ritual-de-lo-habitual", "three/days/xiola.apk", "casey, niccoli"); appCenterRecorder.setBaseUrl(mockWebServer.url("/").toString()); freeStyleProject.getPublishersList().add(appCenterRecorder); slave = new MockSlave("test-slave", 1, Node.Mode.NORMAL, "", RetentionStrategy.Always.INSTANCE, Collections.emptyList()); jenkinsRule.jenkins.addNode(slave); freeStyleProject.setAssignedNode(slave); }
Example #3
Source File: WithMavenStepTest.java From pipeline-maven-plugin with MIT License | 5 votes |
@Before public void setup() throws Exception { super.setup(); JavaGitContainer slaveContainer = slaveRule.get(); DumbSlave agent = new DumbSlave("remote", "", "/home/test/slave", "1", Node.Mode.NORMAL, "", new SSHLauncher(slaveContainer.ipBound(22), slaveContainer.port(22), "test", "test", "", ""), RetentionStrategy.INSTANCE, Collections.<NodeProperty<?>>emptyList()); jenkinsRule.jenkins.addNode(agent); }
Example #4
Source File: JenkinsRule.java From jenkins-test-harness with MIT License | 5 votes |
public DumbSlave createSlave(String nodeName, String labels, EnvVars env) throws Exception { synchronized (jenkins) { DumbSlave slave = new DumbSlave(nodeName, "dummy", createTmpDir().getPath(), "1", Node.Mode.NORMAL, labels==null?"":labels, createComputerLauncher(env), RetentionStrategy.NOOP, Collections.EMPTY_LIST); jenkins.addNode(slave); return slave; } }
Example #5
Source File: HudsonTestCase.java From jenkins-test-harness with MIT License | 5 votes |
public DumbSlave createSlave(String nodeName, String labels, EnvVars env) throws Exception { synchronized (jenkins) { DumbSlave slave = new DumbSlave(nodeName, "dummy", createTmpDir().getPath(), "1", Mode.NORMAL, labels==null?"":labels, createComputerLauncher(env), RetentionStrategy.NOOP, Collections.emptyList()); jenkins.addNode(slave); return slave; } }
Example #6
Source File: ParallelsDesktopConnectorSlave.java From jenkins-parallels with MIT License | 5 votes |
@DataBoundConstructor public ParallelsDesktopConnectorSlave(ParallelsDesktopCloud owner, String name, String remoteFS, ComputerLauncher launcher, boolean useAsBuilder) throws IOException, Descriptor.FormException { super(name, "", remoteFS, 1, Mode.NORMAL, "", launcher, useAsBuilder ? new RetentionStrategy.Always() : new RetentionStrategy.Demand(1, 1), new ArrayList<NodeProperty<?>>()); this.owner = owner; this.useAsBuilder = useAsBuilder; }
Example #7
Source File: KubernetesSlave.java From kubernetes-plugin with Apache License 2.0 | 5 votes |
/** * @deprecated Use {@link Builder} instead. */ @Deprecated public KubernetesSlave(PodTemplate template, String nodeDescription, KubernetesCloud cloud, String labelStr, RetentionStrategy rs) throws Descriptor.FormException, IOException { this(template, nodeDescription, cloud.name, labelStr, rs); }
Example #8
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 #9
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 #10
Source File: KubernetesSlave.java From kubernetes-plugin with Apache License 2.0 | 5 votes |
private RetentionStrategy determineRetentionStrategy() { if (podTemplate.getIdleMinutes() == 0) { return new OnceRetentionStrategy(cloud.getRetentionTimeout()); } else { return new CloudRetentionStrategy(podTemplate.getIdleMinutes()); } }
Example #11
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 #12
Source File: DockerFunctions.java From yet-another-docker-plugin with MIT License | 5 votes |
/** * Only this plugin specific strategies. */ public static List<Descriptor<RetentionStrategy<?>>> getDockerRetentionStrategyDescriptors() { List<Descriptor<RetentionStrategy<?>>> strategies = new ArrayList<>(); strategies.add(getInstance().getDescriptor(DockerOnceRetentionStrategy.class)); strategies.add(getInstance().getDescriptor(DockerCloudRetentionStrategy.class)); strategies.add(getInstance().getDescriptor(DockerComputerIOLauncher.class)); return strategies; }
Example #13
Source File: DockerSlaveTemplate.java From yet-another-docker-plugin with MIT License | 5 votes |
/** * tmp fix for terminating boolean caching */ public RetentionStrategy getRetentionStrategyCopy() { if (retentionStrategy instanceof DockerOnceRetentionStrategy) { DockerOnceRetentionStrategy onceRetention = (DockerOnceRetentionStrategy) retentionStrategy; return new DockerOnceRetentionStrategy(onceRetention.getIdleMinutes()); } return retentionStrategy; }
Example #14
Source File: DockerProvisioningStrategy.java From yet-another-docker-plugin with MIT License | 5 votes |
/** * Exclude unknown mix of configuration. */ @VisibleForTesting protected static boolean notAllowedStrategy(DockerSlaveTemplate template) { if (isNull(template)) { LOG.debug("Skipping DockerProvisioningStrategy because: template is null"); return true; } final RetentionStrategy retentionStrategy = template.getRetentionStrategy(); if (isNull(retentionStrategy)) { LOG.debug("Skipping DockerProvisioningStrategy because: strategy is null for {}", template); } if (retentionStrategy instanceof DockerOnceRetentionStrategy) { if (template.getNumExecutors() == 1) { LOG.debug("Applying faster provisioning for single executor template {}", template); return false; } else { LOG.debug("Skipping DockerProvisioningStrategy because: numExecutors is {} for {}", template.getNumExecutors(), template); return true; } } if (retentionStrategy instanceof RetentionStrategy.Demand) { LOG.debug("Applying faster provisioning for Demand strategy for template {}", template); return false; } // forbid by default LOG.trace("Skipping YAD provisioning for unknown mix of configuration for {}", template); return true; }
Example #15
Source File: DockerTemplate.java From docker-plugin with MIT License | 4 votes |
public RetentionStrategy getRetentionStrategy() { return retentionStrategy; }
Example #16
Source File: DockerSlaveConfig.java From yet-another-docker-plugin with MIT License | 4 votes |
public RetentionStrategy getRetentionStrategy() { return retentionStrategy; }
Example #17
Source File: DockerSlaveConfig.java From yet-another-docker-plugin with MIT License | 4 votes |
@DataBoundSetter public void setRetentionStrategy(RetentionStrategy retentionStrategy) { this.retentionStrategy = retentionStrategy; }
Example #18
Source File: DockerFunctions.java From yet-another-docker-plugin with MIT License | 4 votes |
/** * Because {@link Functions#getRetentionStrategyDescriptors()} is restricted. */ public static List<Descriptor<RetentionStrategy<?>>> getRetentionStrategyDescriptors() { return RetentionStrategy.all(); }
Example #19
Source File: PretendSlave.java From jenkins-test-harness with MIT License | 4 votes |
public PretendSlave(String name, String remoteFS, int numExecutors, Mode mode, String labelString, ComputerLauncher launcher, FakeLauncher faker) throws IOException, FormException { super(name, "pretending a slave", remoteFS, String.valueOf(numExecutors), mode, labelString, launcher, RetentionStrategy.NOOP, Collections.emptyList()); this.faker = faker; }
Example #20
Source File: EC2FleetNode.java From ec2-spot-jenkins-plugin with Apache License 2.0 | 4 votes |
public EC2FleetNode(final String name, final String nodeDescription, final String remoteFS, final int numExecutors, final Mode mode, final String label, final List<? extends NodeProperty<?>> nodeProperties, final EC2FleetCloud cloud, ComputerLauncher launcher) throws IOException, Descriptor.FormException { super(name, nodeDescription, remoteFS, numExecutors, mode, label, launcher, RetentionStrategy.NOOP, nodeProperties); this.cloud = cloud; }