The /api/rest/2.0/vcs/git/commits/deploy
endpoint imports the TML files from the last commit in a Git branch back into the ThoughtSpot Org the REST API command is used to, controlled by the bearer token of the REST API request.
You must specify the branch_name of the commits to deploy from. In the standard deployment patterns, the branch name should be the commit_branch_name
defined for the Org in the Git configuration, also called the environment branch.
In a single-tenanted deployment pattern, you might instead deploy to each end-customer Org from the "release" / "pre-prod" branch rather than deploy from the branch of the Orgβs environment. If you have any additional processes to run on the TML files prior to final deployment, it is preferable to merge changes to the environment branch and then deploy commits from the environment branch.
Because each Org in ThoughtSpot has distinct objects with their own GUIDs, the import process for objects originating from a different environment requires swapping in the correct GUIDs.
If you have enabled GUID mapping in the Git configuration on your deployment instance, the version control APIs automatically generate a GUID mapping file and update object references when deploying your commits to the destination environment.
See the GUID mapping documentation to understand how it works and the additional capabilities for handling other substitutions that may be necessary during deploying commits to the destination environment.
The example script in Python shows the pattern of deploying to "prod org per customer" from a single pre_prod/release
branch, to avoid the need for pull requests into each branch linked to an end customer Org.
Note
|
Parallel deployment to multiple organizations within a single cluster is not supported. Developers must run deployments to each organization sequentially.
|
Parameter | Description |
---|
commit_id
Optional
| String. ID of the commit to deploy on the cluster. By default, the command will deploy the head of the branch. To deploy a specific version, specify the commit_id . If your team uses tags or releases, supply the commit_id from Git associated with the release or tag. |
branch_name
| String. Name of the branch from which the commit must be picked for deployment. |
deploy_type
|
String. Specify one of the following options:
-
DELTA (default)
Deploys only the changes that were applied at the specified commit_id . For example, if three TML files were updated in the commit_id specified in the API request, only those changes will be deployed.
-
FULL
Deploys all the files in the Git branch, including the files from the commit_id specified in the request and all other files that were already committed.
|
deploy_policy
|
String. Action to apply when deploying a commit. The allowed values are:
-
ALL_OR_NONE (Default)
Deploys all changes or none. This option cancels the deployment of all ThoughtSpot objects if at least one of them fails to import.
-
PARTIAL
Deploys partial objects. This option imports the subset of ThoughtSpot objects that validate successfully even if other objects in the same deploy operations fail to import.
-
VALIDATE_ONLY
Runs validation to detect if your destination environment can import the changes without conflicts. Use this when the TML content is modified between source and destination environments and if you do not want the TML content in your destination branch to be modified after a pull request from your dev branch.
|
| |
curl -X POST \
--url 'https://{ThoughtSpot-Host}/api/rest/2.0/vcs/git/commits/deploy' \
-H 'Authorization: Bearer {Bearer_token}'\
-H 'Accept: application/json'\
-H 'Content-Type: application/json' \
--data-raw '{
"deploy_type": "DELTA",
"deploy_policy": "ALL_OR_NONE",
"commit_id": "afc0fea831558e30d7064ab019f49243b1f09552",
"branch_name": "main"
}'
If the API request is successful, the changes are applied to the objects in the prod
environment. A tracking file is generated in the Git branch used for storing configuration files. This file includes the commit_id
specified in the API request.
The subsequent API calls to deploy commits will consider the saved commit_id
and deploy_type
specified in the API request:
-
If deploy_type
is set as DELTA
, all the changes between the last tracked commit id
and the new commit_id
specified in the API request will be deployed to the destination environment or Org.
-
If the deploy_type
is FULL
, all the files from the commit_id
specified in the API request will be deployed. If any object or file is deleted in the commit specified in the API request, it will be deleted from the destination environment during deployment.