Class BatchControlJobProperty

java.lang.Object
hudson.model.JobProperty<Job<?,?>>
io.jenkins.plugins.batchcontrol.config.BatchControlJobProperty
All Implemented Interfaces:
ExtensionPoint, Describable<JobProperty<?>>, ReconfigurableDescribable<JobProperty<?>>, BuildStep

@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public class BatchControlJobProperty extends JobProperty<Job<?,?>>
Per-job batch control settings (SPEC items 5 and 6): whether the job requires an approved run request, trigger-blocking policy, and an optional job-level approver restriction.

These settings have no effect while the global run-control switch is off.

  • Constructor Details

    • BatchControlJobProperty

      @DataBoundConstructor public BatchControlJobProperty(boolean approvalRequired)
  • Method Details

    • isApprovalRequired

      public boolean isApprovalRequired()
    • activationLocked

      public static BatchControlJobProperty activationLocked()
      The new-job activation lock of D-34: approvalRequired, blockTimer and blockUpstream all on, and no upstream allow list — so no cause at all can start the job until somebody turns a switch off in its configuration.

      The empty allow list is part of the lock rather than an accident of construction: with blockUpstream on, allowedUpstreamJobs is the list of upstream jobs that are exempt from it (D-16), so a non-empty list is an open upstream door (P-14).

    • withActivationLock

      public BatchControlJobProperty withActivationLock()
      These settings with the D-34 activation lock applied: every setting that decides whether a run may start is forced to its locked value, and the settings that decide nothing about starting a run are carried over.

      approvalRequired is final, so the default has to rebuild the property rather than flip a field. jobApprovers is carried over because it only ever narrows who may approve a request for this job (policy.ApprovalPolicy#checkDesignation applies it on top of the global approver list), so honouring a creator-supplied value cannot widen anything. The trigger policy is not carried over — see activationLocked() and P-14.

    • isActivationLocked

      public boolean isActivationLocked()
      Whether these settings already are the activation lock, so that applying it again would cost the job a property rebuild and a save (S-20) and change nothing.
    • getBlockingSwitches

      public List<String> getBlockingSwitches()
      The trigger switches that are refusing unattended runs of this job right now, in the order blockTimer, blockUpstream (job-page notice). Empty while run control is off, because the queue gate then lets every cause pass and a switch that is set blocks nothing. Since D-46 the switches refuse timer and upstream runs whatever approvalRequired says, so the notice follows the switches alone (e2e-03 DEF-15). The notice tells the reader to clear the switch in the job configuration, which is itself change-controlled.
    • isBlockTimer

      public boolean isBlockTimer()
    • setBlockTimer

      @DataBoundSetter public void setBlockTimer(boolean blockTimer)
    • isBlockUpstream

      public boolean isBlockUpstream()
    • setBlockUpstream

      @DataBoundSetter public void setBlockUpstream(boolean blockUpstream)
    • getAllowedUpstreamJobs

      public List<String> getAllowedUpstreamJobs()
    • setAllowedUpstreamJobs

      @DataBoundSetter public void setAllowedUpstreamJobs(List<String> allowedUpstreamJobs)
    • getAllowedUpstreamJobsText

      public String getAllowedUpstreamJobsText()
    • setAllowedUpstreamJobsText

      @DataBoundSetter public void setAllowedUpstreamJobsText(String text)
    • getJobApprovers

      public List<String> getJobApprovers()
    • setJobApprovers

      @DataBoundSetter public void setJobApprovers(List<String> jobApprovers)
    • getJobApproversText

      public String getJobApproversText()
    • setJobApproversText

      @DataBoundSetter public void setJobApproversText(String text)