Search in sources :

Example 16 with PluginWrapper

use of hudson.PluginWrapper in project dependency-check-plugin by jenkinsci.

the class AbstractDependencyCheckBuilder method perform.

/**
 * This method is called whenever the build step is executed.
 */
@Override
public void perform(@Nonnull final Run<?, ?> build, @Nonnull final FilePath filePath, @Nonnull final Launcher launcher, @Nonnull final TaskListener listener) throws InterruptedException, IOException {
    // Determine if the build should be skipped or not
    if (isSkip(build, listener)) {
        build.setResult(Result.SUCCESS);
        return;
    }
    // Get the version of the plugin and print it out
    final PluginWrapper wrapper = Jenkins.getInstance().getPluginManager().getPlugin(DependencyCheckDescriptor.PLUGIN_ID);
    listener.getLogger().println(OUT_TAG + wrapper.getLongName() + " v" + wrapper.getVersion());
    final ClassLoader classLoader = wrapper.classLoader;
    final boolean isMaster = build.getExecutor().getOwner().getNode() == Jenkins.getInstance();
    // Node-agnostic execution of Dependency-Check
    boolean success;
    if (isMaster) {
        success = launcher.getChannel().call(new DependencyCheckExecutor(options, listener, classLoader));
    } else {
        success = launcher.getChannel().call(new DependencyCheckExecutor(options, listener));
    }
    if (success) {
        build.setResult(Result.SUCCESS);
    } else {
        build.setResult(Result.FAILURE);
    }
}
Also used : PluginWrapper(hudson.PluginWrapper)

Example 17 with PluginWrapper

use of hudson.PluginWrapper in project support-core-plugin by jenkinsci.

the class AboutJenkins method addContents.

@Override
public void addContents(@NonNull Container container) {
    List<PluginWrapper> activePlugins = new ArrayList<PluginWrapper>();
    List<PluginWrapper> disabledPlugins = new ArrayList<PluginWrapper>();
    populatePluginsLists(activePlugins, disabledPlugins);
    container.add(new AboutContent(activePlugins));
    container.add(new ItemsContent());
    container.add(new NodesContent());
    container.add(new ActivePlugins(activePlugins));
    container.add(new DisabledPlugins(disabledPlugins));
    container.add(new FailedPlugins());
    container.add(new Dockerfile(activePlugins, disabledPlugins));
    container.add(new MasterChecksumsContent());
    for (final Node node : Jenkins.getInstance().getNodes()) {
        container.add(new NodeChecksumsContent(node));
    }
}
Also used : Node(hudson.model.Node) ArrayList(java.util.ArrayList) PluginWrapper(hudson.PluginWrapper)

Example 18 with PluginWrapper

use of hudson.PluginWrapper in project promoted-builds-plugin by jenkinsci.

the class JobDslPromotionProcessConverter method obtainClassOwnership.

@CheckForNull
private String obtainClassOwnership() {
    if (this.classOwnership != null) {
        return this.classOwnership;
    }
    if (pm == null) {
        Jenkins j = Jenkins.getInstanceOrNull();
        pm = j != null ? j.getPluginManager() : null;
    }
    if (pm == null) {
        return null;
    }
    // TODO: possibly recursively scan super class to discover dependencies
    PluginWrapper p = pm.whichPlugin(hudson.plugins.promoted_builds.PromotionProcess.class);
    this.classOwnership = p != null ? p.getShortName() + '@' + trimVersion(p.getVersion()) : null;
    return this.classOwnership;
}
Also used : Jenkins(jenkins.model.Jenkins) PluginWrapper(hudson.PluginWrapper) CheckForNull(javax.annotation.CheckForNull)

Example 19 with PluginWrapper

use of hudson.PluginWrapper in project promoted-builds-plugin by jenkinsci.

the class GroovyConditionDescriptor method isApplicable.

@Override
public boolean isApplicable(final AbstractProject<?, ?> item) {
    final PluginManager pluginManager = Jenkins.get().getPluginManager();
    final PluginWrapper plugin = pluginManager.getPlugin("script-security");
    return plugin != null && plugin.isActive();
}
Also used : PluginManager(hudson.PluginManager) PluginWrapper(hudson.PluginWrapper)

Aggregations

PluginWrapper (hudson.PluginWrapper)19 BaseTest (io.jenkins.blueocean.service.embedded.BaseTest)5 Test (org.junit.Test)5 ArrayList (java.util.ArrayList)4 File (java.io.File)3 JSONObject (net.sf.json.JSONObject)3 IOException (java.io.IOException)2 InputStream (java.io.InputStream)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2 CheckForNull (javax.annotation.CheckForNull)2 Jenkins (jenkins.model.Jenkins)2 PluginManager (hudson.PluginManager)1 Initializer (hudson.init.Initializer)1 Node (hudson.model.Node)1 DescriptorImpl (hudson.node_monitors.ArchitectureMonitor.DescriptorImpl)1 IOException2 (hudson.util.IOException2)1 BlueExtensionClassContainer (io.jenkins.blueocean.rest.model.BlueExtensionClassContainer)1 BufferedReader (java.io.BufferedReader)1 InputStreamReader (java.io.InputStreamReader)1