Skip to end of metadata
Go to start of metadata

Plugin Information

View Environment File on the plugin site for more information.

This plugin enables you to set environment variables via a file. The file's format must be the standard Java property file format.

Superseded by the EnvInject Plugin?

The property file is always retrieved from the file system of the Jenkins master node, even in distributed setups with slave nodes.

You can reference already defined environment variables both to specify the path to the property file, in a job's configuration, and in property values, in the property file.


When referencing properties you must always use the syntax $EnvVarName, regardless of the operating system where Jenkins is running.

Here is an example of a property reference in EnvFile's configuration:


Note: You can reference environment variables already defined by the SetEnv plugin.


Changelog

Version 1.2 (8/5/2011)
  • Update for Jenkins
  • Japanese localization
Version 1.1 (10/20/2010)
Version 1.0 (01/23/2010)
  • Added functionality to resolve variables against hudson-variables.
Version 0.9 (01/22/2010)
  • Initial release.

11 Comments

  1. Unknown User (gregmoore)

    a little detail would be nice.. llike:

    Does it work with any sort of job? specifically Free-form projects?

    Does it work with slaves?

    What platforms does it support (unix/linux, Windows (what versions), Mac osx) ?

    What format is the file?

    Is there a limit to the number of variables that can be added?

    How does the file get specified?

    Thank in advance.

    Greg.

    1. Exactly, I want to know, how to specify a file, such as "file name", "variable format", ...

  2. Unknown User (jl.pinardon)

    Well, interesting plugin, as it correctly works for Upstream/Downstream project. But what about access control ?
    I mean, in the case of  a complex set of Upstream/Downstream jobs sharing the same Env file, does the plugin (or Hudson) ensures something like an access control ?

  3. Unknown User (masin_p)

    Hi

    I think, it's very helpfull plugin for me, unfortunatly, i cant use them. I create new job and there I'm tryintg to use it. First time job is saving ok, but when I'm running that, nothing change. After second job configuration, when I'm seting path to file and trying to save configuration, hudson sets error. I'm sure that this plugin causing that.

    So please, help me. I like to read variables from file and put them to mail and this plugin would be the best to this issue.

    As Greg sayed- give more infromation how to use it.

    1. I've create a Jira issue to trace this...: JENKINS-7310

  4. Unknown User (masin_p)

    Great!

    But could some one tell me, how readed file should look like and how call readed variables in email? I create file lke variable=value(new_line) and file is readed. In log I see: envfile Reading environment variables from file.
    envfile Path to file: C:\test\temp\env.txt
    envfile RUNS=1111
    envfile PASSED=2222
    envfile SKIPPED=4444
    envfile PASSED=2222

    But in email, when I put ENV, var="RUNS"}

    +

    I have empty field. What I'm doing wrong? How I should configure my job, that readed variables will be visible in email.

    BR. Marcin

  5. Unknown User (masin_p)

    Hi

    I found, that only variables set in setenv plugin are visible in ext-email plugin and can be putted to email. This is not envfile but ext-email plugin bug. So in my opinion correction in ext-mail is needed. 

    BR. Marcin.

  6. Unknown User (dkroot)

    Somehow, envfile didn't work for me. I can see it reading variable in console output. It looks like this:

    [envfile] Foo=value

    However, when I dump all env. variables in my Ant build, Foo is nowhere to be seen:

     <property environment="env" />
     <echoproperties prefix="env" />
    

    What could be wrong?

    1. Unknown User (dkroot)

      I think that I might have found the reason for this problem. If I try to read a variable with the same name as the build parameter of a parameterized build (Foo) then - no luck. If I try to read a variable Bar then envfile works for me.

      What I am trying to do is to invoke normally manual build via a different trigger.

      I guess I can modify my build to account for both Foo and Bar, but isn't it a bug?

    1. A comment was added to the issue.