You can bootstrap your teams' Git-based projects by copying a Git-based project "template." By sharing and copying Git-based projects, you can achieve better outcomes and more reliable results through these benefits:
-
Increased consistency between projects
-
Faster project setup
-
Better adherence to best practices
-
Stronger collaboration
In your Git-based project, you can organize your repository and your project to follow best practices for your field. Every team member can start on a new project by making a copy of that project.
When you copy a Git-based project, certain configurations and materials are copied to the new Project while others are not:
Copied | Not copied | |
---|---|---|
Project overview | Tags, description, tasks, and README | Entity links to tasks (Workspaces, Jobs, Apps, Domino endpoints, files) |
Project materials | Files, artifacts, code, datasets and imported Git repository, imported projects | External data sources, audit data, run history, discussion history |
Project settings | Environment variables, hardware tier, environment, results, exports, integrations, and visibility (public, searchable, private) , Project task stages | Access and sharing |
Other | Published applications, Domino endpoints, and Launchers |
Note
|
Datasets can only be copied to a new project through the Domino API with the parameter copyDatasets:true . See the code examples below.
|
To support different needs, Git-based projects support two modes of copy: reference copy and deep copy.
- Deep copy
-
This creates an independent copy of the original repository. Use this when building a brand new project from an existing project. You can create a deep copy using the Domino UI or the API.
- Reference copy
-
All the changes in one project are reflected in all the referenced projects. Use this when multiple parallel projects rely on the same main Git repository. For example, this is a common scenario for statistical analysis in the pharmaceutical field. You can only create a reference copy using the Domino API.
Using the Domino UI or the API, you can create a deep copy of any Git-based project. This creates a copy of the original repository that you can modify independently.
Deep copy using the Domino API
import requests
project_id = 'asdf1234'
code_repo_credential_id = 'asdf123'
domino_project_name = 'my_new_project'
shared_repo_url = 'https://github.com/user/repo.git'
url = f'https://host.com/api/projects/v1/projects/{project_id}/copy-project'
body = {
'name': domino_project_name,
'visibility': 'private',
'copyDatasets': true,
'gitCodeRepoSpec': {
'credentialId': code_repo_credential_id,
'deepCopy': {
'visibility': 'private',
'newRepoName': 'new_git_repo',
'newRepoOwnerName': 'git_user'
}
}
}
requests.post(url, data=body)
When you create a reference copy, all the changes in one project are reflected in all the referenced projects. Use this when multiple parallel projects rely on the same main Git repository.
The Python example below illustrates how you can automatically create a reference copy of a project using the Domino API.
import requests
project_id = 'asdf1234'
code_repo_credential_id = 'asdf123'
domino_project_name = 'my_new_project'
shared_repo_url = 'https://github.com/user/repo.git'
url = f'https://host.com/api/projects/v1/projects/{project_id}/copy-project'
body = {
'name': domino_project_name,
'visibility': 'private',
'copyDatasets': true,
'gitCodeRepoSpec': {
'credentialId': code_repo_credential_id,
'referenceCopy': {
'mainRepoUrl': shared_repo_url
}
}
}
requests.post(url, data=body)
java.lang.RuntimeException: One or more of the datasets in this project are already being copied elsewhere. Please wait for them to copy and then try again.
When you copy a dataset from one project to another, it is locked in a “copying” state until the copying operation finishes. To maintain the integrity of the dataset, it cannot be copied anywhere else while in this state.
If you receive the error above, your new project was not created.
Wait for the datasets to finish copying into the previous project and then try again with the same API call.
The error can occur if the dataset is already being copied into a different project, or if you try to copy the same project several times in a short interval with copyDatasets=true
.
-
Only GitHub, GitHub Enterprise, GitLab, and GitLab Enterprise are supported providers. Other providers such as Bitbucket are not supported.
-
SSH credentials are not supported. You must use a Personal Access Token with repository read and write permissions enabled.
-
In order to copy a Git-based project, the GitHub repository you want to copy must be a template repository:
Collaborators on the parent project are not copied to the new dataset or project.