@Override public void run() { try { ACL.impersonate(ACL.SYSTEM); LOGGER.info(String.format("Shutting down VM as requested by %s from %s", getAuthentication().getName(), req != null ? req.getRemoteAddr() : "???")); cleanUp(); System.exit(0); } catch (Exception e) { LOGGER.log(Level.WARNING, "Failed to shut down Jenkins", e); } } }.start();
/** * Computes the build cause, using RemoteCause or UserCause as appropriate. */ @Restricted(NoExternalUse.class) public static final CauseAction getBuildCause(ParameterizedJob job, StaplerRequest req) { Cause cause; @SuppressWarnings("deprecation") hudson.model.BuildAuthorizationToken authToken = job.getAuthToken(); if (authToken != null && authToken.getToken() != null && req.getParameter("token") != null) { // Optional additional cause text when starting via token String causeText = req.getParameter("cause"); cause = new Cause.RemoteCause(req.getRemoteAddr(), causeText); } else { cause = new Cause.UserIdCause(); } return new CauseAction(cause); }
isQuietingDown = true; final String exitUser = getAuthentication().getName(); final String exitAddr = req!=null ? req.getRemoteAddr() : "unknown"; new Thread("safe-exit thread") { @Override
/** * Shutdown the system. * * @since 1.161 */ public void doExit(StaplerRequest req, StaplerResponse rsp) throws IOException { checkPermission(ADMINISTER); logger.error(String.format("Shutting down VM as requested by %s from %s", getAuthentication().getName(), req.getRemoteAddr())); rsp.setStatus(HttpServletResponse.SC_OK); rsp.setContentType("text/plain"); PrintWriter w = rsp.getWriter(); w.println("Shutting down"); w.close(); System.exit(0); }
/** * Shutdown the system. * @since 1.161 */ public void doExit(StaplerRequest req, StaplerResponse rsp) throws IOException { checkPermission(ADMINISTER); LOGGER.severe(String.format("Shutting down VM as requested by %s from %s", getAuthentication().getName(), req.getRemoteAddr())); rsp.setStatus(HttpServletResponse.SC_OK); rsp.setContentType("text/plain"); PrintWriter w = rsp.getWriter(); w.println("Shutting down"); w.close(); System.exit(0); }
/** * Shutdown the system. * @since 1.161 */ public void doExit(StaplerRequest req, StaplerResponse rsp) throws IOException { checkPermission(ADMINISTER); LOGGER.severe(String.format("Shutting down VM as requested by %s from %s", getAuthentication().getName(), req.getRemoteAddr())); rsp.setStatus(HttpServletResponse.SC_OK); rsp.setContentType("text/plain"); PrintWriter w = rsp.getWriter(); w.println("Shutting down"); w.close(); System.exit(0); }
/** * Shutdown the system. * @since 1.161 */ public void doExit(StaplerRequest req, StaplerResponse rsp) throws IOException { checkPermission(ADMINISTER); LOGGER.severe(String.format("Shutting down VM as requested by %s from %s", getAuthentication().getName(), req.getRemoteAddr())); rsp.setStatus(HttpServletResponse.SC_OK); rsp.setContentType("text/plain"); PrintWriter w = rsp.getWriter(); w.println("Shutting down"); w.close(); System.exit(0); }
isQuietingDown = true; final String exitUser = getAuthentication().getName(); final String exitAddr = req.getRemoteAddr().toString(); new Thread("safe-exit thread") { @Override
/** * Shutdown the system. * @since 1.161 */ @CLIMethod(name="shutdown") @RequirePOST public void doExit( StaplerRequest req, StaplerResponse rsp ) throws IOException { checkPermission(ADMINISTER); LOGGER.severe(String.format("Shutting down VM as requested by %s from %s", getAuthentication().getName(), req!=null?req.getRemoteAddr():"???")); if (rsp!=null) { rsp.setStatus(HttpServletResponse.SC_OK); rsp.setContentType("text/plain"); try (PrintWriter w = rsp.getWriter()) { w.println("Shutting down"); } } cleanUp(); System.exit(0); }
isQuietingDown = true; final String exitUser = getAuthentication().getName(); final String exitAddr = req.getRemoteAddr().toString(); new Thread("safe-exit thread") {
isQuietingDown = true; final String exitUser = getAuthentication().getName(); final String exitAddr = req.getRemoteAddr().toString(); new Thread("safe-exit thread") {
isQuietingDown = true; final String exitUser = getAuthentication().getName(); final String exitAddr = req.getRemoteAddr().toString(); new Thread("safe-exit thread") {
/** * Computes the build cause, using RemoteCause or UserCause as appropriate. */ /*package*/ CauseAction getBuildCause(StaplerRequest req) { Cause cause; if (authToken != null && authToken.getToken() != null && req.getParameter("token") != null) { // Optional additional cause text when starting via token String causeText = req.getParameter("cause"); cause = new RemoteCause(req.getRemoteAddr(), causeText); } else { cause = new UserCause(); } return new CauseAction(cause); }
/** * Computes the build cause, using RemoteCause or UserCause as appropriate. */ /*package*/ CauseAction getBuildCause(StaplerRequest req) { Cause cause; if (authToken != null && authToken.getToken() != null && req.getParameter("token") != null) { // Optional additional cause text when starting via token String causeText = req.getParameter("cause"); cause = new RemoteCause(req.getRemoteAddr(), causeText); } else { cause = new UserCause(); } return new CauseAction(cause); }
/** * Computes the build cause, using RemoteCause or UserCause as appropriate. */ /* * package */ CauseAction getBuildCause(StaplerRequest req) { Cause cause; if (authToken != null && authToken.getToken() != null && req.getParameter("token") != null) { // Optional additional cause text when starting via token String causeText = req.getParameter("cause"); cause = new RemoteCause(req.getRemoteAddr(), causeText); } else { cause = new UserCause(); } return new CauseAction(cause); }
/** * Computes the build cause, using RemoteCause or UserCause as appropriate. */ /* * package */ CauseAction getBuildCause(StaplerRequest req) { Cause cause; if (authToken != null && authToken.getToken() != null && req.getParameter("token") != null) { // Optional additional cause text when starting via token String causeText = req.getParameter("cause"); cause = new RemoteCause(req.getRemoteAddr(), causeText); } else { cause = new UserCause(); } return new CauseAction(cause); }
/** * Computes the build cause, using RemoteCause or UserCause as appropriate. */ @Restricted(NoExternalUse.class) public static final CauseAction getBuildCause(ParameterizedJob job, StaplerRequest req) { Cause cause; @SuppressWarnings("deprecation") hudson.model.BuildAuthorizationToken authToken = job.getAuthToken(); if (authToken != null && authToken.getToken() != null && req.getParameter("token") != null) { // Optional additional cause text when starting via token String causeText = req.getParameter("cause"); cause = new Cause.RemoteCause(req.getRemoteAddr(), causeText); } else { cause = new Cause.UserIdCause(); } return new CauseAction(cause); }
isQuietingDown = true; final String exitUser = getAuthentication().getName(); final String exitAddr = req!=null ? req.getRemoteAddr() : "unknown"; new Thread("safe-exit thread") { @Override
/** * This is a copy (not a wrapper) of getBuildCause() in * {@link AbstractProject}. This is necessary, because we can't access * that field as our parent is loaded by a different class loader. * <p> * The function is used, because we need to splice-in one additional * {@link Action} for creation of Builds: {@link VersioningAction}. * <p> * FIXME: The ideal solution to this is to simply add an Extension Point * into Jenkins, that allows one to contribute additional actions. * * @param req * @return */ @SuppressWarnings("deprecation") public CauseAction getBuildCauseOverride(StaplerRequest req) { Cause cause; if (getAuthToken() != null && getAuthToken().getToken() != null && req.getParameter("token") != null) { // Optional additional cause text when starting via token String causeText = req.getParameter("cause"); cause = new RemoteCause(req.getRemoteAddr(), causeText); } else { cause = new UserIdCause(); } return new CauseAction(cause); }
cause = new RemoteCause(req.getRemoteAddr(), causeText); } else { Object rebuild = req.getAttribute("rebuildCause");