KBEC-00195 - Procedure to export all projects

Article ID:360033192791
1 minute readKnowledge base
On this page

Summary

Is there a way to export and import multiple objects?

Solution

Full import/export is more properly designated for the backup/restore type of operation. There is no way to exclude pieces, either on export or import, although this is possible with a script that iterates over all projects (or at least all that are not part of CloudBees CD (CloudBees Flow) and/or plugins) and export each one of them. Then you can import them into the other system.

The procedure for exporting individual projects is attached.

Notes regarding the procedure:

  • This procedure should work for Commander 5.x and CloudBees CD (CloudBees Flow) 6.x and above.

  • By default, this procedure imports itself into a project called "EA Testing".
    You need to either create this project (if it does not exist) or provide an import path such as
    ectool import export_procedure_Export\ All\ Projects.xml --path /projects/<projectName >/procedure/<procedureName >
    (again, <projectName> is the name of an existing project).

  • This procedure has three steps:

    • create a list of all projects and store it in a property

    • export the procedure itself (for convenience)

    • export projects into the job’s workspace

Review the code to see if you need to adjust anything (for example, project filters in the first step).

This article is part of our Knowledge Base and is provided for guidance-based purposes only. The solutions or workarounds described here are not officially supported by CloudBees and may not be applicable in all environments. Use at your own discretion, and test changes in a safe environment before applying them to production systems.