Class AskInteractiveStep

java.lang.Object
hudson.model.AbstractDescribableImpl<org.jenkinsci.plugins.workflow.steps.Step>
org.jenkinsci.plugins.workflow.steps.Step
io.jenkins.plugins.interactiveinput.step.AskInteractiveStep
All Implemented Interfaces:
ExtensionPoint, Describable<org.jenkinsci.plugins.workflow.steps.Step>, Serializable

public class AskInteractiveStep extends org.jenkinsci.plugins.workflow.steps.Step implements Serializable
The askInteractive pipeline step (§6.1): a durable, human-answered input step that surfaces in the notification bell and rich modal.

 def answer = askInteractive(
     prompt: 'Which environment should I deploy to?',
     choices: [
         [id: 'staging',    label: 'Staging',    why: 'Latest passing build hash matches.'],
         [id: 'production', label: 'Production', why: 'PR was tagged release/*.']
     ],
     allowFreeText: false,
     slaMinutes: 15,
     submitterFilter: null,
     contextMarkdown: null)
 

Return value: the picked choice id (String); or [text: '...', choice: null] for free text; the sentinel "__deny__" (a human denied but chose to continue) or "__skip__" (an automation skipped the input) — both let the pipeline branch and carry on. A Deny/abort instead aborts the run (Result.ABORTED, via a FlowInterruptedException, like the built-in input step); a TimeoutException is thrown on SLA expiry.

Parameters (B24). To serve as a drop-in for the built-in input step, the step also accepts a list of ParameterDefinitions via parameters. When present, the human fills in a typed form (text / boolean / choice / password) instead of picking a choice, and the submitted values are returned with the same contract as input: a single parameter returns its value directly; multiple parameters return a Map of name→value. Values are created and validated through Jenkins' own SimpleParameterDefinition.createValue(String).

See Also:
  • Constructor Details

    • AskInteractiveStep

      @DataBoundConstructor public AskInteractiveStep(@NonNull String prompt)
  • Method Details

    • getPrompt

      @NonNull public String getPrompt()
    • getChoices

      @NonNull public List<Choice> getChoices()
    • setChoices

      @DataBoundSetter public void setChoices(@CheckForNull List<Choice> choices)
    • getParameters

      @NonNull public List<ParameterDefinition> getParameters()
    • setParameters

      @DataBoundSetter public void setParameters(@CheckForNull List<ParameterDefinition> parameters)
    • isAllowFreeText

      public boolean isAllowFreeText()
    • setAllowFreeText

      @DataBoundSetter public void setAllowFreeText(boolean allowFreeText)
    • getSlaMinutes

      public int getSlaMinutes()
    • setSlaMinutes

      @DataBoundSetter public void setSlaMinutes(int slaMinutes)
    • getSubmitterFilter

      @CheckForNull public String getSubmitterFilter()
    • setSubmitterFilter

      @DataBoundSetter public void setSubmitterFilter(@CheckForNull String submitterFilter)
    • getContextMarkdown

      @CheckForNull public String getContextMarkdown()
    • setContextMarkdown

      @DataBoundSetter public void setContextMarkdown(@CheckForNull String contextMarkdown)
    • getEscalation

      @CheckForNull public String getEscalation()
    • setEscalation

      @DataBoundSetter public void setEscalation(@CheckForNull String escalation)
    • resolveSlaMs

      public long resolveSlaMs()
      Returns:
      the effective SLA in milliseconds, resolving the JCasC default when unset.
    • start

      public org.jenkinsci.plugins.workflow.steps.StepExecution start(org.jenkinsci.plugins.workflow.steps.StepContext context) throws Exception
      Specified by:
      start in class org.jenkinsci.plugins.workflow.steps.Step
      Throws:
      Exception