databricksdatabricks-repos

How to checkout a specific repo tag?


I've created a repo in Databricks. I would like to work on a specific tagged version of the repo, however, I can't see options in the UI to specify the branch.

Next I created a notebook and attempted to run

%sh git tag
fatal: not a git repository (or any parent up to mount point /)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

Is it possible to switch to a tag, if so how?


Solution

  • You can check out a specific tag with Databricks CLI:

    $ databricks repos create --url https://github.com/databricks-academy/data-engineering-with-databricks.git --path /Repos/u/Academy
    {
      "id": 3965682671931295,
      "path": "/Repos/u/Academy",
      "url": "https://github.com/databricks-academy/data-engineering-with-databricks.git",
      "provider": "gitHub",
      "branch": "published",
      "head_commit_id": "6c3b171726803c1bb7494ed592ae549dcafa1f81"
    }
    
    $ databricks repos update --repo-id 3965682671931295 --tag v2.2.2
    {
      "id": 3965682671931295,
      "url": "https://github.com/databricks-academy/data-engineering-with-databricks.git",
      "provider": "gitHub",
      "head_commit_id": "619532eddf7d2cce8f48772afc8d69797036890c"
    }