After I reinstalled Jenkins and Cloudbees Free Enterprise plugins, an environment variable set in my Jenkins folder stopped working and disappeared from the config UI. However, it is still there in the config.xml on the filesystem, as:
<properties>
<com.cloudbees.hudson.plugins.folder.properties.EnvVarsFolderProperty>
How should I now create environment variables that apply to an entire folder?
@Mig82 has provided a great solution. It has one limitation, though, which is that the folder environment variables it provides are not available in the SCM section of a freestyle build, and possibly in some other sections.
I've found I can get around this using a snippet of groovy:
After much thought, and since I've had to deal with this need for a while, I've put some work into defining my own plugin to cover this need. It allows you to define a list of String properties for a folder, which can then be inherited by the jobs inside it, thus removing the need to specify the same properties over and over again for all the jobs inside a folder.
https://github.com/mig82/folder-properties-plugin
I hope this is useful to others. I plan to submit this to Jenkins CI Org as soon as I've had time to document it better and write some test scripts.
The functionality has been moved to the Folders Plus plugin, which requires a Jenkins Enterprise paid license.