Class LibraryResolver
java.lang.Object
org.jenkinsci.plugins.workflow.libs.LibraryResolver
- All Implemented Interfaces:
ExtensionPoint
- Direct Known Subclasses:
FolderLibraries.ForJob,GlobalLibraries.ForJob,GlobalUntrustedLibraries.ForJob
Allows a provider of libraries to indicate which libraries should be visible to a given job.
-
Nested Class Summary
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract Collection<LibraryConfiguration>Check for libraries visible to a given job.fromConfiguration(org.kohsuke.stapler.StaplerRequest2 request) A list of libraries that may have already been configured in this context.abstract booleanWhether these libraries should be run outside the sandbox.suggestedConfigurations(ItemGroup<?> group) A list of libraries that might be visible in a given location.
-
Constructor Details
-
LibraryResolver
public LibraryResolver()
-
-
Method Details
-
isTrusted
public abstract boolean isTrusted()Whether these libraries should be run outside the sandbox. -
forJob
@NonNull public abstract Collection<LibraryConfiguration> forJob(@NonNull Job<?, ?> job, @NonNull Map<String, String> libraryVersions) Check for libraries visible to a given job.An implementation may ignore the
libraryVersionsparameter and simply list configured libraries visible to the job; the caller will select which libraries to actually load, taking into accountLibraryConfiguration.isImplicit(). Or it may dynamically generate library configurations by matching library names against some predefined pattern.By returning a library with a matching
name, this resolver “claims” that entry oflibraryVersions; subsequent resolvers will not be offered that entry. It is an error if no resolver claims a given entry. Multiple resolvers might return a library of a given name if the libraries are implicit, in which case only the first will be loaded.- Parameters:
job- a joblibraryVersions- libraries explicitly requested in the job, as a map fromLibraryConfiguration.getName()to version or null; may be empty- Returns:
- a possibly empty collection of associated libraries
-
fromConfiguration
@NonNull public Collection<LibraryConfiguration> fromConfiguration(@NonNull org.kohsuke.stapler.StaplerRequest2 request) A list of libraries that may have already been configured in this context. Implementations should only return libraries that the current user has permission to configure in this context.- Parameters:
request- a web request- Returns:
- known libraries, if any (empty by default)
-
suggestedConfigurations
@NonNull public Collection<LibraryConfiguration> suggestedConfigurations(@NonNull ItemGroup<?> group) A list of libraries that might be visible in a given location. Typically would be the same asforJob(hudson.model.Job<?, ?>, java.util.Map<java.lang.String, java.lang.String>)applied toAbstractItem.getParent(). If a resolver can dynamically generate library configurations, it can simply return one or more examples here.- Parameters:
group- Jenkins root or some folder- Returns:
- any suggested libraries (empty by default)
-