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

envinject fails to "really" set/override build parameters

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • envinject-plugin
    • None

      If you load a properties file as a build step, that overrides one or more build parameters, the injected variables will show up in the "Injected Environment Variables View", but the subsequent build steps will be provided with whatever was specified in the build parameter at the start of the build.

      Consider the following:
      Step 1 (generate the params.properties file)
      cd sast_product
      ./waf configure
      waf params

      Here is the resulting file's contents:
      SIM_REV = 81b806d6c4165277ad456a3ffd7ee2c5e0a9ed73
      SIM_REMOTE_REV = d82501d4a73c200974138016f3b2628d0bbf0366
      SIM_UI_REV = 2a0aef21282b1277f75555e9c68e4ace8deed055
      FSW_CONTAINER_REV = 1e8d2005a045ac51219a1fd8915c7bd0f4f8a177
      SIM_COMMON_REV = 6315defaf0c7376f2889bda3473828e2fbf2f743
      SIM_INTERFACE_REV = 88c48d1349fb90cddbcaa1a21e93eee20cb15687
      AST_REV = 8f947e56c1a6693687e8097fb50bba1626989ea6
      WILLY_WONKA = harris

      All but the last one map to build parameters. The last one is NOT a build parameter. Just a fake variable I added for test purposes.

      Step 2 (Inject Environment variables)
      Properties File Path: sast_product/build/params.properties
      Console output:
      [EnvInject] - Injecting environment variables from a build step.
      [EnvInject] - Injecting as environment variables the properties file path 'sast_product/build/params.properties'
      [EnvInject] - Variables injected successfully.

      Step 3 (Execute shell and print the variables)
      echo $SIM_COMMON_REV
      echo $SIM_INTERFACE_REV
      echo $WILLY_WONKA
      Console output:
      [sast_product_linux64] $ bash -xe /tmp/hudson6024044080448978568.sh
      + echo default
      default
      + echo default
      default
      + echo harris

      You can see what's set in the environment are the build parameters ("default" is the default parameter value for SIM_COMMON_REV and SIM_INTERFACE_REV) and not the injected variables from the previous step. The dummy variable I added to the properties file that doesn't attempt to shadow a build parameter prints out OK.

      I'm attaching the config.xml, but I'm hoping this description will suffice.

            gbois Gregory Boissinot
            mears Josh Davidson
            Votes:
            16 Vote for this issue
            Watchers:
            24 Start watching this issue

              Created:
              Updated: