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

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

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

Jenkins.getVersion介绍

[英]Parses #VERSION into VersionNumber, or null if it's not parseable as a version number (such as when Jenkins is run with "mvn hudson-dev:run")
[中]

代码示例

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

/**
 * Provides the list of platform plugin updates from the last time
 * the upgrade was run.
 * @return {@code null} if the version range cannot be retrieved.
 */
@CheckForNull
public JSONArray getPlatformPluginUpdates() {
  final VersionNumber version = getCurrentLevel();
  if (version == null) {
    return null;
  }
  return getPlatformPluginsForUpdate(version, Jenkins.getVersion());
}

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

private Object buildComponentInformation() {
  Map<String, String> components = new TreeMap<>();
  VersionNumber core = Jenkins.getVersion();
  components.put("jenkins-core", core == null ? "" : core.toString());
  for (PluginWrapper plugin : Jenkins.get().pluginManager.getPlugins()) {
    if (plugin.isActive()) {
      components.put(plugin.getShortName(), plugin.getVersion());
    }
  }
  return components;
}

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

public String getCss() {
    final VersionNumber version = Jenkins.getVersion();
    if (version == null || version.isNewerThan(new VersionNumber("2.103"))) {
      return "alert alert-warning";
    }
    return "warning";
  }
}

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

