当前位置: 首页>>代码示例>>Java>>正文


Java NodePropertyDescriptor类代码示例

本文整理汇总了Java中hudson.slaves.NodePropertyDescriptor的典型用法代码示例。如果您正苦于以下问题:Java NodePropertyDescriptor类的具体用法?Java NodePropertyDescriptor怎么用?Java NodePropertyDescriptor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


NodePropertyDescriptor类属于hudson.slaves包,在下文中一共展示了NodePropertyDescriptor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: findNodeProperty

import hudson.slaves.NodePropertyDescriptor; //导入依赖的package包/类
/**
 * Finds the {@link NodeProperty} for the external workspace definition.
 *
 * @param node the current node
 * @return the node property for the external workspace manager
 * @throws IOException if node property was not found
 */
@Nonnull
private static ExternalWorkspaceProperty findNodeProperty(Node node) throws IOException {
    DescribableList<NodeProperty<?>, NodePropertyDescriptor> nodeProperties = node.getNodeProperties();

    ExternalWorkspaceProperty exwsNodeProperty = null;
    for (NodeProperty<?> nodeProperty : nodeProperties) {
        if (nodeProperty instanceof ExternalWorkspaceProperty) {
            exwsNodeProperty = (ExternalWorkspaceProperty) nodeProperty;
            break;
        }
    }

    if (exwsNodeProperty == null) {
        String message = format("There is no External Workspace config defined in Node '%s' config", node.getDisplayName());
        throw new AbortException(message);
    }

    return exwsNodeProperty;
}
 
开发者ID:jenkinsci,项目名称:external-workspace-manager-plugin,代码行数:27,代码来源:ExwsExecution.java

示例2: localRootPathToNodeMountPoint

import hudson.slaves.NodePropertyDescriptor; //导入依赖的package包/类
@LocalData
@Test
public void localRootPathToNodeMountPoint() throws Exception {

    // The node configuration version 1.0.0 contains a localRootPath field.
    // This tests that future versions load this field as nodeMountPoint,
    // in other words it tests NodeDisk.readResolve()

    Computer computer = jr.getInstance().getComputer("node1");
    Node node = computer.getNode();
    DescribableList<NodeProperty<?>,NodePropertyDescriptor> props = node.getNodeProperties();
    ExternalWorkspaceProperty exwsProp = props.get(ExternalWorkspaceProperty.class);

    List<NodeDiskPool> diskPools = exwsProp.getNodeDiskPools();
    assertThat(diskPools.size(), is(1));

    NodeDiskPool diskPool = diskPools.get(0);
    assertThat(diskPool.getDiskPoolRefId(), is ("dp1"));

    List<NodeDisk> disks = diskPool.getNodeDisks();
    assertThat(disks.size(), is(1));

    NodeDisk disk = disks.get(0);
    assertThat(disk.getDiskRefId(), is("d1"));
    assertThat(disk.getNodeMountPoint(), is("/tmp/dp1/d1"));
}
 
开发者ID:jenkinsci,项目名称:external-workspace-manager-plugin,代码行数:27,代码来源:ConfigMigrationTest.java

示例3: configDefaults

import hudson.slaves.NodePropertyDescriptor; //导入依赖的package包/类
/**
 * Xstream ignores default field values, so set them explicitly
 */
private void configDefaults() {
    if (mode == null) {
        mode = Node.Mode.NORMAL;
    }
    if (retentionStrategy == null) {
        retentionStrategy = new DockerOnceRetentionStrategy(10);
    }
    if (pullStrategy == null) {
        pullStrategy = DockerImagePullStrategy.PULL_LATEST;
    }
    if (nodeProperties == null) {
        nodeProperties = 
            new DescribableList<NodeProperty<?>, NodePropertyDescriptor>(Jenkins.getInstance());
    }
}
 
开发者ID:jenkinsci,项目名称:docker-plugin,代码行数:19,代码来源:DockerTemplate.java

示例4: getNodePropertiesDescriptors

import hudson.slaves.NodePropertyDescriptor; //导入依赖的package包/类
/**
 * Get a list of all {@link NodePropertyDescriptor}s we can use to define DockerSlave NodeProperties.
 */
public List<NodePropertyDescriptor> getNodePropertiesDescriptors() {

    // Copy/paste hudson.model.Slave.SlaveDescriptor.nodePropertyDescriptors marked as @Restricted for reasons I don't get
    List<NodePropertyDescriptor> result = new ArrayList<NodePropertyDescriptor>();
    Collection<NodePropertyDescriptor> list =
            (Collection) Jenkins.getInstance().getDescriptorList(NodeProperty.class);
    for (NodePropertyDescriptor npd : DescriptorVisibilityFilter.applyType(DockerTransientNode.class, list)) {
        if (npd.isApplicable(DockerTransientNode.class)) {
            result.add(npd);
        }
    }


    final Iterator<NodePropertyDescriptor> iterator = result.iterator();
    while (iterator.hasNext()) {
        final NodePropertyDescriptor de = iterator.next();
        // see https://issues.jenkins-ci.org/browse/JENKINS-47697
        if ("org.jenkinsci.plugins.matrixauth.AuthorizationMatrixNodeProperty".equals(de.getKlass().toJavaClass().getName())) {
            iterator.remove();
        }
    }
    return result;
}
 
