/** * * @return true if the support plugin is installed, false otherwise. */ private boolean _hasSupportPluginInstalled() { return Jenkins.getInstance().getPlugin("configuration-as-code-support") != null; }
/** * 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)); } } }
final Plugin plugin = jenkins.getPlugin(p.shortname); if (plugin != null) {
@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()); }
@CheckForNull static GitlabMergeRequestPlugin get() { Jenkins instance = Jenkins.getInstance(); return instance == null ? null : instance.getPlugin(GitlabMergeRequestPlugin.class); }
/** * 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; }
/** * Returns this singleton instance. * * @return the singleton. */ public static PluginImpl getInstance() { return Jenkins.getInstance().getPlugin(PluginImpl.class); }
@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)); }
/** * Returns the plugin for tests. * * @return plugin */ public static JobConfigHistory getPlugin() { Jenkins jenkins = Jenkins.getInstance(); return jenkins != null ? jenkins.getPlugin(JobConfigHistory.class) : null; }
/** * 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; } }
/** * * @return true if the support plugin is installed, false otherwise. */ private boolean _hasSupportPluginInstalled() { return Jenkins.getInstance().getPlugin("configuration-as-code-support") != null; }
public static boolean isConditionalBuildStepInstalled(){ final hudson.Plugin plugin = Jenkins.getInstance().getPlugin("conditional-buildstep"); return plugin != null ? plugin.getWrapper().isActive() : false; } }
@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); } } }
private synchronized boolean startExecution(){ DiskUsagePlugin plugin = Jenkins.getInstance().getPlugin(DiskUsagePlugin.class); if(!plugin.getConfiguration().isCalculationJobsEnabled()) return false; return !isExecutingMoreThenOneTimes(); }
public CronTab getCronTab() throws ANTLRException{ String cron = Jenkins.getInstance().getPlugin(DiskUsagePlugin.class).getConfiguration().getCountIntervalForBuilds(); CronTab tab = new CronTab(cron); return tab; }
private synchronized boolean startExecution(){ DiskUsagePlugin plugin = Jenkins.getInstance().getPlugin(DiskUsagePlugin.class); if(!plugin.getConfiguration().isCalculationBuildsEnabled()) return false; return !isExecutingMoreThenOneTimes(); }
@Override public CronTab getCronTab() throws ANTLRException { String cron = Jenkins.getInstance().getPlugin(DiskUsagePlugin.class).getConfiguration().getCountIntervalForWorkspaces(); CronTab tab = new CronTab(cron); return tab; }
@Override public CronTab getCronTab() throws ANTLRException { String cron = Jenkins.getInstance().getPlugin(DiskUsagePlugin.class).getConfiguration().getCountIntervalForJobs(); CronTab tab = new CronTab(cron); return tab; }
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; }
@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(); }