Manage VCS integrations

Manage VCS integrations and VCS mappings
Read time 2 minutesLast updated 8 hours ago

Prerequisites

To access and create VCS integrations or VCS mappings, make sure the app has the right access. Read more about managing Identity.

Create a VCS Integration

To create a new VCS integration, use the following method:
integration_creation = unity_cloud.models.VcsIntegrationCreation(name="my new integration",
                                                                 provider="PlasticSCM",
                                                                 server_host="your_server_url.com",
                                                                 auth_bearer_token="123456")

vcs_integration = unity_cloud.assets.create_vcs_integration(org_id="012345678912", integration_creation=integration_creation)

Retrieve a VCS Integration

To retrieve a previously created VCS integration, pass the organization ID and the VCS integration ID.
vcs_integration = unity_cloud.assets.get_vcs_integration(org_id="012345678912", vcs_integration_id="my_integration_id")

List VCS Integrations

To list all VCS integrations in an organization, you may specify optional parameters for pagination.
vcs_integrations = unity_cloud.assets.list_vcs_integrations(org_id="012345678912", limit_to=100, skip=0 )
Note that the
limit_to
and
skip
parameters are optional and setting them to 0 will return all results.

Update a VCS Integration

To update an existing VCS integration, provide the updated information, organization ID, and integration ID.
integration_update = unity_cloud.models.VcsIntegrationUpdate(name="my new integration",
                                                                 provider="PlasticSCM",
                                                                 server_host="your_server_url.com",
                                                                 auth_bearer_token="123456")

vcs_integration = unity_cloud.assets.update_vcs_integration(org_id="012345678912",
                                                                  integration_creation=integration_update,
                                                                  vcs_integration_id="my_integration_to_update_id")

Delete a VCS Integration

To delete a VCS integration, provide the organization ID and integration ID.
delete_success = unity_cloud.assets.delete_vcs_integration(org_id="012345678912", vcs_integration_id="my_integration_id")

List VCS Integration Repositories

To list repositories associated with a VCS integration:
repositories = unity_cloud.assets.list_vcs_integration_repositories(org_id="012345678912",
vcs_integration_id="my_integration_id",
limit_to=100, skip=0)
Note that the
limit_to
and
skip
parameters are optional and setting them to 0 will return all results.

List Repository Branches

To list branches of a repository in a VCS integration:
branches = unity_cloud.assets.list_repository_branches(org_id="012345678912",
vcs_integration_id="my_integration_id",
repository_name="my_repository_name",
limit_to=100, skip=0)
Note that the
limit_to
and
skip
parameters are optional and setting them to 0 will return all results.

List Branch Folders

To retrieve folders from a specific branch in a repository:
folders = unity_cloud.assets.list_branch_folders(org_id="012345678912",
vcs_integration_id="my_integration_id",
repository_name="my_repository_name",
branch_name="my_branch_name",
file_path="my/folder/path",
limit_to=100, skip=0)
Leave the
file_path
parameter empty to list the root folder. Note that the
limit_to
and
skip
parameters are optional and setting them to 0 will return all results.

Create a VCS Mapping

To create a mapping between a VCS repository and a project, you must first have a created asset and a VCS integration, and then use the following method::
vcs_mapping_creation = unity_cloud.models.VcsMappingCreation(asset_id="my_asset_id",
                                                             asset_version="my_asset_version",
                                                             vcs_integration_id="my_integration_id",
                                                             repository_name="my_repository",
                                                             branch_name="my_branch",
                                                             filter_paths=["/"],
                                                             filter_extensions=[".fbx", ".png"],
                                                             filter_files=["file1", "file2"])


vcs_mapping = unity_cloud.assets.create_vcs_mapping(project_id="012345678912",
                                                              vcs_mapping_creation=vcs_mapping_creation)
Use the
filter_paths
,
filter_extensions
, and
filter_files
parameters to specify the files to include in the mapping.
filter_paths
is a list of paths to include in the mapping. Set to
["/"]
to include all paths.
filter_extensions
is a list of file extensions to include in the mapping. Leave empty to include all extensions.
filter_files
is a list of file along with their path to include in the mapping. Leave empty to include all files.

Update a VCS Mapping

To update an existing VCS mapping:
vcs_mapping_update = unity_cloud.models.VcsMappingUpdate(id="my_mapping_id",
                                                         project_id="012345678912",
                                                         filter_paths=["/"],
                                                         filter_extensions=[".fbx", ".png"],
                                                         filter_files=["file1", "file2"])


update_success = unity_cloud.assets.update_vcs_mapping(project_id="012345678912",
                                                              vcs_mapping_update=vcs_mapping_update)

Retrieve a VCS Mapping

To retrieve details of a VCS mapping:
vcs_mapping = unity_cloud.assets.get_vcs_integration(project_id="012345678912", vcs_mapping_id="my_mapping_id")