Prerequisites:
- These operations are part of the Enterprise plan. On other plans, they fail with
PLAN_UPGRADE_REQUIRED. - An account API key with the
X-Paradime-Workspaceheader, or a workspace API key. - The Git repository admin capability group.
Operations
Read the repository and its deploy key
gitRepository shows how the workspace reaches its repository:
modeisSSH_DEPLOY_KEY,GITHUB_APP, orGITLAB_APP.statesays where the connection is:
githubAppInstallUrl is the page where a workspace member installs the Paradime GitHub App, in a browser. It is null when your account can’t connect through the GitHub App. See Pending user action.
Example response
Example response
deployKey makes the first one and adds an audit entry. Add the public key to the repository as a deploy key with write access, on your git provider, before you connect it.
Connect a repository with the deploy key
Set exactly one field ofconnection: deployKey, githubApp, or gitlabApp. With deployKey:
providerisGITHUB,GITLAB,BITBUCKET, orAZURE_DEVOPS.urimust be an SSH git URL,user@host:pathorssh://user@host/path, for examplegit@github.com:acme/analytics.git.dbtProjectDiris the folder inside the repository that holdsdbt_project.yml. Leave it out when the file is at the repository’s root.validateistrueby default: Paradime clones the repository in a job, checksdbt_project.yml, syncs production, and restarts the workspace’s editors. Withvalidate: false, Paradime only saves the repository asPENDING_VALIDATION, for example before someone adds the deploy key to it.forcereplaces a cloned repository with another one. Without it, connecting a different repository to a workspace that has a clone is aCONFLICT.
job that clones it. Poll the job with adminJob until its status is SUCCEEDED or FAILED. The job has a time limit of 5 minutes, and its result is a GitRepositoryConnectResult. If the job fails, failure.code tells you why:
job is null when nothing needed a clone: with validate: false, or when you send the same input again for a repository that is already cloned. Sending the same input again changes nothing and starts no job.
Connect a repository through the GitHub App or GitLab
The app connections finish before the mutation returns, so they start no job.githubAppconnects through the Paradime GitHub App. Send theinstallationIdof an installation your account holds and the numericrepositoryIdof the repository. Send neither to move the workspace’s current repository to the app. Install the app first: see Connect with the GitHub App.gitlabAppconnects through your account’s GitLab connection. Send the connection’sbaseUrland the numericprojectId, or neither to move the workspace’s current repository to the connection.
deployKey with the same uri and dbtProjectDir that the workspace has now.
Check that the deploy key can push
checkGitRepository checks, in a job, that the workspace’s deploy key can push to a repository. It changes nothing, so you can run it before you connect. The job has a time limit of 2 minutes. It fails with CONNECTION_TEST_FAILED when the key can’t push, and its result is a GitRepositoryCheckResult.
Rotate the deploy key
rotateGitDeployKey replaces the workspace’s deploy key and returns the new public key. Every call makes a new key.
Errors
These are the cases specific to git repositories. For the error format and the codes every area shares, see Errors.
The jobs report their own failures in
failure.code, as described in Connect a repository with the deploy key.
Related
- Python SDK: Git: the same operations in
paradime.admin.git. - Paradime CLI:
paradime admin:paradime admin gitshows the repository, connects it, checks it, and rotates the key. - Git repositories: the same settings in the app.
- Connect with the GitHub App: install the Paradime GitHub App.
- Administration API: Setup status: the
GIT_REPOSITORYandGITHUB_APPsteps.