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

Support default value for parameters if they are not set

      Please consider supporting a default value for parameters if they are empty or unset. There are cases where env parameters ${ENV, var="SOME_ENV_VAR"} are not set. And for build parameters there can be the case when it is not set at all. For example, this happens with Groovy scripts that trigger builds, see e.g. JENKINS-13768

      In these cases it would be nice to be able to print something instead of the empty string. For env vars this seems easy, as it's just another parameters then: ${ENV, var="SOME_ENV_VAR", ifUnset="[not set]"}". For build parameters it might be more tricky, but the the same concept might apply. And since they end up in env variables anyway, one workaround would be simply using ${ENV, var="MyBuildParameter", ifUnset="[not set]"}.

       

          [JENKINS-42698] Support default value for parameters if they are not set

          Axel Heider created issue -
          David van Laatum made changes -
          Component/s New: token-macro-plugin [ 15832 ]
          David van Laatum made changes -
          Assignee Original: David van Laatum [ davidvanlaatum ] New: Alex Eastabrook [ eastabrooka ]
          David van Laatum made changes -
          Assignee Original: Alex Eastabrook [ eastabrooka ] New: Alex Earl [ slide_o_mix ]

          slide_o_mix I beleave this is done in the token macros plugin

          David van Laatum added a comment - slide_o_mix I beleave this is done in the token macros plugin
          Axel Heider made changes -
          Description Original: Please consider supporting a default value for parameters if they are empty or unset. There are cases where env parameters {{$\{ENV, var="SOME_ENV_VAR"}"}}are no set. And for build parameters there can be the case when it is not set at all. For exmaple, this happens with Groovy scripts tthat trigger builds, see e.g. JENKINS-13768

          In these cases it would be nice to be able to print something instead of the empty string. For env vars this seems easy, as it's just another parameters then: {{$\{ENV, var="SOME_ENV_VAR", ifUnset="[no set]"}"}}. For build parameters it might be more tricky, but the the same concept might apply. And since they end up in env variables anyway, one workaround would be simply using {{$\{ENV, var="MyBuildParameter", ifUnset="[no set]"}}}.

           
          New: Please consider supporting a default value for parameters if they are empty or unset. There are cases where env parameters {{$\{ENV, var="SOME_ENV_VAR"}}} are no set. And for build parameters there can be the case when it is not set at all. For example, this happens with Groovy scripts that trigger builds, see e.g. JENKINS-13768

          In these cases it would be nice to be able to print something instead of the empty string. For env vars this seems easy, as it's just another parameters then: {{$\{ENV, var="SOME_ENV_VAR", ifUnset="[no set]"}"}}. For build parameters it might be more tricky, but the the same concept might apply. And since they end up in env variables anyway, one workaround would be simply using {{$\{ENV, var="MyBuildParameter", ifUnset="[no set]"}}}.

           
          Axel Heider made changes -
          Description Original: Please consider supporting a default value for parameters if they are empty or unset. There are cases where env parameters {{$\{ENV, var="SOME_ENV_VAR"}}} are no set. And for build parameters there can be the case when it is not set at all. For example, this happens with Groovy scripts that trigger builds, see e.g. JENKINS-13768

          In these cases it would be nice to be able to print something instead of the empty string. For env vars this seems easy, as it's just another parameters then: {{$\{ENV, var="SOME_ENV_VAR", ifUnset="[no set]"}"}}. For build parameters it might be more tricky, but the the same concept might apply. And since they end up in env variables anyway, one workaround would be simply using {{$\{ENV, var="MyBuildParameter", ifUnset="[no set]"}}}.

           
          New: Please consider supporting a default value for parameters if they are empty or unset. There are cases where env parameters {{$\{ENV, var="SOME_ENV_VAR"}}} are not set. And for build parameters there can be the case when it is not set at all. For example, this happens with Groovy scripts that trigger builds, see e.g. JENKINS-13768

          In these cases it would be nice to be able to print something instead of the empty string. For env vars this seems easy, as it's just another parameters then: {{$\{ENV, var="SOME_ENV_VAR", ifUnset="[no set]"}"}}. For build parameters it might be more tricky, but the the same concept might apply. And since they end up in env variables anyway, one workaround would be simply using {{$\{ENV, var="MyBuildParameter", ifUnset="[no set]"}}}.

           
          Axel Heider made changes -
          Description Original: Please consider supporting a default value for parameters if they are empty or unset. There are cases where env parameters {{$\{ENV, var="SOME_ENV_VAR"}}} are not set. And for build parameters there can be the case when it is not set at all. For example, this happens with Groovy scripts that trigger builds, see e.g. JENKINS-13768

          In these cases it would be nice to be able to print something instead of the empty string. For env vars this seems easy, as it's just another parameters then: {{$\{ENV, var="SOME_ENV_VAR", ifUnset="[no set]"}"}}. For build parameters it might be more tricky, but the the same concept might apply. And since they end up in env variables anyway, one workaround would be simply using {{$\{ENV, var="MyBuildParameter", ifUnset="[no set]"}}}.

           
          New: Please consider supporting a default value for parameters if they are empty or unset. There are cases where env parameters {{$\{ENV, var="SOME_ENV_VAR"}}} are not set. And for build parameters there can be the case when it is not set at all. For example, this happens with Groovy scripts that trigger builds, see e.g. JENKINS-13768

          In these cases it would be nice to be able to print something instead of the empty string. For env vars this seems easy, as it's just another parameters then: {{$\{ENV, var="SOME_ENV_VAR", ifUnset="[not set]"}"}}. For build parameters it might be more tricky, but the the same concept might apply. And since they end up in env variables anyway, one workaround would be simply using {{$\{ENV, var="MyBuildParameter", ifUnset="[not set]"}}}.

           

          Alex Earl added a comment -

          I could add this for ENV, but not globally.

          Alex Earl added a comment - I could add this for ENV, but not globally.

          Axel Heider added a comment -

          Yes, please do this 

          Axel Heider added a comment - Yes, please do this 

            slide_o_mix Alex Earl
            axelh Axel Heider
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: