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

Pipeline editor does not recognize agent { label "labelName" } without node

    Details

    • Similar Issues:
    • Sprint:
      Blue Ocean - Candidates

      Description

      Quoting from https://jenkins.io/doc/book/pipeline/syntax/

      agent { node { label 'labelName' } } behaves the same as agent { label 'labelName' }, but node allows for additional options (such as customWorkspace).

      If I use the longer syntax, then the Blue Ocean Pipeline Editor shows the label in "Pipeline Settings". However, if I use the shorter syntax, then the "Agent" drop-down list just shows "Select an option". The UI should be the same in either case.

      Test with Jenkinsfile:

      pipeline {
        agent {
          label 'labelName'
        }
        stages {
          stage('Build') {
            steps {
              sleep 1
            }
          }
        }
      }
      

      vs.

      pipeline {
        agent {
          node {
            label 'labelName'
          }
        }
        stages {
          stage('Build') {
            steps {
              sleep 1
            }
          }
        }
      }
      

      IMHO, it would be OK to silently convert one syntax to the other.

        Attachments

          Activity

          kon Kalle Niemitalo created issue -
          kon Kalle Niemitalo made changes -
          Field Original Value New Value
          Description Quoting from [https://jenkins.io/doc/book/pipeline/syntax/]

          {quote}
          agent \{ node \{ label 'labelName' } } behaves the same as agent \{ label 'labelName' }, but node allows for additional options (such as customWorkspace).
          {quote}

          If I use the longer syntax, then the Blue Ocean Pipeline Editor shows the label in "Pipeline Settings". However, if I use the shorter syntax, then the "Agent" combo box just shows "Select an option". The UI should be the same in either case.

          Test with Jenkinsfile:

          {code}
          pipeline {
            agent {
              label 'labelName'
            }
            stages {
              stage('Build') {
                steps {
                  sleep 1
                }
              }
            }
          }
          {code}

          vs.

          {code}
          pipeline {
            agent {
              node {
                label 'labelName'
              }
            }
            stages {
              stage('Build') {
                steps {
                  sleep 1
                }
              }
            }
          }
          {code}

          IMHO, it would be OK to silently convert one syntax to the other.
          Quoting from [https://jenkins.io/doc/book/pipeline/syntax/]

          {quote}
          agent \{ node \{ label 'labelName' } } behaves the same as agent \{ label 'labelName' }, but node allows for additional options (such as customWorkspace).
          {quote}

          If I use the longer syntax, then the Blue Ocean Pipeline Editor shows the label in "Pipeline Settings". However, if I use the shorter syntax, then the "Agent" drop-down list just shows "Select an option". The UI should be the same in either case.

          Test with Jenkinsfile:

          {code}
          pipeline {
            agent {
              label 'labelName'
            }
            stages {
              stage('Build') {
                steps {
                  sleep 1
                }
              }
            }
          }
          {code}

          vs.

          {code}
          pipeline {
            agent {
              node {
                label 'labelName'
              }
            }
            stages {
              stage('Build') {
                steps {
                  sleep 1
                }
              }
            }
          }
          {code}

          IMHO, it would be OK to silently convert one syntax to the other.
          jamesdumay James Dumay made changes -
          Epic Link JENKINS-36291 [ 172300 ]
          jamesdumay James Dumay made changes -
          Sprint Blue Ocean 1.4 - beta 4 [ 441 ]
          kshultz Karl Shultz made changes -
          Labels testing-notes-reviewed
          bigming1712 big ming made changes -
          Rank Ranked higher
          bigming1712 big ming made changes -
          Rank Ranked lower

            People

            • Assignee:
              Unassigned
              Reporter:
              kon Kalle Niemitalo
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated: