au.com.centrumsystems.hudson.plugin.buildpipeline.trigger
Class BuildPipelineTrigger

java.lang.Object
  extended by hudson.tasks.BuildStepCompatibilityLayer
      extended by hudson.tasks.Publisher
          extended by hudson.tasks.Notifier
              extended by au.com.centrumsystems.hudson.plugin.buildpipeline.trigger.BuildPipelineTrigger
All Implemented Interfaces:
hudson.ExtensionPoint, hudson.model.DependecyDeclarer, hudson.model.Describable<hudson.tasks.Publisher>, hudson.tasks.BuildStep, jenkins.model.DependencyDeclarer

public class BuildPipelineTrigger
extends hudson.tasks.Notifier
implements hudson.model.DependecyDeclarer

The build pipeline trigger allows the creation of downstream jobs which aren't triggered automatically. This allows us to have manual "approval" steps in the process where jobs are manually promoted along the pipeline by a user pressing a button on the view.

Author:
Centrum Systems

Nested Class Summary
static class BuildPipelineTrigger.DescriptorImpl
          Set the descriptor for build pipeline trigger class This descriptor is only attached to Build Trigger Post Build action in JOB configuration page
 
Nested classes/interfaces inherited from class hudson.tasks.Publisher
hudson.tasks.Publisher.DescriptorExtensionListImpl
 
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
hudson.ExtensionPoint.LegacyInstancesAreScopedToHudson
 
Nested classes/interfaces inherited from interface hudson.tasks.BuildStep
hudson.tasks.BuildStep.PublisherList
 
Field Summary
 
Fields inherited from interface hudson.tasks.BuildStep
BUILDERS, PUBLISHERS
 
Constructor Summary
BuildPipelineTrigger(String downstreamProjectNames, List<hudson.plugins.parameterizedtrigger.AbstractBuildParameters> configs)
          Construct the trigger setting the project name and manual build promotion option
 
Method Summary
 void buildDependencyGraph(hudson.model.AbstractProject owner, hudson.model.DependencyGraph graph)
          this method is required to rebuild the dependency graph of the downstream project
 List<hudson.plugins.parameterizedtrigger.AbstractBuildParameters> getConfigs()
           
 String getDownstreamProjectNames()
           
 hudson.tasks.BuildStepMonitor getRequiredMonitorService()
           
 boolean needsToRunAfterFinalized()
           
 boolean onDownstreamProjectDeleted(String oldName)
          Deletes a project from downstreamProjectNames.
 boolean onDownstreamProjectRenamed(String oldName, String newName)
          Renames a project contained in downstreamProjectNames
 boolean perform(hudson.model.AbstractBuild<?,?> build, hudson.Launcher launcher, hudson.model.BuildListener listener)
           
 void removeDownstreamTrigger(BuildPipelineTrigger bpTrigger, hudson.model.AbstractProject<?,?> ownerProject, String downstreamProjectName)
          Removes a downstream trigger (BuildPipelineTrigger) from a project.
 void setDownstreamProjectNames(String downstreamProjectNames)
           
 
Methods inherited from class hudson.tasks.Notifier
getDescriptor
 
Methods inherited from class hudson.tasks.Publisher
all, getProjectAction, 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
 

Constructor Detail

BuildPipelineTrigger

@DataBoundConstructor
public BuildPipelineTrigger(String downstreamProjectNames,
                                                 List<hudson.plugins.parameterizedtrigger.AbstractBuildParameters> configs)
Construct the trigger setting the project name and manual build promotion option

Parameters:
downstreamProjectNames - - the job name of the downstream build
configs - - the build parameters
Method Detail

getDownstreamProjectNames

public String getDownstreamProjectNames()

setDownstreamProjectNames

public void setDownstreamProjectNames(String downstreamProjectNames)

getConfigs

public List<hudson.plugins.parameterizedtrigger.AbstractBuildParameters> getConfigs()

buildDependencyGraph

public void buildDependencyGraph(hudson.model.AbstractProject owner,
                                 hudson.model.DependencyGraph graph)
this method is required to rebuild the dependency graph of the downstream project

Specified by:
buildDependencyGraph in interface jenkins.model.DependencyDeclarer
Parameters:
owner - owner
graph - graph

needsToRunAfterFinalized

public boolean needsToRunAfterFinalized()
Overrides:
needsToRunAfterFinalized in class hudson.tasks.Publisher

getRequiredMonitorService

public hudson.tasks.BuildStepMonitor getRequiredMonitorService()
Specified by:
getRequiredMonitorService in interface hudson.tasks.BuildStep

perform

public boolean perform(hudson.model.AbstractBuild<?,?> build,
                       hudson.Launcher launcher,
                       hudson.model.BuildListener listener)
                throws InterruptedException,
                       IOException
Specified by:
perform in interface hudson.tasks.BuildStep
Overrides:
perform in class hudson.tasks.BuildStepCompatibilityLayer
Throws:
InterruptedException
IOException

onDownstreamProjectRenamed

public boolean onDownstreamProjectRenamed(String oldName,
                                          String newName)
Renames a project contained in downstreamProjectNames

Parameters:
oldName - - The old name of the project
newName - - The new name of the project
Returns:
- true: A downstream project has been renamed; false No downstream projects were renamed

onDownstreamProjectDeleted

public boolean onDownstreamProjectDeleted(String oldName)
Deletes a project from downstreamProjectNames.

Parameters:
oldName - - Project to be deleted
Returns:
- true; project deleted: false; project not deleted onDownstreamProjectRenamed(String, String)

removeDownstreamTrigger

public void removeDownstreamTrigger(BuildPipelineTrigger bpTrigger,
                                    hudson.model.AbstractProject<?,?> ownerProject,
                                    String downstreamProjectName)
Removes a downstream trigger (BuildPipelineTrigger) from a project. This removes both: - The downstream project name from the downstreamProjectNames attribute - The BuildPipelineTrigger from the AbstractProject publishers list

Parameters:
bpTrigger - - The BuildPipelineTrigger to be removed
ownerProject - - The AbstractProject from which to removed the BuildPipelineTrigger
downstreamProjectName - - The name of the AbstractProject associated with the BuildPipelineTrigger


Copyright © 2004-2014. All Rights Reserved.