repos
Creates, updates, deletes, gets or lists a repos resource.
Overview
| Name | repos |
| Type | Resource |
| Id | databricks_workspace.workspace.repos |
Fields
The following fields are returned by SELECT queries:
- get
- list
| Name | Datatype | Description |
|---|---|---|
id | integer | ID of the Git folder (repo) object in the workspace. |
head_commit_id | string | SHA-1 hash representing the commit ID of the current HEAD of the repo. |
branch | string | |
path | string | Path of the Git folder (repo) in the workspace. |
provider | string | Git provider of the linked Git repository. |
sparse_checkout | object | Sparse checkout settings for the Git folder (repo). |
url | string | URL of the linked Git repository. |
| Name | Datatype | Description |
|---|---|---|
id | integer | Id of the git folder (repo) in the Workspace. |
head_commit_id | string | Current git commit id of the git folder (repo). |
branch | string | Name of the current git branch of the git folder (repo). |
path | string | Root path of the git folder (repo) in the Workspace. |
provider | string | Git provider of the remote git repository, e.g. `gitHub`. |
sparse_checkout | object | Sparse checkout config for the git folder (repo). |
url | string | URL of the remote git repository. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | repo_id, deployment_name | Returns the repo with the given repo ID. | |
list | select | deployment_name | next_page_token, path_prefix | Returns repos that the calling user has Manage permissions on. Use next_page_token to iterate |
create | insert | deployment_name, url, provider | Creates a repo in the workspace and links it to the remote Git repo specified. Note that repos created | |
update | update | repo_id, deployment_name | Updates the repo to a different branch or tag, or updates the repo to the latest commit on the same | |
delete | delete | repo_id, deployment_name | Deletes the specified repo. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
deployment_name | string | The Databricks Workspace Deployment Name (default: dbc-abcd0123-a1bc) |
repo_id | integer | The ID for the corresponding repo to delete. |
next_page_token | string | Token used to get the next page of results. If not specified, returns the first page of results as well as a next page token if there are more results. |
path_prefix | string | Filters repos that have paths starting with the given path prefix. If not provided or when provided an effectively empty prefix (/ or /Workspace) Git folders (repos) from /Workspace/Repos will be served. |
SELECT examples
- get
- list
Returns the repo with the given repo ID.
SELECT
id,
head_commit_id,
branch,
path,
provider,
sparse_checkout,
url
FROM databricks_workspace.workspace.repos
WHERE repo_id = '{{ repo_id }}' -- required
AND deployment_name = '{{ deployment_name }}' -- required
;
Returns repos that the calling user has Manage permissions on. Use next_page_token to iterate
SELECT
id,
head_commit_id,
branch,
path,
provider,
sparse_checkout,
url
FROM databricks_workspace.workspace.repos
WHERE deployment_name = '{{ deployment_name }}' -- required
AND next_page_token = '{{ next_page_token }}'
AND path_prefix = '{{ path_prefix }}'
;
INSERT examples
- create
- Manifest
Creates a repo in the workspace and links it to the remote Git repo specified. Note that repos created
INSERT INTO databricks_workspace.workspace.repos (
url,
provider,
path,
sparse_checkout,
deployment_name
)
SELECT
'{{ url }}' /* required */,
'{{ provider }}' /* required */,
'{{ path }}',
'{{ sparse_checkout }}',
'{{ deployment_name }}'
RETURNING
id,
head_commit_id,
branch,
path,
provider,
sparse_checkout,
url
;
# Description fields are for documentation purposes
- name: repos
props:
- name: deployment_name
value: "{{ deployment_name }}"
description: Required parameter for the repos resource.
- name: url
value: "{{ url }}"
description: |
URL of the Git repository to be linked.
- name: provider
value: "{{ provider }}"
description: |
Git provider. This field is case-insensitive. The available Git providers are `gitHub`, `bitbucketCloud`, `gitLab`, `azureDevOpsServices`, `gitHubEnterprise`, `bitbucketServer`, `gitLabEnterpriseEdition` and `awsCodeCommit`.
- name: path
value: "{{ path }}"
description: |
Desired path for the repo in the workspace. Almost any path in the workspace can be chosen. If repo is created in `/Repos`, path must be in the format `/Repos/{folder}/{repo-name}`.
- name: sparse_checkout
description: |
If specified, the repo will be created with sparse checkout enabled. You cannot enable/disable sparse checkout after the repo is created.
value:
patterns:
- "{{ patterns }}"
UPDATE examples
- update
Updates the repo to a different branch or tag, or updates the repo to the latest commit on the same
UPDATE databricks_workspace.workspace.repos
SET
branch = '{{ branch }}',
sparse_checkout = '{{ sparse_checkout }}',
tag = '{{ tag }}'
WHERE
repo_id = '{{ repo_id }}' --required
AND deployment_name = '{{ deployment_name }}' --required;
DELETE examples
- delete
Deletes the specified repo.
DELETE FROM databricks_workspace.workspace.repos
WHERE repo_id = '{{ repo_id }}' --required
AND deployment_name = '{{ deployment_name }}' --required
;