Package hudson.model

Interface Queue.Task

    • Method Detail

      • isBuildBlocked

        @Deprecated
        default boolean isBuildBlocked()
        Deprecated.
        Returns true if the execution should be blocked for temporary reasons.
      • getCauseOfBlockage

        @CheckForNull
        default CauseOfBlockage getCauseOfBlockage()
        If the execution of this task should be blocked for temporary reasons, this method returns a non-null object explaining why.

        Otherwise this method returns null, indicating that the build can proceed right away.

        This can be used to define mutual exclusion that goes beyond ResourceActivity.getResourceList().

        Returns:
        by default, null
      • getAffinityKey

        default String getAffinityKey()
        Returns task-specific key which is used by the LoadBalancer to choose one particular executor amongst all the free executors on all possibly suitable nodes. NOTE: To be able to re-use the same node during the next run this key should not change from one run to another. You probably want to compute that key based on the job's name.
        Returns:
        by default: getFullDisplayName()
        See Also:
        LoadBalancer
      • checkAbortPermission

        void checkAbortPermission()
        Checks the permission to see if the current user can abort this executable. Returns normally from this method if it's OK.

        NOTE: If you have implemented AccessControlled this should just be checkPermission(hudson.model.Item.CANCEL);

        Throws:
        org.springframework.security.access.AccessDeniedException - if the permission is not granted.
      • hasAbortPermission

        boolean hasAbortPermission()
        Works just like checkAbortPermission() except it indicates the status by a return value, instead of exception. Also used by default for Queue.Item.hasCancelPermission().

        NOTE: If you have implemented AccessControlled this should just be return hasPermission(hudson.model.Item.CANCEL);

        Returns:
        false if the user doesn't have the permission.
      • getUrl

        String getUrl()
        Returns the URL of this task relative to the context root of the application.

        When the user clicks an item in the queue, this is the page where the user is taken to. Hudson expects the current instance to be bound to the URL returned by this method.

        Returns:
        URL that ends with '/'.
      • isConcurrentBuild

        default boolean isConcurrentBuild()
        True if the task allows concurrent builds, where the same Queue.Task is executed by multiple executors concurrently on the same or different nodes.
        Returns:
        by default, false
        Since:
        1.338
      • getSubTasks

        default Collection<? extends SubTask> getSubTasks()
        Obtains the SubTasks that constitute this task.

        The collection returned by this method must also contain the primary SubTask represented by this Queue.Task object itself as the first element. The returned value is read-only.

        At least size 1.

        Returns:
        by default, this
        Since:
        1.377
      • getDefaultAuthentication2

        @NonNull
        default org.springframework.security.core.Authentication getDefaultAuthentication2()
        This method allows the task to provide the default fallback authentication object to be used when QueueItemAuthenticator fails to authenticate the build.

        When the task execution touches other objects inside Jenkins, the access control is performed based on whether this Authentication is allowed to use them.

        Returns:
        by default, ACL.SYSTEM2
        Since:
        2.266
        See Also:
        QueueItemAuthenticator, Tasks.getDefaultAuthenticationOf(Queue.Task)
      • getDefaultAuthentication2

        @NonNull
        default org.springframework.security.core.Authentication getDefaultAuthentication2​(Queue.Item item)
        This method allows the task to provide the default fallback authentication object to be used when QueueItemAuthenticator fails to authenticate the build.

        When the task execution touches other objects inside Jenkins, the access control is performed based on whether this Authentication is allowed to use them.

        This method was added to an interface after it was created, so plugins built against older versions of Jenkins may not have this method implemented. Called private method _getDefaultAuthenticationOf(Task) on Tasks to avoid AbstractMethodError.

        Since:
        2.266
        See Also:
        QueueItemAuthenticator, Tasks.getDefaultAuthenticationOf(Queue.Task, Queue.Item)