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

Declarative Pipeline: add option to set environment variables based on user passed boolean parameter in the environment directive

    Details

    • Similar Issues:

      Description

      Hi,

      Currently there is no option to set an environment variable based on boolean value within the environment directive. I think it is crucial to implement support for something like this:

       

      pipeline{
      agent any
      environment {
      
      /*Option1*/
      condition $params.some_bool_parameter{CC = "1"}
      
      /* Option2 variable will be set to "1" only if the boolean value is true */
      CC = $params.some_bool_parameter : "1"
      
      /* This is currently supported */
      CC = $params.some_non_bool_parameter
      }
      }
      

       

        Attachments

          Activity

            People

            • Assignee:
              abayer Andrew Bayer
              Reporter:
              progovoy Pavel Rogovoy
            • Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: