Class BuildFlowScriptAction
- java.lang.Object
-
- hudson.plugins.project_inheritance.projects.view.BuildFlowScriptAction
-
- All Implemented Interfaces:
Action,Describable<BuildFlowScriptAction>,ModelObject,RunAction2
public class BuildFlowScriptAction extends Object implements RunAction2, Describable<BuildFlowScriptAction>
This class implements the action that allows you to see and download all the build steps that make up a particular run of a project.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classBuildFlowScriptAction.BuildFlowScriptActionDescriptor
-
Constructor Summary
Constructors Constructor Description BuildFlowScriptAction()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcreateTgzArchive(File dstFile, List<MetaScript> scripts)ReadOnlyConfigurationArchivedoDownload()Creates anHttpResponsethat will send a TGZ containing build scripts.FilegenerateExecutableCompoundScript(AbstractBuild<?,?> build, List<Builder> builders, String archiveName, Map<String,String> params)static MetaScriptgetBashControlFile(File prefix, String scriptName, List<MetaScript> scripts, Map<String,String> env, boolean setWorkspaceVars)This method generates a "build.sh" Bash control file for the given script files.AbstractBuild<?,?>getBuild()AbstractBuild<?,?>getBuild(org.kohsuke.stapler.StaplerRequest req)protected List<Builder>getBuildersFor(AbstractProject<?,?> p)Returns the list of build steps for a given project, or an empty list if the project is invalid or has no builders.static MetaScriptgetCmdControlFile(File prefix, String scriptName, List<MetaScript> scripts, Map<String,String> env, boolean setWorkspaceVars)This method generates a "build.bat" windows CMD control file for the given script filesBuildFlowScriptAction.BuildFlowScriptActionDescriptorgetDescriptor()static BuildFlowScriptAction.BuildFlowScriptActionDescriptorgetDescriptorStatic()StringgetDisplayName()StringgetIconFileName()AbstractProject<?,?>getProject()Returns the project associated with the build this action is configured on.InheritanceProjectgetProject(org.kohsuke.stapler.StaplerRequest request)This method returns theInheritanceProjectassociated with the given request; if any are.static Map<String,String>getResolvedBuildParameters(AbstractBuild<?,?> build)static Map<String,String>getResolvedBuildParameters(InheritanceProject project)StringgetUrlName()voidonAttached(Run<?,?> r)voidonLoad(Run<?,?> r)static voidregisterXStream()
-
-
-
Method Detail
-
onAttached
public void onAttached(Run<?,?> r)
- Specified by:
onAttachedin interfaceRunAction2
-
onLoad
public void onLoad(Run<?,?> r)
- Specified by:
onLoadin interfaceRunAction2
-
registerXStream
@Initializer(after=PLUGINS_STARTED) public static void registerXStream()
-
getProject
public AbstractProject<?,?> getProject()
Returns the project associated with the build this action is configured on.- Returns:
- null, if no build is present from which the project can be grabbed.
-
getProject
public InheritanceProject getProject(org.kohsuke.stapler.StaplerRequest request)
This method returns theInheritanceProjectassociated with the given request; if any are. Otherwise, returns null.- Parameters:
request- the request to check for anInheritanceProject- Returns:
- null, if no such project is associated with the request
-
getBuild
public AbstractBuild<?,?> getBuild()
-
getBuild
public AbstractBuild<?,?> getBuild(org.kohsuke.stapler.StaplerRequest req)
-
getIconFileName
public String getIconFileName()
- Specified by:
getIconFileNamein interfaceAction
-
getDisplayName
public String getDisplayName()
- Specified by:
getDisplayNamein interfaceAction- Specified by:
getDisplayNamein interfaceModelObject
-
getUrlName
public String getUrlName()
- Specified by:
getUrlNamein interfaceAction
-
doDownload
public ReadOnlyConfigurationArchive doDownload()
Creates anHttpResponsethat will send a TGZ containing build scripts.- Returns:
- null, if the file could not be generated, otherwise a valid
HttpResponse.
-
getBuildersFor
protected List<Builder> getBuildersFor(AbstractProject<?,?> p)
Returns the list of build steps for a given project, or an empty list if the project is invalid or has no builders.- Parameters:
p- the project to scan- Returns:
- a list, never null but may be empty.
-
generateExecutableCompoundScript
public File generateExecutableCompoundScript(AbstractBuild<?,?> build, List<Builder> builders, String archiveName, Map<String,String> params) throws IOException
- Throws:
IOException
-
getCmdControlFile
public static MetaScript getCmdControlFile(File prefix, String scriptName, List<MetaScript> scripts, Map<String,String> env, boolean setWorkspaceVars)
This method generates a "build.bat" windows CMD control file for the given script files- Parameters:
prefix- the directory the control file will be created in. May be null.scriptName- the name for the control file, defaults to "build" if null or blank.scripts- the scripts for which to create the control fileenv- the environment variables to be set in this control filesetWorkspaceVars- if true, the script will set and create the WORKSPACE variable.- Returns:
- a script containing a Windows CMD control file
-
getBashControlFile
public static MetaScript getBashControlFile(File prefix, String scriptName, List<MetaScript> scripts, Map<String,String> env, boolean setWorkspaceVars)
This method generates a "build.sh" Bash control file for the given script files.- Parameters:
prefix- the directory the control file will be created in. May be null.scriptName- the name for the control file, defaults to "build" if null or blank.scripts- the scripts for which to create the control fileenv- the environment variables to be set in this control filesetWorkspaceVars- if true, the script will set and create the WORKSPACE variable.- Returns:
- a script containing a Bash control file
-
createTgzArchive
public void createTgzArchive(File dstFile, List<MetaScript> scripts) throws IOException
- Throws:
IOException
-
getResolvedBuildParameters
public static Map<String,String> getResolvedBuildParameters(AbstractBuild<?,?> build)
-
getResolvedBuildParameters
public static Map<String,String> getResolvedBuildParameters(InheritanceProject project)
-
getDescriptor
public BuildFlowScriptAction.BuildFlowScriptActionDescriptor getDescriptor()
- Specified by:
getDescriptorin interfaceDescribable<BuildFlowScriptAction>
-
getDescriptorStatic
public static BuildFlowScriptAction.BuildFlowScriptActionDescriptor getDescriptorStatic()
-
-