Environment
-
CloudBees CI (CloudBees Core) on modern cloud platforms - Managed controller
-
CloudBees CI (CloudBees Core) on modern cloud platforms - Operations Center
-
CloudBees CI (CloudBees Core) on traditional platforms - Client controller
-
CloudBees CI (CloudBees Core) on traditional platforms - Operations Center
-
CloudBees Jenkins Enterprise
-
CloudBees Jenkins Enterprise - Managed controller
-
CloudBees Jenkins Enterprise - Operations center
Resolution
If using CJOC
If your controller is connected to a CJOC instance, then the simplest solution might be to use the Move / Copy / Promote functionality provided by CJOC.
See Moving, Copying, or Promoting Items Using the Jenkins CLI for how to execute these operations remotely.
NOTE:: This approach allows you the option to also move build history.
If not using CJOC
There doesn’t appear to be a move operation, so the simplest solution might be to use a combination of copy and then delete operations to simulate a move operation.
NOTE: This approach will move the job config only. It does not move build history or build artifacts.
Example (using cURL)
The root URL for this instance is https://localhost:8080
.
The admin username and API token for this instance is admin:token
.
1) Copy job
-
Example that copies job
example-job
to a new job namedmoved-example-job
on the same controller location.curl -s -XPOST 'https://localhost:8080/createItem?name=moved-example-job&mode=copy&from=example-job' -u admin:token -H "$CRUMB" -H "Content-Type:text/xml"
-
Example that copies job
example-job
from folderfolder
to a new job namedmoved-example-job
on thefolder2
folder.curl -s -XPOST 'https://localhost:8080/job/folder2/createItem?name=moved-example-job&mode=copy&from=folder/example-job' -u admin:token -H "$CRUMB" -H "Content-Type:text/xml"
Jobs created though the REST API are subjected to migration by the RunIdMigrator on the next Jenkins startup. Please have a look at Jenkins Startup logs show RunIdMigrator logs.
|