Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-38494

User can see the input form on an input step (UI)

    • frank, christmas

      In Scope

      • Step should show the "waiting for input" indicator.
      • Input form should be shown where the log is usually shown.
      • When the user clicks "Submit" the form disappears and the log for that step is shown (Note: progress via karaoke should resume at this point)
      • User cannot submit the form unless they have filled in all values.
      • We will need to show a form validation message if the user tries to submit the form with empty values.
      • The confirmation button label is "Continue"
      • The button in the header is "Abort" which aborts the run.
      • See https://issues.jenkins-ci.org/browse/JENKINS-35899 for details on the visual design of this and screen shots

      Before vivek left he was able to merge the first tranche of support for input.
      This is described in this closed PR here: https://github.com/jenkinsci/blueocean-plugin/pull/645 (with a sample pipeline, that will return states waiting for input)

      Creating the following pipeline and calling it "paused"

      node {
          stage("parallelStage"){
            parallel left : {
                  echo "running"
                  def branchInput = input message: 'Please input branch to test against', parameters: [[$class: 'StringParameterDefinition', defaultValue: 'master', description: '', name: 'branch']]
                  echo "BRANCH NAME: ${branchInput}"
              }, 
              right : {
                  sh 'sleep 100000'
              }
          }
      }
      

      Run it - and then go to the following URL:

      http://localhost:8080/jenkins/blue/rest/organizations/jenkins/pipelines/paused/runs/1/steps/

      And you will see:

      {
      "_class": "io.jenkins.blueocean.rest.impl.pipeline.PipelineStepImpl",
      "_links": {},
      "actions": [],
      "displayName": "Wait for interactive input",
      "durationInMillis": 124735,
      "id": "12",
      "input": {
      "_class": "io.jenkins.blueocean.rest.impl.pipeline.InputStepImpl",
      "_links": {
      "self": {
      "_class": "io.jenkins.blueocean.rest.hal.Link",
      "href": "/blue/rest/organizations/jenkins/pipelines/paused/runs/1/steps/12/input/"
      }
      },
      "id": "C51b52435b43a326d5d4f92c290a64d5",
      "message": "Please input branch to test against",
      "ok": "Proceed",
      "parameters": [
      {
      "_class": "hudson.model.StringParameterDefinition",
      "defaultParameterValue": {
      "_class": "hudson.model.StringParameterValue",
      "name": "branch",
      "value": "master"
      },
      "description": "",
      "name": "branch",
      "type": "StringParameterDefinition"
      }
      ],
      "submitter": null
      },
      "result": "UNKNOWN",
      "startTime": "2016-12-13T15:32:28.343+1100",
      "state": "PAUSED"
      }
      

      We can come up with more canonical examples of all input types once familiar with the api:

      GET /jenkins/blue/rest/organizations/jenkins/pipelines/pipeline1/runs/1/ should report state==PAUSED, result==UNKNOWN
      GET /jenkins/blue/rest/organizations/jenkins/pipelines/pipeline1/runs/1/nodes/ should report state==PAUSED, result==UNKNOWN for nodes parallelStage and right.
      GET /jenkins/blue/rest/organizations/jenkins/pipelines/pipeline1/runs/1/steps/ should report state==PAUSED, result==UNKNOWN for step id 12

      When you drill into a step for a paused node you can see the input required:

      eg:
      http://localhost:8080/jenkins/blue/rest/organizations/jenkins/pipelines/paused/runs/1/nodes/6/steps/12/

      Has an input value of:

      "input": {
      "_class": "io.jenkins.blueocean.rest.impl.pipeline.InputStepImpl",
      "_links": {
      "self": {
      "_class": "io.jenkins.blueocean.rest.hal.Link",
      "href": "/blue/rest/organizations/jenkins/pipelines/paused/runs/1/nodes/6/steps/12/input/"
      }
      },
      "id": "C51b52435b43a326d5d4f92c290a64d5",
      "message": "Please input branch to test against",
      "ok": "Proceed",
      "parameters": [
      {
      "_class": "hudson.model.StringParameterDefinition",
      "defaultParameterValue": {
      "_class": "hudson.model.StringParameterValue",
      "name": "branch",
      "value": "master"
      },
      "description": "",
      "name": "branch",
      "type": "StringParameterDefinition"
      }
      ],
      "submitter": null
      }
      
      

      which is what the form is rendered from.

          [JENKINS-38494] User can see the input form on an input step (UI)

          Michael Neale added a comment -

          I am not 100% clear on the validation yet - I think some more research needed to know what is current behavior/possible/ideal - but this sounds like something to aim for.

          Michael Neale added a comment - I am not 100% clear on the validation yet - I think some more research needed to know what is current behavior/possible/ideal - but this sounds like something to aim for.

          James Dumay added a comment - - edited

          michaelneale brody I can't think of a good reason why you wouldn't want to validate here (I suspect lack of validation in classic was an oversight rather than by design)

          James Dumay added a comment - - edited michaelneale brody I can't think of a good reason why you wouldn't want to validate here (I suspect lack of validation in classic was an oversight rather than by design)

          Brody Maclean added a comment -

          Zeplin https://zpl.io/ZwQgQM

          Mockup

          Brody Maclean added a comment - Zeplin https://zpl.io/ZwQgQM Mockup

          Michael Neale added a comment - - edited

          I put some details on how to get at the real data in the description.

          The following is a pipeline that excercises all types of input we want to support at the moment - you can run this, and log at the console to get to a form that you can fill in to try it if you like:

          node {
              stage("parallelStage"){
                      echo "running"
                      def branchInput = input id: 'CustomIdHere', message: 'this is a message to user', ok: 'Go ahead', parameters: [
                          booleanParam(defaultValue: false, description: 'yes or no', name: 'thisIsBool'), 
                          choice(choices: 'c1\nc2', description: 'this is choice description', name: 'This is choice'), 
                          text(defaultValue: 'default', description: 'Long text goes here', name: 'This is a multi line string'), 
                          string(defaultValue: 'yeah', description: 'string parameter desc', name: 'this is a string parmeter'), 
                          password(defaultValue: 'secret', description: 'password param desc', name: 'password param')
                      ]
                      echo "BRANCH NAME: ${branchInput}"
              }
          }
          

          Note that it shows a choice as a drop down cc brody jamesdumay - (we wouldn't have both radio and drop down - which should it be - as there is only one "choice" type?)

          What this looks like in Jenkins today on the console screen:

          Michael Neale added a comment - - edited I put some details on how to get at the real data in the description. The following is a pipeline that excercises all types of input we want to support at the moment - you can run this, and log at the console to get to a form that you can fill in to try it if you like: node { stage("parallelStage"){ echo "running" def branchInput = input id: 'CustomIdHere', message: 'this is a message to user', ok: 'Go ahead', parameters: [ booleanParam(defaultValue: false, description: 'yes or no', name: 'thisIsBool'), choice(choices: 'c1\nc2', description: 'this is choice description', name: 'This is choice'), text(defaultValue: 'default', description: 'Long text goes here', name: 'This is a multi line string'), string(defaultValue: 'yeah', description: 'string parameter desc', name: 'this is a string parmeter'), password(defaultValue: 'secret', description: 'password param desc', name: 'password param') ] echo "BRANCH NAME: ${branchInput}" } } Note that it shows a choice as a drop down cc brody jamesdumay - (we wouldn't have both radio and drop down - which should it be - as there is only one "choice" type?) What this looks like in Jenkins today on the console screen:

          James Dumay added a comment -

          brody I don't think we should have an 'abort' button. The affirmative should be "Continue" instead of "Submit"?

          James Dumay added a comment - brody I don't think we should have an 'abort' button. The affirmative should be "Continue" instead of "Submit"?

          Michael Neale added a comment -

          jamesdumay brody currently the user can enter the text for the proceed button (but not the cancel). It is really a "continue or not" function - however it is worded (not continuing does not mean failure necessarily)

          Michael Neale added a comment - jamesdumay brody currently the user can enter the text for the proceed button (but not the cancel). It is really a "continue or not" function - however it is worded (not continuing does not mean failure necessarily)

          Brody Maclean added a comment -

          jamesdumay michaelneale I'm happy for you guys to make the call. Abort does sound a little extreme but what happens if you choose not to Input? "Skip"? or just nothing?

          Brody Maclean added a comment - jamesdumay michaelneale I'm happy for you guys to make the call. Abort does sound a little extreme but what happens if you choose not to Input? "Skip"? or just nothing?

          James Dumay added a comment -

          brody I'm not sure why the original feature in pipeline stage view had a way to "abort" the run but I know people have been frustrated thinking this was a "cancel" (if you abort, then the run is killed for ever).

          You can't skip an input - its required before proceeding.

          James Dumay added a comment - brody I'm not sure why the original feature in pipeline stage view had a way to "abort" the run but I know people have been frustrated thinking this was a "cancel" (if you abort, then the run is killed for ever). You can't skip an input - its required before proceeding.

          Brody Maclean added a comment -

          jamesdumay I thought it was required but was confused by Mic's "not continuing does not mean failure necessarily" wording.
          So "Continue" is the primary action & there is not secondary?

          Brody Maclean added a comment - jamesdumay I thought it was required but was confused by Mic's "not continuing does not mean failure necessarily" wording. So "Continue" is the primary action & there is not secondary?

          Michael Neale added a comment - - edited

          yes you have to have a way to cancel/abort/whatever we call. It halts the run from proceeding. "Abort" is probably fine wording. I think we discussed once that "cancel" was bad wording, as it may imply they are just cancelling the form, not the run. "Continue" is the primary, but the wording can be customised by the author. Lets just leave it as "abort" for now for the secondary, and revisit later to avoid bike-shedding.

          Michael Neale added a comment - - edited yes you have to have a way to cancel/abort/whatever we call. It halts the run from proceeding. "Abort" is probably fine wording. I think we discussed once that "cancel" was bad wording, as it may imply they are just cancelling the form, not the run. "Continue" is the primary, but the wording can be customised by the author. Lets just leave it as "abort" for now for the secondary, and revisit later to avoid bike-shedding.

          michaelneale one observation about the input. In the above input pause the classic UI will display 2 buttons (even if if one is not defined in the above response)

          You find there is only "ok" but no "cancel" should we fix this in the backend for consistency, since I could imagine use cases that have only one button, but we could create a "dummy" cancel button if we have only one button.

          Thorsten Scherler added a comment - michaelneale one observation about the input. In the above input pause the classic UI will display 2 buttons (even if if one is not defined in the above response) You find there is only "ok" but no "cancel" should we fix this in the backend for consistency, since I could imagine use cases that have only one button, but we could create a "dummy" cancel button if we have only one button.

          Thorsten Scherler added a comment - - edited

          current testing pipe:

          node {
              stage("one"){
                  input message: 'Another Brother', ok: 'OK-Computer', parameters: [choice(choices: 'die\nby\nmy\nhand', description: '''stirb
          durch
          meine
          hand''', name: 'choose'), booleanParam(defaultValue: false, description: 'aaaa', name: 'boolena')]
          
              }
              stage("two"){
                def branchInput = input message: 'Please input branch to test against', parameters: [[$class: 'StringParameterDefinition', defaultValue: 'master', description: '', name: 'branch']]
                      echo "BRANCH NAME: ${branchInput}"
              }
          }
          

          Input gone wild pipe https://issues.jenkins-ci.org/browse/JENKINS-38494?focusedCommentId=280198&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-280198

          Thorsten Scherler added a comment - - edited current testing pipe: node { stage( "one" ){ input message: 'Another Brother' , ok: 'OK-Computer' , parameters: [choice(choices: 'die\nby\nmy\nhand' , description: '''stirb durch meine hand ''', name: ' choose '), booleanParam(defaultValue: false , description: ' aaaa ', name: ' boolena')] } stage( "two" ){ def branchInput = input message: 'Please input branch to test against' , parameters: [[$class: 'StringParameterDefinition' , defaultValue: 'master' , description: '', name: ' branch']] echo "BRANCH NAME: ${branchInput}" } } Input gone wild pipe https://issues.jenkins-ci.org/browse/JENKINS-38494?focusedCommentId=280198&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-280198

          James Dumay added a comment -

          tscherler our "Abort" button will be in the header where "stop" and "re-run" usually goes. The "Submit" button should be labeled "Continue".

          James Dumay added a comment - tscherler our "Abort" button will be in the header where "stop" and "re-run" usually goes. The "Submit" button should be labeled "Continue".

          Thorsten Scherler added a comment - - edited

          jamesdumay you are talking about the new design. IMO we should place them correctly when we generally implement the new headers but not in this PR

          Just re-read your command. You refer to the dialog where we have the default "cancel" button and the ok which can contain custom caption

          Thorsten Scherler added a comment - - edited jamesdumay you are talking about the new design. IMO we should place them correctly when we generally implement the new headers but not in this PR Just re-read your command. You refer to the dialog where we have the default "cancel" button and the ok which can contain custom caption

          Michael Neale added a comment - - edited

          tscherler after talking with brody, we think that if there are 5 or less items in a "choice" - use radio button. if there are more than 5, use a drop down.

          EDIT: see brody screen shot below.

          Michael Neale added a comment - - edited tscherler after talking with brody, we think that if there are 5 or less items in a "choice" - use radio button. if there are more than 5, use a drop down. EDIT: see brody screen shot below.

          Brody Maclean added a comment -

          2 - 6 choices – radio
          7+ – dropdown

          Brody Maclean added a comment - 2 - 6 choices – radio 7+ – dropdown

          Michael Neale added a comment -

          TODO: brody to confirm colours. Also - no need to add an element for credentials at this stage. Vivek to provide flowNode that can be posted to.

          Michael Neale added a comment - TODO: brody to confirm colours. Also - no need to add an element for credentials at this stage. Vivek to provide flowNode that can be posted to.

          Brody Maclean added a comment -

          tscherler I had a poke around but didn't find a teal colour in any of the variables.less files on Github.
          Either way, they current teal is #24B0D5;

          Brody Maclean added a comment - tscherler I had a poke around but didn't find a teal colour in any of the variables.less files on Github. Either way, they current teal is #24B0D5;

            tscherler Thorsten Scherler
            jamesdumay James Dumay
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: