Class ParameterFiles

java.lang.Object
io.jenkins.plugins.batchcontrol.policy.ParameterFiles

@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public final class ParameterFiles extends Object
D-72: disposal of the temporary files that typed parameter values keep until a build takes them over, for values that will never reach the queue: a run request that ended without a run (REJECTED, CANCELLED, EXPIRED, INVALIDATED before it was queued), a submission that was refused before a request was stored, a person's own build submission that the queue gate refused, or rerun values that could not be completed. Once a request's build is queued, the queue and the build own its files and nothing here touches them.

Two parameter types keep such a file: core's FileParameterValue ($JENKINS_HOME/fileParameterValueFiles/) and the file-parameters plugin's stashed file value ($JENKINS_HOME/stashedFileParameterValueFiles/, through FileParametersSupport when that plugin is installed). The plugin's Base64 file value keeps its content in the value itself.

D-74 (2): why a cancelled queue item. Neither type exposes its temporary file or a method that deletes it (core's FileParameterValue#getFile2() returns the upload, not the copy it keeps). The only supported cleanup each offers is its public listener for cancelled queue items, FileParameterValue.CancelledQueueListener and StashedFileParameterValue.CancelledQueueListener. Each deletes the temporary files of its own values in a cancelled Queue.LeftItem. So this class calls exactly those two listeners, by their classes, with a cancelled item that carries the values. No other queue listener is called, nothing enters the queue, and no private field is read. A listener that fails is logged; the listeners log their own failed deletions. A value of any other type is left alone.

  • Method Details

    • dispose

      public static void dispose(@CheckForNull List<? extends ParameterValue> values, String owner)
      Disposes of the temporary files held by values, which must never be (or have been) handed to the queue. owner names them in the log (a request id, a refused submission). Never throws: what cannot be disposed of is logged.
    • keepsTemporaryFile

      public static boolean keepsTemporaryFile(ParameterValue value)
      Whether value keeps a temporary file until its build takes it over: core's file value or the file-parameters plugin's stashed file value. Such a value of a completed build cannot be reused as it is: its build consumed the file.