Class Job


  • public class Job
    extends EntityPropertiesBuilder<JobProperties>
    Represents a Bamboo job. Job is a unit of work within Stage that can be run parallel to other jobs if multiple agents are available. When executing several jobs on single agents, order in which jobs from single stage are executed is not defined.
    • Constructor Detail

      • Job

        public Job​(@NotNull
                   @NotNull Job copy)
      • Job

        public Job​(@NotNull
                   @NotNull java.lang.String name,
                   @NotNull
                   @NotNull java.lang.String key)
            throws PropertiesValidationException
        Specify job with given name and key.

        If oid is not specified, key serves as a job identifier. If a job with specified key does not exist, a new one is created. If it does exists it is updated, it can also be moved between stages.

        Parameters:
        name - job's name
        key - job's short key, must be unique within the plan.
        Throws:
        PropertiesValidationException
      • Job

        public Job​(@NotNull
                   @NotNull java.lang.String name,
                   @NotNull
                   @NotNull BambooKey key)
            throws PropertiesValidationException
        Specify job with given name and key.

        If oid is not specified, key serves as a job identifier. If a job with specified key does not exist, a new one is creted. If it does exists it is updated, it can also be moved between stages.

        Parameters:
        name - job's name
        key - job's short key, must be unique within the plan.
        Throws:
        PropertiesValidationException
    • Method Detail

      • key

        public Job key​(@NotNull
                       @NotNull java.lang.String key)
                throws PropertiesValidationException
        Sets the job's key.

        If oid is not specified, key serves as a job identifier. If a job with specified key does not exist, a new one is created. If it does exists it is updated, it can also be moved between stages.

        Parameters:
        key - job's short key, must be unique within the plan.
        Throws:
        PropertiesValidationException
      • key

        public Job key​(@NotNull
                       @NotNull BambooKey key)
                throws PropertiesValidationException
        Sets the job's key.

        If oid is not specified, key serves as a job identifier. If a job with specified key does not exist, a new one is created. If it does exists it is updated, in particular it can be moved between stages.

        Parameters:
        key - job's short key, must be unique within the plan.
        Throws:
        PropertiesValidationException
      • artifacts

        public Job artifacts​(@NotNull
                             @NotNull Artifact... artifacts)
        Adds provided Artifacts to the list of artifacts produced by the job.
      • artifactSubscriptions

        public Job artifactSubscriptions​(@NotNull
                                         @NotNull ArtifactSubscription... subscriptions)
        Add artifact subscriptions. Subscription can only be defined for shared artifacts.

        Artifact subscription specify which subsequent jobs rely on this artifact.

      • tasks

        public Job tasks​(@NotNull
                         @NotNull Task<?,​?>... tasks)
        Adds provided Tasks to the list of tasks executed by the job.
      • finalTasks

        public Job finalTasks​(@NotNull
                              @NotNull Task<?,​?>... finalTasks)
        Adds provided Tasks to the list of the final tasks executed by the job.

        Final tasks for a job are always executed, even if previous tasks in the job failed.

      • requirements

        public Job requirements​(Requirement... requirements)
        Adds custom requirements to the job.

        Requirements control which Bamboo agents are able to execute the job.

      • cleanWorkingDirectory

        public Job cleanWorkingDirectory​(boolean cleanWorkingDirectory)
        Specifies if job should clean working directory after executing.
      • pluginConfigurations

        public Job pluginConfigurations​(@NotNull
                                        @NotNull PluginConfiguration<?>... pluginConfigurations)
        Appends plugin configuration to the plan. If the same plugin is specified second time, its configuration is overwritten.
      • noPluginConfigurations

        @Deprecated
        public Job noPluginConfigurations()
        Deprecated.
        Use this method to specify that your job has default plugins configuration.
      • getKey

        @NotNull
        public @NotNull BambooKey getKey()
        Returns job's key, which serves as identifier for this object.
        Throws:
        java.lang.IllegalStateException - if key is undefined