hudson.maven
Class RedeployPublisher

java.lang.Object
  extended by hudson.tasks.BuildStepCompatibilityLayer
      extended by hudson.tasks.Publisher
          extended by hudson.tasks.Recorder
              extended by hudson.maven.RedeployPublisher
All Implemented Interfaces:
ExtensionPoint, Describable<Publisher>, BuildStep

public class RedeployPublisher
extends Recorder

Publisher for MavenModuleSetBuild to deploy artifacts after a build is fully succeeded.

Note that the - historical given - name of this class is quite misleading as this publisher usually does no REdeployment of artifacts. If you're looking for the redeploy functionality in the Jenkins UI: that is implemented in MavenAbstractArtifactRecord.doRedeploy(String, String, boolean)!

Since:
1.191
Author:
Kohsuke Kawaguchi

Nested Class Summary
static class RedeployPublisher.DescriptorImpl
           
static class RedeployPublisher.WrappedArtifactRepository
           
 
Nested classes/interfaces inherited from class hudson.tasks.Publisher
Publisher.DescriptorExtensionListImpl
 
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
 
Nested classes/interfaces inherited from interface hudson.tasks.BuildStep
BuildStep.PublisherList
 
Field Summary
 boolean evenIfUnstable
           
 String id
          Repository ID.
 String releaseEnvVar
           
 boolean uniqueVersion
           
 String url
          Repository URL to deploy artifacts to.
 
Fields inherited from interface hudson.tasks.BuildStep
BUILDERS, PUBLISHERS
 
Constructor Summary
RedeployPublisher(String id, String url, boolean uniqueVersion)
          Deprecated. 
RedeployPublisher(String id, String url, boolean uniqueVersion, boolean evenIfUnstable)
          Deprecated. 
RedeployPublisher(String id, String url, boolean uniqueVersion, boolean evenIfUnstable, String releaseEnvVar)
           
 
Method Summary
protected  List<MavenAbstractArtifactRecord> getActions(AbstractBuild<?,?> build, BuildListener listener)
           
protected  MavenModuleSetBuild getMavenBuild(AbstractBuild<?,?> build)
          Obtains the MavenModuleSetBuild that we'll work on, or null.
 BuildStepMonitor getRequiredMonitorService()
          Declares the scope of the synchronization monitor this BuildStep expects from outside.
protected  Result getTreshold()
           
 boolean perform(AbstractBuild<?,?> build, Launcher launcher, BuildListener listener)
          Runs the step over the given build and reports the progress to the listener.
 
Methods inherited from class hudson.tasks.Recorder
getDescriptor
 
Methods inherited from class hudson.tasks.Publisher
all, getProjectAction, needsToRunAfterFinalized, prebuild
 
Methods inherited from class hudson.tasks.BuildStepCompatibilityLayer
getProjectAction, getProjectActions, perform, prebuild
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface hudson.tasks.BuildStep
getProjectAction, getProjectActions, prebuild
 

Field Detail

id

public final String id
Repository ID. This is matched up with ~/.m2/settings.xml for authentication related information.


url

public final String url
Repository URL to deploy artifacts to.


uniqueVersion

public final boolean uniqueVersion

evenIfUnstable

public final boolean evenIfUnstable

releaseEnvVar

public final String releaseEnvVar
Constructor Detail

RedeployPublisher

@Deprecated
public RedeployPublisher(String id,
                                    String url,
                                    boolean uniqueVersion)
Deprecated. 

For backward compatibility


RedeployPublisher

@Deprecated
public RedeployPublisher(String id,
                                    String url,
                                    boolean uniqueVersion,
                                    boolean evenIfUnstable)
Deprecated. 

Since:
1.347

RedeployPublisher

@DataBoundConstructor
public RedeployPublisher(String id,
                                              String url,
                                              boolean uniqueVersion,
                                              boolean evenIfUnstable,
                                              String releaseEnvVar)
Method Detail

perform

public boolean perform(AbstractBuild<?,?> build,
                       Launcher launcher,
                       BuildListener listener)
                throws InterruptedException,
                       IOException
Description copied from interface: BuildStep
Runs the step over the given build and reports the progress to the listener.

A plugin can contribute the action object to Actionable.getActions() so that a 'report' becomes a part of the persisted data of Build. This is how JUnit plugin attaches the test report to a build page, for example.

Specified by:
perform in interface BuildStep
Overrides:
perform in class BuildStepCompatibilityLayer
Returns:
true if the build can continue, false if there was an error and the build needs to be aborted.

Using the return value to indicate success/failure should be considered deprecated, and implementations are encouraged to throw AbortException to indicate a failure.

Throws:
InterruptedException - If the build is interrupted by the user (in an attempt to abort the build.) Normally the BuildStep implementations may simply forward the exception it got from its lower-level functions.
IOException - If the implementation wants to abort the processing when an IOException happens, it can simply propagate the exception to the caller. This will cause the build to fail, with the default error message. Implementations are encouraged to catch IOException on its own to provide a better error message, if it can do so, so that users have better understanding on why it failed.

getMavenBuild

protected MavenModuleSetBuild getMavenBuild(AbstractBuild<?,?> build)
Obtains the MavenModuleSetBuild that we'll work on, or null.

This allows promoted-builds plugin to reuse the code for delayed deployment.


getActions

protected List<MavenAbstractArtifactRecord> getActions(AbstractBuild<?,?> build,
                                                       BuildListener listener)

getRequiredMonitorService

public BuildStepMonitor getRequiredMonitorService()
Description copied from interface: BuildStep
Declares the scope of the synchronization monitor this BuildStep expects from outside.

This method is introduced for preserving compatibility with plugins written for earlier versions of Hudson, which never run multiple builds of the same job in parallel. Such plugins often assume that the outcome of the previous build is completely available, which is no longer true when we do concurrent builds.

To minimize the necessary code change for such plugins, BuildStep implementations can request Hudson to externally perform synchronization before executing them. This behavior is as follows:

BuildStepMonitor.BUILD
This BuildStep is only executed after the previous build is fully completed (thus fully restoring the earlier semantics of one build at a time.)
BuildStepMonitor.STEP
This BuildStep is only executed after the same step in the previous build is completed. For build steps that use a weaker assumption and only rely on the output from the same build step of the early builds, this improves the concurrency.
BuildStepMonitor.NONE
No external synchronization is performed on this build step. This is the most efficient, and thus the recommended value for newer plugins. Wherever necessary, you can directly use CheckPoints to perform necessary synchronizations.

Migrating Older Implementation

If you are migrating BuildStep implementations written for earlier versions of Hudson, here's what you can do:

Note to caller

For plugins written against earlier versions of Hudson, calling this method results in AbstractMethodError.


getTreshold

protected Result getTreshold()


Copyright © 2004-2013. All Rights Reserved.