Hi Vincent,

Thanks for replying :)
My debugging setup does not work, so I simply do install on the project, 
and then load the output .hpi file into my Jenkins. 
So strange that it works for you. Do you have any jelly files or such made 
for this class? Perhaps one of my plugins is conflicting with it? 

My plugins are:
ant <http://wiki.jenkins-ci.org/display/JENKINS/Ant+Plugin>
1.1 <http://lb-cbga-voip3:8080/pluginManager/plugin/ant/thirdPartyLicenses>
CVS Plugin <http://wiki.jenkins-ci.org/display/JENKINS/CVS+Plugin>
Integrates Jenkins with CVS version control system.
1.6 <http://lb-cbga-voip3:8080/pluginManager/plugin/cvs/thirdPartyLicenses>
Git Plugin <http://wiki.jenkins-ci.org/display/JENKINS/Git+Plugin>
This plugin integrates GIT <http://git.or.cz/> with Jenkins.
1.1.21<http://lb-cbga-voip3:8080/pluginManager/plugin/git/thirdPartyLicenses>
Green Balls <http://wiki.jenkins-ci.org/display/JENKINS/Green+Balls>
Because green is better than blue! For color blind support configure user 
property.
1.12<http://lb-cbga-voip3:8080/pluginManager/plugin/greenballs/thirdPartyLicenses>
Hudson Locks and Latches 
plugin<http://wiki.hudson-ci.org/display/HUDSON/Locks+and+Latches+plugin>
This plugin adds locking and latch functionality to Hudson.
0.6<http://lb-cbga-voip3:8080/pluginManager/plugin/locks-and-latches/thirdPartyLicenses>
javadoc <http://wiki.jenkins-ci.org/display/JENKINS/Javadoc+Plugin>
1.0<http://lb-cbga-voip3:8080/pluginManager/plugin/javadoc/thirdPartyLicenses>
Jenkins Exclusion 
Plug-in<https://wiki.jenkins-ci.org/display/JENKINS/Exclusion-Plugin>
This plugin manage exclusion between jobs.
0.7<http://lb-cbga-voip3:8080/pluginManager/plugin/Exclusion/thirdPartyLicenses>
Jenkins Parameterized Trigger 
plugin<http://wiki.jenkins-ci.org/display/JENKINS/Parameterized+Trigger+Plugin>
2.15<http://lb-cbga-voip3:8080/pluginManager/plugin/parameterized-trigger/thirdPartyLicenses>
Jenkins SCons plugin<http://wiki.jenkins-ci.org/display/JENKINS/SCons+Plugin>
This plugin provides SCons <http://www.scons.org/> support in Jenkins.
0.4<http://lb-cbga-voip3:8080/pluginManager/plugin/scons/thirdPartyLicenses>
Jenkins SSH Slaves 
plugin<http://wiki.jenkins-ci.org/display/JENKINS/SSH+Slaves+plugin>
0.21<http://lb-cbga-voip3:8080/pluginManager/plugin/ssh-slaves/thirdPartyLicenses>
Jenkins TAP Plugin <http://wiki.jenkins-ci.org/display/JENKINS/TAP+Plugin>
This plugin publishes TAP test results.
1.3 <http://lb-cbga-voip3:8080/pluginManager/plugin/tap/thirdPartyLicenses>
LDAP Plugin <http://wiki.jenkins-ci.org/display/JENKINS/LDAP+Plugin>
1.1 <http://lb-cbga-voip3:8080/pluginManager/plugin/ldap/thirdPartyLicenses>
Maven 2 Project 
Plugin<http://wiki.jenkins-ci.org/display/JENKINS/Maven+2+Project+Plugin>
1.472<http://lb-cbga-voip3:8080/pluginManager/plugin/maven-plugin/thirdPartyLicenses>
Monitoring external 
jobs<https://wiki.jenkins-ci.org/display/JENKINS/Monitoring+external+jobs>
1.0<http://lb-cbga-voip3:8080/pluginManager/plugin/external-monitor-job/thirdPartyLicenses>
Node and Label parameter 
plugin<https://wiki.jenkins-ci.org/display/JENKINS/NodeLabel+Parameter+Plugin>
1.2.1<http://lb-cbga-voip3:8080/pluginManager/plugin/nodelabelparameter/thirdPartyLicenses>
pam-auth<http://wiki.jenkins-ci.org/display/JENKINS/PAM+Authentication+Plugin>
1.0<http://lb-cbga-voip3:8080/pluginManager/plugin/pam-auth/thirdPartyLicenses>
resourceManagementPlugin<http://jenkins-ci.org/plugin/resourceManagementPlugin/>
This plugin is a sample to explain how to write a Jenkins plugin.
1.0-SNAPSHOT (private-08/14/2012 
16:30-tbrouwer)<http://lb-cbga-voip3:8080/pluginManager/plugin/resourceManagementPlugin/thirdPartyLicenses>
Static Analysis Utilities <http://wiki.jenkins-ci.org/x/CwDgAQ>
This plug-in provides utilities for the static code analysis plug-ins.

If you like this open source plug-in please consider supporting my work by 
buying my Android game Inca 
Trails<http://play.google.com/store/apps/details?id=de.hafner.ullrich.incatrails.full>
.
1.43<http://lb-cbga-voip3:8080/pluginManager/plugin/analysis-core/thirdPartyLicenses>
Subversion Plugin<http://wiki.jenkins-ci.org/display/JENKINS/Subversion+Plugin>
1.34<http://lb-cbga-voip3:8080/pluginManager/plugin/subversion/thirdPartyLicenses>
Throttle Concurrent Builds 
Plugin<http://wiki.jenkins-ci.org/display/JENKINS/Throttle+Concurrent+Builds+Plugin>
This plugin allows for throttling the number of concurrent builds of a 
project running per node or globally.
testing_1639<http://lb-cbga-voip3:8080/pluginManager/plugin/throttle-concurrents/thirdPartyLicenses>
Token Macro 
Plugin<http://wiki.jenkins-ci.org/display/JENKINS/Token+Macro+Plugin>
This plug-in adds reusable macro expansion capability for other plug-ins to 
use.
1.5.1<http://lb-cbga-voip3:8080/pluginManager/plugin/token-macro/thirdPartyLicenses>
Translation Assistance 
Plugin<http://wiki.jenkins-ci.org/display/JENKINS/Translation+Assistance+Plugin>
1.8<http://lb-cbga-voip3:8080/pluginManager/plugin/translation/thirdPartyLicenses>
Warnings Plug-in <http://wiki.jenkins-ci.org/x/G4CGAQ>
This plug-in collects the compiler warnings of the project modules and 
visualizes the results.

If you like this open source plug-in please consider supporting my work by 
buying my Android game Inca 
Trails<http://play.google.com/store/apps/details?id=de.hafner.ullrich.incatrails.full>
.
4.13<http://lb-cbga-voip3:8080/pluginManager/plugin/warnings/thirdPartyLicenses>Workspace
 
Cleanup 
Plugin<http://wiki.jenkins-ci.org/display/JENKINS/Workspace+Cleanup+Plugin>
Just to confirm: this should just hook into Jenkins without any triggers 
from our side? Just having this code and loading in this plugin should 
already add the environmental variable?

Thomas

On Tuesday, August 21, 2012 3:57:12 PM UTC+1, ThomasBrouwer wrote:
>
> Hi there!
>
> I just cannot seem to be able to add environmental variables in my plugin. 
> I made a separate class extending EnvironmentContributor:
>
> package hudson.plugins.throttleconcurrents;
>
> import hudson.EnvVars;
> import hudson.Extension;
> import hudson.model.EnvironmentContributor;
> import hudson.model.TaskListener;
> import hudson.model.Run;
>
> import java.io.IOException;
>
> @Extension
> public class ThrottleAddEnvVar extends EnvironmentContributor {
> // This class is for adding the environmental variable containing the 
> assigned labels
>  @Override
> public void buildEnvironmentFor(Run r, EnvVars envs, TaskListener 
> listener) throws IOException, InterruptedException {
> ThrottleQueueTaskDispatcher.writeMessage("Running buildEnvironmentFor()!");
>  //Put together category-labels string 
> String labelEnvVar = "category1|label1<>category2|label2"; // String 
> storing the LABELS environmental variable. Form is: 
> category1|label1<>category2|label2<>...
>                 envs.put("LABELS", labelEnvVar);
>         }
> }
>
> but this does not do anything at all. In fact, 
> the ThrottleQueueTaskDispatcher.writeMessage() call is never made so 
> buildEnvironmentFor() is simply never executed. When is this function 
> supposed to be called?
> I've been noticing more often that having a class have @Extension does not 
> mean it is picked up. What else, besides what is above, would be necessary? 
> This generalizes to other extension points such as Builders and such.
>
> Help will be greatly appreciated!
> Thomas
>

Reply via email to