jenkins.model.Jenkins.getAgentProtocols()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(5.5k)|赞(0)|评价(0)|浏览(167)

本文整理了Java中jenkins.model.Jenkins.getAgentProtocols()方法的一些代码示例,展示了Jenkins.getAgentProtocols()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Jenkins.getAgentProtocols()方法的具体详情如下:
包路径:jenkins.model.Jenkins
类名称:Jenkins
方法名:getAgentProtocols

Jenkins.getAgentProtocols介绍

[英]Returns the enabled agent protocols.
[中]返回启用的代理协议。

代码示例

代码示例来源:origin: jenkinsci/jenkins

/**
 * Returns a comma separated list of the enabled {@link AgentProtocol#getName()} implementations so that
 * clients can avoid creating additional work for the server attempting to connect with unsupported protocols.
 *
 * @return a comma separated list of the enabled {@link AgentProtocol#getName()} implementations
 * @since 2.16
 */
public String getAgentProtocolNames() {
  return StringUtils.join(Jenkins.getInstance().getAgentProtocols(), ", ");
}

代码示例来源:origin: jenkinsci/jenkins

public Set<String> getAgentProtocols() {
  return Jenkins.getInstance().getAgentProtocols();
}

代码示例来源:origin: jenkinsci/jenkins

@CheckForNull
  public static String getDeprecatedProtocolsString() {
    final List<String> deprecatedProtocols = new ArrayList<>();
    final Set<String> agentProtocols = Jenkins.get().getAgentProtocols();
    for (String name : agentProtocols) {
      AgentProtocol pr = AgentProtocol.of(name);
      if (pr != null && pr.isDeprecated()) {
        deprecatedProtocols.add(name);
      }
    }
    if (deprecatedProtocols.isEmpty()) {
      return null;
    }
    return StringUtils.join(deprecatedProtocols, ',');
  }
}

代码示例来源:origin: jenkinsci/jenkins

AgentProtocol p = AgentProtocol.of(protocol);
if (p!=null) {
  if (Jenkins.getInstance().getAgentProtocols().contains(protocol)) {
    LOGGER.log(p instanceof PingAgentProtocol ? Level.FINE : Level.INFO, "Accepted {0} connection #{1} from {2}", new Object[] {protocol, id, this.s.getRemoteSocketAddress()});
    p.handle(this.s);

代码示例来源:origin: jenkinsci/jenkins

@Override
public boolean isActivated() {
  final Set<String> agentProtocols = Jenkins.get().getAgentProtocols();
  for (String name : agentProtocols) {
    AgentProtocol pr = AgentProtocol.of(name);
    if (pr != null && pr.isDeprecated()) {
      return true;
    }
  }
  return false;
}

代码示例来源:origin: jenkinsci/configuration-as-code-plugin

@Test
  @ConfiguredWithCode(value = "AgentProtocolsTest.yml")
  public void configure_agent_protocols() throws Exception {
    final Jenkins jenkins = Jenkins.getInstance();
    final Set<String> agentProtocols =
        Arrays.stream(new String[]{"JNLP4-connect", "Ping"}).collect(Collectors.toSet());
    assertEquals(agentProtocols, jenkins.getAgentProtocols());
  }
}

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

/**
 * Returns a comma separated list of the enabled {@link AgentProtocol#getName()} implementations so that
 * clients can avoid creating additional work for the server attempting to connect with unsupported protocols.
 *
 * @return a comma separated list of the enabled {@link AgentProtocol#getName()} implementations
 * @since 2.16
 */
public String getAgentProtocolNames() {
  return StringUtils.join(Jenkins.getInstance().getAgentProtocols(), ", ");
}

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

public Set<String> getAgentProtocols() {
  return Jenkins.getInstance().getAgentProtocols();
}

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

@CheckForNull
public static String getDeprecatedProtocolsString() {
  final List<String> deprecatedProtocols = new ArrayList<>();
  final Set<String> agentProtocols = Jenkins.getInstance().getAgentProtocols();
  for (String name : agentProtocols) {
    AgentProtocol pr = AgentProtocol.of(name);
    if (pr != null && pr.isDeprecated()) {
      deprecatedProtocols.add(name);
    }
  }
  if (deprecatedProtocols.isEmpty()) {
    return null;
  }
  return StringUtils.join(deprecatedProtocols, ',');
}

代码示例来源:origin: jenkinsci/jclouds-plugin

public FormValidation doCheckUseJnlp(@QueryParameter final String value,
    @QueryParameter final String preExistingJenkinsUser, @QueryParameter final String initScriptId) {
  if (Boolean.valueOf(Util.fixEmptyAndTrim(value)).booleanValue()) {
    if (null == Jenkins.getInstance().getTcpSlaveAgentListener() || -1 == Jenkins.getInstance().getSlaveAgentPort()) {
      return FormValidation.error("This feature cannot work, because the JNLP port is disabled in global security.");
    }
    final Set<String> aps = Jenkins.getInstance().getAgentProtocols();
    if (!(aps.contains("JNLP-connect") || aps.contains("JNLP2-connect") || aps.contains("JNLP3-connect"))) {
      return FormValidation.error("This feature cannot work, because all JNLP protocols are disabled in global security.");
    }
    if (!Boolean.valueOf(Util.fixEmptyAndTrim(preExistingJenkinsUser)).booleanValue()) {
      return FormValidation.error("Jenkins user provisioning relies on posix system, accessible via SSH.");
    }
    if (!ConfigHelper.getConfig(initScriptId).isEmpty()) {
      return FormValidation.error("Init script functionality relies on a posix system, accessible via SSH.");
    }
  }
  return FormValidation.ok();
}

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

@Override
public boolean isActivated() {
  final Set<String> agentProtocols = Jenkins.getInstance().getAgentProtocols();
  for (String name : agentProtocols) {
    AgentProtocol pr = AgentProtocol.of(name);
    if (pr != null && pr.isDeprecated()) {
      return true;
    }
  }
  return false;
}

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

AgentProtocol p = AgentProtocol.of(protocol);
if (p!=null) {
  if (Jenkins.getInstance().getAgentProtocols().contains(protocol)) {
    LOGGER.log(p instanceof PingAgentProtocol ? Level.FINE : Level.INFO, "Accepted {0} connection #{1} from {2}", new Object[] {protocol, id, this.s.getRemoteSocketAddress()});
    p.handle(this.s);

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

HashSet<String> newProtocols = new HashSet<>(jenkins.getAgentProtocols());
newProtocols.removeAll(Arrays.asList(
    "JNLP2-connect", "JNLP-connect", "CLI-connect"

相关文章

Jenkins类方法