Answers: <p>After some more research I found the answer:</p>
  
  <pre><code>  def coreImageTags = input(
      id: 'coreImageTags', message: 'Enter a comma separated list of additional tags for the image (0.0.1,some-tagname,etc):?', 
      parameters: [
        [$class: 'StringParameterDefinition', defaultValue: 'None', description: 'List of tags', name: 'coreImageTagsList'],
      ]
    )
  
    echo ("Image tags: "+coreImageTags)
  </code></pre>
  
  <p><strong>Important note</strong></p>
  
  <p>It is stated in the documentation but I want to point it out specifically: If you copy/paste my solution here, <code>coreImageTags</code> will contain a string directly. If you do multiple parameters like so:</p>
  
  <pre><code>    parameters: [
        [$class: 'StringParameterDefinition', defaultValue: 'None', description: 'List of tags', name: 'coreImageTagsList'],
        [$class: 'StringParameterDefinition', defaultValue: 'None', description: 'Something else', name: 'somethingElse'],
      ]
  </code></pre>
  
  <p>You will not get a single values but an array of values:</p>
  
  <pre><code>  echo ("Image tags: "+coreImageTags['coreImageTagsList'])
    echo ("Image tags: "+coreImageTags['somethingElse'])
  </code></pre>
  
  <p>The following posts will help:</p>
  
  <p><a href="https://stackoverflow.com/questions/47080683/read-interactive-input-in-jenkins-pipeline-to-a-variable">stackoverflow.com read-interactive-input-in-jenkins-pipeline-to-a-variable</a></p>
  
  <p><a href="https://support.cloudbees.com/hc/en-us/articles/204986450-Pipeline-How-to-manage-user-inputs" rel="nofollow noreferrer">CloudBees - Pipeline-How-to-manage-user-inputs</a></p>
  
  <p>A list of classes you can use in this way and what they do is in the Jenkins Input-Step documentation:
  <a href="https://jenkins.io/doc/pipeline/steps/pipeline-input-step/" rel="nofollow noreferrer">Pipeline - Input Step</a></p>
  
Answers: CC BY-SA 4.0
Answers: 2019-03-07T14:43:09.170Z
Answers: 2019-03-07T14:43:09.170Z
Answers: Worp
Body: <p>I am struggling to set up an input step in a <strong>scripted</strong> Jenkins pipeline that will let me as the user to input a string.</p>
  
  <p>Scenario:
  I am building a Docker image. I want to ask the user what tags to tag the image with once it's built. I want the user to supply a comma separated list like so:
  latest,0.0.4,some-tag-name</p>
  
  <p>All I have right now is an input asking the user if the core image should be built:</p>
  
  <pre><code>  def buildCoreImage = input(
      message: 'Build Core Image?',
      ok: 'Yes', 
      parameters: [
        booleanParam(defaultValue: true, description: 'Push the button to build core image.',name: 'Yes?')
      ]
    )
  
    echo "Build core?:" + buildCoreImage
  </code></pre>
  
  <p>So in theory it should be as easy as changing the booleanParam to a stringParam, BUT the documentation does not have it:
  <a href="https://jenkins.io/doc/pipeline/steps/pipeline-input-step/" rel="nofollow noreferrer">Jenkins - Pipeline: Input Step</a></p>
  
  <p>Thanks for your time!</p>
  
Tags: <jenkins><jenkins-pipeline><jenkinsfile>
Title: Jenkins - Scripted Pipeline - Input String
UserDisplayName: Worp
ThreadText: # Jenkins - Scripted Pipeline - Input String
  
  (Asked by: username_0 on 2019-03-05)
  
  I am struggling to set up an input step in a **scripted** Jenkins pipeline that will let me as the user to input a string.
  
  Scenario:
  I am building a Docker image. I want to ask the user what tags to tag the image with once it's built. I want the user to supply a comma separated list like so:
  latest,0.0.4,some-tag-name
  
  All I have right now is an input asking the user if the core image should be built:
  
  ```
    def buildCoreImage = input(
      message: 'Build Core Image?',
      ok: 'Yes', 
      parameters: [
        booleanParam(defaultValue: true, description: 'Push the button to build core image.',name: 'Yes?')
      ]
    )
  
    echo "Build core?:" + buildCoreImage
  
  ```
  
  So in theory it should be as easy as changing the booleanParam to a stringParam, BUT the documentation does not have it:
  [Jenkins - Pipeline: Input Step](https://jenkins.io/doc/pipeline/steps/pipeline-input-step/)
  
  Thanks for your time!
  
  **Tags:** jenkins, jenkins-pipeline, jenkinsfile
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2019-03-07. Score: 2 | Accepted answer
  
  After some more research I found the answer:
  
  ```
    def coreImageTags = input(
      id: 'coreImageTags', message: 'Enter a comma separated list of additional tags for the image (0.0.1,some-tagname,etc):?', 
      parameters: [
        [$class: 'StringParameterDefinition', defaultValue: 'None', description: 'List of tags', name: 'coreImageTagsList'],
      ]
    )
  
    echo ("Image tags: "+coreImageTags)
  
  ```
  
  **Important note**
  
  It is stated in the documentation but I want to point it out specifically: If you copy/paste my solution here, `coreImageTags` will contain a string directly. If you do multiple parameters like so:
  
  ```
      parameters: [
        [$class: 'StringParameterDefinition', defaultValue: 'None', description: 'List of tags', name: 'coreImageTagsList'],
        [$class: 'StringParameterDefinition', defaultValue: 'None', description: 'Something else', name: 'somethingElse'],
      ]
  
  ```
  
  You will not get a single values but an array of values:
  
  ```
    echo ("Image tags: "+coreImageTags['coreImageTagsList'])
    echo ("Image tags: "+coreImageTags['somethingElse'])
  
  ```
  
  The following posts will help:
  
  [stackoverflow.com read-interactive-input-in-jenkins-pipeline-to-a-variable](https://stackoverflow.com/questions/47080683/read-interactive-input-in-jenkins-pipeline-to-a-variable)
  
  [CloudBees - Pipeline-How-to-manage-user-inputs](https://support.cloudbees.com/hc/en-us/articles/204986450-Pipeline-How-to-manage-user-inputs)
  
  A list of classes you can use in this way and what they do is in the Jenkins Input-Step documentation:
  [Pipeline - Input Step](https://jenkins.io/doc/pipeline/steps/pipeline-input-step/)
  
  
  ---
  
  