开发者ID:jenkinsci,项目名称:docker-plugin,代码行数:27,代码来源:DockerTemplate.java

示例5: getNodePropertyDescriptors

import hudson.slaves.NodePropertyDescriptor; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
public static List<NodePropertyDescriptor> getNodePropertyDescriptors(Class<? extends Node> clazz) {
    List<NodePropertyDescriptor> result = new ArrayList<>();
    Collection<NodePropertyDescriptor> list = (Collection) Jenkins.getInstance().getDescriptorList(NodeProperty.class);
    for (NodePropertyDescriptor npd : list) {
        if (npd.isApplicable(clazz)) {
            result.add(npd);
        }
    }
    return result;
}
 
开发者ID:KostyaSha,项目名称:yet-another-docker-plugin,代码行数:12,代码来源:DockerFunctions.java

示例6: start

import hudson.slaves.NodePropertyDescriptor; //导入依赖的package包/类
@Override
public boolean start() throws Exception {
    LOGGER.log(Level.FINE, "Starting container step.");
    String containerName = step.getName();

    KubernetesNodeContext nodeContext = new KubernetesNodeContext(getContext());
    client = nodeContext.connectToCloud();

    EnvironmentExpander env = getContext().get(EnvironmentExpander.class);
    EnvVars globalVars = null;
    Jenkins instance = Jenkins.getInstance();
    DescribableList<NodeProperty<?>, NodePropertyDescriptor> globalNodeProperties = instance
            .getGlobalNodeProperties();
    List<EnvironmentVariablesNodeProperty> envVarsNodePropertyList = globalNodeProperties
            .getAll(EnvironmentVariablesNodeProperty.class);
    if (envVarsNodePropertyList != null && envVarsNodePropertyList.size() != 0) {
        globalVars = envVarsNodePropertyList.get(0).getEnvVars();
    }
    decorator = new ContainerExecDecorator();
    decorator.setClient(client);
    decorator.setPodName(nodeContext.getPodName());
    decorator.setContainerName(containerName);
    decorator.setNamespace(nodeContext.getNamespace());
    decorator.setEnvironmentExpander(env);
    decorator.setWs(getContext().get(FilePath.class));
    decorator.setGlobalVars(globalVars);
    getContext().newBodyInvoker()
            .withContext(BodyInvoker
                    .mergeLauncherDecorators(getContext().get(LauncherDecorator.class), decorator))
            .withCallback(new ContainerExecCallback(decorator))
            .start();
    return false;
}
 
开发者ID:carlossg,项目名称:jenkins-kubernetes-plugin,代码行数:34,代码来源:ContainerStepExecution.java

示例7: configureCloud

import hudson.slaves.NodePropertyDescriptor; //导入依赖的package包/类
@Before
public void configureCloud() throws Exception {
    cloud = setupCloud(this);
    createSecret(cloud.connect());
    cloud.getTemplates().clear();
    cloud.addTemplate(buildBusyboxTemplate("busybox"));

    // Agents running in Kubernetes (minikube) need to connect to this server, so localhost does not work
    URL url = r.getURL();

    String hostAddress = System.getProperty("jenkins.host.address");
    if (hostAddress == null) {
        hostAddress = InetAddress.getLocalHost().getHostAddress();
    }
    URL nonLocalhostUrl = new URL(url.getProtocol(), hostAddress, url.getPort(),
            url.getFile());
    JenkinsLocationConfiguration.get().setUrl(nonLocalhostUrl.toString());

    r.jenkins.clouds.add(cloud);

    DescribableList<NodeProperty<?>, NodePropertyDescriptor> list =  r.jenkins.getGlobalNodeProperties();
    EnvironmentVariablesNodeProperty newEnvVarsNodeProperty = new hudson.slaves.EnvironmentVariablesNodeProperty();
    list.add(newEnvVarsNodeProperty);
    EnvVars envVars = newEnvVarsNodeProperty.getEnvVars();
    envVars.put("GLOBAL", "GLOBAL");
    envVars.put("JAVA_HOME_X", "java-home-x");
    r.jenkins.save();
}
 
开发者ID:carlossg,项目名称:jenkins-kubernetes-plugin,代码行数:29,代码来源:AbstractKubernetesPipelineTest.java

示例8: Expand

