Being able to clone a Space and use all of it's data, for testing purposes or any other reason, can have great value. However not every user can just clone any Space. In the section below we show what rules determine whether you can, then later on we will show what will be cloned from one Space to another.
Rules for cloning a space
When we want to clone a Space, you need to fulfil certain rules. Since we don't want anyone who doesn't have access to a Space to clone it and gain access this way, the first rule is access. The access comes in 2 forms; User access and Domain access (more information about domains can be found here: Domains).
- The User needs to be part of a Domain
- The Space has needs to have given access to a Domain, the Users within the Domain will then need Write access to the space.
The next part of the restrictions are access to the User and Spaces menu, to see and use this menu, a user will need administration rights. For more information on user administration please see our guide here.
Note that when the User is part of a User Group, these project specific and global rights can be assigned to the user group as well. In this case it will also have all the rights and to clone the Space.
How do I clone a space?
To clone a space, go to the Users and Spaces menu located on the taskbar on the left and click the submenu 'All spaces' This will take you to a list of all the spaces present on an environment. If the user has the correct rights (as explained above in the rules section), pressing the three dot menu on the right of the screen for the space they want to clone will bring up a menu as shown below:
Pressing the clone option in the menu will take you to a new page:
Here you have the option to give the cloned space a different name, the option to make the clone a public space and custom identifier in their respective field. It will also show the identifier of the space toy are cloning in the Space id field.
There are also 3 options when cloning a space that can be selected.
Clone data: Will clone any data present on the space being cloned, including any data that is stored in the config branch (like views and forms)
Clone files: Will clone any files stored for the space being cloned, including previously uploaded files using pipelines.
Clone pipelines config: Will clone all tasks present on the space being cloned, including their configured schedules. NOTE: If any of these tasks are using files, the clone files will also need to be checked in order for the task to work.
Once done, press the green Clone button and the space will be cloned, depending on the size of the space this will take some time, but once the cloning is done you will be taken to the page of the new space. Here you will have to assign a domain and user permissions in the same way you need to do for all new spaces.
What will be cloned?
Next up, it is important to note what will be cloned. And the basic answer is 'everything!'. By default all options are checked when cloning.
- Space settings are available as data in the $config branch and are cloned
- This includes views, services and forms
- Space data is cloned
- Branches are cloned
- Commits are derived data and therefor not cloned, but the information is still available
- Merge requests are cloned (part of the $config branch)
- Previously used files are cloned
- Pipelines configurations are cloned