本文整理了Java中jenkins.model.Jenkins.getPlugin()
方法的一些代码示例,展示了Jenkins.getPlugin()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Jenkins.getPlugin()
方法的具体详情如下:
包路径:jenkins.model.Jenkins
类名称:Jenkins
方法名:getPlugin
[英]Gets the plugin object from its class.
This allows easy storage of plugin information in the plugin singleton without every plugin reimplementing the singleton pattern.
[中]从其类中获取插件对象。
这允许在插件单例中轻松存储插件信息,而无需每个插件重新实现单例模式。
代码示例来源:origin: jenkinsci/configuration-as-code-plugin
/**
*
* @return true if the support plugin is installed, false otherwise.
*/
private boolean _hasSupportPluginInstalled() {
return Jenkins.getInstance().getPlugin("configuration-as-code-support") != null;
}
代码示例来源:origin: jenkinsci/jenkins
/**
* Report to the administrator if the plugin with the given name is older then the required version.
*
* @param pluginName shortName of the plugin (artifactId)
* @param requiredVersion the lowest version which is OK (e.g. 2.2.2)
* @param message the message to show (plain text)
*/
public void ifPluginOlderThenReport(String pluginName, String requiredVersion, String message){
Plugin plugin = Jenkins.getInstance().getPlugin(pluginName);
if(plugin != null){
if(plugin.getWrapper().getVersionNumber().isOlderThan(new VersionNumber(requiredVersion))) {
pluginsToBeUpdated.put(pluginName, new PluginUpdateInfo(pluginName, message));
}
}
}
代码示例来源:origin: jenkinsci/configuration-as-code-plugin
final Plugin plugin = jenkins.getPlugin(p.shortname);
if (plugin != null) {
代码示例来源:origin: jenkinsci/configuration-as-code-plugin
@Test
@Ignore //TODO: This needs to be re-enabled once we can actually dynamically load plugins
@ConfiguredWithCode("PluginManagerConfiguratorTest.yml")
public void testInstallPlugins() throws Exception {
final Plugin chucknorris = j.jenkins.getPlugin("chucknorris");
assertNotNull(chucknorris);
assertEquals("1.0", chucknorris.getWrapper().getVersion());
}
代码示例来源:origin: timols/jenkins-gitlab-merge-request-builder-plugin
@CheckForNull
static GitlabMergeRequestPlugin get() {
Jenkins instance = Jenkins.getInstance();
return instance == null ? null : instance.getPlugin(GitlabMergeRequestPlugin.class);
}
代码示例来源:origin: jenkinsci/email-ext-plugin
/**
* Returns whether the specified plug-in is installed.
*
* @param shortName
* the plug-in to check
* @return <code>true</code> if the specified plug-in is installed,
* <code>false</code> if not.
*/
public static boolean isPluginInstalled(final String shortName) {
return Jenkins.getActiveInstance().getPlugin(shortName) != null;
}
代码示例来源:origin: com.sonymobile.jenkins.plugins.lenientshutdown/lenientshutdown
/**
* Returns this singleton instance.
*
* @return the singleton.
*/
public static PluginImpl getInstance() {
return Jenkins.getInstance().getPlugin(PluginImpl.class);
}
代码示例来源:origin: jenkinsci/artifactory-plugin
@Override
public boolean isApplicable(Class<? extends AbstractProject> jobType) {
return hudson.model.FreeStyleProject.class.isAssignableFrom(jobType) ||
hudson.matrix.MatrixProject.class.isAssignableFrom(jobType) ||
(Jenkins.getInstance().getPlugin(PluginsUtils.MULTIJOB_PLUGIN_ID) != null &&
com.tikal.jenkins.plugins.multijob.MultiJobProject.class.isAssignableFrom(jobType));
}
代码示例来源:origin: jenkinsci/jobConfigHistory-plugin
/**
* Returns the plugin for tests.
*
* @return plugin
*/
public static JobConfigHistory getPlugin() {
Jenkins jenkins = Jenkins.getInstance();
return jenkins != null ? jenkins.getPlugin(JobConfigHistory.class) : null;
}
代码示例来源:origin: Diabol/delivery-pipeline-plugin
/**
* Returns whether the specified plug-in is installed.
*
* @param shortName
* the plug-in to check
* @return <code>true</code> if the specified plug-in is installed,
* <code>false</code> if not.
*/
public static boolean isPluginInstalled(final String shortName) {
return getInstance().getPlugin(shortName) != null;
}
}
代码示例来源:origin: io.jenkins/configuration-as-code
/**
*
* @return true if the support plugin is installed, false otherwise.
*/
private boolean _hasSupportPluginInstalled() {
return Jenkins.getInstance().getPlugin("configuration-as-code-support") != null;
}
代码示例来源:origin: jenkinsci/parameterized-trigger-plugin
public static boolean isConditionalBuildStepInstalled(){
final hudson.Plugin plugin = Jenkins.getInstance().getPlugin("conditional-buildstep");
return plugin != null ? plugin.getWrapper().isActive() : false;
}
}
代码示例来源:origin: jenkinsci/swarm-plugin
@Restricted(NoExternalUse.class)
public void doDynamic(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
Plugin plugin = Jenkins.getActiveInstance().getPlugin("swarm");
if (plugin != null) {
plugin.doDynamic(req, rsp);
}
}
}
代码示例来源:origin: org.jenkins-ci.plugins/disk-usage
private synchronized boolean startExecution(){
DiskUsagePlugin plugin = Jenkins.getInstance().getPlugin(DiskUsagePlugin.class);
if(!plugin.getConfiguration().isCalculationJobsEnabled())
return false;
return !isExecutingMoreThenOneTimes();
}
代码示例来源:origin: org.jenkins-ci.plugins/disk-usage
public CronTab getCronTab() throws ANTLRException{
String cron = Jenkins.getInstance().getPlugin(DiskUsagePlugin.class).getConfiguration().getCountIntervalForBuilds();
CronTab tab = new CronTab(cron);
return tab;
}
代码示例来源:origin: org.jenkins-ci.plugins/disk-usage
private synchronized boolean startExecution(){
DiskUsagePlugin plugin = Jenkins.getInstance().getPlugin(DiskUsagePlugin.class);
if(!plugin.getConfiguration().isCalculationBuildsEnabled())
return false;
return !isExecutingMoreThenOneTimes();
}
代码示例来源:origin: org.jenkins-ci.plugins/disk-usage
@Override
public CronTab getCronTab() throws ANTLRException {
String cron = Jenkins.getInstance().getPlugin(DiskUsagePlugin.class).getConfiguration().getCountIntervalForWorkspaces();
CronTab tab = new CronTab(cron);
return tab;
}
代码示例来源:origin: org.jenkins-ci.plugins/disk-usage
@Override
public CronTab getCronTab() throws ANTLRException {
String cron = Jenkins.getInstance().getPlugin(DiskUsagePlugin.class).getConfiguration().getCountIntervalForJobs();
CronTab tab = new CronTab(cron);
return tab;
}
代码示例来源:origin: org.jenkins-ci.plugins/disk-usage
public static Long calculateWorkspaceDiskUsageForPath(FilePath workspace, ArrayList<FilePath> exceeded) throws IOException, InterruptedException{
Long diskUsage = 0l;
if(workspace.exists()){
try{
diskUsage = workspace.getChannel().callAsync(new DiskUsageCallable(workspace, exceeded)).get(Jenkins.getInstance().getPlugin(DiskUsagePlugin.class).getConfiguration().getTimeoutWorkspace(), TimeUnit.MINUTES);
}
catch(Exception e){
Logger.getLogger(DiskUsageUtil.class.getName()).log(Level.WARNING, "Disk usage fails to calculate workspace for file path " + workspace.getRemote() + " through channel " + workspace.getChannel(),e);
}
}
return diskUsage;
}
代码示例来源:origin: org.jenkins-ci.plugins/disk-usage
@Override
protected void doRun() throws Exception {
DiskUsagePlugin plugin = Jenkins.getInstance().getPlugin(DiskUsagePlugin.class);
plugin.refreshGlobalInformation();
File jobsDir = new File(Jenkins.getInstance().getRootDir(), "jobs");
Long freeJobsDirSpace = jobsDir.getTotalSpace();
DiskUsageProjectActionFactory.DESCRIPTOR.addHistory(new DiskUsageOvearallGraphGenerator.DiskUsageRecord(plugin.getCashedGlobalBuildsDiskUsage(), plugin.getGlobalSlaveDiskUsageWorkspace(), plugin.getCashedGlobalJobsWithoutBuildsDiskUsage(), freeJobsDirSpace, plugin.getCashedNonSlaveDiskUsageWorkspace()));
DiskUsageProjectActionFactory.DESCRIPTOR.save();
}
内容来源于网络,如有侵权,请联系作者删除!