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

EnvJect unsets empty string properties returned in maps

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Blocker Blocker
    • envinject-plugin
    • None
    • 1.69, 1.92.1

      EnvJect unsets empty and whitespace properties

      Example
      return ["LABEL":" ",ANOTHER_LABEL:""]

      [EnvInject] - Unset unresolved 'ANOTHER_LABEL' variable.
      [EnvInject] - Unset unresolved 'LABEL' variable.

      It appears that the fix for JENKINS-14930 caused the problem.

      Unsetting blank variables should be optional.

          [JENKINS-15146] EnvJect unsets empty string properties returned in maps

          Jeff Maxwell created issue -
          Jeff Maxwell made changes -
          Description Original: EnvJect unsets empty and whitespace properties

          Example
          return ["LABEL":" ",ANOTHER_LABEL:""]

          [EnvInject] - Unset unresolved 'ANOTHER_LABEL' variable.
          [EnvInject] - Unset unresolved 'LABEL' variable.
          New: EnvJect unsets empty and whitespace properties

          Example
          return ["LABEL":" ",ANOTHER_LABEL:""]

          [EnvInject] - Unset unresolved 'ANOTHER_LABEL' variable.
          [EnvInject] - Unset unresolved 'LABEL' variable.

          It appears that the fix for JENKINS-14930 caused the problem.

          Unsetting blank variables should be optional.

          Are you sure want to not remove empty environment variables?
          What are your use cases?

          Gregory Boissinot added a comment - Are you sure want to not remove empty environment variables? What are your use cases?
          Gregory Boissinot made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]

          Jeff Maxwell added a comment -

          We need to blank a variable (a perforce label) based on certain combinations of user input.

          Jeff Maxwell added a comment - We need to blank a variable (a perforce label) based on certain combinations of user input.

          Jeff Maxwell added a comment -

          Another example: We need to add maven profiles only certain combinations of user input.
          In the example below ${MAVEN_PROPERTIES} and ${MAVEN_PROFILES} need to be blank under certain circumstances.

          Build:
          Goals and options: ${MAVEN_GOALS} ${MAVEN_PROPERTIES} ${MAVEN_PROFILES}

          Jeff Maxwell added a comment - Another example: We need to add maven profiles only certain combinations of user input. In the example below ${MAVEN_PROPERTIES} and ${MAVEN_PROFILES} need to be blank under certain circumstances. Build: Goals and options: ${MAVEN_GOALS} ${MAVEN_PROPERTIES} ${MAVEN_PROFILES}

          Code changed in jenkins
          User: Gregory Boissinot
          Path:
          src/main/java/org/jenkinsci/plugins/envinject/service/EnvInjectEnvVars.java
          src/test/java/org/jenkinsci/plugins/envinject/EnvInjectEnvVarsEmpty.java
          http://jenkins-ci.org/commit/envinject-plugin/718586449693a86314242223b14813c374b8bbdc
          Log:
          Fix JENKINS-15146

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Gregory Boissinot Path: src/main/java/org/jenkinsci/plugins/envinject/service/EnvInjectEnvVars.java src/test/java/org/jenkinsci/plugins/envinject/EnvInjectEnvVarsEmpty.java http://jenkins-ci.org/commit/envinject-plugin/718586449693a86314242223b14813c374b8bbdc Log: Fix JENKINS-15146

          Sorry for the inconvenience.
          Empty environment variables are acceptable for now.

          Gregory Boissinot added a comment - Sorry for the inconvenience. Empty environment variables are acceptable for now.
          Gregory Boissinot made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: In Progress [ 3 ] New: Resolved [ 5 ]

          I'm getting the same behaviour (blank properties are not set) in 1.92.1

          Jakub Bochenski added a comment - I'm getting the same behaviour (blank properties are not set) in 1.92.1
          Jakub Bochenski made changes -
          Resolution Original: Fixed [ 1 ]
          Status Original: Resolved [ 5 ] New: Reopened [ 4 ]

            gbois Gregory Boissinot
            jmaxwell Jeff Maxwell
            Votes:
            7 Vote for this issue
            Watchers:
            15 Start watching this issue

              Created:
              Updated: