David I.
David I.

Reputation: 4767

Batch renaming of Hudson jobs

This question talks about batch renaming jobs in Hudson, but it only mentions modifying the config.xml file.

http://wiki.hudson-ci.org/display/HUDSON/Administering+Hudson says you can rename jobs by just renaming the directories they are in.

In my Hudson setup, I have many jobs tied together, and also use the Nested Views plugin which records the name of jobs in the master config.xml file.

It seems like the proper way to mass rename jobs is to rename the directory, then edit the master config.xml file, then the config.xml files in each job's directory. Is this right?

Upvotes: 3

Views: 597

Answers (2)

Chris B
Chris B

Reputation: 9259

Directly editing config.xml files should work fine. Alternatively you may want to use Hudson's remote API.

Using the remote API, renaming a job would be a 2-step process:

  1. Copy the job, using a POST to http://my-hudson-server/createItem?name=newJobName&mode=copy&from=oldJobName

  2. Delete the old job, using a POST to http://my-hudson-server/job/oldJobName/doDelete

Take a look at http://my-hudson-server/api for more detailed info on how to use the remote API.

Upvotes: 2

malenkiy_scot
malenkiy_scot

Reputation: 16615

Yes, this looks right.

Make sure Hudson is offline or "preparing for shutdown" and no affected jobs are running. Then restart or reload jobs from disk. An absolute must is to backup your configuration beforehand. A good idea is to create a copy of your configuration and test your changes there.

Upvotes: 1

Related Questions