Is there a way to change the repository URL of a Hudson job using the Hudson CLI API?
There is no way to change the repository URL using the Hudson CLI. However there is a workaround that can be automated with little effort.
Workaround:
We can use cURL to download the config.xml of the job using the following command (note that in order to run cURL commands you have to setup cURL):
curl -X GET http://your-hudson-server/job/TheNameOfTheJob/config.xml -o localCopy.xml
The configuration file will contain something similar to this (depending on the Version Control used):
<scm-property>
<originalValue class="hudson.scm.SubversionSCM">
<locations>
<hudson.scm.SubversionSCM_-ModuleLocation>
<remote>https://your-repository</remote>
The value of the <remote>
tag is the repository url (also check the credentials for the new repository).
There are several cURL ways to submit the modified version of config.xml back on the server. One way is:
curl -X POST http://your-hudson-server/job/TheNameOfTheJob/config.xml --data-binary "@newconfig.xml"