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

Generate runtime model directly from AST model

    • Declarative - 1.2

      My apologies if this isn't a bug, but I've searched high and low and tried a number of things, but I can't seem to find the syntax ex. to solve what's broken.  After upgrading pipeline plugins to the latest releases (as of today), my declarative pipelines broke because it seems there might no longer be ability to use a property in the agent label.  This was working:

      pipeline{
      
          parameters {
              choice(choices: 'server-cd\server-demo', description: DeployEnvironmentHelp, name: 'Environment')
          } 
      
          environment {
              DEPLOYENVIRONMENT = "${params.Environment}"
          }
      
          agent none
      
          stages {
              stage ("Stage 1") {
                  agent {label DEPLOYENVIRONMENT}
                  echo 'Get Deployment Helper Files from SCM repo(s)...'
              }
          } 
      }

      But the pipeline fails saying that the DEPLOYENVIRONMENT is not a proper value (I no longer have the exact message )  

      As of model def. 1.1.1, is it no longer possible to use an environment variable or property in the agent label?   btw - I'm setting DEPLOYENVIRONMENT so I can do other tests and not have to keep using params.Environment, but in other pipelines I set properties so that I can define which agent based on properties that change in the pipeline.

       

       

          [JENKINS-42753] Generate runtime model directly from AST model

          Jason Davis created issue -
          Jason Davis made changes -
          Description Original: My apologies if this isn't a bug, but I've searched high and low and tried a number of things, but I can't seem to find the syntax ex. to solve what's broken.  After upgrading pipeline plugins to the latest releases (as of today), my declarative pipelines broke because it seems there might no longer be ability to use a property in the agent label.  I had something like this:
          {noformat}
          pipeline{

              parameters {
                  choice(choices: 'server-cd\server-demo', description: DeployEnvironmentHelp, name: 'Environment')
              }

              environment {
                  DEPLOYENVIRONMENT = "${params.Environment}"
              }

              agent none

              stages {
                  stage ("Stage 1") {
                      agent {label DEPLOYENVIRONMENT}
                      echo 'Get Deployment Helper Files from SCM repo(s)...'
                  }
              }
          }{noformat}
          But the pipeline fails saying that the DEPLOYENVIRONMENT is not a proper value (I no longer have the exact message :()  

          As of model def. 1.1.1, is it no longer possible to use an environment variable or property in the agent label?   btw - I'm setting DEPLOYENVIRONMENT so I can do other tests and not have to keep using params.Environment, but in other pipelines I set properties so that I can define which agent based on properties that change in the pipeline.

           

           
          New: My apologies if this isn't a bug, but I've searched high and low and tried a number of things, but I can't seem to find the syntax ex. to solve what's broken.  After upgrading pipeline plugins to the latest releases (as of today), my declarative pipelines broke because it seems there might no longer be ability to use a property in the agent label.  This was working:
          {noformat}
          pipeline{

              parameters {
                  choice(choices: 'server-cd\server-demo', description: DeployEnvironmentHelp, name: 'Environment')
              }

              environment {
                  DEPLOYENVIRONMENT = "${params.Environment}"
              }

              agent none

              stages {
                  stage ("Stage 1") {
                      agent {label DEPLOYENVIRONMENT}
                      echo 'Get Deployment Helper Files from SCM repo(s)...'
                  }
              }
          }{noformat}
          But the pipeline fails saying that the DEPLOYENVIRONMENT is not a proper value (I no longer have the exact message :()  

          As of model def. 1.1.1, is it no longer possible to use an environment variable or property in the agent label?   btw - I'm setting DEPLOYENVIRONMENT so I can do other tests and not have to keep using params.Environment, but in other pipelines I set properties so that I can define which agent based on properties that change in the pipeline.

           

           
          Jason Davis made changes -
          Summary Original: Using a Pipeline Property an Agent Label? New: Using a Pipeline Property with an Agent Label?
          Andrew Bayer made changes -
          Issue Type Original: Bug [ 1 ] New: Improvement [ 4 ]
          Priority Original: Minor [ 4 ] New: Critical [ 2 ]
          Summary Original: Using a Pipeline Property with an Agent Label? New: Generate runtime model directly from AST model
          Andrew Bayer made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]
          Andrew Bayer made changes -
          Status Original: In Progress [ 3 ] New: In Review [ 10005 ]
          Andrew Bayer made changes -
          Remote Link New: This issue links to "PR #140 (Web Link)" [ 15720 ]
          Andrew Bayer made changes -
          Link New: This issue relates to JENKINS-42777 [ JENKINS-42777 ]
          Andrew Bayer made changes -
          Link New: This issue relates to JENKINS-42829 [ JENKINS-42829 ]
          Andrew Bayer made changes -
          Status Original: In Review [ 10005 ] New: In Progress [ 3 ]
          Andrew Bayer made changes -
          Labels New: declarative-variable-and-method-resolution

            abayer Andrew Bayer
            jedavis Jason Davis
            Votes:
            5 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:
              Resolved: