public class Plan extends RootEntityPropertiesBuilder<PlanProperties>
Represents a Bamboo plan.

In RSS mode, can also represent configuration of a Specs plan branch.

  • Field Details

  • Constructor Details

    • Plan

      public Plan(@NotNull @NotNull Plan copy)
    • Plan

      public Plan(@NotNull @NotNull Project project, @NotNull @NotNull String name, @NotNull @NotNull 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 name
      key - plan's short key, must be unique within the project.
      Throws:
      PropertiesValidationException
      See Also:
    • Plan

      public Plan(@NotNull @NotNull Project project, @NotNull @NotNull 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 name
      key - plan's short key, must be unique within the project.
      Throws:
      PropertiesValidationException
      See Also:
  • Method Details

    • 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 String name) throws PropertiesValidationException
      Sets the plan name.

      Ignored on branches.

      Throws:
      PropertiesValidationException
    • key

      public Plan key(@Nullable @Nullable 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:
    • 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

      public Plan oid(@Nullable @Nullable 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 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 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.
      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 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.
    • variables

      public Plan variables(@NotNull @NotNull Variable... variables)
      Adds plan variables.
    • 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:
    • 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:
    • 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 String... labels)
      Adds labels to this plan.
    • labels

      public Plan labels(@NotNull @NotNull Label... 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 with labels(Label...). There's no need to explicitly call this method.

    • getIdentifier

      @NotNull public @NotNull PlanIdentifier getIdentifier()
      Returns identifier for this object.
      Throws:
      IllegalStateException - if key is undefined
    • getKey

      @NotNull public @NotNull BambooKey getKey()
      Returns plan's key.
      Throws:
      IllegalStateException - if key is undefined
    • getOid

      @NotNull public @NotNull BambooOid getOid()
      Returns plan's oid.
      Throws:
      IllegalStateException - if oid is undefined
    • build

      Specified by:
      build in class EntityPropertiesBuilder<PlanProperties>
      Throws:
      PropertiesValidationException
    • humanReadableType

      public String humanReadableType()
      Description copied from class: RootEntityPropertiesBuilder
      Entity type that is shown to human.
      Specified by:
      humanReadableType in class RootEntityPropertiesBuilder<PlanProperties>
    • humanReadableId

      public String humanReadableId()
      Description copied from class: RootEntityPropertiesBuilder
      Entity type and id representation that is shown to human.
      Specified by:
      humanReadableId in class RootEntityPropertiesBuilder<PlanProperties>