Package com.atlassian.bamboo.task
Interface TaskContext
-
- All Superinterfaces:
CommonTaskContext,InternalTaskContext,PluginKeyProvider,TaskIdentifier
- All Known Implementing Classes:
TaskContextImpl
@PublicApi public interface TaskContext extends CommonTaskContext
Encapsulates the environment and configuration of a task running in a building environment.- Since:
- 3.1
N.B All methods remain on this interface (even though they are on the super class) so we don't accidentally break backwards compatibility.
- See Also:
TaskType,TaskIdentifier
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description @NotNull BuildContextgetBuildContext()Contains all the build related information about the running of the tasks@NotNull BuildLoggergetBuildLogger()Returns the appropriate logger for the task@NotNull ConfigurationMapgetConfigurationMap()AMapofStringvalues fromTaskDefinition.getConfiguration()where the values have gone through variable substitution throughCustomVariableContext.substituteString(String).@NotNull FilegetRootDirectory()Get build root directory (where sources were checked out)@Nullable Map<String,String>getRuntimeTaskContext()@NotNull FilegetWorkingDirectory()Get build working directory (where task should be executed).-
Methods inherited from interface com.atlassian.bamboo.task.CommonTaskContext
doesTaskProduceTestResults, getCommonContext, getRuntimeTaskData
-
Methods inherited from interface com.atlassian.bamboo.task.TaskIdentifier
getId, getPluginKey, getUserDescription, isEnabled, isFinalising
-
-
-
-
Method Detail
-
getBuildContext
@NotNull @NotNull BuildContext getBuildContext()
Contains all the build related information about the running of the tasks- Returns:
-
getBuildLogger
@NotNull @NotNull BuildLogger getBuildLogger()
Returns the appropriate logger for the task- Specified by:
getBuildLoggerin interfaceCommonTaskContext- Returns:
-
getRootDirectory
@NotNull @NotNull File getRootDirectory()
Get build root directory (where sources were checked out)- Specified by:
getRootDirectoryin interfaceCommonTaskContext- Returns:
- Build root directory
-
getWorkingDirectory
@NotNull @NotNull File getWorkingDirectory()
Get build working directory (where task should be executed).Default implementation checks for the
TaskConfigConstants.CFG_WORKING_SUBDIRECTORYkey in the TaskConfiguration if such key exists and has not empty value then working directory would be getRootDirectory() + value ofTaskConfigConstants.CFG_WORKING_SUBDIRECTORYkey.- Specified by:
getWorkingDirectoryin interfaceCommonTaskContext- Returns:
- Build working directory
-
getConfigurationMap
@NotNull @NotNull ConfigurationMap getConfigurationMap()
AMapofStringvalues fromTaskDefinition.getConfiguration()where the values have gone through variable substitution throughCustomVariableContext.substituteString(String). All ${bamboo.*} and ${system.*} params are substituted.- Specified by:
getConfigurationMapin interfaceCommonTaskContext- Returns:
-
getRuntimeTaskContext
@Nullable @Nullable Map<String,String> getRuntimeTaskContext()
- Specified by:
getRuntimeTaskContextin interfaceCommonTaskContext- Returns:
- custom runtime data that complement static task configuration
-
-