/** * {@inheritDoc} */ @Override protected void checkRename(String newName) throws Failure { if (isBuilding()) { throw new Failure(Messages.Job_NoRenameWhileBuilding()); } }
if (j.isBuilding()) { LOGGER.log(Level.FINE, "Job {0} is building, so not deleting", item.getFullDisplayName()); return false;
public boolean superIsBuilding() { return super.isBuilding(); }
/** * Allows a subclass to block renames under dynamic conditions. * @return a message if rename should currently be prohibited, or null to allow */ @CheckForNull protected String renameBlocker() { for (Job<?,?> job : getAllJobs()) { if (job.isBuilding()) { return "Unable to rename a folder while a job inside it is building."; } } return null; }
public void onScheduleBuild(Job<?, ?> project, GhprbCause cause) { if (project == null || cause == null) { return; } if (project.isBuilding() || project.isInQueue()) { cancelCurrentBuilds(project, cause.getPullID()); } }
@Override public boolean isBuilding() { initPython(); if (pexec.isImplemented(8)) { return pexec.execPythonBool("is_building"); } else { return super.isBuilding(); } }
/** * {@inheritDoc} */ @Override protected void checkRename(String newName) { for (Job<?,?> job : getAllJobs()) { if (job.isBuilding()) { throw new Failure("Unable to rename a folder while a job inside it is building."); } } String blocker = renameBlocker(); if (blocker != null) { throw new Failure(blocker); } }
/** * Renames this job. */ @RequirePOST public/* not synchronized. see renameTo() */void doDoRename( StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException { if (!hasPermission(CONFIGURE)) { // rename is essentially delete followed by a create checkPermission(CREATE); checkPermission(DELETE); } String newName = req.getParameter("newName"); Jenkins.checkGoodName(newName); if (isBuilding()) { // redirect to page explaining that we can't rename now rsp.sendRedirect("rename?newName=" + URLEncoder.encode(newName, "UTF-8")); return; } renameTo(newName); // send to the new job page // note we can't use getUrl() because that would pick up old name in the // Ancestor.getUrl() rsp.sendRedirect2("../" + newName); }
if (item instanceof Job<?, ?>) { job = (Job) item; if (job.isBuilding()) { return new TeamUtils.ErrorHttpResponse(job.getName() + " is building.");
/** * Renames this job. */ public/* not synchronized. see renameTo() */void doDoRename( StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException { requirePOST(); // rename is essentially delete followed by a create checkPermission(CREATE); checkPermission(DELETE); String newName = req.getParameter("newName"); Hudson.checkGoodName(newName); if (isBuilding()) { // redirect to page explaining that we can't rename now rsp.sendRedirect("rename?newName=" + URLEncoder.encode(newName, "UTF-8")); return; } renameTo(newName); // send to the new job page // note we can't use getUrl() because that would pick up old name in the // Ancestor.getUrl() rsp.sendRedirect2(req.getContextPath() + '/' + getParent().getUrl() + getShortUrl()); }
/** * Renames this job. */ public/* not synchronized. see renameTo() */ void doDoRename( StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException { requirePOST(); // rename is essentially delete followed by a create checkPermission(CREATE); checkPermission(DELETE); String newName = req.getParameter("newName"); Hudson.checkGoodName(newName); if (isBuilding()) { // redirect to page explaining that we can't rename now rsp.sendRedirect("rename?newName=" + URLEncoder.encode(newName, "UTF-8")); return; } renameTo(newName); // send to the new job page // note we can't use getUrl() because that would pick up old name in the // Ancestor.getUrl() rsp.sendRedirect2(req.getContextPath() + '/' + getParent().getUrl() + getShortUrl()); }
/** * Renames this job. */ public/* not synchronized. see renameTo() */void doDoRename( StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException { requirePOST(); // rename is essentially delete followed by a create checkPermission(CREATE); checkPermission(DELETE); String newName = req.getParameter("newName"); Hudson.checkGoodName(newName); if (isBuilding()) { // redirect to page explaining that we can't rename now rsp.sendRedirect("rename?newName=" + URLEncoder.encode(newName, "UTF-8")); return; } renameTo(newName); // send to the new job page // note we can't use getUrl() because that would pick up old name in the // Ancestor.getUrl() rsp.sendRedirect2(req.getContextPath() + '/' + getParent().getUrl() + getShortUrl()); }
String checkName = newName; if (isBuilding()) {