Execute git pull on databricks notebook using CLI and/or API - databricks

Using Databricks Repos, you can add a git repo to Databricks and execute git actions such as git pull. This is done by clicking on the branch name in the top left, and clicking the button saying "Pull".
I would like to do this without clicking on things in my browser.
What is the Databricks CLI syntax for triggering a git pull on a given repo?
What is the Databricks API endpoint for triggering a git pull on a given repo?
I would assume that both are possible (this answer implies so), but providing just one would be sufficient to answer my question.
One might wonder what I expect to happen if a pull is non-trivial, eg. the branches have diverged or "your unstaged changes would be wiped out by pulling...". Simply erroring out would be sufficient in this case. I intend to ensure that it will never happen through other mechanisms.

For databricks-cli it's the databricks repos update command:
>databricks repos update -h
Usage: databricks repos update [OPTIONS]
Checks out the repo to the given branch or tag. This call returns an error
if the branch or tag doesn't exist.
Options:
--repo-id TEXT Repo ID
--path TEXT Workspace path of the repo object
--branch TEXT Branch name
--tag TEXT Tag name
it will checkout branch even if repo is on the given branch:
databricks repos update --path /Repos/.... --branch releases
You can find the working demo of it in the following repository that shows integration of Repos with Azure DevOps.
For REST API, there is the corresponding endpoint. The only difference from CLI is that it accepts only Repository ID, not the path, but you can find Repos ID from path via Get Status endpoint of Workspace API. You can find an example in the history of the same demo repository (please note that Repos API could change since that time)

Related

Force init in Gitea when repo is created

When you create a repo in Gitea from the website you can mark "Initialize Repository (Adds .gitignore, License and README)", and when you create a repo in Gitea from the API you can set auto_init to true.
Is there any way to configure Gitea to force Initialize Repository for all repos no matter if they are created from the website or API and no matter what the user chose for this option?
In other words, I need to configure my Gitea to always initialize every repo that is created.

Azure DevOps Pipines - Git Respository local directory location

I have created a Pipeline in Azure DevOps and have associated a git repository.
It is cloned to my agent, but I can't get control over in which local directory the repository is cloned to. I am working with self hosted Agent.
The next task need to use a specific file in the repository to complete the task.
The last things tha should happen in the pipline, is push back changes made in the respository.
I think what you want is WorkingDirectory, the local path on the agent where your source code files are downloaded. For example: c:\agent_work\1\s

Azure DevOps: policy for branch creation

We want only some people to be able to create 'release/*' branch in Azure DevOps cloud(?) repo.
Unfortunately, I couldn’t find this option in UI.
I also couldn’t find it here
https://learn.microsoft.com/en-us/azure/devops/repos/git/branch-policies?view=azure-devops
and here
https://learn.microsoft.com/en-us/azure/devops/repos/git/branch-permissions?view=azure-devops
I tried to implement it with REST API but my attempts were unsuccessful.
I also didn’t find any extension which could help me with this.
I'm still looking for a solution.
There is not option in the UI to set the create branch permission for branches.
However, you can achieve this by runing tf git permission commands in Developer Command Prompt for Visual Studio to deny the permission to create branches under releases. See below example:
Below command will block the users in Contributors group creating branches under releases
tf git permission /deny:CreateBranch /group:[MyProject]\Contributors /collection:https://dev.azure.com/MyOrganiza/ /teamproject:MyProject /repository:myRepo /branch:releases
Check Git Permission Command for more information.

Azure devops cicd gitlab integration

I am using an external private gitlab repository for code and using azure-devops for cicd pipeline. When the user checks in code to the gitlab project repository azure-devops builds and releases. It names the build as CI BUILD. How can I get username and current changeset (name of the user who just checked in his code and his changeset files name) to show with build in azure-devops?
You can click on the build record of the CI trigger in the build pipeline.
The username of the changer and commit will be displayed at the top of the record. Click commit and you will be taken to the changed file.
In the sample ,I use the github repository for code ,I think the same is true with gitlab.

App Service Editor in Azure

The App Service Editor (Preview) in Azure
When I 'Initialize Git Repository', where is my git repository created? Is there a repository URL that I can use?
And if later, after finish changing my code, I want to export repository (e.g., get a copy to my local machine), how can I do that?
You can access the git repository through command line or via the URL given in your instance dashboard in properties
there should be a Git URL field there.

Resources