For job migration:
- You can get the list of jobs installed on {SOURCE_JENKINS_URL} using a REST call,
{SOURCE_JENKINS_URL}/view/All/api/json
- Then you can get each job config.xml file from the jobs on {SOURCE_JENKINS_URL} using the job URL
{SOURCE_JENKINS_URL}/job/{JOB_NAME}
. - Use this config.xml file to POST the content of the XML file on {DESTINATION_JENKINS_URL} and that will create a job on {DESTINATION_JENKINS_URL}.
For plugin migration:
- GET request:
{SOURCE_JENKINS_SERVER}/pluginManager/api/json?depth=1
will get you the list of plugins installed with their version. You can send a POST request with the following parameters to install these plugins.
final_url=`{DESTINATION_JENKINS_SERVER}/pluginManager/installNecessaryPlugins`
data=`<jenkins><install plugin="{PLUGIN_NAME}@latest"/></jenkins>` (where, latest will fetch the latest version of the plugin_name)
auth=`(destination_jenkins_username, destination_jenkins_password)`
header=`{crumb_field:crumb_value,"Content-Type":"application/xml”}` (where crumb_field=Jenkins-Crumb and get crumb value using API call {DESTINATION_JENKINS_SERVER}/crumbIssuer/api/json
No comments:
Post a Comment