|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.atlassian.bamboo.command.Command com.atlassian.bamboo.builder.AbstractBuilder
public abstract class AbstractBuilder
Common builder functionality.
Field Summary | |
---|---|
static java.lang.String |
BUILD_FAILED_MARKER
|
static java.lang.String |
BUILD_SUCCESSFUL_MARKER
|
protected BuildDirectoryManager |
buildDirectoryManager
|
protected static java.lang.String |
DEFAULT_TEST_REPORTS_XML
|
protected ErrorUpdateHandler |
errorUpdateHandler
|
protected static int |
FIND_FAILURE_MESSAGE_IN_LAST
|
protected static int |
FIND_SUCCESS_MESSAGE_IN_LAST
Bamboo will look at this constant to find how far back in the logs to look for a successful message |
static java.lang.String |
PARAM_BUILD_LABEL
|
static java.lang.String |
PARAM_BUILDJDK
|
static java.lang.String |
PARAM_ENV_VAR
|
static java.lang.String |
PARAM_HASTESTS
|
static java.lang.String |
PARAM_HOME
|
static java.lang.String |
PARAM_PROJECT_FILE
|
static java.lang.String |
PARAM_TEST_RESULTS_DIRECTORY
|
static java.lang.String |
PARAM_WORKING_SUB_DIR
|
protected static boolean |
SEARCH_BUILD_SUCCESS_FAIL_MESSAGE_EVERYWHERE
|
protected TemplateRenderer |
templateRenderer
|
Fields inherited from class com.atlassian.bamboo.command.Command |
---|
buildLoggerManager, CBD_BUILD_COMMANDLINE, substitutionBean |
Fields inherited from interface com.atlassian.bamboo.builder.Builder |
---|
CAPABILITY_BUILDER_PREFIX, CAPABILITY_BUILDER_TYPE |
Constructor Summary | |
---|---|
protected |
AbstractBuilder()
|
Method Summary | |
---|---|
void |
collateTestResults(BuildIdentifier buildIdentifier,
CurrentBuildResult buildResult,
BuildLogger buildLogger)
|
java.util.Map<java.lang.String,java.lang.String> |
customiseLabelTypeMap(java.util.Map<java.lang.String,java.lang.String> labelTypeMap)
Allows the builder to add extra label -> builder type key mappings |
void |
customizeBuildRequirements(BuildConfiguration buildConfiguration,
RequirementSet requirementSet)
Extension point for adding/customizing requirements when editing a build's builder configuration. |
void |
executeBuild(BuildContext buildContext,
ReadOnlyCapabilitySet capabilitySet)
Runs the build, and updates the build results in the build context. |
java.io.File |
getBuildDir()
Location of build directory |
BuildDirectoryManager |
getBuildDirectoryManager()
|
java.lang.String |
getBuildJdk()
Provide the UI form with the JDK the build needs to be built on |
java.lang.String |
getCompleteKey()
Returns the full plugin descriptor key |
java.lang.String |
getEditHtml(BuildConfiguration buildConfiguration,
Plan plan)
Returns HTML that represents the form fragment for editing the repository. |
java.lang.String |
getEnvironmentVariables()
Provides the ui form with the build's system environment variables |
protected FilteredMap<java.lang.String> |
getFilteredParams()
|
java.util.Map<java.lang.String,java.lang.String> |
getFullParams()
Gets the full params that's used to persist. |
java.lang.String |
getKey()
Returns the short simple key for this builder (e.g. |
java.lang.String |
getKeyPrefix()
|
java.lang.String |
getLabel()
What is the label used to getPrettyPrint this item in the GUI? |
java.lang.String |
getPath(ReadOnlyCapabilitySet capabilitySet)
The home path of the builder's command line |
java.lang.String |
getPathHelp()
Help text for the builder type |
java.lang.String |
getProjectFile()
Return the project file path relative to the working subdirectory |
protected java.util.Map<java.lang.String,java.lang.Object> |
getTemplateContext()
|
java.lang.String |
getTestChecked()
Informs the UI if the build is testless. |
java.lang.String |
getTestResultsDirectory()
What are the build's junit test results stored? Can be a comma separated list |
java.lang.String |
getViewHtml(Plan plan)
Returns the HTML that represents the view of the repository configuration |
java.io.File |
getWorkingDirectory()
Get the location of the build file (includes the working sub directory of if it exists) |
java.lang.String |
getWorkingSubDirectory()
Return the optional working subdirectory |
boolean |
hasPassed(int returnCode,
int buildNumber,
java.lang.String planKey)
Determines based on the return code and/or logs whether the build has passed. |
boolean |
hasTests()
Does the build have any tests to be included in the build results web pages? |
void |
init(com.atlassian.plugin.ModuleDescriptor moduleDescriptor)
Initialises the Plugin with the plugin module descriptor |
boolean |
isJdkValid()
|
boolean |
isLabelPathMapConfigurable()
Returns true if the Builder can have its LabelPathMap configurable. |
protected boolean |
outputEndsWith(int positionFromEnd,
java.lang.String expectedText,
java.lang.String planKey,
int buildNumber)
Utility method to check the buildlogs contained the expected success text |
void |
populateBuildErrors(CurrentBuildResult buildResult,
java.util.List<java.lang.String> errorOutput,
java.lang.String planKey,
int buildNumber)
An extension point for implementors to modify the Error Summary |
void |
prepareConfigObject(BuildConfiguration buildConfiguration)
Do any preprocessing work before validation occurs. |
protected void |
removeAllSystemJdkRequirements(RequirementSet requirementSet)
|
void |
removeBuildRequirements(BuildConfiguration buildConfiguration,
RequirementSet requirementSet)
Extension point for removing requirements when given plugin is excluded from build's builder configuration. |
CurrentBuildResult |
runBuild(BuildContext buildContext,
ReadOnlyCapabilitySet capabilitySet)
|
void |
setAdministrationConfiguration(AdministrationConfiguration administrationConfiguration)
|
void |
setBuildDir(java.io.File buildDirectory)
Where is the build file file? |
void |
setBuildDirectoryManager(BuildDirectoryManager buildDirectoryManager)
|
void |
setBuildJdk(java.lang.String buildJdk)
Define the JDK the build beeds to be built on. |
void |
setBuildLogFileAccessorFactory(BuildLogFileAccessorFactory buildLogFileAccessorFactory)
|
void |
setEnvironmentVariables(java.lang.String envVars)
Define the system environment variabled required to build the build. |
void |
setErrorUpdateHandler(ErrorUpdateHandler errorUpdateHandler)
|
void |
setHasTests(boolean hasTests)
Does the build have any tests to be included in the build results web pages? |
void |
setJdkManager(JdkManager jdkManager)
|
void |
setKey(java.lang.String key)
|
void |
setLabel(java.lang.String label)
Sets the label being used by the builder |
void |
setParams(FilteredMap filteredParams)
Updates the current builder object with |
void |
setProjectFile(java.lang.String projectFile)
Specify project file path relative to the working subdirectory. |
void |
setTemplateRenderer(TemplateRenderer templateRenderer)
|
void |
setTestChecked(java.lang.String enabled)
The user has selected that the build has tests (via a checkbox) |
void |
setTestResultsDirectory(java.lang.String testResultDirectory)
Let the builder specify the location of the build's test result files. |
void |
setWorkingSubDirectory(java.lang.String workingSubDirectory)
Specify the working sub directory |
java.lang.String |
toString()
Default toString simply displays the name so they can be slotted into drop down lists and such like. |
protected abstract ErrorCollection |
validate(FilteredMap<java.lang.String> filteredParams)
|
ErrorCollection |
validate(ReadOnlyCapabilitySet capabilities)
Validate the Builder's current internal settings are still valid |
Methods inherited from class com.atlassian.bamboo.command.Command |
---|
decorateCommandLine, executeCommand, getBuildLoggerManager, getCommandArguments, getCommandExecutable, getCommandLine, getCustomEnvironmentVars, getEnvironmentSetting, getSubstitutedCommandLine, getVariableSubstitutionBean, isWindowsPlatform, setBuildLoggerManager, setPluginAccessor, setVariableSubstitutionBean |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface com.atlassian.bamboo.builder.Builder |
---|
addDefaultLabelPathMaps, getName, isPathValid |
Methods inherited from interface com.atlassian.bamboo.v2.build.BuildConfigurationAwarePlugin |
---|
addDefaultValues, validate |
Field Detail |
---|
protected static final java.lang.String DEFAULT_TEST_REPORTS_XML
public static final java.lang.String PARAM_BUILD_LABEL
public static final java.lang.String PARAM_HASTESTS
public static final java.lang.String PARAM_TEST_RESULTS_DIRECTORY
public static final java.lang.String PARAM_BUILDJDK
public static final java.lang.String PARAM_HOME
public static final java.lang.String PARAM_WORKING_SUB_DIR
public static final java.lang.String PARAM_PROJECT_FILE
public static final java.lang.String PARAM_ENV_VAR
protected static final int FIND_SUCCESS_MESSAGE_IN_LAST
protected static final int FIND_FAILURE_MESSAGE_IN_LAST
public static final java.lang.String BUILD_SUCCESSFUL_MARKER
public static final java.lang.String BUILD_FAILED_MARKER
protected static final boolean SEARCH_BUILD_SUCCESS_FAIL_MESSAGE_EVERYWHERE
protected transient TemplateRenderer templateRenderer
protected transient ErrorUpdateHandler errorUpdateHandler
protected transient BuildDirectoryManager buildDirectoryManager
Constructor Detail |
---|
protected AbstractBuilder()
Method Detail |
---|
public void setAdministrationConfiguration(AdministrationConfiguration administrationConfiguration)
public void setTemplateRenderer(TemplateRenderer templateRenderer)
public void setErrorUpdateHandler(ErrorUpdateHandler errorUpdateHandler)
public void init(@NotNull com.atlassian.plugin.ModuleDescriptor moduleDescriptor)
InitablePluginModule
init
in interface InitablePluginModule
moduleDescriptor
- Plugin module descriptor@NotNull public java.lang.String getKey()
Builder
getKey
in interface Builder
public void setKey(@NotNull java.lang.String key)
public java.lang.String getKeyPrefix()
@NotNull public java.lang.String getCompleteKey()
Builder
getCompleteKey
in interface Builder
@Nullable public java.lang.String getPath(ReadOnlyCapabilitySet capabilitySet)
Builder
getPath
in interface Builder
@NotNull public java.lang.String getEditHtml(@NotNull BuildConfiguration buildConfiguration, @NotNull Plan plan)
BuildConfigurationAwarePlugin
getEditHtml
in interface BuildConfigurationAwarePlugin
buildConfiguration
- BuildConfiguration
for which edit HTML has to be rendered.plan
- Plan
for which edit HTML has to be rendered. May be null during creation phase of plan.
public void prepareConfigObject(@NotNull BuildConfiguration buildConfiguration)
BuildConfigurationAwarePlugin
prepareConfigObject
in interface BuildConfigurationAwarePlugin
buildConfiguration
- - @NotNullpublic void customizeBuildRequirements(@NotNull BuildConfiguration buildConfiguration, @NotNull RequirementSet requirementSet)
ConfigurablePlugin
customizeBuildRequirements
in interface ConfigurablePlugin
buildConfiguration
- source of information for customizing build requirementsrequirementSet
- requirements to be customizedpublic void removeBuildRequirements(@NotNull BuildConfiguration buildConfiguration, @NotNull RequirementSet requirementSet)
ConfigurablePlugin
removeBuildRequirements
in interface ConfigurablePlugin
buildConfiguration
- source of information for customizing build requirementsrequirementSet
- requirements to be customizedprotected void removeAllSystemJdkRequirements(@NotNull RequirementSet requirementSet)
public boolean isLabelPathMapConfigurable()
Builder
LabelPathMap
configurable. If it can't be, it won't be displayed
on the ConfigureBuilder page.
isLabelPathMapConfigurable
in interface Builder
LabelPathMap
is configurablepublic java.util.Map<java.lang.String,java.lang.String> customiseLabelTypeMap(java.util.Map<java.lang.String,java.lang.String> labelTypeMap)
Builder
customiseLabelTypeMap
in interface Builder
labelTypeMap
- may be nullprotected java.util.Map<java.lang.String,java.lang.Object> getTemplateContext()
public void executeBuild(@NotNull BuildContext buildContext, ReadOnlyCapabilitySet capabilitySet) throws java.lang.InterruptedException, RepositoryException
BuilderV2
executeBuild
in interface BuilderV2
java.lang.InterruptedException
RepositoryException
public CurrentBuildResult runBuild(@NotNull BuildContext buildContext, @NotNull ReadOnlyCapabilitySet capabilitySet) throws java.lang.InterruptedException
java.lang.InterruptedException
public void populateBuildErrors(CurrentBuildResult buildResult, java.util.List<java.lang.String> errorOutput, java.lang.String planKey, int buildNumber)
populateBuildErrors
in interface BuilderV2
buildResult
- - CurrentBuildResult
representing the results of the current builderrorOutput
- - ErrorLogEntry
objects representing the current std error outputpublic void collateTestResults(BuildIdentifier buildIdentifier, CurrentBuildResult buildResult, BuildLogger buildLogger) throws java.lang.InterruptedException
java.lang.InterruptedException
public boolean hasPassed(int returnCode, int buildNumber, java.lang.String planKey)
BuilderV2
hasPassed
in interface BuilderV2
returnCode
- return code from build execution commandplanKey
- @return true if build has passedpublic void setBuildDir(java.io.File buildDirectory)
buildDirectory
- The directory containing the build filepublic java.io.File getBuildDir()
public java.io.File getWorkingDirectory()
getWorkingDirectory
in class Command
@NotNull public java.lang.String getLabel()
getLabel
in interface Builder
public void setLabel(@NotNull java.lang.String label)
Builder
setLabel
in interface Builder
public java.lang.String getTestResultsDirectory()
public void setTestResultsDirectory(java.lang.String testResultDirectory)
testResultDirectory
- The location of the junit test result xml filespublic java.lang.String getWorkingSubDirectory()
public void setWorkingSubDirectory(java.lang.String workingSubDirectory)
workingSubDirectory
- Working subdirectory relative to build rootpublic java.lang.String getProjectFile()
public void setProjectFile(java.lang.String projectFile)
projectFile
- project file path relative to the working subdirectorypublic java.lang.String toString()
toString
in class java.lang.Object
public boolean hasTests()
hasTests
in interface Builder
public void setHasTests(boolean hasTests)
hasTests
- True if the build should have tests.public void setTestChecked(java.lang.String enabled)
enabled
- set to "on" by the webwork frameworkpublic java.lang.String getTestChecked()
public void setEnvironmentVariables(java.lang.String envVars)
MutableEnvironmentVariablesAwareBuilder
setEnvironmentVariables
in interface MutableEnvironmentVariablesAwareBuilder
envVars
- The paramspublic java.lang.String getEnvironmentVariables()
EnvironmentVariablesAwareBuilder
getEnvironmentVariables
in interface EnvironmentVariablesAwareBuilder
@Nullable public java.lang.String getBuildJdk()
getBuildJdk
in interface Builder
public void setBuildJdk(@NotNull java.lang.String buildJdk)
setBuildJdk
in interface Builder
buildJdk
- The JAVA_HOME JDKpublic boolean isJdkValid()
protected boolean outputEndsWith(int positionFromEnd, java.lang.String expectedText, java.lang.String planKey, int buildNumber)
positionFromEnd
- The expectedText should be wihtin positionFromEnd lines of the end of the output. If 0
the text will not be looked through at all, if -1 the entire text will be searchedexpectedText
- The text to look forplanKey
- The key for the build to check outputbuildNumber
- The build number to chek the output of
public void setParams(@NotNull FilteredMap filteredParams)
Builder
setParams
in interface Builder
filteredParams
- - Filtered Map with the prefix builder key stripped out@NotNull public ErrorCollection validate(ReadOnlyCapabilitySet capabilities)
Builder
validate
in interface Builder
protected abstract ErrorCollection validate(FilteredMap<java.lang.String> filteredParams)
@NotNull public java.util.Map<java.lang.String,java.lang.String> getFullParams()
Builder
getFullParams
in interface Builder
protected FilteredMap<java.lang.String> getFilteredParams()
@NotNull public java.lang.String getViewHtml(@NotNull Plan plan)
BuildConfigurationAwarePlugin
getViewHtml
in interface BuildConfigurationAwarePlugin
@NotNull public java.lang.String getPathHelp()
Builder
getPathHelp
in interface Builder
public BuildDirectoryManager getBuildDirectoryManager()
public void setBuildDirectoryManager(BuildDirectoryManager buildDirectoryManager)
public void setJdkManager(JdkManager jdkManager)
public void setBuildLogFileAccessorFactory(BuildLogFileAccessorFactory buildLogFileAccessorFactory)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |