Reputation: 1044
I am using https://wiki.jenkins.io/display/JENKINS/EnvInject+Plugin 1.93.1 in my Jenkins installation.
I need to fetch the EnvInject properties configuration for every job I have, but I can't seem to find a way to do this in the job rest api.
The way I figured to do this is by fetching the last build for every job and then hit the injectedEnvVars/api/.
This strategy is not optimal because I have to do a request for every job, and that is taking too long (4000+ jobs).
Am I missing something? Is there a way to fetch the envInject properties together with the job information?
Upvotes: 0
Views: 305
Reputation: 13712
If you think send 4000 HTTP requests is not effective, You can iterate the JENKINS_HOME folder on Jenkins Master.
Following picture illustrate the structure for injectedEnvVars.txt
which stores the value of EnvInject.
.jenkins
is JENKINS_HOME folderfetch-envinject-value
is jenkins jobbuilds/1
is the 1st job buildbuilds/1/injectedEnvVars.txt
is all environment variables for this job build.Upvotes: 1