views:

102

answers:

2

hi,

i'm curious how other people do this task. Let's say you have like 100+ projects and each project has configured some users to be notified when the status changes. Now you have to add a new e-mail to this list. The hard way is to go into every project and add it by hand. That's how i do it atm (of course there are no 100+ projects atm). Is there any better way ? I know there is a configuration slicing plugin but last time i checked it didn't cover the e-mail list.

kukudas

+3  A: 

How about just having a distribution list in your email system and then you can add the new address to that?

Though if you need to do it the hard way, then I'd recommend pointing sed at the XML config file for each job.

Christopher
thx for your response, the first suggestion actually would solve my problem, should thought about that myself :). What do you mean with "sed" ?
kukudas
Ah, `sed` is a "stream editor" that lets you easily search and replace text within files -- it's generally available on any Linux system. http://www.gnu.org/software/sed/
Christopher
+1  A: 

As Christopher mentions, Hudson stores all of it's data on disk which means that you can easily edit the configuration of any and all jobs on disk and tell Hudson to then reload the configuration from disk.

A couple of months ago I needed to change a few dozens jobs to email one distribution list instead of another (really, distribution lists are the answer here, I can't imagine editing the configuration files for each new address), and here is the sed command I used:

#from $HUDSON_HOME directory
for i in `ls */config.xml`; do sed -i.bak 's/oldlist@/newlist@/' $i; done

The -i switch means "edit files in place" and adding a suffix to it (.bak) tells sed to make a backup of the original file first (in files that end with the suffix .bak).

If you wanted to instead add a new email address to a list of existing email addresses, you'd have to adjust your sed command to search for whatever string in the config.xml file you are hoping to match.

After this, login to the hudson management console and tell it to reload configuration info.

matt b