mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-16 13:32:24 +00:00
Extracted TaskAction/TaskThread from AbstractSCMTagAction, and reused it to build Maven redeployment support.
git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@7442 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
1 parent
a35c5c96ca
commit
a1930be131
12 files changed
+270
-189
No files matched your search
@@ -1,22 +1,22 @@
|
||||
package hudson.maven.reporters;
|
||||
|
||||
import hudson.model.Action;
|
||||
import hudson.model.AbstractProject;
|
||||
import hudson.model.AbstractBuild;
|
||||
import hudson.model.TaskListener;
|
||||
import hudson.security.Permission;
|
||||
import hudson.util.StreamTaskListener;
|
||||
import hudson.maven.MavenEmbedder;
|
||||
import hudson.maven.MavenUtil;
|
||||
import org.kohsuke.stapler.StaplerRequest;
|
||||
import org.kohsuke.stapler.StaplerResponse;
|
||||
import org.kohsuke.stapler.QueryParameter;
|
||||
import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
|
||||
import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
|
||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
import hudson.model.AbstractBuild;
|
||||
import hudson.model.AbstractProject;
|
||||
import hudson.model.TaskListener;
|
||||
import hudson.model.TaskThread;
|
||||
import hudson.model.TaskAction;
|
||||
import hudson.security.Permission;
|
||||
import org.apache.maven.artifact.deployer.ArtifactDeploymentException;
|
||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
|
||||
import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
|
||||
import org.apache.maven.embedder.MavenEmbedderException;
|
||||
import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
|
||||
import org.kohsuke.stapler.QueryParameter;
|
||||
import org.kohsuke.stapler.StaplerRequest;
|
||||
import org.kohsuke.stapler.StaplerResponse;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import java.io.IOException;
|
||||
@@ -30,12 +30,11 @@ import java.io.IOException;
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
*/
|
||||
abstract class MavenAbstractArtifactRecord<T extends AbstractBuild<?,?>> implements Action {
|
||||
|
||||
public abstract class MavenAbstractArtifactRecord<T extends AbstractBuild<?,?>> extends TaskAction {
|
||||
/**
|
||||
* Gets the parent build object to which this record is registered.
|
||||
*/
|
||||
public abstract T getParent();
|
||||
public abstract T getBuild();
|
||||
|
||||
public final String getIconFileName() {
|
||||
return "redo.gif";
|
||||
@@ -49,33 +48,35 @@ abstract class MavenAbstractArtifactRecord<T extends AbstractBuild<?,?>> impleme
|
||||
return "redeploy";
|
||||
}
|
||||
|
||||
protected Permission getPermission() {
|
||||
return REDEPLOY;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a redeployment.
|
||||
*/
|
||||
public final void doRedeploy(StaplerRequest req, StaplerResponse rsp,
|
||||
@QueryParameter("id") String id,
|
||||
@QueryParameter("url") String repositoryUrl,
|
||||
@QueryParameter("uniqueVersion") boolean uniqueVersion) throws ServletException, IOException {
|
||||
getParent().checkPermission(REDEPLOY);
|
||||
@QueryParameter("id") final String id,
|
||||
@QueryParameter("url") final String repositoryUrl,
|
||||
@QueryParameter("uniqueVersion") final boolean uniqueVersion) throws ServletException, IOException {
|
||||
getBuild().checkPermission(REDEPLOY);
|
||||
|
||||
try {
|
||||
StreamTaskListener listener = new StreamTaskListener(rsp.getOutputStream());
|
||||
MavenEmbedder embedder = MavenUtil.createEmbedder(listener, null);
|
||||
ArtifactRepositoryLayout layout =
|
||||
(ArtifactRepositoryLayout) embedder.getContainer().lookup( ArtifactRepositoryLayout.ROLE,"default");
|
||||
ArtifactRepositoryFactory factory =
|
||||
(ArtifactRepositoryFactory) embedder.lookup(ArtifactRepositoryFactory.ROLE);
|
||||
new TaskThread(this) {
|
||||
protected void perform(TaskListener listener) throws Exception {
|
||||
MavenEmbedder embedder = MavenUtil.createEmbedder(listener, null);
|
||||
ArtifactRepositoryLayout layout =
|
||||
(ArtifactRepositoryLayout) embedder.getContainer().lookup( ArtifactRepositoryLayout.ROLE,"default");
|
||||
ArtifactRepositoryFactory factory =
|
||||
(ArtifactRepositoryFactory) embedder.lookup(ArtifactRepositoryFactory.ROLE);
|
||||
|
||||
ArtifactRepository repository = factory.createDeploymentArtifactRepository(
|
||||
id, repositoryUrl, layout, uniqueVersion);
|
||||
ArtifactRepository repository = factory.createDeploymentArtifactRepository(
|
||||
id, repositoryUrl, layout, uniqueVersion);
|
||||
|
||||
deploy(embedder,repository,listener);
|
||||
deploy(embedder,repository,listener);
|
||||
|
||||
embedder.stop();
|
||||
} catch (Throwable e) {
|
||||
// TODO
|
||||
throw new ServletException(e);
|
||||
}
|
||||
embedder.stop();
|
||||
}
|
||||
}.start();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -29,7 +29,7 @@ public class MavenAggregatedArtifactRecord extends MavenAbstractArtifactRecord<M
|
||||
this.parent = build;
|
||||
}
|
||||
|
||||
public MavenModuleSetBuild getParent() {
|
||||
public MavenModuleSetBuild getBuild() {
|
||||
return parent;
|
||||
}
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ public class MavenArtifactRecord extends MavenAbstractArtifactRecord<MavenBuild>
|
||||
this.attachedArtifacts = attachedArtifacts;
|
||||
}
|
||||
|
||||
public MavenBuild getParent() {
|
||||
public MavenBuild getBuild() {
|
||||
return parent;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
package hudson.model;
|
||||
|
||||
import org.kohsuke.stapler.StaplerRequest;
|
||||
import org.kohsuke.stapler.StaplerResponse;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.io.IOException;
|
||||
|
||||
import hudson.security.Permission;
|
||||
|
||||
/**
|
||||
* Partial {@link Action} implementation for those who kick some
|
||||
* processing asynchronously (such as SCM tagging.)
|
||||
*
|
||||
* <p>
|
||||
* The class offers the basic set of functionality to do it.
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
* @since 1.191
|
||||
* @see TaskThread
|
||||
*/
|
||||
public abstract class TaskAction extends AbstractModelObject implements Action {
|
||||
/**
|
||||
* If non-null, that means either the activitiy is in progress
|
||||
* asynchronously, or it failed unexpectedly and the thread is dead.
|
||||
*/
|
||||
protected transient volatile TaskThread workerThread;
|
||||
|
||||
/**
|
||||
* Hold the log of the tagging operation.
|
||||
*/
|
||||
protected transient WeakReference<LargeText> log;
|
||||
|
||||
protected abstract Permission getPermission();
|
||||
|
||||
protected abstract AbstractBuild getBuild();
|
||||
|
||||
public WeakReference<LargeText> getLog() {
|
||||
return log;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSearchUrl() {
|
||||
return getUrlName();
|
||||
}
|
||||
|
||||
public TaskThread getWorkerThread() {
|
||||
return workerThread;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles incremental log output.
|
||||
*/
|
||||
public void doProgressiveLog( StaplerRequest req, StaplerResponse rsp) throws IOException {
|
||||
if(log==null) {
|
||||
rsp.setStatus(HttpServletResponse.SC_OK);
|
||||
} else {
|
||||
LargeText text = log.get();
|
||||
if(text!=null)
|
||||
text.doProgressText(req,rsp);
|
||||
else
|
||||
rsp.setStatus(HttpServletResponse.SC_OK);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the error status.
|
||||
*/
|
||||
public synchronized void doClearError(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
|
||||
getBuild().checkPermission(getPermission());
|
||||
|
||||
if(workerThread!=null && !workerThread.isAlive())
|
||||
workerThread = null;
|
||||
rsp.sendRedirect(".");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
package hudson.model;
|
||||
|
||||
import hudson.util.ByteBuffer;
|
||||
import hudson.util.StreamTaskListener;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
/**
|
||||
* {@link Thread} for performing one-off task.
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
* @since 1.191
|
||||
*/
|
||||
public abstract class TaskThread extends Thread {
|
||||
// StringWriter is synchronized
|
||||
protected final ByteBuffer log = new ByteBuffer();
|
||||
protected final LargeText text = new LargeText(log,false);
|
||||
|
||||
private final TaskAction owner;
|
||||
|
||||
protected TaskThread(TaskAction owner) {
|
||||
super(owner.getBuild().toString()+' '+owner.getDisplayName());
|
||||
this.owner = owner;
|
||||
}
|
||||
|
||||
public String getLog() {
|
||||
// this method can be invoked from another thread.
|
||||
return log.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers that this {@link TaskThread} is run for the specified
|
||||
* {@link TaskAction}. This can be explicitly called from subtypes
|
||||
* to associate a single {@link TaskThread} across multiple tag actions.
|
||||
*/
|
||||
protected final void associateWith(TaskAction action) {
|
||||
action.workerThread = this;
|
||||
action.log = new WeakReference<LargeText>(text);
|
||||
}
|
||||
|
||||
public synchronized void start() {
|
||||
associateWith(owner);
|
||||
super.start();
|
||||
}
|
||||
|
||||
public final void run() {
|
||||
TaskListener listener = new StreamTaskListener(log);
|
||||
try {
|
||||
perform(listener);
|
||||
listener.getLogger().println("Completed");
|
||||
owner.workerThread = null;
|
||||
} catch (InterruptedException e) {
|
||||
listener.getLogger().println("Aborted");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace(listener.getLogger());
|
||||
}
|
||||
text.markAsComplete();
|
||||
}
|
||||
|
||||
/**
|
||||
* Do the actual work.
|
||||
*
|
||||
* @throws Exception
|
||||
* The exception is recorded and reported as a failure.
|
||||
*/
|
||||
protected abstract void perform(TaskListener listener) throws Exception;
|
||||
}
|
||||
@@ -1,22 +1,12 @@
|
||||
package hudson.scm;
|
||||
|
||||
import hudson.model.LargeText;
|
||||
import hudson.model.TaskListener;
|
||||
import hudson.model.AbstractModelObject;
|
||||
import hudson.model.Action;
|
||||
import hudson.model.AbstractBuild;
|
||||
import hudson.model.Hudson;
|
||||
import hudson.util.ByteBuffer;
|
||||
import hudson.util.StreamTaskListener;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.io.IOException;
|
||||
|
||||
import hudson.model.TaskAction;
|
||||
import org.kohsuke.stapler.StaplerRequest;
|
||||
import org.kohsuke.stapler.StaplerResponse;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.ServletException;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Common part of {@link CVSSCM.TagAction} and {@link SubversionTagAction}.
|
||||
@@ -28,20 +18,9 @@ import javax.servlet.ServletException;
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
*/
|
||||
public abstract class AbstractScmTagAction extends AbstractModelObject implements Action {
|
||||
public abstract class AbstractScmTagAction extends TaskAction {
|
||||
protected final AbstractBuild build;
|
||||
|
||||
/**
|
||||
* If non-null, that means the tagging is in progress
|
||||
* (asynchronously.)
|
||||
*/
|
||||
protected transient volatile AbstractTagWorkerThread workerThread;
|
||||
|
||||
/**
|
||||
* Hold the log of the tagging operation.
|
||||
*/
|
||||
protected transient WeakReference<LargeText> log;
|
||||
|
||||
protected AbstractScmTagAction(AbstractBuild build) {
|
||||
this.build = build;
|
||||
}
|
||||
@@ -51,77 +30,18 @@ public abstract class AbstractScmTagAction extends AbstractModelObject implement
|
||||
return "tagBuild";
|
||||
}
|
||||
|
||||
public String getSearchUrl() {
|
||||
return getUrlName();
|
||||
}
|
||||
|
||||
public AbstractBuild getBuild() {
|
||||
return build;
|
||||
}
|
||||
|
||||
public AbstractTagWorkerThread getWorkerThread() {
|
||||
return workerThread;
|
||||
}
|
||||
|
||||
public void doIndex(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
|
||||
req.setAttribute("build",build);
|
||||
req.getView(this,chooseAction()).forward(req,rsp);
|
||||
}
|
||||
|
||||
private synchronized String chooseAction() {
|
||||
protected synchronized String chooseAction() {
|
||||
if(workerThread!=null)
|
||||
return "inProgress.jelly";
|
||||
return "tagForm.jelly";
|
||||
return "form.jelly";
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles incremental log output.
|
||||
*/
|
||||
public void doProgressiveLog( StaplerRequest req, StaplerResponse rsp) throws IOException {
|
||||
if(log==null) {
|
||||
rsp.setStatus(HttpServletResponse.SC_OK);
|
||||
} else {
|
||||
LargeText text = log.get();
|
||||
if(text!=null)
|
||||
text.doProgressText(req,rsp);
|
||||
else
|
||||
rsp.setStatus(HttpServletResponse.SC_OK);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the error status.
|
||||
*/
|
||||
public synchronized void doClearError(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
|
||||
if(!Hudson.adminCheck(req,rsp))
|
||||
return;
|
||||
|
||||
if(workerThread!=null && !workerThread.isAlive())
|
||||
workerThread = null;
|
||||
rsp.sendRedirect(".");
|
||||
}
|
||||
|
||||
|
||||
public static abstract class AbstractTagWorkerThread extends Thread {
|
||||
// StringWriter is synchronized
|
||||
protected final ByteBuffer log = new ByteBuffer();
|
||||
protected final LargeText text = new LargeText(log,false);
|
||||
|
||||
public String getLog() {
|
||||
// this method can be invoked from another thread.
|
||||
return log.toString();
|
||||
}
|
||||
|
||||
public final void run() {
|
||||
TaskListener listener = new StreamTaskListener(log);
|
||||
perform(listener);
|
||||
listener.getLogger().println("Completed");
|
||||
text.markAsComplete();
|
||||
}
|
||||
|
||||
/**
|
||||
* Do the actual work.
|
||||
*/
|
||||
protected abstract void perform(TaskListener listener);
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import hudson.FilePath.FileCallable;
|
||||
import hudson.Launcher;
|
||||
import hudson.Proc;
|
||||
import hudson.Util;
|
||||
import hudson.security.Permission;
|
||||
import static hudson.Util.fixEmpty;
|
||||
import static hudson.Util.fixNull;
|
||||
import hudson.model.AbstractBuild;
|
||||
@@ -13,15 +14,14 @@ import hudson.model.AbstractProject;
|
||||
import hudson.model.BuildListener;
|
||||
import hudson.model.Hudson;
|
||||
import hudson.model.Job;
|
||||
import hudson.model.LargeText;
|
||||
import hudson.model.ModelObject;
|
||||
import hudson.model.Run;
|
||||
import hudson.model.TaskListener;
|
||||
import hudson.model.TaskThread;
|
||||
import hudson.org.apache.tools.ant.taskdefs.cvslib.ChangeLogTask;
|
||||
import hudson.remoting.Future;
|
||||
import hudson.remoting.RemoteOutputStream;
|
||||
import hudson.remoting.VirtualChannel;
|
||||
import hudson.scm.AbstractScmTagAction.AbstractTagWorkerThread;
|
||||
import hudson.util.*;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.tools.ant.BuildException;
|
||||
@@ -48,7 +48,6 @@ import java.io.PrintWriter;
|
||||
import java.io.Reader;
|
||||
import java.io.Serializable;
|
||||
import java.io.StringWriter;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.text.DateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@@ -1197,11 +1196,16 @@ public class CVSSCM extends SCM implements Serializable {
|
||||
}.check();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Permission getPermission() {
|
||||
return TAG;
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoked to actually tag the workspace.
|
||||
*/
|
||||
public synchronized void doSubmit(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
|
||||
build.getParent().getACL().checkPermission(TAG);
|
||||
build.checkPermission(TAG);
|
||||
|
||||
Map<AbstractBuild,String> tagSet = new HashMap<AbstractBuild,String>();
|
||||
|
||||
@@ -1239,7 +1243,7 @@ public class CVSSCM extends SCM implements Serializable {
|
||||
}
|
||||
}
|
||||
|
||||
new TagWorkerThread(tagSet).start();
|
||||
new TagWorkerThread(this,tagSet).start();
|
||||
|
||||
doIndex(req,rsp);
|
||||
}
|
||||
@@ -1336,7 +1340,6 @@ public class CVSSCM extends SCM implements Serializable {
|
||||
// completed successfully
|
||||
onTagCompleted(tagName);
|
||||
build.save();
|
||||
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace(listener.fatalError(e.getMessage()));
|
||||
} finally {
|
||||
@@ -1363,20 +1366,19 @@ public class CVSSCM extends SCM implements Serializable {
|
||||
}
|
||||
}
|
||||
|
||||
public static final class TagWorkerThread extends AbstractTagWorkerThread {
|
||||
public static final class TagWorkerThread extends TaskThread {
|
||||
private final Map<AbstractBuild,String> tagSet;
|
||||
|
||||
public TagWorkerThread(Map<AbstractBuild,String> tagSet) {
|
||||
public TagWorkerThread(TagAction owner,Map<AbstractBuild,String> tagSet) {
|
||||
super(owner);
|
||||
this.tagSet = tagSet;
|
||||
}
|
||||
|
||||
public synchronized void start() {
|
||||
for (Entry<AbstractBuild, String> e : tagSet.entrySet()) {
|
||||
TagAction ta = e.getKey().getAction(TagAction.class);
|
||||
if(ta!=null) {
|
||||
ta.workerThread = this;
|
||||
ta.log = new WeakReference<LargeText>(text);
|
||||
}
|
||||
if(ta!=null)
|
||||
associateWith(ta);
|
||||
}
|
||||
|
||||
super.start();
|
||||
|
||||
@@ -43,7 +43,6 @@ import org.tmatesoft.svn.core.auth.SVNSSHAuthentication;
|
||||
import org.tmatesoft.svn.core.auth.SVNSSLAuthentication;
|
||||
import org.tmatesoft.svn.core.auth.SVNUserNameAuthentication;
|
||||
import org.tmatesoft.svn.core.internal.io.dav.DAVRepositoryFactory;
|
||||
import org.tmatesoft.svn.core.internal.io.dav.http.IHTTPConnectionFactory;
|
||||
import org.tmatesoft.svn.core.internal.io.dav.http.DefaultHTTPConnectionFactory;
|
||||
import org.tmatesoft.svn.core.internal.io.fs.FSRepositoryFactory;
|
||||
import org.tmatesoft.svn.core.internal.io.svn.SVNRepositoryFactoryImpl;
|
||||
@@ -77,6 +76,7 @@ import java.io.Serializable;
|
||||
import java.io.StringWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Hashtable;
|
||||
@@ -85,7 +85,6 @@ import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Random;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.Collections;
|
||||
import java.util.logging.ConsoleHandler;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
@@ -4,9 +4,10 @@ import hudson.model.AbstractBuild;
|
||||
import hudson.model.Action;
|
||||
import hudson.model.Hudson;
|
||||
import hudson.model.TaskListener;
|
||||
import hudson.model.LargeText;
|
||||
import hudson.model.TaskThread;
|
||||
import hudson.scm.SubversionSCM.SvnInfo;
|
||||
import hudson.util.CopyOnWriteMap;
|
||||
import hudson.security.Permission;
|
||||
import org.kohsuke.stapler.StaplerRequest;
|
||||
import org.kohsuke.stapler.StaplerResponse;
|
||||
import org.tmatesoft.svn.core.SVNException;
|
||||
@@ -18,16 +19,15 @@ import org.tmatesoft.svn.core.wc.SVNRevision;
|
||||
import javax.servlet.ServletException;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* {@link Action} that lets people create tag for the given build.
|
||||
@@ -111,8 +111,7 @@ public class SubversionTagAction extends AbstractScmTagAction {
|
||||
* Invoked to actually tag the workspace.
|
||||
*/
|
||||
public synchronized void doSubmit(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
|
||||
if(!Hudson.adminCheck(req,rsp))
|
||||
return;
|
||||
getBuild().checkPermission(getPermission());
|
||||
|
||||
Map<SvnInfo,String> newTags = new HashMap<SvnInfo,String>();
|
||||
|
||||
@@ -129,22 +128,21 @@ public class SubversionTagAction extends AbstractScmTagAction {
|
||||
rsp.sendRedirect(".");
|
||||
}
|
||||
|
||||
protected Permission getPermission() {
|
||||
return SubversionSCM.TAG;
|
||||
}
|
||||
|
||||
/**
|
||||
* The thread that performs tagging operation asynchronously.
|
||||
*/
|
||||
public final class TagWorkerThread extends AbstractTagWorkerThread {
|
||||
public final class TagWorkerThread extends TaskThread {
|
||||
private final Map<SvnInfo,String> tagSet;
|
||||
|
||||
public TagWorkerThread(Map<SvnInfo, String> tagSet) {
|
||||
public TagWorkerThread(Map<SvnInfo,String> tagSet) {
|
||||
super(SubversionTagAction.this);
|
||||
this.tagSet = tagSet;
|
||||
}
|
||||
|
||||
public synchronized void start() {
|
||||
SubversionTagAction.this.workerThread = this;
|
||||
SubversionTagAction.this.log = new WeakReference<LargeText>(text);
|
||||
super.start();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void perform(TaskListener listener) {
|
||||
try {
|
||||
|
||||
+29
-20
@@ -7,29 +7,38 @@
|
||||
Redeploy Artifacts
|
||||
</h1>
|
||||
|
||||
<p>
|
||||
This page allows you to redeploy the build artifacts to a repository after the fact.
|
||||
</p>
|
||||
<j:choose>
|
||||
<!-- A deployment is in progress -->
|
||||
<j:when test="${it.workerThread!=null}">
|
||||
<st:include page="log.jelly" />
|
||||
</j:when>
|
||||
|
||||
<f:form method="post" action="redeploy">
|
||||
<f:entry title="Repository URL">
|
||||
<f:textbox name="url" />
|
||||
</f:entry>
|
||||
<f:advanced>
|
||||
<f:entry title="Repository ID">
|
||||
<f:textbox name="id" />
|
||||
</f:entry>
|
||||
<f:entry>
|
||||
<f:checkbox name="uniqueVersion"/>
|
||||
<label class="attach-previous">Assign unique versions to snapshots</label>
|
||||
</f:entry>
|
||||
</f:advanced>
|
||||
<!-- No deployment is in progress. Display the form. -->
|
||||
<j:otherwise>
|
||||
<p>
|
||||
This page allows you to redeploy the build artifacts to a repository after the fact.
|
||||
</p>
|
||||
|
||||
<f:block>
|
||||
<f:submit value="OK" style="margin-top:1em;" />
|
||||
</f:block>
|
||||
</f:form>
|
||||
<f:form method="post" action="redeploy">
|
||||
<f:entry title="Repository URL">
|
||||
<f:textbox name="url" />
|
||||
</f:entry>
|
||||
<f:advanced>
|
||||
<f:entry title="Repository ID">
|
||||
<f:textbox name="id" />
|
||||
</f:entry>
|
||||
<f:entry>
|
||||
<f:checkbox name="uniqueVersion"/>
|
||||
<label class="attach-previous">Assign unique versions to snapshots</label>
|
||||
</f:entry>
|
||||
</f:advanced>
|
||||
|
||||
<f:block>
|
||||
<f:submit value="OK" style="margin-top:1em;" />
|
||||
</f:block>
|
||||
</f:form>
|
||||
</j:otherwise>
|
||||
</j:choose>
|
||||
</l:main-panel>
|
||||
</l:layout>
|
||||
</j:jelly>
|
||||
@@ -0,0 +1,22 @@
|
||||
<!--
|
||||
Include this in the main page to display the log
|
||||
-->
|
||||
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">
|
||||
<j:choose>
|
||||
<!-- Do progressive console output -->
|
||||
<j:when test="${it.workerThread.alive}">
|
||||
<pre id="out"></pre>
|
||||
<div id="spinner">
|
||||
<img src="${imagesURL}/spinner.gif" />
|
||||
</div>
|
||||
<t:progressiveText href="progressiveLog" idref="out" spinner="spinner" />
|
||||
</j:when>
|
||||
<!-- output is completed now. -->
|
||||
<j:otherwise>
|
||||
<pre><st:out value="${it.workerThread.log}"/></pre>
|
||||
<form method="get" action="clearError">
|
||||
<f:submit value="Clear error to retry" />
|
||||
</form>
|
||||
</j:otherwise>
|
||||
</j:choose>
|
||||
</j:jelly>
|
||||
@@ -4,26 +4,10 @@
|
||||
<l:main-panel>
|
||||
<h1>Build #${it.build.number}</h1>
|
||||
<p>
|
||||
Tagging is in progress.
|
||||
${%Tagging is in progress:}
|
||||
</p>
|
||||
|
||||
<j:choose>
|
||||
<!-- Do progressive console output -->
|
||||
<j:when test="${it.workerThread.alive}">
|
||||
<pre id="out"></pre>
|
||||
<div id="spinner">
|
||||
<img src="${imagesURL}/spinner.gif" />
|
||||
</div>
|
||||
<t:progressiveText href="progressiveLog" idref="out" spinner="spinner" />
|
||||
</j:when>
|
||||
<!-- output is completed now. -->
|
||||
<j:otherwise>
|
||||
<pre><st:out value="${it.workerThread.log}"/></pre>
|
||||
<form method="get" action="clearError">
|
||||
<f:submit value="Clear error to retry" />
|
||||
</form>
|
||||
</j:otherwise>
|
||||
</j:choose>
|
||||
<st:include page="log.jelly" />
|
||||
</l:main-panel>
|
||||
</l:layout>
|
||||
</j:jelly>
|
||||
Reference in new issue
Block a user