Export items from or import items into the repository
repository object in the Deploy command-line interface (CLI) allows you to export the Deploy repository tree to a ZIP file that can be imported into the same Deploy server or into another Deploy server. The ZIP file contains all configuration item (CI) properties, including artifact files.
For example, you can use this feature to create CIs in a sandbox or test instance of Deploy, and then import them into a production Deploy instance.
Administrative permissions are required to perform repository export or import. You can monitor the server log files to see the progress.
repository object exports the current versions of the CIs that are stored in the Deploy repository; for example, applications, environments, infrastructure CIs such as hosts and servers, and configuration CIs such as triggers and deployment pipelines. This includes artifact files in deployment packages.
It does not export previous versions of CIs. It also does not export Deploy items that are not CIs, such as user roles, global permissions, CI-level permissions, deployment tasks, and so on.
To export all CIs in the repository, use
None as the argument:
To export the CIs under an internal root (
Configuration), specify the root:
For example, this command will export all applications to a ZIP file called
deployit> fileName = repository.exportCisAndWait('Applications')
Important: During the export process, do not change the repository items that are being exported. Doing so may interrupt the export or corrupt the output.
Exporting large number of configuration items can take a long time, so it is recommended to do it when no deployments are running.
The export process is a task, so you can control it using the same objects you use for a deployment. For example, if you want to have more control over the export task:
taskId = repository.exportCis('Applications') task2.start(taskId) print(str(task2.get(taskId).state)) deployit.waitForTask(taskId)
To import previously exported content, use either:
taskId = repository.importCis(fileName) task2.start(taskId) print(str(task2.get(taskId).state)) deployit.waitForTask(taskId)
The content of the exported location will be removed before import. For example, if you export a directory called
Applications/myApps, then this directory will be removed before the archive is imported. If you exported the whole repository by passing
/ as a root ID, then all CIs except the internal roots (
Configuration) will be removed from the repository.