import hudson.slaves.NodePropertyDescriptor; //导入依赖的package包/类
public Expand(Map<String, String> map) {
	Jenkins jenkins = Jenkins.getInstance();
	if (jenkins == null) {
		logger.warning("Jenkins instance is null!");
		return;
	}

	DescribableList<NodeProperty<?>, NodePropertyDescriptor> props = jenkins.getGlobalNodeProperties();
	if (props != null) {
		for (NodeProperty<?> node : props) {
			if (node instanceof EnvironmentVariablesNodeProperty) {
				EnvironmentVariablesNodeProperty env = (EnvironmentVariablesNodeProperty) node;
				formatTags.putAll((env).getEnvVars());
			}
		}
	}

	for (Entry<String, String> entry : map.entrySet()) {
		String key = entry.getKey();
		String value = entry.getValue();
		if (ReviewProp.isProp(key)) {
			// Known Perforce Review property; prefix with namespace
			key = ReviewProp.NAMESPACE + key;
		}
		set(key, value);
	}
}
 
开发者ID:p4paul,项目名称:p4-jenkins,代码行数:28,代码来源:Expand.java

示例9: getGlobalNodeProperties

import hudson.slaves.NodePropertyDescriptor; //导入依赖的package包/类
/**
 * Get a map with the global node properties.
 *
 * @since 1.6
 * @return map with global node properties
 */
public static @Nonnull Map<String, Object> getGlobalNodeProperties() {
    Map<String, Object> map = new HashMap<String, Object>();
    Jenkins instance = Jenkins.getInstance();
    DescribableList<NodeProperty<?>, NodePropertyDescriptor> globalNodeProperties = instance.getGlobalNodeProperties();
    if (globalNodeProperties != null) {
        for (NodeProperty<?> nodeProperty : globalNodeProperties) {
            if (nodeProperty instanceof EnvironmentVariablesNodeProperty) {
                EnvironmentVariablesNodeProperty envNodeProperty = (EnvironmentVariablesNodeProperty) nodeProperty;
                map.putAll(envNodeProperty.getEnvVars());
            }
        }
    }
    return map;
}
 
开发者ID:imoutsatsos,项目名称:uno-choice-plugin,代码行数:21,代码来源:Utils.java

示例10: getNodePropertyDescriptors

import hudson.slaves.NodePropertyDescriptor; //导入依赖的package包/类
@Override
public List<NodePropertyDescriptor> getNodePropertyDescriptors() {
	initPython();
	if (pexec.isImplemented(11)) {
		return (List) pexec.execPython("get_node_property_descriptors");
	} else {
		return super.getNodePropertyDescriptors();
	}
}
 
开发者ID:conyx,项目名称:jenkins.py,代码行数:10,代码来源:NodePW.java

示例11: readResolve

import hudson.slaves.NodePropertyDescriptor; //导入依赖的package包/类
public Object readResolve() {
  if (nodeProperties == null) {
    nodeProperties = new DescribableList<NodeProperty<?>,NodePropertyDescriptor>(Jenkins.getInstance());
  }
  if (minExecutors == 0) {
    this.minExecutors = 1;
  }
  return this;
}
 
开发者ID:jenkinsci,项目名称:mesos-plugin,代码行数:10,代码来源:MesosSlaveInfo.java

示例12: getNodeProperties

import hudson.slaves.NodePropertyDescriptor; //导入依赖的package包/类
public DescribableList<NodeProperty<?>, NodePropertyDescriptor> getNodeProperties() {
	return nodeProperties;
}
 
开发者ID:kmbulebu,项目名称:docker-ephemeral-cloud,代码行数:4,代码来源:DockerImage.java

示例13: readResolve

import hudson.slaves.NodePropertyDescriptor; //导入依赖的package包/类
public Object readResolve() {
	if(nodeProperties==null)
            nodeProperties = new DescribableList<NodeProperty<?>,NodePropertyDescriptor>(Jenkins.getInstance());
	return this;
}
 
开发者ID:kmbulebu,项目名称:docker-ephemeral-cloud,代码行数:6,代码来源:DockerImage.java

示例14: getNodeProperties

import hudson.slaves.NodePropertyDescriptor; //导入依赖的package包/类
@Override
public DescribableList<NodeProperty<?>, NodePropertyDescriptor> getNodeProperties() {
	initPython();
	return (DescribableList) pexec.execPython("get_node_properties");
}
 
开发者ID:conyx,项目名称:jenkins.py,代码行数:6,代码来源:NodePW.java

示例15: superGetNodePropertyDescriptors

import hudson.slaves.NodePropertyDescriptor; //导入依赖的package包/类
public List<NodePropertyDescriptor> superGetNodePropertyDescriptors() {
	return super.getNodePropertyDescriptors();
}
 
开发者ID:conyx,项目名称:jenkins.py,代码行数:4,代码来源:NodePW.java


注:本文中的hudson.slaves.NodePropertyDescriptor类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。