Class Plan
- java.lang.Object
-
- com.atlassian.bamboo.specs.api.builders.EntityPropertiesBuilder<T>
-
- com.atlassian.bamboo.specs.api.builders.RootEntityPropertiesBuilder<PlanProperties>
-
- com.atlassian.bamboo.specs.api.builders.plan.Plan
-
public class Plan extends RootEntityPropertiesBuilder<PlanProperties>
Represents a Bamboo plan.In RSS mode, can also represent configuration of a Specs plan branch.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
TYPE
-
Constructor Summary
Constructors Constructor Description Plan(@NotNull Plan copy)
Plan(@NotNull Project project, @NotNull java.lang.String name, @NotNull BambooKey key)
Specify plan with given project, name and key.Plan(@NotNull Project project, @NotNull java.lang.String name, @NotNull java.lang.String key)
Specify plan with given project, name and key.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description Plan
branchConfiguration(@NotNull PlanBranchConfiguration planBranchConfiguration)
On a Specs plan branch, defines branch specific configuration.protected PlanProperties
build()
Plan
clearNotifications()
Clears all notifications previously added to this plan.Plan
clearTriggers()
Clears all previously added triggers to this plan.Plan
dependencies(@NotNull Dependencies dependencies)
Specifies configuration of dependencies support for this plan.Plan
description(@Nullable java.lang.String description)
Sets the plan's description.Plan
enabled(boolean enabled)
Enables/disables the plan.Plan
forceStopHungBuilds()
Deprecated.since 9.3.@NotNull PlanIdentifier
getIdentifier()
Returns identifier for this object.@NotNull BambooKey
getKey()
Returns plan's key.@NotNull BambooOid
getOid()
Returns plan's oid.java.lang.String
humanReadableId()
Entity type and id representation that is shown to human.java.lang.String
humanReadableType()
Entity type that is shown to human.Plan
ignoreHungBuilds()
Deprecated.since 9.3.Plan
inProject(@NotNull Project project)
Sets the project plan belongs to.Plan
key(@Nullable BambooKey key)
Sets the plan's key.Plan
key(@Nullable java.lang.String key)
Sets the plan's key.Plan
labels(@NotNull Label... labels)
Adds labels to this plan.Plan
labels(@NotNull java.lang.String... labels)
Adds labels to this plan.Plan
linkedRepositories(@NotNull VcsRepositoryIdentifier... repositories)
Deprecated.since 6.2, uselinkedRepositories(String...)
Plan
linkedRepositories(@NotNull java.lang.String... repositoriesNames)
Adds linked repositories with given names to this plan.Plan
name(@NotNull java.lang.String name)
Sets the plan name.Plan
noDependencies()
Deprecated.Plan
noLabels()
Deprecated.Plan
noNotifications()
Deprecated.Plan
noPluginConfigurations()
Deprecated.Plan
notifications(@NotNull Notification... notifications)
Appends a notification rule to the plan.Plan
oid(@Nullable BambooOid oid)
Sets the plans's oid.Plan
oid(@Nullable java.lang.String oid)
Sets the plans's oid.Plan
planBranchManagement(@NotNull PlanBranchManagement planBranchManagement)
Specifies plan branch management options for this plan.Plan
planRepositories(@NotNull VcsRepository<?,?>... repositories)
Adds local repositories to this plan.Plan
pluginConfigurations(@NotNull PluginConfiguration<?>... pluginConfigurations)
Appends plugin configuration to the plan.Plan
projectRepositories(@NotNull java.lang.String... repositoriesNames)
Adds project repositories with given names to this plan.Plan
repositoryBranches(@NotNull VcsRepositoryBranch... repositoryBranches)
Defines which branches should be built by this plan or plan branch.Plan
stages(@NotNull Stage... stages)
Adds the stages to the end of stages list.Plan
triggers(@NotNull Trigger<?,?>... triggers)
Adds triggers to this plan.Plan
variables(@NotNull Variable... variables)
Adds plan variables.
-
-
-
Field Detail
-
TYPE
public static final java.lang.String TYPE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Plan
public Plan(@NotNull @NotNull Plan copy)
-
Plan
public Plan(@NotNull @NotNull Project project, @NotNull @NotNull java.lang.String name, @NotNull @NotNull java.lang.String key) throws PropertiesValidationException
Specify plan with given project, name and key.If oid is not specified, key serves as a plan identifier. If a plan with specified key does not exist, a new one is created, otherwise it is updated.
When defining a Specs branch, these parameters should identify the master plan. Plan branch key and name are generated automatically.
- Parameters:
project
- project this plan belongs to. Project must exist.name
- plan's namekey
- plan's short key, must be unique within the project.- Throws:
PropertiesValidationException
- See Also:
oid(String)
-
Plan
public Plan(@NotNull @NotNull Project project, @NotNull @NotNull java.lang.String name, @NotNull @NotNull BambooKey key) throws PropertiesValidationException
Specify plan with given project, name and key.If oid is not specified, key serves as a plan identifier. If a plan with specified key does not exist, a new one is created, otherwise it is updated.
When defining a Specs branch, these parameters should identify the master plan. Plan branch key and name are generated automatically.
- Parameters:
project
- project this plan belongs to. Project must exist.name
- plan's namekey
- plan's short key, must be unique within the project.- Throws:
PropertiesValidationException
- See Also:
oid(String)
-
-
Method Detail
-
inProject
public Plan inProject(@NotNull @NotNull Project project) throws PropertiesValidationException
Sets the project plan belongs to. Project must exist.- Throws:
PropertiesValidationException
-
name
public Plan name(@NotNull @NotNull java.lang.String name) throws PropertiesValidationException
Sets the plan name.Ignored on branches.
- Throws:
PropertiesValidationException
-
key
public Plan key(@Nullable @Nullable java.lang.String key) throws PropertiesValidationException
Sets the plan's key.If oid is not specified, key serves as a plan identifier. If a plan with specified key does not exist, a new one is created, otherwise it is updated.
When defining a Specs branch, should identify the master plan. Plan branch key and name are generated automatically.
- Parameters:
key
- plan's short key, must be unique within the project.- Throws:
PropertiesValidationException
- See Also:
oid(String)
-
key
public Plan key(@Nullable @Nullable BambooKey key) throws PropertiesValidationException
Sets the plan's key.If oid is not specified, key serves as a plan identifier. If a plan with specified key does not exist, a new one is created, otherwise it is updated.
When defining a Specs branch, should identify the master plan. Plan branch key and name are generated automatically.
- Parameters:
key
- plan's short key, must be unique within the project.- Throws:
PropertiesValidationException
- See Also:
oid(String)
-
oid
public Plan oid(@Nullable @Nullable java.lang.String oid) throws PropertiesValidationException
Sets the plans's oid.If set, it is used to identify the plan. If a plan with specified oid does not exist, a new one is created, otherwise it is updated.
When defining a Specs branch, should identify the master plan. Oid of a plan branch is generated automatically.
- Throws:
PropertiesValidationException
-
oid
public Plan oid(@Nullable @Nullable BambooOid oid) throws PropertiesValidationException
Sets the plans's oid.If set, it is used to identify the plan. If a plan with specified oid does not exist, a new one is created, otherwise it is updated.
When defining a Specs branch, should identify the master plan. Oid of a plan branch is generated automatically.
- Throws:
PropertiesValidationException
-
description
public Plan description(@Nullable @Nullable java.lang.String description) throws PropertiesValidationException
Sets the plan's description.- Throws:
PropertiesValidationException
-
stages
public Plan stages(@NotNull @NotNull Stage... stages)
Adds the stages to the end of stages list. The order of stages is preserved.
-
planRepositories
public Plan planRepositories(@NotNull @NotNull VcsRepository<?,?>... repositories)
Adds local repositories to this plan.This method will create new plan-local repository definitions for this plan. To link plan to global repositories instead, use
linkedRepositories(String[])
.The list of repositories on branches must match the master plan, that is, while the repositories can have different configuration their names must match repositories defined for the master plan.
Redefinition of a default repository is not possible at all on Specs branch. Any such settings will be ignored and default repository will be set to match the current branch. See also
RssRuntimeContext.getCurrentRssBranch()
-
linkedRepositories
public Plan linkedRepositories(@NotNull @NotNull java.lang.String... repositoriesNames)
Adds linked repositories with given names to this plan.This method will link existing global repositories to this plan. To add plan-local repository definitions instead, use
planRepositories(VcsRepository[])
.The list of repositories on branches must match the master plan, that is, while the repositories can have different configuration their names must match repositories defined for the master plan.
On branch: in order to avoid unnecessary redefinition of a plan repository, this method can be also used to reference it.
-
linkedRepositories
@Deprecated public Plan linkedRepositories(@NotNull @NotNull VcsRepositoryIdentifier... repositories)
Deprecated.since 6.2, uselinkedRepositories(String...)
Adds linked repositories to this plan.This method will link existing global repositories to this plan. To add plan-local repository definitions instead, use
planRepositories(VcsRepository[])
.
-
projectRepositories
public Plan projectRepositories(@NotNull @NotNull java.lang.String... repositoriesNames)
Adds project repositories with given names to this plan. Available for Bamboo DC only.This method will link existing project repositories to this plan. To add plan-local repository definitions instead, use
planRepositories(VcsRepository[])
.The list of repositories on branches must match the master plan, that is, while the repositories can have different configuration their names must match repositories defined for the master plan.
On branch: in order to avoid unnecessary redefinition of a plan repository, this method can be also used to reference it.
- Since:
- 8.0
-
repositoryBranches
public Plan repositoryBranches(@NotNull @NotNull VcsRepositoryBranch... repositoryBranches)
Defines which branches should be built by this plan or plan branch. Arguments can reference any repository attached to the plan (local or linked).Redefinition of a default repository is not possible at all on Specs branch. Any such settings will be ignored and default repository will be set to match the current branch. See also
RssRuntimeContext.getCurrentRssBranch()
-
triggers
public Plan triggers(@NotNull @NotNull Trigger<?,?>... triggers)
Adds triggers to this plan.
-
clearTriggers
public Plan clearTriggers()
Clears all previously added triggers to this plan.
-
enabled
public Plan enabled(boolean enabled) throws PropertiesValidationException
Enables/disables the plan.- Throws:
PropertiesValidationException
-
planBranchManagement
public Plan planBranchManagement(@NotNull @NotNull PlanBranchManagement planBranchManagement) throws PropertiesValidationException
Specifies plan branch management options for this plan. These options control if and how Bamboo should perform automatic branch management.This settings are only applied on the default branch and as defaults for non-Specs branches.
- Throws:
PropertiesValidationException
- See Also:
PlanBranchManagement
-
branchConfiguration
public Plan branchConfiguration(@NotNull @NotNull PlanBranchConfiguration planBranchConfiguration) throws PropertiesValidationException
On a Specs plan branch, defines branch specific configuration. Has no effect on master plan.- Throws:
PropertiesValidationException
-
dependencies
public Plan dependencies(@NotNull @NotNull Dependencies dependencies) throws PropertiesValidationException
Specifies configuration of dependencies support for this plan.Ignored on branches.
- Throws:
PropertiesValidationException
- See Also:
Dependencies
-
noDependencies
@Deprecated public Plan noDependencies()
Deprecated.Use this method to specify that your plan has no dependencies. If you have dependencies on other plans specified in Bamboo and you use this method in Bamboo Specs, your existing plan dependencies will be cleaned. Introduced for migration option for plans created via Specs in Bamboo 6.0.
If your plan doesn't have dependencies on other plans, don't configure any dependencies. No need to explicit using this method.
-
pluginConfigurations
public Plan pluginConfigurations(@NotNull @NotNull PluginConfiguration<?>... pluginConfigurations)
Appends plugin configuration to the plan. If the same plugin is specified second time, its configuration is overwritten.Ignored on branches.
-
noPluginConfigurations
@Deprecated public Plan noPluginConfigurations()
Deprecated.Use this method to specify that your plan has default plugins configuration. If you have any plugin configuration specified in Bamboo and you use this method in Bamboo Specs, your existing plan plugin configuration will be cleaned. Introduced for migration option for plans created via Specs in Bamboo 6.0.
If you want to have default plugin configuration for your plan, don't introduce any plugin configuration. No need to explicit using this method.
-
notifications
public Plan notifications(@NotNull @NotNull Notification... notifications)
Appends a notification rule to the plan.
-
clearNotifications
public Plan clearNotifications()
Clears all notifications previously added to this plan.
-
noNotifications
@Deprecated public Plan noNotifications()
Deprecated.Use this method to specify that your plan has no notification rules. If you have notification rules specified in Bamboo and you use this method in Bamboo Specs, your existing plan notification rules will be cleaned. Introduced for migration option for plans created via Specs in Bamboo 6.0.
If you don't want notifications for your plan, don't configure any. No need to explicitly using this method.
-
forceStopHungBuilds
@Deprecated public Plan forceStopHungBuilds()
Deprecated.since 9.3. Use #pluginConfigurations(new ForceStopBuild().enabled(true))Use this method to configure Bamboo to stop hung build and kill all processes executed by current plan. When Build Monitoring is disabled at Bamboo server validation error will be thrown.Ignored on branches.
-
ignoreHungBuilds
@Deprecated public Plan ignoreHungBuilds()
Deprecated.since 9.3. Use #pluginConfigurations(new ForceStopBuild().enabled(false))Use this method to ignore hung build and allow user to stop it manually.Ignored on branches.
-
labels
public Plan labels(@NotNull @NotNull java.lang.String... labels)
Adds labels to this plan.
-
noLabels
@Deprecated public Plan noLabels()
Deprecated.Use this method to specify that your plan has no labels. If you have any labels added to your plan in Bamboo and you use this method in Bamboo Specs, your existing labels will be cleaned. Introduced for migration option for plans created via Specs in Bamboo 7.0.If your plan doesn't need any labels, don't add eny with
labels(String...)
nor withlabels(Label...)
. There's no need to explicitly call this method.
-
getIdentifier
@NotNull public @NotNull PlanIdentifier getIdentifier()
Returns identifier for this object.- Throws:
java.lang.IllegalStateException
- if key is undefined
-
getKey
@NotNull public @NotNull BambooKey getKey()
Returns plan's key.- Throws:
java.lang.IllegalStateException
- if key is undefined
-
getOid
@NotNull public @NotNull BambooOid getOid()
Returns plan's oid.- Throws:
java.lang.IllegalStateException
- if oid is undefined
-
build
protected PlanProperties build() throws PropertiesValidationException
- Specified by:
build
in classEntityPropertiesBuilder<PlanProperties>
- Throws:
PropertiesValidationException
-
humanReadableType
public java.lang.String humanReadableType()
Description copied from class:RootEntityPropertiesBuilder
Entity type that is shown to human.- Specified by:
humanReadableType
in classRootEntityPropertiesBuilder<PlanProperties>
-
humanReadableId
public java.lang.String humanReadableId()
Description copied from class:RootEntityPropertiesBuilder
Entity type and id representation that is shown to human.- Specified by:
humanReadableId
in classRootEntityPropertiesBuilder<PlanProperties>
-
-