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 class
BuildFlowScriptAction.BuildFlowScriptActionDescriptor
-
Constructor Summary
Constructors Constructor Description BuildFlowScriptAction()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
createTgzArchive(File dstFile, List<MetaScript> scripts)
ReadOnlyConfigurationArchive
doDownload()
Creates anHttpResponse
that will send a TGZ containing build scripts.File
generateExecutableCompoundScript(AbstractBuild<?,?> build, List<Builder> builders, String archiveName, Map<String,String> params)
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.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 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 filesBuildFlowScriptAction.BuildFlowScriptActionDescriptor
getDescriptor()
static BuildFlowScriptAction.BuildFlowScriptActionDescriptor
getDescriptorStatic()
String
getDisplayName()
String
getIconFileName()
AbstractProject<?,?>
getProject()
Returns the project associated with the build this action is configured on.InheritanceProject
getProject(org.kohsuke.stapler.StaplerRequest request)
This method returns theInheritanceProject
associated with the given request; if any are.static Map<String,String>
getResolvedBuildParameters(AbstractBuild<?,?> build)
static Map<String,String>
getResolvedBuildParameters(InheritanceProject project)
String
getUrlName()
void
onAttached(Run<?,?> r)
void
onLoad(Run<?,?> r)
static void
registerXStream()
-
-
-
Method Detail
-
onAttached
public void onAttached(Run<?,?> r)
- Specified by:
onAttached
in interfaceRunAction2
-
onLoad
public void onLoad(Run<?,?> r)
- Specified by:
onLoad
in 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 theInheritanceProject
associated 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:
getIconFileName
in interfaceAction
-
getDisplayName
public String getDisplayName()
- Specified by:
getDisplayName
in interfaceAction
- Specified by:
getDisplayName
in interfaceModelObject
-
getUrlName
public String getUrlName()
- Specified by:
getUrlName
in interfaceAction
-
doDownload
public ReadOnlyConfigurationArchive doDownload()
Creates anHttpResponse
that 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:
getDescriptor
in interfaceDescribable<BuildFlowScriptAction>
-
getDescriptorStatic
public static BuildFlowScriptAction.BuildFlowScriptActionDescriptor getDescriptorStatic()
-
-