props.put("version",String.valueOf(Jenkins.getVersion()));
} catch (IllegalArgumentException e) {

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

/*package*/ void completeSetup() throws IOException, ServletException {
  Jenkins.get().checkPermission(Jenkins.ADMINISTER);
  InstallUtil.saveLastExecVersion();
  setCurrentLevel(Jenkins.getVersion());
  InstallUtil.proceedToNextStateFrom(InstallState.INITIAL_SETUP_COMPLETED);
}

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

if (lastExecVersion.isNewerThan(InstallUtil.NEW_INSTALL_VERSION) && lastExecVersion.isOlderThan(Jenkins.getVersion())) {

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

LOGGER.warning(shortName + " doesn't declare required core version.");
} else {
  VersionNumber actualVersion = Jenkins.getVersion();
  if (actualVersion.isOlderThan(new VersionNumber(requiredCoreVersion))) {
    versionDependencyError(Messages.PluginWrapper_obsoleteCore(Jenkins.getVersion().toString(), requiredCoreVersion), Jenkins.getVersion().toString(), requiredCoreVersion);

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

/**
 * Returns true if this warning is relevant to the current configuration
 * @return true if this warning is relevant to the current configuration
 */
public boolean isRelevant() {
  switch (this.type) {
    case CORE:
      VersionNumber current = Jenkins.getVersion();
      if (!isRelevantToVersion(current)) {
        return false;
      }
      return true;
    case PLUGIN:
      // check whether plugin is installed
      PluginWrapper plugin = Jenkins.getInstance().getPluginManager().getPlugin(this.component);
      if (plugin == null) {
        return false;
      }
      // check whether warning is relevant to installed version
      VersionNumber currentCore = plugin.getVersionNumber();
      if (!isRelevantToVersion(currentCore)) {
        return false;
      }
      return true;
    case UNKNOWN:
    default:
      return false;
  }
}

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

info.put("core", Jenkins.getVersion().toString());
info.put("clientDate", clientDateString());
info.put("properties", security);

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

setCurrentLevel(Jenkins.getVersion());

代码示例来源:origin: awslabs/aws-codepipeline-plugin-for-jenkins

private static String getJenkinsVersion() {
  final VersionNumber jenkinsVersion = Jenkins.getVersion();
  if (jenkinsVersion != null) {
    return jenkinsVersion.toString();
  } else {
    return UNKNOWN;
  }
}

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

/**
 * Provides the list of platform plugin updates from the last time
 * the upgrade was run.
 * @return {@code null} if the version range cannot be retrieved.
 */
@CheckForNull
public JSONArray getPlatformPluginUpdates() {
  final VersionNumber version = getCurrentLevel();
  if (version == null) {
    return null;
  }
  return getPlatformPluginsForUpdate(version, Jenkins.getVersion());
}

代码示例来源:origin: org.jenkins-ci.plugins/ssh-slaves

final VersionNumber version = Jenkins.getVersion();
if (version == null) {

代码示例来源:origin: io.jenkins/configuration-as-code

public String getCss() {
    final VersionNumber version = Jenkins.getVersion();
    if (version == null || version.isNewerThan(new VersionNumber("2.103"))) {
      return "alert alert-warning";
    }
    return "warning";
  }
}

代码示例来源:origin: groupon/DotCi

public boolean isNewJenkins() {
  final VersionNumber matrixBreakOutVersion = new VersionNumber("1.560");
  return Jenkins.getVersion().isNewerThan(matrixBreakOutVersion);
}

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

private void initializeProperties(final Map<String, String> properties) {
  properties.put(PROPERTY_USER_ID, getUserId());
  // Get Jenkins version info
  properties.put(PROPERTY_JENKINS_VERSION, Jenkins.getVersion().toString());
  properties.put(PROPERTY_PLUGIN_VERSION, getPluginVersion());
  // Get OS info
  properties.put(PROPERTY_LOCALE, getLocaleName());
  properties.put(PROPERTY_OS_PLATFORM, getPlatformName());
  properties.put(PROPERTY_OS_VERSION, getPlatformVersion());
  // Get Java info
  properties.put(PROPERTY_JAVA_NAME, getJavaName());
  properties.put(PROPERTY_JAVA_VERSION, getJavaVersion());
}

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

/**
 * @return true if this version of the plugin is running on a Jenkins version where JENKINS-43786 is included.
 */
@Restricted(DoNotUse.class)
public boolean isTheNewDesignAvailable() {
  final VersionNumber version = Jenkins.getVersion();
  if (version != null && version.isNewerThan(new VersionNumber("2.103"))) {
    return true;
  }
  return false;
}

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

/**
 * Gets the full User Agent used to make requests to TFS/Team Services.
 */
public String getUserAgent(final String defaultUserAgent) {
  try {
    return MessageFormat.format(USER_AGENT_FORMAT,
        PRODUCT_NAME,
        getPluginVersion(),
        "Jenkins",
        Jenkins.getVersion(),
        getPlatformName(),
        getPlatformVersion(),
        getJavaName(),
        getJavaVersion(),
        defaultUserAgent);
  } catch (final Throwable t) {
    logger.warn("Error getting UserAgent", t);
    return defaultUserAgent;
  }
}

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

/*package*/ void completeSetup() throws IOException, ServletException {
  Jenkins.getInstance().checkPermission(Jenkins.ADMINISTER);
  InstallUtil.saveLastExecVersion();
  setCurrentLevel(Jenkins.getVersion());
  PluginServletFilter.removeFilter(FORCE_SETUP_WIZARD_FILTER);
  isUsingSecurityToken = false; // this should not be considered new anymore
  InstallUtil.proceedToNextStateFrom(InstallState.INITIAL_SETUP_COMPLETED);
}

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

/**
 * Returns true if this warning is relevant to the current configuration
 * @return true if this warning is relevant to the current configuration
 */
public boolean isRelevant() {
  switch (this.type) {
    case CORE:
      VersionNumber current = Jenkins.getVersion();
      if (!isRelevantToVersion(current)) {
        return false;
      }
      return true;
    case PLUGIN:
      // check whether plugin is installed
      PluginWrapper plugin = Jenkins.getInstance().getPluginManager().getPlugin(this.component);
      if (plugin == null) {
        return false;
      }
      // check whether warning is relevant to installed version
      VersionNumber currentCore = plugin.getVersionNumber();
      if (!isRelevantToVersion(currentCore)) {
        return false;
      }
      return true;
    case UNKNOWN:
    default:
      return false;
  }
}

相关文章

Jenkins类方法