Class Jenkins
- All Implemented Interfaces:
ExtensionPoint,Describable<Node>,DescriptorByNameOwner,ItemGroup<TopLevelItem>,ModelObject,ModifiableItemGroup<TopLevelItem>,ModifiableViewGroup,PersistenceRoot,ReconfigurableDescribable<Node>,Saveable,ViewGroup,SearchableModelObject,SearchItem,AccessControlled,DirectlyModifiableTopLevelItemGroup,FullyNamed,FullyNamedModelObject,Loadable,ModelObjectWithChildren,ModelObjectWithContextMenu,ModifiableTopLevelItemGroup,OnMaster,org.kohsuke.stapler.StaplerFallback,org.kohsuke.stapler.StaplerProxy
- Direct Known Subclasses:
Hudson
- Author:
- Kohsuke Kawaguchi
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic final classstatic classstatic interfaceHook for a test harness to intercept Jenkins.get() Do not use in the production code as the signature may change.static classstatic classNested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudsonNested classes/interfaces inherited from interface jenkins.model.ModelObjectWithContextMenu
ModelObjectWithContextMenu.ContextMenu, ModelObjectWithContextMenu.ContextMenuVisibility, ModelObjectWithContextMenu.MenuItem, ModelObjectWithContextMenu.MenuItemType -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Permissionfinal List<AdministrativeMonitor> AdministrativeMonitors installed on this system.Extension list thatdoResources(StaplerRequest2, StaplerResponse2)can serve.static final AuthenticationDeprecated.static final org.springframework.security.core.AuthenticationAuthenticationobject that represents the anonymous user.static booleanAutomatically try to launch an agent when Jenkins is initialized or a new agent computer is created.static Stringfinal Hudson.CloudListActiveClouds.protected final ConcurrentMap<Node, Computer> Computers in this Jenkins system.static booleanDeprecated.as of 1.464 This flag will have no effect.static intThe amount of time by which to extend the startup notification timeout as each initialization milestone is attained.static booleanDeprecated.No longer used.static booleanLive view of recentLogRecords produced by Jenkins.final LookupStores various objects scoped toJenkins.static final PermissionThis permission grants access to parts of the Jenkins system configuration.static final Permission[]static final StringName of the system property escape hatch for SECURITY-2424.final OverallLoadStatisticsLoad statistics of the entire system.final NodeProvisionerDeprecated.as of 1.467 UseunlabeledNodeProvisioner.static booleanstatic final PermissionGroupfinal PluginManagerLoaded plugins.HTTP proxy configuration.static final Permissionstatic StringPrefix to static resources like images and javascripts in the war file.final FileRoot directory of the system.static final PermissionDeprecated.in Jenkins 2.222 useADMINISTERinsteadfinal javax.servlet.ServletContextDeprecated.static StringUnique random token that identifies the current session.protected NodeListDeprecated.in favour ofNodesstatic final PermissionAllows read-only access to large parts of the system configuration.static final StringThe version number before it is "computed" (by a call to computeVersion()).final LoadStatisticsLoad statistics of the free roaming jobs and agents.final NodeProvisionerNodeProvisionerthat reacts tounlabeledLoad.static StringVersion number of this Jenkins.static StringHash ofVERSION.static StringPrefix to resources alongside view scripts.static final com.thoughtworks.xstream.XStreamThread-safe reusableXStream.static final XStream2Fields inherited from class hudson.model.AbstractCIBase
LOG_STARTUP_PERFORMANCEFields inherited from class hudson.model.Node
holdOffLaunchUntilSave, SKIP_BUILD_CHECK_ON_FLYWEIGHTS -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedprotectedJenkins(File root, jakarta.servlet.ServletContext context, PluginManager pluginManager) -
Method Summary
Modifier and TypeMethodDescriptionstatic void_doScript(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp, jakarta.servlet.RequestDispatcher view, hudson.remoting.VirtualChannel channel, ACL acl) static void_doScript(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp, javax.servlet.RequestDispatcher view, hudson.remoting.VirtualChannel channel, ACL acl) _getFingerprint(String md5sum) Gets aFingerprintobject if it exists.<I extends TopLevelItem>
IAdds an item to this group.voidAdds one moreNodeto Jenkins.voidbooleancanAdd(TopLevelItem item) Returns true if a particular item may be added to this group.booleanDetermine whether a view may be deleted.checkDisplayName(String displayName, TopLevelItem item) Checks to see if the candidate displayName collides with any existing display names or project names in the items parent groupstatic voidcheckGoodName(String name) Check if the given name is suitable as a name for job, view, etc.voidcleanUp()Called to shut down the system.<T extends TopLevelItem>
TCopies a job.createLauncher(TaskListener listener) Returns aLauncherfor executing programs on this node.createPath(String absolutePath) Gets theFilePathon this node.createProject(TopLevelItemDescriptor type, String name) createProject(TopLevelItemDescriptor type, String name, boolean notify) Creates a new job.<T extends TopLevelItem>
TcreateProject(Class<T> type, String name) Creates a new job.createProjectFromXML(String name, InputStream xml) Creates a new job from its configuration XML.voiddeleteView(View view) Deletes a view in this group.voidorg.kohsuke.stapler.HttpRedirectCancel previous quiet down Jenkins - preparation for a restartdoCheckDisplayName(String displayName, String jobName) doCheckURIEncoding(org.kohsuke.stapler.StaplerRequest2 request) Deprecated.doCheckViewName(String value) Checks if a top-level view with the given name exists and make sure that the name is good as a view name.doChildrenContextMenu(org.kohsuke.stapler.StaplerRequest2 request, org.kohsuke.stapler.StaplerResponse2 response) Generates the context menu to list up all the children.voiddoClassicThreadDump(org.kohsuke.stapler.StaplerResponse2 rsp) Backward compatibility.voiddoConfigExecutorsSubmit(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) Accepts submission from the node configuration page.voiddoConfigSubmit(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) Accepts submission from the configuration page.doContextMenu(org.kohsuke.stapler.StaplerRequest2 request, org.kohsuke.stapler.StaplerResponse2 response) Generates the context menu.doCreateItem(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) The request format follows that of<n:form xmlns:n="/lib/form">.voiddoCreateView(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) doDefaultJDKCheck(org.kohsuke.stapler.StaplerRequest2 request, String value) If the user chose the default JDK, make sure we got 'java' in PATH.voiddoDoFingerprintCheck(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) Do a finger-print check.voiddoEval(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) Evaluates the Jelly script submitted by the client.voiddoExit(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) Shutdown the system.voiddoFingerprintCleanup(org.kohsuke.stapler.StaplerResponse2 rsp) voiddoGc(org.kohsuke.stapler.StaplerResponse2 rsp) For debugging.voiddoIconSize(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) Changes the icon size by changing the cookiedoJnlpJars(org.kohsuke.stapler.StaplerRequest2 req) voiddoLoginEntry(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) Called once the user logs in.voiddoLogout(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) Logs out the user.voiddoLogout(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) Deprecated.org.kohsuke.stapler.HttpRedirectorg.kohsuke.stapler.HttpRedirectdoQuietDown(boolean block, int timeout) Deprecated.since 2.267; usedoQuietDown(boolean, int, String, boolean)instead.org.kohsuke.stapler.HttpRedirectdoQuietDown(boolean block, int timeout, String message) Deprecated.usedoQuietDown(boolean, int, String, boolean)instead.org.kohsuke.stapler.HttpRedirectdoQuietDown(boolean block, int timeout, String message, boolean safeRestart) Quiet down Jenkins - preparation for a restartorg.kohsuke.stapler.HttpResponsedoReload()Reloads the configuration.voiddoResources(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) Serves static resources placed along with Jelly view files.voiddoRestart(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) Perform a restart of Jenkins, if we can.org.kohsuke.stapler.HttpResponsedoSafeExit(org.kohsuke.stapler.StaplerRequest req) Deprecated.org.kohsuke.stapler.HttpResponsedoSafeExit(org.kohsuke.stapler.StaplerRequest2 req) Shutdown the system safely.org.kohsuke.stapler.HttpResponsedoSafeRestart(org.kohsuke.stapler.StaplerRequest req) Deprecated.usedoSafeRestart(StaplerRequest2, String)instead.org.kohsuke.stapler.HttpResponsedoSafeRestart(org.kohsuke.stapler.StaplerRequest2 req, String message) Queues up a safe restart of Jenkins.org.kohsuke.stapler.HttpResponsedoSafeRestart(org.kohsuke.stapler.StaplerRequest req, String message) Deprecated.voiddoScript(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) For system diagnostics.voiddoScript(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) Deprecated.voiddoScriptText(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) Run arbitrary Groovy script and return result as plain text.voiddoScriptText(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) Deprecated.voiddoSecured(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) Checks if the user was successfully authenticated.voiddoSignup(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) Sign up for the user account.voidSimulates OutOfMemoryError.voiddoSubmitDescription(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) Accepts the new description.voiddoTestPost(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) org.kohsuke.stapler.HttpResponseBinds /userContent/...doViewExistsCheck(String value) Deprecated.1.512voiddoWorkspaceCleanup(org.kohsuke.stapler.StaplerResponse2 rsp) static StringexpandVariablesForDirectory(String base, String itemFullName, String itemRootDir) voidgenerateNotFoundResponse(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) Serve a custom 404 error page, configured in web.xml.static Jenkinsget()Gets theJenkinssingleton.getACL()Returns the rootACL.Returns the transientActions associated with the top page.Returns the enabled and activated administrative monitors accessible to the current user.static JenkinsDeprecated.This is a verbose historical alias forget().org.kohsuke.stapler.framework.adjunct.AdjunctManagergetAdjuncts(String dummy) MakesAdjunctManagerURL-bound.BindsAdministrativeMonitors to URL.Returns the enabled agent protocols.Obtains the thread dump of all agents (including the controller/built-in node.)getApi()static AuthenticationDeprecated.static org.springframework.security.core.AuthenticationGets theAuthenticationobject that represents the user associated with the current request.getBuildDirFor(Job job) getBuilder(String shortClassName) Gets the builder descriptor by name.getBuildWrapper(String shortClassName) Gets the build wrapper descriptor by name.Estimates the clock difference with this agent.hudson.remoting.Callable<ClockDifference, IOException> Returns aCallablethat when run on the channel, estimates the clock difference.getCloud()Only there to bind to /cloud/ URL.Deprecated.UI method.getComputer(String name) protected ConcurrentMap<Node, Computer> Computer[]Gets the read-only list of allComputers.protected XmlFileThe file we save our configuration.Exported alias forJenkinsLocationConfiguration.getUrl().Gets theCrumbIssuercurrently in use.Gets the descriptor for this instance.getDescriptor(Class<? extends Describable> type) Gets theDescriptorthat corresponds to the givenDescribabletype.getDescriptor(String id) ExposesDescriptorby its name to URL.Alias forgetDescriptor(String).<T extends Descriptor>
TgetDescriptorByType(Class<T> type) Gets theDescriptorinstance in the current Jenkins by its type.<T extends Describable<T>,D extends Descriptor<T>>
DescriptorExtensionList<T, D> getDescriptorList(Class<T> type) ReturnsExtensionListthat retains the discoveredDescriptorinstances for the given kind ofDescribable.getDescriptorOrDie(Class<? extends Describable> type) Works just likegetDescriptor(Class)but don't take no for an answer.getDynamic(String token) <T> ExtensionList<T> getExtensionList(Class<T> extensionType) ReturnsExtensionListthat retains the discovered instances for the given extension type.getExtensionList(String extensionType) Deprecated.This is no longer supported.getFingerprint(String md5sum) Works likeModelObject.getDisplayName()but return the full path that includes all the display names of the ancestors in an unspecified format.Returns the full name of this object, which is a qualified name that includes the names of all its ancestors, separated by '/'.Obtains the heap dump.Gets the initialization milestone that we've already reached.com.google.inject.InjectorGets the dependency injection container that hosts all the extension implementations and other components in Jenkins.Get the Jenkinsinstall state.static JenkinsDeprecated.This is a historical alias forgetInstanceOrNull()but with ambiguous nullability.static JenkinsGets theJenkinssingleton.Gets theIteminside this group that has a given name, or null if it does not exist.final ItemGets the item by its path name from the given contextfinal <T extends Item>
Tfinal <T extends Item>
TgetItemByFullName(String fullName) <T extends Item>
TgetItemByFullName(String fullName, Class<T> type) Gets theItemobject by its full name.Returns theItemGroupfrom which the views in this group should render items.Returns the read-only view of all theTopLevelItems keyed by their names.getItems()Gets just the immediate children ofJenkins.<T> List<T> Gets just the immediate children ofJenkinsbut of the given type.getItems(Predicate<TopLevelItem> pred) Gets just the immediate children ofJenkinsbased on supplied predicate.Gets the JDK installation of the given name, or returns null.getJDKs()getJnlpJars(String fileName) Serves jar files for inbound agents.Gets the names of all theJobs.getJobProperty(String shortClassName) Gets theJobPropertyDescriptorby name.Gets the label that exists on this system by the name.getLabelAtom(String name) Returns the label atom of the given name.Gets all the active labels in the current system.Returns the manually configured label for a node.Returns the unique identifier of this Jenkins that has been historically used to identify this Jenkins to the outside world.getLog()For bindingLogRecorderManagerto "/log".Gets the markup formatter used in the system.getMe()Exposes the current user to/meURL.getMode()ReturnsNode.Mode.EXCLUSIVEif this node is only available for those jobs that exclusively specifies this node as the assigned node.Deprecated.Gets the agent node of the give name, hooked under this Jenkins.Human-readable description of this node.Gets theNodePropertyinstances configured for thisNode.getNodes()intReturns the number ofExecutors.getOrLoadNode(String nodeName) <P extends Plugin>
PGets the plugin object from its class.Gets the plugin object from its short name.getPlugins(Class<P> clazz) Gets the plugin objects from their super-class.Returns the primaryViewthat renders the top-page of Jenkins.The strategy used to check the project names.Deprecated.This method will ignore Maven and matrix projects, as well as projects inside containers such as folders.getProxy()Retrieve the proxy configuration.getPublisher(String shortClassName) Gets the publisher descriptor by name.getQueue()Returns quiet down reason if it was indicated.intGets the system default quiet period.getRepositoryBrowser(String shortClassName) Gets the repository browser descriptor by name.getRetentionStrategy(String shortClassName) Gets the retention strategy descriptor by name.Gets the root directory on the file system that thisItemcan use freely for storing the configuration data.getRootDirFor(TopLevelItem child) Assigns theroot directoryfor children.Gets the root directory of this node.Gets the absolute URL of Jenkins, such ashttp://localhost/jenkins/.Gets the absolute URL of Jenkins top page, such ashttp://localhost/jenkins/.Gets the SCM descriptor by name.intGets the global SCM check out retry count.Deprecated.UseSCMListener.all()instead.Returns the URL of this item relative to the parentSearchItem.Deprecated.Due to the past security advisory, this value should not be used any more to protect sensitive information.Deprecated.SeegetSecretKey().Returns the constant that captures the three basic security modes in Jenkins.getSecurityRealms(String shortClassName) Gets theSecurityRealmdescriptors by name.Gets the special label that represents this node itself.jakarta.servlet.ServletContextIf set, a currently active setup wizard - e.g.intFallback to the primary view.static hudson.util.VersionNumberGet the stored version of Jenkins, as stored bydoConfigSubmit(org.kohsuke.stapler.StaplerRequest2, org.kohsuke.stapler.StaplerResponse2).Synonym forgetDescription().Gets the names of all theTopLevelItems.getTrigger(String shortClassName) Gets the trigger descriptor by name.Gets a list of unprotected root actions.Gets the URL token that prefixes the URLs for childItems.Gets the user of the given name.static hudson.util.VersionNumberParsesVERSIONintoVersionNumber, or null if it's not parseable as a version number (such as when Jenkins is run withmvn jetty:run)Gets a view by the specified name.Returns actions that should be displayed in views.getViews()Gets the read-only list of allViews.Gets the TabBar for the views.Gets theWidgets registered on this object.getWorkspaceFor(TopLevelItem item) Returns a "workspace" directory for the givenTopLevelItem.static booleanDeprecated.booleanIf the configured buildsDir has it's default value or has been changed.booleanIf usage statistics has been disabledbooleanReturns if the quietingDown is a safe restart.booleanReturns true if Jenkins is quieting down.booleanIs Jenkins running in HTTPS? Note that we can't really trustServletRequest.isSecure()because HTTPS might be terminated in the reverse proxy.booleanbooleanisSubjectToMandatoryReadPermissionCheck(String restOfPath) Test a path to see if it is subject to mandatory read permission checks by container-managed securitybooleanReturns true if the container initiated the termination of the web application.booleanisUpgradedFromBefore(hudson.util.VersionNumber v) Returns true if the current running Jenkins is upgraded from a version earlier than the specified version.booleanIf usage statistics are being collectedbooleanIf true, all the POST requests to Jenkins would have to have crumb in it to protect Jenkins from CSRF vulnerabilities.booleanbooleanA convenience method to check if there's some security restrictions in place.voidload()Loads the state of this object from disk.voidstatic <T> TShortcut forJenkins.getInstanceOrNull()?.lookup.get(type)Default implementation that returns empty index.voidonDeleted(TopLevelItem item) Called in response toAbstractItem.doDoDelete(StaplerRequest2, StaplerResponse2)voidonRenamed(TopLevelItem job, String oldName, String newName) Called byJob.renameTo(String)to update relevant data structure.voidonViewRenamed(View view, String oldName, String newName) Viewcalls this method when it's renamed.voidputItem(TopLevelItem item) Overwrites the existing item by new one.protected ObjectMaintains backwards compatibility.voidRebuilds the dependency map.Rebuilds the dependency map asynchronously.voidRefreshExtensionLists by adding all the newly discovered extensions.voidreload()Reloads the configuration synchronously.voidremove(TopLevelItem item) Removes an item from this group.voidremoveNode(Node n) Removes aNodefrom Jenkins.voidrestart()Performs a restart.voidDeprecated.usesafeRestart(String)instead.voidsafeRestart(String message) Queues up a restart to be performed once there are no builds currently running.voidsave()Save the settings to a file.voidsetAgentProtocols(Set<String> protocols) Deprecated.No longer does anything.voidSets a new authorization strategy.voidsetCrumbIssuer(CrumbIssuer issuer) voidsetDisableRememberMe(boolean disableRememberMe) voidsetInstallState(InstallState newState) Update the current install state.voidsetJDKs(Collection<? extends JDK> jdks) Replaces all JDK installations with those from the given collection.voidsetLabelString(String label) Sets the label string for a node.voidsetLog(LogRecorderManager log) Set the LogRecorderManager.voidSets the markup formatter used in the system globally.voidvoidsetMyViewsTabBar(MyViewsTabBar myViewsTabBar) Deprecated.voidsetNodeName(String name) voidvoidsetNoUsageStatistics(Boolean noUsageStatistics) Sets the noUsageStatistics flagvoidsetNumExecutors(int n) Sets a number of executors.voidvoidvoidsetProxy(ProxyConfiguration proxy) Set the proxy configuration.voidsetQuietPeriod(Integer quietPeriod) Sets the global quiet period.voidsetRawBuildsDir(String buildsDir) voidsetScmCheckoutRetryCount(int scmCheckoutRetryCount) voidsetSecurityRealm(SecurityRealm securityRealm) Sets a security realm.voidsetSlaveAgentPort(int port) voidsetSystemMessage(String message) Sets the system message.voidsetViews(Collection<View> views) Completely replaces views.voidsetViewsTabBar(ViewsTabBar viewsTabBar) booleantryGetLabelAtom(String name) Returns the label atom of the given name, only if it already exists.voidunloadNode(Node n) Unload a node from Jenkins without touching its configuration file.protected voidUpdate the list of computers that are running on this Jenkins instance.protected voidupdateComputers(Node... nodes) Update the computers for the given nodes.protected voidbooleanupdateNode(Node n) Saves an existingNodeon disk, called byNode.save().Methods inherited from class hudson.model.AbstractCIBase
getDisabledAdministrativeMonitors, getNodeName, getUrl, interruptReloadThread, resetLabel, setDisabledAdministrativeMonitors, setViewOwner, updateComputerList, updateNewComputerMethods inherited from class hudson.model.Node
canTake, canTake, drainLabelsToTrim, getAssignedLabels, getChannel, getFileSystemProvisioner, getLabelCloud, getNodeProperty, getNodeProperty, getNodePropertyDescriptors, getTemporaryOfflineCause, isAcceptingTasks, isHoldOffLaunchUntilSave, onLoad, reconfigure, reconfigure, toComputerMethods inherited from class hudson.model.AbstractModelObject
getSearch, getSearchIndex, getSearchName, requirePOST, sendError, sendError, sendError, sendError, sendError, sendError, sendError, sendErrorMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface hudson.security.AccessControlled
checkAnyPermission, checkPermission, hasAnyPermission, hasPermission, hasPermission, hasPermission2Methods inherited from interface hudson.model.ItemGroup
allItems, allItems, allItems, getAllItems, getAllItems, getAllItems, getItemName, getItemsStream, getItemsStream, getUrlMethods inherited from interface jenkins.model.ModelObjectWithChildren
doChildrenContextMenuMethods inherited from interface jenkins.model.ModelObjectWithContextMenu
doContextMenuMethods inherited from interface hudson.model.ModifiableItemGroup
doCreateItemMethods inherited from interface hudson.search.SearchItem
getSearchGroup, getSearchIconMethods inherited from interface hudson.model.ViewGroup
getAllViews, getUrl, getUserViewsTabBar
-
Field Details
-
lookup
Stores various objects scoped toJenkins. -
root
Root directory of the system. -
computers
Computers in this Jenkins system. Read-only. -
clouds
ActiveClouds. -
slaves
Deprecated.in favour ofNodesLegacy store of the set of installed cluster nodes. -
pluginManager
Loaded plugins. -
tcpSlaveAgentListener
-
overallLoad
Load statistics of the entire system. This includes every executor and every job in the system. -
unlabeledLoad
Load statistics of the free roaming jobs and agents. This includes all executors onNode.Mode.NORMALnodes and jobs that do not have any assigned nodes.- Since:
- 1.467
-
unlabeledNodeProvisioner
NodeProvisionerthat reacts tounlabeledLoad.- Since:
- 1.467
-
overallNodeProvisioner
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) @Deprecated public final transient NodeProvisioner overallNodeProvisionerDeprecated.as of 1.467 UseunlabeledNodeProvisioner. This was broken because it was tracking all the executors in the system, but it was only tracking free-roaming jobs in the queue. SoCloudfails to launch nodes when you have some exclusive agents and free-roaming jobs in the queue. -
servletContext
Deprecated. -
administrativeMonitors
AdministrativeMonitors installed on this system.- See Also:
-
proxy
HTTP proxy configuration. -
ALLOWED_RESOURCE_EXTENSIONS
Extension list thatdoResources(StaplerRequest2, StaplerResponse2)can serve. This set is mutable to allow plugins to add additional extensions. -
logRecords
Live view of recentLogRecords produced by Jenkins. -
XSTREAM
public static final com.thoughtworks.xstream.XStream XSTREAMThread-safe reusableXStream. -
XSTREAM2
-
UNCOMPUTED_VERSION
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public static final String UNCOMPUTED_VERSIONThe version number before it is "computed" (by a call to computeVersion()).- Since:
- 2.0
- See Also:
-
VERSION
Version number of this Jenkins. -
CHANGELOG_URL
-
VERSION_HASH
Hash ofVERSION. -
SESSION_HASH
Unique random token that identifies the current session. Used to makeRESOURCE_PATHunique so that we can set long "Expires" header. We used to useVERSION_HASH, but making this session local allows us to reuse the sameRESOURCE_PATHfor static resources in plugins. -
RESOURCE_PATH
Prefix to static resources like images and javascripts in the war file. Either "" or strings like "/static/VERSION", which avoids Jenkins to pick up stale cache when the user upgrades to a different version.Value computed in
WebAppMain. -
VIEW_RESOURCE_PATH
Prefix to resources alongside view scripts. Strings like "/resources/VERSION", which avoids Jenkins to pick up stale cache when the user upgrades to a different version.Value computed in
WebAppMain. -
PARALLEL_LOAD
public static boolean PARALLEL_LOAD -
KILL_AFTER_LOAD
public static boolean KILL_AFTER_LOAD -
FLYWEIGHT_SUPPORT
Deprecated.No longer used. -
CONCURRENT_BUILD
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) @Deprecated public static boolean CONCURRENT_BUILDDeprecated.as of 1.464 This flag will have no effect.Tentative switch to activate the concurrent build behavior. When we merge this back to the trunk, this allows us to keep this feature hidden for a while until we iron out the kinks.- See Also:
-
NAME_VALIDATION_REJECTS_TRAILING_DOT_PROP
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public static final String NAME_VALIDATION_REJECTS_TRAILING_DOT_PROPName of the system property escape hatch for SECURITY-2424. It allows to have back the legacy (and vulnerable) behavior allowing a "good name" to end with a dot. This could be used to exploit two names colliding in the file system to extract information. The files ending with a dot are only a problem on Windows. The default value is true. For detailed documentation: Support for Whitespace characters in File and Folder names for Windows- See Also:
-
AUTOMATIC_AGENT_LAUNCH
public static boolean AUTOMATIC_AGENT_LAUNCHAutomatically try to launch an agent when Jenkins is initialized or a new agent computer is created. -
EXTEND_TIMEOUT_SECONDS
public static int EXTEND_TIMEOUT_SECONDSThe amount of time by which to extend the startup notification timeout as each initialization milestone is attained. -
PERMISSIONS
-
ADMINISTER
-
MANAGE
This permission grants access to parts of the Jenkins system configuration.Only features that won't have an impact on Jenkins' overall security and stability should have their permission requirement lowered from
ADMINISTERtoMANAGE. For example, many scripting and code execution features (e.g., configuring master agents, paths to tools on master, etc.) are unsafe to make available to users with only this permission, as they could be used to bypass permission enforcement and elevate permissions.This permission is disabled by default and support for it considered experimental. Administrators can set the system property
jenkins.security.ManagePermissionto enable it.- Since:
- 2.222
-
SYSTEM_READ
Allows read-only access to large parts of the system configuration. When combined withMANAGE, it is expected that everything is shown as if onlySYSTEM_READwas granted, but that only options editable by users withMANAGEare editable. -
MANAGE_AND_SYSTEM_READ
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public static final Permission[] MANAGE_AND_SYSTEM_READ -
READ
-
RUN_SCRIPTS
Deprecated.in Jenkins 2.222 useADMINISTERinstead -
ANONYMOUS2
public static final org.springframework.security.core.Authentication ANONYMOUS2Authenticationobject that represents the anonymous user. Because Spring Security creates its ownAnonymousAuthenticationTokeninstances, the code must not expect the singleton semantics. This is just a convenient instance.- Since:
- 2.266
-
ANONYMOUS
Deprecated.useANONYMOUS2- Since:
- 1.343
-
-
Constructor Details
-
Jenkins
protected Jenkins(File root, jakarta.servlet.ServletContext context) throws IOException, InterruptedException, org.jvnet.hudson.reactor.ReactorException - Throws:
IOExceptionInterruptedExceptionorg.jvnet.hudson.reactor.ReactorException
-
Jenkins
protected Jenkins(File root, jakarta.servlet.ServletContext context, PluginManager pluginManager) throws IOException, InterruptedException, org.jvnet.hudson.reactor.ReactorException - Parameters:
pluginManager- If non-null, use existing plugin manager. create a new one.- Throws:
IOExceptionInterruptedExceptionorg.jvnet.hudson.reactor.ReactorException
-
-
Method Details
-
loadNode
@Restricted(org.kohsuke.accmod.restrictions.Beta.class) public void loadNode(File dir) throws IOException - Throws:
IOException
-
getServletContext
public jakarta.servlet.ServletContext getServletContext()- Since:
- 2.475
-
get
Gets theJenkinssingleton.- Returns:
Jenkinsinstance- Throws:
IllegalStateException- for the reasons thatgetInstanceOrNull()might return null- Since:
- 2.98
-
getActiveInstance
Deprecated.This is a verbose historical alias forget().- Throws:
IllegalStateException- Since:
- 1.590
-
getInstanceOrNull
Gets theJenkinssingleton.get()is what you normally want.In certain rare cases you may have code that is intended to run before Jenkins starts or while Jenkins is being shut down. For those rare cases use this method.
In other cases you may have code that might end up running on a remote JVM and not on the Jenkins controller or built-in node. For those cases you really should rewrite your code so that when the
Callableis sent over the remoting channel it can do whatever it needs without ever referring toJenkins; for example, gather any information you need on the controller side before constructing the callable. If you must do a runtime check whether you are in the controller or agent, useJenkinsJVMrather than this method, as merely loading theJenkinsclass file into an agent JVM can cause linkage errors under some conditions.- Returns:
- The instance. Null if the
Jenkinsservice has not been started, or was already shut down, or we are running on an unrelated JVM, typically an agent. - Since:
- 1.653
-
getInstance
Deprecated.This is a historical alias forgetInstanceOrNull()but with ambiguous nullability. Useget()in typical cases. -
readResolve
Maintains backwards compatibility. Invoked by XStream when this object is de-serialized. -
getProxy
Retrieve the proxy configuration.- Returns:
- the proxy configuration
- Since:
- 2.205
-
setProxy
Set the proxy configuration.- Parameters:
proxy- the proxy to set- Since:
- 2.205
-
getInstallState
Get the Jenkinsinstall state.- Returns:
- The Jenkins
install state.
-
setInstallState
Update the current install state. This will invoke state.initializeState() when the state has been transitioned. -
getTcpSlaveAgentListener
-
getAdjuncts
MakesAdjunctManagerURL-bound. The dummy parameter allows us to use different URLs for the same adjunct, for proper cache handling. -
getSlaveAgentPort
@Exported public int getSlaveAgentPort() -
isSlaveAgentPortEnforced
public boolean isSlaveAgentPortEnforced()- Since:
- 2.24
-
setSlaveAgentPort
- Parameters:
port- 0 to indicate random available TCP port. -1 to disable this service.- Throws:
IOException
-
getAgentProtocols
Returns the enabled agent protocols.- Returns:
- the enabled agent protocols.
- Since:
- 2.16
-
setAgentProtocols
Deprecated.No longer does anything. -
setNodeName
Description copied from class:NodeWhen the user clones aNode, Hudson uses this method to change the node name right after the clonedNodeobject is instantiated.This method is never used for any other purpose, and as such for all practical intents and purposes, the node name should be treated like immutable.
- Specified by:
setNodeNamein classNode
-
getNodeDescription
Description copied from class:NodeHuman-readable description of this node.- Specified by:
getNodeDescriptionin classNode
-
getDescription
-
getPluginManager
-
getUpdateCenter
-
isNoUsageStatistics
If usage statistics has been disabled- Since:
- 2.226
-
isUsageStatisticsCollected
public boolean isUsageStatisticsCollected()If usage statistics are being collected- Returns:
trueif usage statistics should be collected. Defaults totruewhennoUsageStatisticsis not set.
-
setNoUsageStatistics
Sets the noUsageStatistics flag- Throws:
IOException
-
getApi
-
getSecretKey
Deprecated.Due to the past security advisory, this value should not be used any more to protect sensitive information. SeeConfidentialStoreandConfidentialKeyfor how to store secrets.Returns a secret key that survives across container start/stop.This value is useful for implementing some of the security features.
-
getSecretKeyAsAES128
Deprecated.SeegetSecretKey().Gets the secret key as a key for AES-128.- Since:
- 1.308
-
getLegacyInstanceId
Returns the unique identifier of this Jenkins that has been historically used to identify this Jenkins to the outside world.This form of identifier is weak in that it can be impersonated by others. See the Instance Identity plugin for more modern form of instance ID that can be challenged and verified.
- Since:
- 1.498
-
getScm
Gets the SCM descriptor by name. Primarily used for making them web-visible. -
getRepositoryBrowser
Gets the repository browser descriptor by name. Primarily used for making them web-visible. -
getBuilder
Gets the builder descriptor by name. Primarily used for making them web-visible. -
getBuildWrapper
Gets the build wrapper descriptor by name. Primarily used for making them web-visible. -
getPublisher
Gets the publisher descriptor by name. Primarily used for making them web-visible. -
getTrigger
Gets the trigger descriptor by name. Primarily used for making them web-visible. -
getRetentionStrategy
Gets the retention strategy descriptor by name. Primarily used for making them web-visible. -
getJobProperty
Gets theJobPropertyDescriptorby name. Primarily used for making them web-visible. -
getComputer
Deprecated.UI method. Not meant to be used programmatically. -
getCloud
Only there to bind to /cloud/ URL. Otherwise /cloud/new gets resolved to getCloud("new") by stapler which is not what we want. -
getDescriptor
ExposesDescriptorby its name to URL. After doing all thegetXXX(shortClassName)methods, I finally realized that this just doesn't scale.- Parameters:
id- EitherDescriptor.getId()(recommended) or the short name of aDescribablesubtype (for compatibility)- Throws:
IllegalArgumentException- if a short name was passed which matches multiple IDs (fail fast)
-
getDescriptorByName
Alias forgetDescriptor(String).- Specified by:
getDescriptorByNamein interfaceDescriptorByNameOwner- Parameters:
id- EitherDescriptor.getId()(recommended) or the short name.
-
getDescriptor
Gets theDescriptorthat corresponds to the givenDescribabletype.If you have an instance of
typeand callDescribable.getDescriptor(), you'll get the same instance that this method returns. -
getDescriptorOrDie
Works just likegetDescriptor(Class)but don't take no for an answer.- Throws:
AssertionError- If the descriptor is missing.- Since:
- 1.326
-
getDescriptorByType
Gets theDescriptorinstance in the current Jenkins by its type. -
getSecurityRealms
Gets theSecurityRealmdescriptors by name. Primarily used for making them web-visible. -
updateNewComputer
-
updateComputerList
protected void updateComputerList()Update the list of computers that are running on this Jenkins instance. ConsiderupdateComputers(Node...)instead if you know what nodes needs to be updated.- See Also:
-
updateComputers
Update the computers for the given nodes. -
getSCMListeners
Deprecated.UseSCMListener.all()instead. -
getPlugin
Gets the plugin object from its short name. This allows URLhudson/plugin/IDto be served by the views of the plugin class.- Parameters:
shortName- Short name of the plugin- Returns:
- The plugin singleton or
nullif for some reason the plugin is not loaded. The fact the plugin is loaded does not mean it is enabled and fully initialized for the current Jenkins session. UsePlugin.getWrapper()and thenPluginWrapper.isActive()to check it.
-
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.
- Type Parameters:
P- Class of the plugin- Parameters:
clazz- The plugin class (beware class-loader fun, this will probably only work from within the jpi that defines the plugin class, it may or may not work in other cases)- Returns:
- The plugin singleton or
nullif for some reason the plugin is not loaded. The fact the plugin is loaded does not mean it is enabled and fully initialized for the current Jenkins session. UsePlugin.getWrapper()and thenPluginWrapper.isActive()to check it.
-
getPlugins
Gets the plugin objects from their super-class.- Parameters:
clazz- The plugin class (beware class-loader fun)- Returns:
- The plugin instances.
-
getSystemMessage
Synonym forgetDescription(). -
getMarkupFormatter
Gets the markup formatter used in the system.- Returns:
- never null.
- Since:
- 1.391
-
setMarkupFormatter
Sets the markup formatter used in the system globally.- Since:
- 1.391
-
setSystemMessage
Sets the system message.- Throws:
IOException
-
getFederatedLoginService
-
getFederatedLoginServices
-
createLauncher
Description copied from class:NodeReturns aLauncherfor executing programs on this node.The callee must call
Launcher.decorateFor(Node)before returning to complete the decoration.- Specified by:
createLauncherin classNode
-
getFullName
Description copied from interface:FullyNamedReturns the full name of this object, which is a qualified name that includes the names of all its ancestors, separated by '/'.- Specified by:
getFullNamein interfaceFullyNamed- Returns:
- the full name of this object.
-
getFullDisplayName
Description copied from interface:FullyNamedModelObjectWorks likeModelObject.getDisplayName()but return the full path that includes all the display names of the ancestors in an unspecified format.- Specified by:
getFullDisplayNamein interfaceFullyNamedModelObject
-
getActions
Returns the transientActions associated with the top page.Adding
Actionis primarily useful for plugins to contribute an item to the navigation bar of the top page. See existingActionimplementation for it affects the GUI.To register an
Action, implementRootActionextension point, or write code likeJenkins.get().getActions().add(...).- Returns:
- Live list where the changes can be made. Can be empty but never null.
- Since:
- 1.172
-
getItems
Gets just the immediate children ofJenkins.- Specified by:
getItemsin interfaceItemGroup<TopLevelItem>- See Also:
-
getItems
Gets just the immediate children ofJenkinsbased on supplied predicate.- Specified by:
getItemsin interfaceItemGroup<TopLevelItem>- Since:
- 2.221
- See Also:
-
getItemMap
Returns the read-only view of all theTopLevelItems keyed by their names.This method is efficient, as it doesn't involve any copying.
- Since:
- 1.296
-
getItems
Gets just the immediate children ofJenkinsbut of the given type. -
getProjects
Deprecated.This method will ignore Maven and matrix projects, as well as projects inside containers such as folders. You may prefer to callItemGroup.getAllItems(Class)onAbstractProject, perhaps also usingUtil.createSubList(java.util.Collection<?>, java.lang.Class<T>)to consider onlyTopLevelItems. (That will also consider the caller's permissions.) If you really want to get justProjects at top level, ignoring permissions, you can filter the values fromgetItemMap()usingUtil.createSubList(java.util.Collection<?>, java.lang.Class<T>).Gets a list of simple top-level projects. -
getJobNames
Gets the names of all theJobs. -
doFillJobNameItems
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public ComboBoxModel doFillJobNameItems() -
getViewActions
Description copied from interface:ViewGroupReturns actions that should be displayed in views.In this interface, the return value is used read-only. This doesn't prevent subtypes from returning modifiable actions, however.
- Specified by:
getViewActionsin interfaceViewGroup- Returns:
- may be empty but never null;
getActions()by default - See Also:
-
getTopLevelItemNames
Gets the names of all theTopLevelItems. -
getView
Gets a view by the specified name. The method iterates throughViewGroups if required. -
getViews
Gets the read-only list of allViews. -
addView
Description copied from interface:ModifiableViewGroup- Specified by:
addViewin interfaceModifiableViewGroup- Throws:
IOException
-
setViews
Completely replaces views.This operation is NOT provided as an atomic operation, but rather the sole purpose of this is to define a setter for this to help introspecting code, such as system-config-dsl plugin
- Throws:
IOException
-
canDelete
Description copied from interface:ViewGroupDetermine whether a view may be deleted. -
deleteView
Description copied from interface:ViewGroupDeletes a view in this group.- Specified by:
deleteViewin interfaceViewGroup- Throws:
IOException
-
onViewRenamed
Description copied from interface:ViewGroupViewcalls this method when it's renamed. This method is intended to work as a notification to theViewGroup(so that it can adjust its internal data structure, for example.)It is the caller's responsibility to ensure that the new name is a legal view name.
- Specified by:
onViewRenamedin interfaceViewGroup
-
getPrimaryView
Returns the primaryViewthat renders the top-page of Jenkins.- Specified by:
getPrimaryViewin interfaceViewGroup- Returns:
- by default, null
-
setPrimaryView
-
getViewsTabBar
Description copied from interface:ViewGroupGets the TabBar for the views. TabBar for views can be provided by extension. Only one TabBar can be active at a given time (Selectable by user in the global Configuration page). Default TabBar is provided by Hudson Platform.- Specified by:
getViewsTabBarin interfaceViewGroup
-
setViewsTabBar
-
getItemGroup
Description copied from interface:ViewGroupReturns theItemGroupfrom which the views in this group should render items.Generally speaking, Views render a subset of
TopLevelItems that belong to this item group.- Specified by:
getItemGroupin interfaceViewGroup- Returns:
- Never null. Sometimes this is
ModifiableItemGroup(if the container allows arbitrary addition). By default,get().
-
getMyViewsTabBar
Deprecated. -
setMyViewsTabBar
Deprecated. -
isUpgradedFromBefore
public boolean isUpgradedFromBefore(hudson.util.VersionNumber v) Returns true if the current running Jenkins is upgraded from a version earlier than the specified version.This method continues to return true until the system configuration is saved, at which point
versionwill be overwritten and Jenkins forgets the upgrade history.To handle SNAPSHOTS correctly, pass in "1.N.*" to test if it's upgrading from the version equal or younger than N. So say if you implement a feature in 1.301 and you want to check if the installation upgraded from pre-1.301, pass in "1.300.*"
- Since:
- 1.301
-
getComputers
Gets the read-only list of allComputers. -
getComputer
-
getLabel
Gets the label that exists on this system by the name.- Returns:
- null if name is null.
- See Also:
-
getLabelAtom
Returns the label atom of the given name.- Returns:
- non-null iff name is non-null
-
tryGetLabelAtom
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) @Nullable public LabelAtom tryGetLabelAtom(@NonNull String name) Returns the label atom of the given name, only if it already exists.- Returns:
- non-null if the label atom already exists.
-
getLabels
Gets all the active labels in the current system. -
getLabelAtomSet
- Overrides:
getLabelAtomSetin classNode- Returns:
- An immutable set of LabelAtom associated with the current node label.
-
getLabelAtoms
-
getQueue
- Specified by:
getQueuein classAbstractCIBase
-
getDisplayName
- Specified by:
getDisplayNamein interfaceModelObject- Overrides:
getDisplayNamein classNode
-
getJDKs
-
setJDKs
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public void setJDKs(Collection<? extends JDK> jdks) Replaces all JDK installations with those from the given collection. UseJDK.DescriptorImpl.setInstallations(JDK...)to set JDK installations from external code. -
getJDK
Gets the JDK installation of the given name, or returns null. -
getNode
Gets the agent node of the give name, hooked under this Jenkins. -
getOrLoadNode
-
getCloud
-
getComputerMap
- Specified by:
getComputerMapin classAbstractCIBase
-
getComputersCollection
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public Collection<Computer> getComputersCollection()- Returns:
- the collection of all
Computers in this instance.
-
getNodes
Returns allNodes in the system, excludingJenkinsinstance itself which represents the built-in node (in other words, this only returns agents).- Specified by:
getNodesin classAbstractCIBase
-
getNodesObject
- Returns:
- The Nodes object.
-
addNode
Adds one moreNodeto Jenkins. If a node of the same name already exists then that node will be replaced.- Throws:
IOException
-
removeNode
Removes aNodefrom Jenkins.- Throws:
IOException
-
unloadNode
Unload a node from Jenkins without touching its configuration file. -
updateNode
Saves an existingNodeon disk, called byNode.save(). This method is preferred in those cases where you need to determine atomically that the node being saved is actually in the list of nodes.- Parameters:
n- the node to be updated.- Returns:
true, if the node was updated.false, if the node was not in the list of nodes.- Throws:
IOException- if the node could not be persisted.- Since:
- 1.634
- See Also:
-
setNodes
- Throws:
IOException
-
getNodeProperties
Description copied from class:NodeGets theNodePropertyinstances configured for thisNode.- Specified by:
getNodePropertiesin classNode
-
getGlobalNodeProperties
-
getAdministrativeMonitor
BindsAdministrativeMonitors to URL.- Parameters:
id- Monitor ID- Returns:
- The requested monitor or
nullif it does not exist
-
getActiveAdministrativeMonitors
Returns the enabled and activated administrative monitors accessible to the current user.- Since:
- 2.64
-
getDescriptor
Description copied from interface:DescribableGets the descriptor for this instance.Descriptoris a singleton for every concreteDescribableimplementation, so ifa.getClass() == b.getClass()then by defaulta.getDescriptor() == b.getDescriptor()as well. (In rare cases a single implementation class may be used for instances with distinct descriptors.)By default looks for a nested class (conventionally named
DescriptorImpl) implementingDescriptorand marked withExtension.- Specified by:
getDescriptorin interfaceDescribable<Node>- Specified by:
getDescriptorin classNode
-
getQuietPeriod
public int getQuietPeriod()Gets the system default quiet period. -
setQuietPeriod
Sets the global quiet period.- Parameters:
quietPeriod- null to the default value.- Throws:
IOException
-
getScmCheckoutRetryCount
public int getScmCheckoutRetryCount()Gets the global SCM check out retry count. -
setScmCheckoutRetryCount
- Throws:
IOException
-
getSearchUrl
Description copied from interface:SearchItemReturns the URL of this item relative to the parentSearchItem.- Specified by:
getSearchUrlin interfaceSearchItem- Overrides:
getSearchUrlin classNode- Returns:
- URL like "foo" or "foo/bar". The path can end with '/'. The path that starts with '/' will be interpreted as the absolute path (within the context path of Jenkins.)
-
makeSearchIndex
Description copied from class:AbstractModelObjectDefault implementation that returns empty index.- Overrides:
makeSearchIndexin classAbstractModelObject
-
getUrlChildPrefix
Description copied from interface:ItemGroupGets the URL token that prefixes the URLs for childItems. Like "job", "item", etc.- Specified by:
getUrlChildPrefixin interfaceItemGroup<TopLevelItem>
-
getRootUrl
Gets the absolute URL of Jenkins, such ashttp://localhost/jenkins/.This method first tries to use the manually configured value, then fall back to
getRootUrlFromRequest(). It is done in this order so that it can work correctly even in the face of a reverse proxy.- Returns:
nullif this parameter is not configured by the user and the calling thread is not in an HTTP request; otherwise the returned URL will always have the trailing/- Throws:
IllegalStateException-JenkinsLocationConfigurationcannot be retrieved. Jenkins instance may be not ready, or there is an extension loading glitch.- Since:
- 1.66
- See Also:
-
getConfiguredRootUrl
@Exported(name="url") @Restricted(org.kohsuke.accmod.restrictions.DoNotUse.class) @CheckForNull public String getConfiguredRootUrl()Exported alias forJenkinsLocationConfiguration.getUrl(). -
isRootUrlSecure
public boolean isRootUrlSecure()Is Jenkins running in HTTPS? Note that we can't really trustServletRequest.isSecure()because HTTPS might be terminated in the reverse proxy. -
getRootUrlFromRequest
Gets the absolute URL of Jenkins top page, such ashttp://localhost/jenkins/.Unlike
getRootUrl(), which uses the manually configured value, this one uses the current request to reconstruct the URL. The benefit is that this is immune to the configuration mistake (users often fail to set the root URL correctly, especially when a migration is involved), but the downside is that unless you are processing a request, this method doesn't work.Please note that this will not work in all cases if Jenkins is running behind a reverse proxy which has not been fully configured. Specifically the
HostandX-Forwarded-Protoheaders must be set. Reverse proxy - Apache shows some examples of configuration.- Since:
- 1.263
-
getRootDir
Description copied from interface:PersistenceRootGets the root directory on the file system that thisItemcan use freely for storing the configuration data.This parameter is given by the
ItemGroupwhenItemis loaded from memory.- Specified by:
getRootDirin interfacePersistenceRoot- Overrides:
getRootDirin classNode
-
getWorkspaceFor
Description copied from class:NodeReturns a "workspace" directory for the givenTopLevelItem.Workspace directory is usually used for keeping out the checked out source code, but it can be used for anything.
- Specified by:
getWorkspaceForin classNode- Returns:
- null if this node is not connected hence the path is not available
-
getBuildDirFor
-
isDefaultBuildDir
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public boolean isDefaultBuildDir()If the configured buildsDir has it's default value or has been changed.- Returns:
- true if default value.
-
expandVariablesForDirectory
-
getRawWorkspaceDir
-
getRawBuildsDir
-
setRawBuildsDir
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public void setRawBuildsDir(String buildsDir) -
getRootPath
Description copied from class:NodeGets the root directory of this node.Hudson always owns a directory on every node. This method returns that.
- Specified by:
getRootPathin classNode- Returns:
- null if the node is offline and hence the
FilePathobject is not available.
-
createPath
Description copied from class:NodeGets theFilePathon this node.- Overrides:
createPathin classNode
-
getClockDifference
Description copied from class:NodeEstimates the clock difference with this agent.- Overrides:
getClockDifferencein classNode- Returns:
- always non-null.
-
getClockDifferenceCallable
Description copied from class:NodeReturns aCallablethat when run on the channel, estimates the clock difference.- Specified by:
getClockDifferenceCallablein classNode- Returns:
- always non-null.
-
getLog
For bindingLogRecorderManagerto "/log". Everything below here is admin-only, so do the check here. -
setLog
Set the LogRecorderManager.- Parameters:
log- the LogRecorderManager to set- Since:
- 2.323
-
isUseSecurity
@Exported public boolean isUseSecurity()A convenience method to check if there's some security restrictions in place. -
isUseProjectNamingStrategy
public boolean isUseProjectNamingStrategy() -
isUseCrumbs
@Exported public boolean isUseCrumbs()If true, all the POST requests to Jenkins would have to have crumb in it to protect Jenkins from CSRF vulnerabilities. -
getSecurity
Returns the constant that captures the three basic security modes in Jenkins. -
getSecurityRealm
- Returns:
- never null.
-
setSecurityRealm
Sets a security realm.- Parameters:
securityRealm- Security realm to set. Ifnull,SecurityRealm.NO_AUTHENTICATIONwill be set.
-
setAuthorizationStrategy
Sets a new authorization strategy.- Parameters:
a- Authorization strategy to set. Ifnull,AuthorizationStrategy.UNSECUREDwill be set
-
isDisableRememberMe
public boolean isDisableRememberMe() -
setDisableRememberMe
public void setDisableRememberMe(boolean disableRememberMe) -
disableSecurity
public void disableSecurity() -
setProjectNamingStrategy
-
getLifecycle
-
getInjector
@CheckForNull public com.google.inject.Injector getInjector()Gets the dependency injection container that hosts all the extension implementations and other components in Jenkins.- Since:
- 1.433
-
getExtensionList
ReturnsExtensionListthat retains the discovered instances for the given extension type.- Parameters:
extensionType- The base type that represents the extension point. NormallyExtensionPointsubtype but that's not a hard requirement.- Returns:
- Can be an empty list but never null.
- See Also:
-
getExtensionList
@Deprecated(since="2.519") public ExtensionList getExtensionList(String extensionType) throws ClassNotFoundException Deprecated.This is no longer supported. For URL access to descriptors, seeDescriptorByNameOwner. For URL access to specific otherExtensionannotated elements, create your ownAction, likeConsoleAnnotatorFactory.RootAction.Formerly used to bindExtensionLists to URLs.- Throws:
ClassNotFoundException- Since:
- 1.349
-
getDescriptorList
@NonNull public <T extends Describable<T>,D extends Descriptor<T>> DescriptorExtensionList<T,D> getDescriptorList(Class<T> type) ReturnsExtensionListthat retains the discoveredDescriptorinstances for the given kind ofDescribable.- Returns:
- Can be an empty list but never null.
-
refreshExtensions
RefreshExtensionLists by adding all the newly discovered extensions. Exposed only forPluginManager.dynamicLoad(File).- Throws:
ExtensionRefreshException
-
getACL
Returns the rootACL.- Specified by:
getACLin interfaceAccessControlled- Overrides:
getACLin classNode- Returns:
- never null.
- See Also:
-
getAuthorizationStrategy
- Returns:
- never null.
-
getProjectNamingStrategy
The strategy used to check the project names.- Returns:
- never
null
-
isQuietingDown
@Exported public boolean isQuietingDown()Returns true if Jenkins is quieting down.No further jobs will be executed unless it can be finished while other current pending builds are still in progress.
-
isPreparingSafeRestart
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) @NonNull public boolean isPreparingSafeRestart()Returns if the quietingDown is a safe restart.- Since:
- 2.414
-
getQuietDownReason
Returns quiet down reason if it was indicated.- Returns:
- Reason if it was indicated. null otherwise
- Since:
- 2.267
-
isTerminating
public boolean isTerminating()Returns true if the container initiated the termination of the web application. -
getInitLevel
Gets the initialization milestone that we've already reached.- Returns:
InitMilestone.STARTEDeven if the initialization hasn't been started, so that this method never returns null.
-
setNumExecutors
Sets a number of executors.- Parameters:
n- Number of executors- Throws:
IOException- Failed to save the configurationIllegalArgumentException- Negative value has been passed
-
getItem
public TopLevelItem getItem(String name) throws org.springframework.security.access.AccessDeniedException Gets theIteminside this group that has a given name, or null if it does not exist.. Note that the look up is case-insensitive.- Specified by:
getItemin interfaceItemGroup<TopLevelItem>- Returns:
- an item whose
Item.getName()isnameand whoseItem.getParent()isthis, or null if there is no such item, or there is but the current user lacks bothItem.DISCOVERandItem.READon it - Throws:
org.springframework.security.access.AccessDeniedException- if the current user hasItem.DISCOVERbut notItem.READon this item
-
getItem
Gets the item by its path name from the given contextPath Names: If the name starts from '/', like "/foo/bar/zot", then it's interpreted as absolute. Otherwise, the name should be something like "foo/bar" and it's interpreted like relative path name in the file system is, against the given context.
For compatibility, as a fallback when nothing else matches, a simple path like
foo/barcan also be treated withgetItemByFullName(java.lang.String, java.lang.Class<T>).- Parameters:
context- null is interpreted asJenkins. Base 'directory' of the interpretation.- Since:
- 1.406
-
getItem
-
getItem
-
getItem
-
getRootDirFor
Description copied from interface:ItemGroupAssigns theroot directoryfor children.- Specified by:
getRootDirForin interfaceItemGroup<TopLevelItem>
-
getItemByFullName
@CheckForNull public <T extends Item> T getItemByFullName(@NonNull String fullName, Class<T> type) throws org.springframework.security.access.AccessDeniedException Gets theItemobject by its full name. Full names are like path names, where each name ofItemis combined by '/'.- Returns:
- null if either such
Itemdoesn't exist under the given full name, or it exists but it's no an instance of the given type. - Throws:
org.springframework.security.access.AccessDeniedException- as perItemGroup.getItem(java.lang.String)
-
getItemByFullName
-
getUser
Gets the user of the given name.- Returns:
- the user of the given name (which may or may not be an id), if that person exists; else null
- See Also:
-
createProject
@NonNull public TopLevelItem createProject(@NonNull TopLevelItemDescriptor type, @NonNull String name) throws IOException - Throws:
IOException
-
createProject
@NonNull public TopLevelItem createProject(@NonNull TopLevelItemDescriptor type, @NonNull String name, boolean notify) throws IOException Description copied from interface:ModifiableTopLevelItemGroupCreates a new job.- Specified by:
createProjectin interfaceModifiableTopLevelItemGroup- Parameters:
type- Descriptor for job typename- Name for jobnotify- Whether to fire onCreated method for all ItemListeners- Throws:
IOException
-
putItem
Overwrites the existing item by new one.This is a short cut for deleting an existing job and adding a new one.
- Throws:
IOExceptionInterruptedException
-
createProject
@NonNull public <T extends TopLevelItem> T createProject(@NonNull Class<T> type, @NonNull String name) throws IOException Creates a new job.This version infers the descriptor from the type of the top-level item.
- Throws:
IllegalArgumentException- if the project of the given name already exists.IOException
-
onRenamed
Called byJob.renameTo(String)to update relevant data structure. assumed to be synchronized on Jenkins by the caller.- Specified by:
onRenamedin interfaceItemGroup<TopLevelItem>- Throws:
IOException
-
onDeleted
Called in response toAbstractItem.doDoDelete(StaplerRequest2, StaplerResponse2)- Specified by:
onDeletedin interfaceItemGroup<TopLevelItem>- Throws:
IOException
-
canAdd
Description copied from interface:DirectlyModifiableTopLevelItemGroupReturns true if a particular item may be added to this group.- Specified by:
canAddin interfaceDirectlyModifiableTopLevelItemGroup- Parameters:
item- an item currently elsewhere- Returns:
- true if
DirectlyModifiableTopLevelItemGroup.add(I, java.lang.String)may be called with this item
-
add
public <I extends TopLevelItem> I add(I item, String name) throws IOException, IllegalArgumentException Description copied from interface:DirectlyModifiableTopLevelItemGroupAdds an item to this group. UnlikeputItem(hudson.model.TopLevelItem)this does not try to callItem.delete()on an existing item, nor does it fireItemListener.onCreated(hudson.model.Item), nor check permissions. Normally you would callItem.onLoad(hudson.model.ItemGroup<? extends hudson.model.Item>, java.lang.String)after calling this method (the implementation is not expected to do so).- Specified by:
addin interfaceDirectlyModifiableTopLevelItemGroup- Type Parameters:
I- the kind of item- Parameters:
item- an item to add which is currently elsewherename- the desired item name in this group (might simply be the originalItem.getName())- Returns:
- normally the same
item, but might be a new copy if necessary - Throws:
IOException- if adding failsIllegalArgumentException- ifDirectlyModifiableTopLevelItemGroup.canAdd(hudson.model.TopLevelItem)is false, or an item with this name already exists, or this item is as yet unnamed
-
remove
Description copied from interface:DirectlyModifiableTopLevelItemGroupRemoves an item from this group. UnlikeItemGroup.onDeleted(T)this is not expected to fire any events.- Specified by:
removein interfaceDirectlyModifiableTopLevelItemGroup- Parameters:
item- an item which was part of this group- Throws:
IOException- if removing failsIllegalArgumentException- if this was not part of the group to begin with
-
getFingerprintMap
-
getFingerprint
- Throws:
IOException
-
_getFingerprint
Gets aFingerprintobject if it exists. Otherwise null.- Throws:
IOException
-
getConfigFile
The file we save our configuration.- Overrides:
getConfigFilein classNode
-
getNumExecutors
public int getNumExecutors()Description copied from class:NodeReturns the number ofExecutors. This may be different fromgetExecutors().size()because it takes time to adjust the number of executors.- Specified by:
getNumExecutorsin classNode
-
getMode
Description copied from class:NodeReturnsNode.Mode.EXCLUSIVEif this node is only available for those jobs that exclusively specifies this node as the assigned node. -
setMode
- Throws:
IOException
-
getLabelString
Description copied from class:NodeReturns the manually configured label for a node. The list of assigned and dynamically determined labels is available viaNode.getAssignedLabels()and includes all labels that have been manually configured. Mainly for form binding.- Specified by:
getLabelStringin classNode
-
setLabelString
Description copied from class:NodeSets the label string for a node. This value will be returned byNode.getLabelString().- Overrides:
setLabelStringin classNode- Parameters:
label- The new label string to use.- Throws:
IOException
-
getSelfLabel
Description copied from class:NodeGets the special label that represents this node itself.- Overrides:
getSelfLabelin classNode
-
createComputer
Description copied from class:NodeCreates a newComputerobject that acts as the UI peer of thisNode. Nobody butAbstractCIBase.updateComputerList(boolean, Collection)should call this method.- Specified by:
createComputerin classNode- Returns:
- Created instance of the computer.
Can be
nullif theNodeimplementation does not support it (e.g.Cloudagent).
-
load
Description copied from interface:LoadableLoads the state of this object from disk.- Specified by:
loadin interfaceLoadable- Throws:
IOException- The state could not be loaded.
-
save
Save the settings to a file.- Specified by:
savein interfaceSaveable- Overrides:
savein classNode- Throws:
IOException- if the persistence failed.
-
cleanUp
public void cleanUp()Called to shut down the system. -
getDynamic
-
doConfigSubmit
@POST public void doConfigSubmit(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException, Descriptor.FormException Accepts submission from the configuration page.- Throws:
IOExceptionjakarta.servlet.ServletExceptionDescriptor.FormException
-
getCrumbIssuer
Gets theCrumbIssuercurrently in use.- Returns:
- null if none is in use.
-
setCrumbIssuer
-
doTestPost
public void doTestPost(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException - Throws:
IOExceptionjakarta.servlet.ServletException
-
doConfigExecutorsSubmit
@POST public void doConfigExecutorsSubmit(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException, Descriptor.FormException Accepts submission from the node configuration page.- Throws:
IOExceptionjakarta.servlet.ServletExceptionDescriptor.FormException
-
doSubmitDescription
public void doSubmitDescription(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException Accepts the new description.- Throws:
IOExceptionjakarta.servlet.ServletException
-
doQuietDown
public org.kohsuke.stapler.HttpRedirect doQuietDown() -
doQuietDown
Deprecated.since 2.267; usedoQuietDown(boolean, int, String, boolean)instead.Quiet down Jenkins - preparation for a restart Presented for compatibility.- Parameters:
block- Block until the system really quiets down and no builds are runningtimeout- If non-zero, only block up to the specified number of milliseconds
-
doQuietDown
@Deprecated(since="2.414") public org.kohsuke.stapler.HttpRedirect doQuietDown(boolean block, int timeout, @CheckForNull String message) throws InterruptedException, IOException Deprecated.usedoQuietDown(boolean, int, String, boolean)instead.Quiet down Jenkins - preparation for a restart- Parameters:
block- Block until the system really quiets down and no builds are runningtimeout- If non-zero, only block up to the specified number of millisecondsmessage- Quiet reason that will be visible to user- Throws:
InterruptedExceptionIOException
-
doQuietDown
public org.kohsuke.stapler.HttpRedirect doQuietDown(@QueryParameter boolean block, @QueryParameter int timeout, @QueryParameter @CheckForNull String message, @QueryParameter boolean safeRestart) throws InterruptedException, IOException Quiet down Jenkins - preparation for a restart- Parameters:
block- Block until the system really quiets down and no builds are runningtimeout- If non-zero, only block up to the specified number of millisecondsmessage- Quiet reason that will be visible to usersafeRestart- If the quietDown is for a safeRestart- Throws:
InterruptedExceptionIOException- Since:
- 2.414
-
doCancelQuietDown
public org.kohsuke.stapler.HttpRedirect doCancelQuietDown()Cancel previous quiet down Jenkins - preparation for a restart -
doToggleCollapse
@POST public org.kohsuke.stapler.HttpResponse doToggleCollapse() throws jakarta.servlet.ServletException, IOException- Throws:
jakarta.servlet.ServletExceptionIOException
-
doClassicThreadDump
public void doClassicThreadDump(org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException Backward compatibility. Redirect to the thread dump.- Throws:
IOExceptionjakarta.servlet.ServletException
-
getAllThreadDumps
Obtains the thread dump of all agents (including the controller/built-in node.)Since this is for diagnostics, it has a built-in precautionary measure against hang agents.
- Throws:
IOExceptionInterruptedException
-
doCreateItem
public TopLevelItem doCreateItem(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException Description copied from interface:ModifiableItemGroupThe request format follows that of<n:form xmlns:n="/lib/form">.- Specified by:
doCreateItemin interfaceModifiableItemGroup<TopLevelItem>- Throws:
IOExceptionjakarta.servlet.ServletException
-
createProjectFromXML
Description copied from interface:ModifiableTopLevelItemGroupCreates a new job from its configuration XML. The type of the job created will be determined by what's in this XML.- Specified by:
createProjectFromXMLin interfaceModifiableTopLevelItemGroup- Parameters:
name- Name of the newly created project.xml- Item configuration as xml- Returns:
- Newly created
TopLevelItem. - Throws:
IOException- Since:
- 1.319
-
copy
Description copied from interface:ModifiableTopLevelItemGroupCopies a job.- Specified by:
copyin interfaceModifiableTopLevelItemGroup- Parameters:
src- ATopLevelItemto be copied.name- Name of the newly created project.- Returns:
- Newly created
TopLevelItem. - Throws:
IOException
-
copy
- Throws:
IOException
-
doCreateView
@POST public void doCreateView(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException, Descriptor.FormException - Throws:
IOExceptionjakarta.servlet.ServletExceptionDescriptor.FormException
-
checkGoodName
Check if the given name is suitable as a name for job, view, etc.- Throws:
Failure- if the given name is not good
-
doSecured
public void doSecured(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException Checks if the user was successfully authenticated.- Throws:
IOExceptionjakarta.servlet.ServletException- See Also:
-
doLoginEntry
public void doLoginEntry(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException Called once the user logs in. Just forward to the top page. Used only byLegacySecurityRealm.- Throws:
IOException
-
doLogout
public void doLogout(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException Logs out the user.- Throws:
IOExceptionjakarta.servlet.ServletException- Since:
- 2.475
-
doLogout
@Deprecated @StaplerNotDispatchable public void doLogout(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) throws IOException, javax.servlet.ServletException Deprecated.- Throws:
IOExceptionjavax.servlet.ServletException
-
getJnlpJars
Serves jar files for inbound agents. -
doJnlpJars
-
doReload
Reloads the configuration.- Throws:
IOException
-
reload
public void reload() throws IOException, InterruptedException, org.jvnet.hudson.reactor.ReactorExceptionReloads the configuration synchronously. Beware that this calls neitherItemListener.onLoaded()norInitializers.- Throws:
IOExceptionInterruptedExceptionorg.jvnet.hudson.reactor.ReactorException
-
doDoFingerprintCheck
public void doDoFingerprintCheck(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException Do a finger-print check.- Throws:
IOExceptionjakarta.servlet.ServletException
-
doGc
For debugging. Expose URL to perform GC.- Throws:
IOException
-
doContextMenu
public ModelObjectWithContextMenu.ContextMenu doContextMenu(org.kohsuke.stapler.StaplerRequest2 request, org.kohsuke.stapler.StaplerResponse2 response) throws IOException, org.apache.commons.jelly.JellyException Description copied from interface:ModelObjectWithContextMenuGenerates the context menu. The typical implementation isreturn new ContextMenu().from(this,request,response);, which implements the default behaviour. SeeModelObjectWithContextMenu.ContextMenu.from(ModelObjectWithContextMenu, StaplerRequest2, StaplerResponse2)for more details of what it does. This should suit most implementations.- Specified by:
doContextMenuin interfaceModelObjectWithContextMenu- Throws:
IOExceptionorg.apache.commons.jelly.JellyException
-
doChildrenContextMenu
public ModelObjectWithContextMenu.ContextMenu doChildrenContextMenu(org.kohsuke.stapler.StaplerRequest2 request, org.kohsuke.stapler.StaplerResponse2 response) throws Exception Description copied from interface:ModelObjectWithChildrenGenerates the context menu to list up all the children.- Specified by:
doChildrenContextMenuin interfaceModelObjectWithChildren- Throws:
Exception
-
getHeapDump
Obtains the heap dump.- Throws:
IOException
-
doSimulateOutOfMemory
Simulates OutOfMemoryError. Useful to make sure OutOfMemoryHeapDump setting.- Throws:
IOException
-
doUserContent
Binds /userContent/... to $JENKINS_HOME/userContent. -
doRestart
@CLIMethod(name="restart") public void doRestart(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException, RestartNotSupportedException Perform a restart of Jenkins, if we can. This first replaces "app" toHudsonIsRestarting- Throws:
IOExceptionjakarta.servlet.ServletExceptionRestartNotSupportedException
-
generateNotFoundResponse
@WebMethod(name="404") @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public void generateNotFoundResponse(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws jakarta.servlet.ServletException, IOException Serve a custom 404 error page, configured in web.xml.- Throws:
jakarta.servlet.ServletExceptionIOException
-
doSafeRestart
@Deprecated(since="2.414") public org.kohsuke.stapler.HttpResponse doSafeRestart(org.kohsuke.stapler.StaplerRequest req) throws IOException, jakarta.servlet.ServletException, RestartNotSupportedException Deprecated.usedoSafeRestart(StaplerRequest2, String)instead.Queues up a safe restart of Jenkins. Builds that cannot continue while the controller is not running have to finish or pause before it can proceed. No new builds will be started. No new jobs are accepted.- Throws:
IOExceptionjakarta.servlet.ServletExceptionRestartNotSupportedException
-
doSafeRestart
public org.kohsuke.stapler.HttpResponse doSafeRestart(org.kohsuke.stapler.StaplerRequest2 req, @QueryParameter("message") String message) throws IOException, jakarta.servlet.ServletException, RestartNotSupportedException Queues up a safe restart of Jenkins. Jobs have to finish or pause before it can proceed. No new jobs are accepted.- Throws:
IOExceptionjakarta.servlet.ServletExceptionRestartNotSupportedException- Since:
- 2.475
-
doSafeRestart
@Deprecated @StaplerNotDispatchable public org.kohsuke.stapler.HttpResponse doSafeRestart(org.kohsuke.stapler.StaplerRequest req, @QueryParameter("message") String message) throws IOException, javax.servlet.ServletException, RestartNotSupportedException Deprecated.- Throws:
IOExceptionjavax.servlet.ServletExceptionRestartNotSupportedException- Since:
- 2.414
-
restart
Performs a restart.- Throws:
RestartNotSupportedException
-
safeRestart
Deprecated.usesafeRestart(String)instead.Queues up a restart to be performed once there are no builds currently running.- Throws:
RestartNotSupportedException- Since:
- 1.332
-
safeRestart
Queues up a restart to be performed once there are no builds currently running.- Parameters:
message- the message to show to users in the shutdown banner.- Throws:
RestartNotSupportedException- Since:
- 2.414
-
doExit
@CLIMethod(name="shutdown") public void doExit(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException Shutdown the system.- Throws:
IOException- Since:
- 1.161
-
doSafeExit
@CLIMethod(name="safe-shutdown") public org.kohsuke.stapler.HttpResponse doSafeExit(org.kohsuke.stapler.StaplerRequest2 req) throws IOException Shutdown the system safely.- Throws:
IOException- Since:
- 1.332
-
doSafeExit
@Deprecated @StaplerNotDispatchable public org.kohsuke.stapler.HttpResponse doSafeExit(org.kohsuke.stapler.StaplerRequest req) throws IOException Deprecated.- Throws:
IOException
-
getAuthentication2
@NonNull public static org.springframework.security.core.Authentication getAuthentication2()Gets theAuthenticationobject that represents the user associated with the current request.- Since:
- 2.266
-
getAuthentication
Deprecated. -
doScript
public void doScript(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException For system diagnostics. Run arbitrary Groovy script.- Throws:
IOExceptionjakarta.servlet.ServletException
-
doScript
@Deprecated @StaplerNotDispatchable public void doScript(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) throws IOException, javax.servlet.ServletException Deprecated.- Throws:
IOExceptionjavax.servlet.ServletException
-
doScriptText
public void doScriptText(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException Run arbitrary Groovy script and return result as plain text.- Throws:
IOExceptionjakarta.servlet.ServletException
-
doScriptText
@Deprecated @StaplerNotDispatchable public void doScriptText(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) throws IOException, javax.servlet.ServletException Deprecated.- Throws:
IOExceptionjavax.servlet.ServletException
-
_doScript
public static void _doScript(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp, jakarta.servlet.RequestDispatcher view, hudson.remoting.VirtualChannel channel, ACL acl) throws IOException, jakarta.servlet.ServletException - Throws:
IOExceptionjakarta.servlet.ServletException- Since:
- 2.475
-
_doScript
@Deprecated public static void _doScript(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp, javax.servlet.RequestDispatcher view, hudson.remoting.VirtualChannel channel, ACL acl) throws IOException, javax.servlet.ServletException Deprecated.- Throws:
IOExceptionjavax.servlet.ServletException- Since:
- 1.509.1
-
doEval
public void doEval(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException Evaluates the Jelly script submitted by the client. This is useful for system administration as well as unit testing.- Throws:
IOExceptionjakarta.servlet.ServletException
-
doSignup
public void doSignup(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException Sign up for the user account.- Throws:
IOExceptionjakarta.servlet.ServletException
-
doIconSize
public void doIconSize(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException Changes the icon size by changing the cookie- Throws:
IOExceptionjakarta.servlet.ServletException
-
doFingerprintCleanup
- Throws:
IOException
-
doWorkspaceCleanup
- Throws:
IOException
-
doDefaultJDKCheck
public FormValidation doDefaultJDKCheck(org.kohsuke.stapler.StaplerRequest2 request, @QueryParameter String value) If the user chose the default JDK, make sure we got 'java' in PATH. -
doCheckViewName
Checks if a top-level view with the given name exists and make sure that the name is good as a view name. -
doViewExistsCheck
Deprecated.1.512Checks if a top-level view with the given name exists. -
doResources
public void doResources(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException Serves static resources placed along with Jelly view files.This method can serve a lot of files, so care needs to be taken to make this method secure. It's not clear to me what's the best strategy here, though the current implementation is based on file extensions.
- Throws:
IOExceptionjakarta.servlet.ServletException
-
doCheckURIEncoding
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) @RestrictedSince("2.37") @Deprecated public FormValidation doCheckURIEncoding(org.kohsuke.stapler.StaplerRequest2 request) throws IOException Deprecated.Checks if container uses UTF-8 to decode URLs. See http://wiki.jenkins-ci.org/display/JENKINS/Tomcat#Tomcat-i18n- Throws:
IOException
-
isCheckURIEncodingEnabled
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) @RestrictedSince("2.37") @Deprecated public static boolean isCheckURIEncodingEnabled()Deprecated.Does not check when system default encoding is "ISO-8859-1". -
getFutureDependencyGraph
-
rebuildDependencyGraph
public void rebuildDependencyGraph()Rebuilds the dependency map. -
rebuildDependencyGraphAsync
Rebuilds the dependency map asynchronously.This would keep the UI thread more responsive and helps avoid the deadlocks, as dependency graph recomputation tends to touch a lot of other things.
- Since:
- 1.522
-
getDependencyGraph
-
getManagementLinks
-
getCategorizedManagementLinks
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public Map<ManagementLink.Category,List<ManagementLink>> getCategorizedManagementLinks() -
getSetupWizard
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public SetupWizard getSetupWizard()If set, a currently active setup wizard - e.g. installation- Since:
- 2.0
-
getMe
Exposes the current user to/meURL. -
getWidgets
Gets theWidgets registered on this object.Plugins who wish to contribute boxes on the side panel can add widgets by
getWidgets().add(new MyWidget())fromPlugin.start(). -
getTarget
- Specified by:
getTargetin interfaceorg.kohsuke.stapler.StaplerProxy
-
isSubjectToMandatoryReadPermissionCheck
Test a path to see if it is subject to mandatory read permission checks by container-managed security- Parameters:
restOfPath- the URI, excluding the Jenkins root URI and query string- Returns:
- true if the path is subject to mandatory read permission checks
- Since:
- 2.37
-
getUnprotectedRootActions
Gets a list of unprotected root actions. These URL prefixes should be exempted from access control checks by container-managed security. Ideally would be synchronized withgetTarget().- Returns:
- a list of URL names
- Since:
- 1.495
-
getStaplerFallback
Fallback to the primary view.- Specified by:
getStaplerFallbackin interfaceorg.kohsuke.stapler.StaplerFallback
-
doCheckDisplayName
@Deprecated public FormValidation doCheckDisplayName(@QueryParameter String displayName, @QueryParameter String jobName) Checks to see if the candidate displayName collides with any existing display names or project names- Parameters:
displayName- The display name to testjobName- The name of the job the user is configuring
-
checkDisplayName
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public FormValidation checkDisplayName(String displayName, TopLevelItem item) Checks to see if the candidate displayName collides with any existing display names or project names in the items parent group- Parameters:
displayName- The display name to testitem- The item to check for duplicates
-
lookup
Shortcut forJenkins.getInstanceOrNull()?.lookup.get(type) -
getVersion
@CheckForNull public static hudson.util.VersionNumber getVersion()ParsesVERSIONintoVersionNumber, or null if it's not parseable as a version number (such as when Jenkins is run withmvn jetty:run) -
getStoredVersion
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) @CheckForNull public static hudson.util.VersionNumber getStoredVersion()Get the stored version of Jenkins, as stored bydoConfigSubmit(org.kohsuke.stapler.StaplerRequest2, org.kohsuke.stapler.StaplerResponse2).Parses the version into
VersionNumber, or null if it's not parseable as a version number (such as when Jenkins is run withmvn jetty:run)- Since:
- 2.0
-
shouldShowStackTrace
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public boolean shouldShowStackTrace()
-
ANONYMOUS2