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 BuildContext
getBuildContext()
Contains all the build related information about the running of the tasks@NotNull BuildLogger
getBuildLogger()
Returns the appropriate logger for the task@NotNull ConfigurationMap
getConfigurationMap()
AMap
ofString
values fromTaskDefinition.getConfiguration()
where the values have gone through variable substitution throughCustomVariableContext.substituteString(String)
.@NotNull File
getRootDirectory()
Get build root directory (where sources were checked out)@Nullable Map<String,String>
getRuntimeTaskContext()
@NotNull File
getWorkingDirectory()
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:
getBuildLogger
in interfaceCommonTaskContext
- Returns:
-
getRootDirectory
@NotNull @NotNull File getRootDirectory()
Get build root directory (where sources were checked out)- Specified by:
getRootDirectory
in 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_SUBDIRECTORY
key in the TaskConfiguration if such key exists and has not empty value then working directory would be getRootDirectory() + value ofTaskConfigConstants.CFG_WORKING_SUBDIRECTORY
key.- Specified by:
getWorkingDirectory
in interfaceCommonTaskContext
- Returns:
- Build working directory
-
getConfigurationMap
@NotNull @NotNull ConfigurationMap getConfigurationMap()
AMap
ofString
values fromTaskDefinition.getConfiguration()
where the values have gone through variable substitution throughCustomVariableContext.substituteString(String)
. All ${bamboo.*} and ${system.*} params are substituted.- Specified by:
getConfigurationMap
in interfaceCommonTaskContext
- Returns:
-
getRuntimeTaskContext
@Nullable @Nullable Map<String,String> getRuntimeTaskContext()
- Specified by:
getRuntimeTaskContext
in interfaceCommonTaskContext
- Returns:
- custom runtime data that complement static task configuration
-
-