Class RunRequest

java.lang.Object
io.jenkins.plugins.batchcontrol.model.RunRequest

@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public final class RunRequest extends Object
A request to run a specific job with a fixed set of parameters (SPEC section 3). Persisted as XStream XML at requests/run/<id>.xml.

D-72, D-74: parameters is the masked display map derived from the submitted ParameterValues once at submission, the only form in which a request's parameters are shown or written anywhere else. The typed values themselves are not part of this object: the store keeps them in their own file (requests/run/<id>.values.xml), read only to approve, submit, recover or dispose of the request, and deleted when the approved run starts or the request ends.

Timestamps are persisted as epoch milliseconds (long) because the Jenkins XStream class filter does not allow java.time.Instant; the accessors expose Instant.

Status transitions must only be performed by the policy services (policy.RunRequestService); other code must not call setStatus(io.jenkins.plugins.batchcontrol.model.RequestStatus).

  • Method Details

    • create

      public static RunRequest create(String jobFullName, Map<String,String> parameters, String reason, String requester, List<String> approvers)
      Creates a new PENDING request with a random UUID id (D-68) and its creation time from BatchClock, holding the masked display map parameters (D-72). The typed values the map was derived from are stored next to it by the store (D-74).
    • create

      public static RunRequest create(String jobFullName, Map<String,String> parameters, String reason, String requester, String approver)
    • getId

      public String getId()
    • getJobFullName

      public String getJobFullName()
    • getParameters

      public Map<String,String> getParameters()
      The masked display map (D-72): a sensitive value is ********, a file value [file] <original file name>. A defensive copy; it never changes after creation.
    • getReason

      public String getReason()
    • getRequester

      public String getRequester()
    • getApprovers

      public List<String> getApprovers()
      The designated approver set (D-37), in designation order.
    • getApprover

      public String getApprover()
      Compatibility view (D-37): the first designated approver, or null with none. New code uses getApprovers() and getDecidedBy().
    • isDesignatedApprover

      public boolean isDesignatedApprover(String userId)
      Whether userId is a member of the designated set.
    • getDecidedBy

      public String getDecidedBy()
      The user who closed the request: the approver who approved or rejected it, or the user who cancelled it (e2e-03 DEF-13); null while undecided.
    • isExpiringNotified

      public boolean isExpiringNotified()
      Whether the D-36 EXPIRING notification was already sent.
    • getStatus

      public RequestStatus getStatus()
    • getCreatedAt

      public Instant getCreatedAt()
    • getDecidedAt

      public Instant getDecidedAt()
    • getDecisionComment

      public String getDecisionComment()
    • isSelfApproved

      public boolean isSelfApproved()
    • getApproverChanges

      public List<RunRequest.ApproverChange> getApproverChanges()
    • getIncidentId

      public String getIncidentId()
    • getExecutedRunId

      public String getExecutedRunId()
    • setStatus

      public void setStatus(RequestStatus status)
      Only the policy services may transition the status.
    • setApprovers

      public void setApprovers(List<String> approvers)
      Only the policy services change the designated set.
    • setDecidedBy

      public void setDecidedBy(String decidedBy)
      Only the policy services record the deciding approver.
    • setExpiringNotified

      public void setExpiringNotified(boolean expiringNotified)
      Only the policy services mark the D-36 EXPIRING notification as sent.
    • setDecidedAt

      public void setDecidedAt(Instant decidedAt)
    • setDecisionComment

      public void setDecisionComment(String decisionComment)
    • setSelfApproved

      public void setSelfApproved(boolean selfApproved)
    • addApproverChange

      public void addApproverChange(RunRequest.ApproverChange change)
    • setIncidentId

      public void setIncidentId(String incidentId)
    • setExecutedRunId

      public void setExecutedRunId(String executedRunId)
    • getExecutedAt

      public Instant getExecutedAt()
      The instant the approved build started, or null if not executed (or stored before).
    • setExecutedAt

      public void setExecutedAt(Instant executedAt)
    • getQueuedAt

      public Instant getQueuedAt()
      The instant the consumption ticket was claimed, or null if still unused.
    • setQueuedAt

      public void setQueuedAt(Instant queuedAt)
      Only the policy service claims (non-null) or re-issues (null) the ticket.
    • getExpiryBase

      public Instant getExpiryBase()
      Base instant for the approved-run timeout; falls back to getDecidedAt().
    • setExpiryBase

      public void setExpiryBase(Instant expiryBase)
    • getInvalidationReason

      public String getInvalidationReason()
    • getQueueCancelledAt

      public Instant getQueueCancelledAt()
      D-72b (7): when the queue item of the approved run was cancelled, or null. The request stays APPROVED until the approved-run timeout ends it; it is never submitted again.
    • setQueueCancelledAt

      public void setQueueCancelledAt(Instant queueCancelledAt)
      Only the policy service records the cancellation of the approved run's queue item.
    • setInvalidationReason

      public void setInvalidationReason(String invalidationReason)