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

ConfigFileProvider variable is not seen by EnvInject

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • envinject-plugin
    • None

      The ConfigFileProvider plugin copies a file to the workspace then sets an environment variable to the path of the copied file.
      If this variable is referenced in EnvInject properties, it fails to be injected with an "unresolved variable" error.
      The behavior is similar to what happens with ToolEnv variables when it is not enabled in the "prepare environment for run" section

          [JENKINS-14897] ConfigFileProvider variable is not seen by EnvInject

          For the ToolEnvPlugin, as I comment in the Tool Environment Plugin wiki page, this plugin is not compatible with this plugin.
          You have to use the SharedObjects plugin (https://wiki.jenkins-ci.org/display/JENKINS/SharedObjects+Plugin). It covers Tool Env features and has a good integration with the EnvInject plugin.

          Gregory Boissinot added a comment - For the ToolEnvPlugin, as I comment in the Tool Environment Plugin wiki page, this plugin is not compatible with this plugin. You have to use the SharedObjects plugin ( https://wiki.jenkins-ci.org/display/JENKINS/SharedObjects+Plugin ). It covers Tool Env features and has a good integration with the EnvInject plugin.

          For the ConfigFileProvider plugin, environment variables are injected by a build wrapper extension. Therefore EnvInject plugin can't capture these new injected environment variables due to Jenkins architecture.
          It should be good if the ConfigFileProvider plugin switch to EnvironmentContributionAction

          Gregory Boissinot added a comment - For the ConfigFileProvider plugin, environment variables are injected by a build wrapper extension. Therefore EnvInject plugin can't capture these new injected environment variables due to Jenkins architecture. It should be good if the ConfigFileProvider plugin switch to EnvironmentContributionAction

          I noticed that the SetEnv plugin is able to get access to the ConfigFileProvider environment variable.
          I'm new to Jenkins code, could you kindly point me to an explanation of that shift in behavior?

          lionel alberti added a comment - I noticed that the SetEnv plugin is able to get access to the ConfigFileProvider environment variable. I'm new to Jenkins code, could you kindly point me to an explanation of that shift in behavior?

          I think it works due to an order issue (alphabetic order) for the list of wrapper plugin type.
          The sentenv plugin might be executed after the ConfigFileProvider.
          Could you attach your job configuration file (config.xml)?

          Gregory Boissinot added a comment - I think it works due to an order issue (alphabetic order) for the list of wrapper plugin type. The sentenv plugin might be executed after the ConfigFileProvider. Could you attach your job configuration file (config.xml)?

          Code changed in jenkins
          User: Gregory Boissinot
          Path:
          pom.xml
          http://jenkins-ci.org/commit/envinject-plugin/8b24daccd99c5c1e0c72fa5fc19b218f51f69129
          Log:
          Upgrade to Jenkins 1.437 for fixing JENKINS-14897

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Gregory Boissinot Path: pom.xml http://jenkins-ci.org/commit/envinject-plugin/8b24daccd99c5c1e0c72fa5fc19b218f51f69129 Log: Upgrade to Jenkins 1.437 for fixing JENKINS-14897

          Code changed in jenkins
          User: Gregory Boissinot
          Path:
          src/main/java/org/jenkinsci/plugins/envinject/service/EnvInjectVariableGetter.java
          http://jenkins-ci.org/commit/envinject-plugin/1adb4759d1a338747d063e3266739d52195d8f67
          Log:
          Fix JENKINS-14897

          Compare: https://github.com/jenkinsci/envinject-plugin/compare/9d7fc88f4e89...1adb4759d1a3

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Gregory Boissinot Path: src/main/java/org/jenkinsci/plugins/envinject/service/EnvInjectVariableGetter.java http://jenkins-ci.org/commit/envinject-plugin/1adb4759d1a338747d063e3266739d52195d8f67 Log: Fix JENKINS-14897 Compare: https://github.com/jenkinsci/envinject-plugin/compare/9d7fc88f4e89...1adb4759d1a3

          The version 1.68 should fix the issue.

          Gregory Boissinot added a comment - The version 1.68 should fix the issue.

          Thank you for the fix. The variable in ConfigFileProvider is injected now.

          lionel alberti added a comment - Thank you for the fix. The variable in ConfigFileProvider is injected now.

            gbois Gregory Boissinot
            lfalberti lionel alberti
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: