Issue Type: Improvement Improvement
Affects Versions: current
Assignee: kutzi
Components: instant-messaging, jabber
Created: 26/Jul/13 1:33 PM
Description:

I tried to set up a Jabber notification that will be sent to $BUILD_USER_ID (environment variable that is set by another plugin), so the user who started the build will be notified when it is done. However the environment variables in the list of notification recipients does not resolve environment variables, so it tried to sent to user named literally "$BUILD_USER_ID" on the jabber server (not the intended recipient...)

It would be nice if environment variables would be resolved in the list of people to notify, to enable notification to recipient addresses calculated by some other plugin.

Following quick hack does what I need to do, but it is not a clean solution, and because of the storage format (plugin stores notification targets internally not as a string from configuration, but as a list of validated jabber IDs) it will be hard to change this cleanly and correctly - since environment variable may or may not contain complete username and may or may not contain more space separated targets, it would probably be necessary to store the target settings as a literal string, converting it to resolved list at end of the build once all the env vars are known and available (and not at time when configuration is saved).

--------------- src/main/java/hudson/plugins/im/IMPublisher.java ---------------
index 6fb5065..2a49a63 100644
@@ -582,6 +582,9 @@ public abstract class IMPublisher extends Notifier implements BuildStep, MatrixA
 		{
 		    try {
                         log(buildListener, "Sending notification to: " + target.toString());
+                        target = getIMDescriptor().getIMMessageTargetConverter().fromString(
+                                build.getEnvironment(buildListener).expand(target.toString()));
+                        log(buildListener, "(expanded) Sending notification to: " + target.toString());
 		        sendNotification(msg, target, buildListener);
 		    } catch (final Throwable t) {
 		        log(buildListener, "There was an error sending notification to: " + target.toString() + "\n" + ExceptionHelper.dump(t));
Project: Jenkins
Priority: Major Major
Reporter: Martin Peticek
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira

--
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply via email to