本文整理汇总了Java中hudson.slaves.RetentionStrategy类的典型用法代码示例。如果您正苦于以下问题:Java RetentionStrategy类的具体用法?Java RetentionStrategy怎么用?Java RetentionStrategy使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RetentionStrategy类属于hudson.slaves包,在下文中一共展示了RetentionStrategy类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testConfig
import hudson.slaves.RetentionStrategy; //导入依赖的package包/类
@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));
}
示例2: EC2AbstractSlave
import hudson.slaves.RetentionStrategy; //导入依赖的package包/类
@DataBoundConstructor
public EC2AbstractSlave(String name, String instanceId, String description, String remoteFS, int numExecutors, Mode mode, String labelString, ComputerLauncher launcher, RetentionStrategy<EC2Computer> retentionStrategy, String initScript, String tmpDir, List<? extends NodeProperty<?>> nodeProperties, String remoteAdmin, String jvmopts, boolean stopOnTerminate, String idleTerminationMinutes, List<EC2Tag> tags, String cloudName, boolean usePrivateDnsName, boolean useDedicatedTenancy, int launchTimeout, AMITypeData amiType) throws FormException, IOException {
super(name, "", remoteFS, numExecutors, mode, labelString, launcher, retentionStrategy, nodeProperties);
this.instanceId = instanceId;
this.initScript = initScript;
this.tmpDir = tmpDir;
this.remoteAdmin = remoteAdmin;
this.jvmopts = jvmopts;
this.stopOnTerminate = stopOnTerminate;
this.idleTerminationMinutes = idleTerminationMinutes;
this.tags = tags;
this.usePrivateDnsName = usePrivateDnsName;
this.useDedicatedTenancy = useDedicatedTenancy;
this.cloudName = cloudName;
this.launchTimeout = launchTimeout;
this.amiType = amiType;
readResolve();
}
示例3: OVirtVMSlave
import hudson.slaves.RetentionStrategy; //导入依赖的package包/类
/**
* The constructor for OVIrtVMSlave. Even though it has tons of parameters,
* it's Jenkins' responsibility to fill those in. This object is used to
* represent a node creating using the ovirt cloud.
*
* @param name name of the node
* @param nodeDescription node description
* @param remoteFS the filesystem used
* @param numExecutors how many executors to run with
* @param mode mode?
* @param labelString the labels associated with this node
* @param delegateLauncher the launcher used to launch that node
* @param retentionStrategy retention strategy
* @param hypervisorDescription the hypervisor description
* @param snapshotName the snapshot used
* @param waitSec how many seconds to wait before retrying
* @param retries how many retries to do
* @param virtualMachineName the name of the ovirt vm
* @param nodeProperties the node properties
*
* @throws Descriptor.FormException FormException
* @throws IOException IOException
*/
@DataBoundConstructor
public OVirtVMSlave(String name, String nodeDescription, String remoteFS,
String numExecutors, Mode mode, String labelString,
ComputerLauncher delegateLauncher,
RetentionStrategy retentionStrategy,
String hypervisorDescription, String snapshotName,
int waitSec, int retries,
String virtualMachineName,
List<? extends NodeProperty<?>> nodeProperties)
throws Descriptor.FormException, IOException {
super(name, nodeDescription, remoteFS, numExecutors, mode, labelString,
new OVirtVMLauncher(delegateLauncher, hypervisorDescription,
virtualMachineName, snapshotName,
waitSec, retries),
retentionStrategy,
nodeProperties);
this.hypervisorDescription = hypervisorDescription;
this.snapshotName = snapshotName;
this.virtualMachineName = virtualMachineName;
this.waitSec = waitSec;
this.retries = retries;
this.delegateLauncher = delegateLauncher;
}
示例4: KubernetesSlave
import hudson.slaves.RetentionStrategy; //导入依赖的package包/类
@DataBoundConstructor
public KubernetesSlave(PodTemplate template, String nodeDescription, String cloudName, String labelStr,
RetentionStrategy rs)
throws Descriptor.FormException, IOException {
super(getSlaveName(template),
nodeDescription,
template.getRemoteFs(),
1,
template.getNodeUsageMode() != null ? template.getNodeUsageMode() : Node.Mode.NORMAL,
labelStr == null ? null : labelStr,
new KubernetesLauncher(),
rs,
template.getNodeProperties());
this.cloudName = cloudName;
this.namespace = Util.fixEmpty(template.getNamespace());
this.template = template;
}
示例5: RavelloSlaveBlueprint
import hudson.slaves.RetentionStrategy; //导入依赖的package包/类
@DataBoundConstructor
public RavelloSlaveBlueprint(String blueprintName, int blueprintId, String slaveName, String remoteFS, String nodeDescription, RetentionStrategy retentionStrategy, int port, String credentialsId,
String jvmOptions, String javaPath, String prefixStartSlaveCmd, String suffixStartSlaveCmd,
Integer launchTimeoutSeconds, Integer maxNumRetries, Integer retryWaitTime, String labelString){
super(blueprintName, blueprintId);
this.slaveName = slaveName;
this.remoteFS = remoteFS;
this.nodeDescription = nodeDescription;
this.retentionStrategy = retentionStrategy;
this.port = port;
this.credentialsId = credentialsId;
this.jvmOptions = jvmOptions;
this.javaPath = javaPath;
this.prefixStartSlaveCmd = prefixStartSlaveCmd;
this.suffixStartSlaveCmd = suffixStartSlaveCmd;
this.launchTimeoutSeconds = launchTimeoutSeconds;
this.maxNumRetries = maxNumRetries;
this.retryWaitTime = retryWaitTime;
this.labelString = labelString;
labelSet = Label.parse(labelString);
}
示例6: RavelloSlaveVM
import hudson.slaves.RetentionStrategy; //导入依赖的package包/类
public RavelloSlaveVM(String vmName, String remoteFS, String nodeDescription, RetentionStrategy retentionStrategy, int port, String credentialsId,
String jvmOptions, String javaPath, String prefixStartSlaveCmd, String suffixStartSlaveCmd,
Integer launchTimeoutSeconds, Integer maxNumRetries, Integer retryWaitTime) {
super(vmName);
this.remoteFS = remoteFS;
this.nodeDescription = nodeDescription;
this.retentionStrategy = retentionStrategy;
this.port = port;
this.credentialsId = credentialsId;
this.jvmOptions = jvmOptions;
this.javaPath = javaPath;
this.prefixStartSlaveCmd = prefixStartSlaveCmd;
this.suffixStartSlaveCmd = suffixStartSlaveCmd;
this.launchTimeoutSeconds = launchTimeoutSeconds;
this.maxNumRetries = maxNumRetries;
this.retryWaitTime = retryWaitTime;
}
示例7: VirtualMachineSlave
import hudson.slaves.RetentionStrategy; //导入依赖的package包/类
@DataBoundConstructor
public VirtualMachineSlave(String name, String nodeDescription, String remoteFS, String numExecutors,
Mode mode, String labelString, ComputerLauncher delegateLauncher,
RetentionStrategy retentionStrategy, List<? extends NodeProperty<?>> nodeProperties,
String datacenterDescription, String datacenterNode, Integer virtualMachineId,
String snapshotName, Boolean startVM, int startupWaitingPeriodSeconds)
throws
Descriptor.FormException, IOException {
super(name, nodeDescription, remoteFS, numExecutors, mode, labelString,
new VirtualMachineLauncher(delegateLauncher, datacenterDescription, datacenterNode, virtualMachineId,
snapshotName, startVM, startupWaitingPeriodSeconds),
retentionStrategy, nodeProperties);
this.datacenterDescription = datacenterDescription;
this.datacenterNode = datacenterNode;
this.virtualMachineId = virtualMachineId;
this.snapshotName = snapshotName;
this.startVM = startVM;
this.startupWaitingPeriodSeconds = startupWaitingPeriodSeconds;
}
示例8: setup
import hudson.slaves.RetentionStrategy; //导入依赖的package包/类
@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);
}
示例9: ParallelsDesktopConnectorSlave
import hudson.slaves.RetentionStrategy; //导入依赖的package包/类
@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;
}
示例10: getDockerRetentionStrategyDescriptors
import hudson.slaves.RetentionStrategy; //导入依赖的package包/类
/**
* 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;
}
示例11: getRetentionStrategyCopy
import hudson.slaves.RetentionStrategy; //导入依赖的package包/类
/**
* tmp fix for terminating boolean caching
*/
public RetentionStrategy getRetentionStrategyCopy() {
if (retentionStrategy instanceof DockerOnceRetentionStrategy) {
DockerOnceRetentionStrategy onceRetention = (DockerOnceRetentionStrategy) retentionStrategy;
return new DockerOnceRetentionStrategy(onceRetention.getIdleMinutes());
}
return retentionStrategy;
}
示例12: notAllowedStrategy
import hudson.slaves.RetentionStrategy; //导入依赖的package包/类
/**
* 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;
}
示例13: demandRetention
import hudson.slaves.RetentionStrategy; //导入依赖的package包/类
@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));
}
示例14: RavelloSlave
import hudson.slaves.RetentionStrategy; //导入依赖的package包/类
@DataBoundConstructor
public RavelloSlave(ComputerLauncher delegate, String name, String nodeDescription, String remoteFS,
int numExecutors, String labelString, RetentionStrategy retentionStrategy)
throws FormException, IOException {
super(name, nodeDescription, remoteFS, numExecutors, Mode.EXCLUSIVE, labelString,
new RavelloLauncher(delegate), retentionStrategy);
}
示例15: createSlave
import hudson.slaves.RetentionStrategy; //导入依赖的package包/类
protected DumbSlave createSlave(String labels) throws Exception {
synchronized (jenkins) {
DumbSlave slave = new DumbSlave("slave-" + jenkins.getInstance().getNodes().size(), "dummy",
Files.createTempDirectory("jenkin-slave").toString(), "1", null /* Mode.NORMAL */, labels==null?"":labels,
createComputerLauncher(null), RetentionStrategy.NOOP, Collections.<NodeProperty<?>>emptyList());
jenkins.getInstance().addNode(slave);
return slave;
}
}