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

Improve validation around script blocks in editor or remove script blocks

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Major Major
    • Blue Ocean 1.4 - beta 1, Blue Ocean 1.4 - beta 2

      In some cases you can make an invalid edit to a script block and it will show a warning, but it may be illegible (it is possbile that some cases slip through the validator and the user ends up with a non valid declarative file and the visual editor can be invoked). 

      kshultz would be good if we could try this again (I build from master) to see if we can see any case where going from the editor gets to a non re-openable state (editing it by hand - well all bets are off in that case anyway). 

       

            • original from karl follows ---*

      Summary:
      Given an existing, working Jenkinsfile which includes two parallel stages (supported by Declarative 1.2-beta4), saving changes to this Jenkinsfile from the Blue Ocean editor (1.3-beta2) is inop.

      Frequency:
      Not 100% reproducible, even with the same repos and branches.

      Prerequisites:
      1. A known-good Jenkinsfile in a remote repository, which includes at least one pair of parallel stages that are compliant with Declarative 1.2-beta4. I'm testing with a GitHub enterprise server.

      2. This Jenkinsfile should be on a branch other than master. Shown below, the branch I'm working on, verify-parallel-lengths, is favorited:

      3. A sample Jenkinsfile with which to recreate this problem is shown below:

      pipeline {
          agent any
          stages { 
              stage('Each of these takes ten seconds') {
                  parallel {
                      stage('first') {
                          steps {
                              echo "First branch"
                                  script {
                                      sh 'for i in `seq 1 10`; do echo "Sleeping 1S"; sleep 1; done'
                                  }
                          }
                      }
                      stage('second') {
                          steps {
                              echo "Second branch"
                              script {
                                  sh 'for i in `seq 1 10`; do echo "Sleeping 1S"; sleep 1; done'
                              }
                          }
                      }
                  }
              }
          }
      }
      

      Steps to recreate:
      1. Add the Pipeline via Blue Ocean, and verify that it will run to completion:

      2. Edit the Pipeline using whatever your preferred way to launch the editor is. Here, I'm clicking on the Edit icon in the build that just ran:

      3. Make a trivial change. Here, I'm changing the name of the "wrapper" stage for my two parallel stages:

      4. Click Save. Provide a description of the change, then click "Save and Run." In this example I'm attempting to commit the changes straight to verify-parallel-lengths, but choosing a new branch name also demonstrates the problem:

      5. You'll get an "Error - Bad request" message, and the change won't get saved.

      6. I was not able to recreate this when editing master.

      I will run back through this with the dev console open when I'm not multitasking taking screen shots, and grab a HAR file.

            abayer Andrew Bayer
            kshultz Karl Shultz
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: