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

Parent injected env properties not propagated to child build jobs

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Major Major
    • envinject-plugin
    • None
    • Ubuntu 12.04.
      ii jenkins 1.472 Continuous integration system written in Jav

      A job that uses "Prepare an environment for the run" and defines some variables either in a properties file, or inline properties, does not pass these variables to child job executions.

      I'm using "Trigger/call builds on other projects" and specifying a list of child jobs, and "Current build parameters" is checked.

      I added an 'env' at the top of the scripts for both parent and child jobs and all of the properties defined in the parent via env injected properties are not present in the child env.

      I also compared the build's "Injected environment variables" and they confirm that the parent injected properties are missing from the child env.

          [JENKINS-14251] Parent injected env properties not propagated to child build jobs

          Bruce Edge added a comment -

          I have a work-around, but I don't feel it should be necessary.

          If I re-specify the same properties file using the "Parameters from properties file" under the "Trigger/call builds on other projects" build action, then the properties are present in the child env.

          I believe that it is still a bug however that the parent's env is not propagated to the child when "Current build parameters" is checked. It should not require that I re-specify the same properties file in two places.

          Bruce Edge added a comment - I have a work-around, but I don't feel it should be necessary. If I re-specify the same properties file using the "Parameters from properties file" under the "Trigger/call builds on other projects" build action, then the properties are present in the child env. I believe that it is still a bug however that the parent's env is not propagated to the child when "Current build parameters" is checked. It should not require that I re-specify the same properties file in two places.

          It is a parameterized jenkins plugin issue (enhancement).

          In my opinion, the plugin need to add an option to add environment variables to the next job.

          Technically:

          • Add a new dependency to envinject-lib library
          • Add a new option to parametrized values
          • If selected, add the EnvInjectAction to the schedule project method
            And that's all. The current code of the EnvInject plugin without changes has to work.

          Gregory Boissinot added a comment - It is a parameterized jenkins plugin issue (enhancement). In my opinion, the plugin need to add an option to add environment variables to the next job. Technically: Add a new dependency to envinject-lib library Add a new option to parametrized values If selected, add the EnvInjectAction to the schedule project method And that's all. The current code of the EnvInject plugin without changes has to work.

          cjo9900 added a comment -

          Environment injected parameter created following Gregory's comments.

          https://github.com/jenkinsci/parameterized-trigger-plugin/pull/23

          cjo9900 added a comment - Environment injected parameter created following Gregory's comments. https://github.com/jenkinsci/parameterized-trigger-plugin/pull/23

          Aaron Stone added a comment -

          This will specifically pull in EnvInject parameters, but will it grab other runtime build params? I'd like to see it bring in everything in the build environment, not only those things registered with EnvInject.

          Aaron Stone added a comment - This will specifically pull in EnvInject parameters, but will it grab other runtime build params? I'd like to see it bring in everything in the build environment, not only those things registered with EnvInject.

          cjo9900 added a comment -

          Env inject plugin should extend AbstractBuildParameters and provide a method for passing the EnvInject Action to triggered jobs.

          cjo9900 added a comment - Env inject plugin should extend AbstractBuildParameters and provide a method for passing the EnvInject Action to triggered jobs.

          Ian Tait added a comment -

          Is this getting any attention? I would also like to see injected environment variables/parameters get passed to triggered builds.

          Ian Tait added a comment - Is this getting any attention? I would also like to see injected environment variables/parameters get passed to triggered builds.

            gbois Gregory Boissinot
            bedge Bruce Edge
            Votes:
            4 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: