1

My work flow is Developer creates a feature branch from main in Databricks repos -> after they make changes on it -> they raise a pull request for merge into main in azure devops-> it triggers the CICD pipeline push the code into the destination branch with changes.

In above process Am able to push the code from feature to feature branch but not into main because main don't have write permissions with CICD. Am confusing to how to achieve this. Below is my yaml pipeline. and also wanted to know, is there possible to update the code into feature branch from main. My target is to update into main. then after move the code from main to feature with same pipeline.

- script: |
      pip install --upgrade databricks-cli
      displayName: 'Install dependencies'

- script: |
      echo "Checking out the $(branchName) branch"
      databricks repos update --path $(Production) --branch $(branchName)
  env:
    DATABRICKS_HOST: $(databricks-url)
    DATABRICKS_TOKEN: $(databricks-pat)
  displayName: 'Update Staging project'

An also I tried to create repos in databricks repos api on higher level folders prod/staging, but this one also failed and throwing error:

Generating script.
Script contents: shell
databricks repos create --url https://harish.alagandula@royhill.com.au:***@dev.azure.com/royhill/Enterprise%20Data%20Platform/_git/EDP_Core --provider azureDevOpsServices --path /Repos/Staged/testrepo
========================== Starting Command Output ===========================
"C:\Windows\system32\cmd.exe" /D /E:ON /V:OFF /S /C "CALL "C:\agents\_work\_temp\7554fb9a-2bb8-4c75-98c3-a4d9819e4420.cmd""
Error: b'{"error_code":"BAD_REQUEST","message":"Remote repo not found. Please ensure that:\\n1. Your remote Git repo URL is valid.\\n2. Your personal access token or app password has the correct repo access."}'
##[error]Cmd.exe exited with code '1'.
Finishing: Update Production project

Below are the commands I tried create repos on Databricks repos API with cicd pipeline

- task: UsePythonVersion@0
  displayName: Configuring Python Version
  inputs:
     versionSpec: '3.9'
     addToPath: true
     architecture: 'x64'

- script: |
     pip install --upgrade databricks-cli
  displayName: 'Install dependencies'

- script: |
    databricks repos create --url https://$(userName):$(devOpsPat)@dev.azure.com/<org>/<projectname>/_git/<reponame> --provider azureDevOpsServices --path /Repos/Staged/reponame
  env:
    DATABRICKS_HOST: $(databricks-url)
    DATABRICKS_TOKEN: $(databricks-pat)
  displayName: 'Update Production project'

Even I tried below command also, but I am getting the same error.

databricks repos create --url https://github.com/<github_profile>/glow 
   --provider gitHub --path /Repos/Production/<reponame>

Please some one help me to sort out these two issues.

Alex Ott
  • 80,552
  • 8
  • 87
  • 132
Harish334363
  • 65
  • 10
  • error message doesn't match to the YAML that you use `databricks repos update` – Alex Ott May 01 '22 at 09:02
  • Have you tried to follow instructions here: https://github.com/alexott/databricks-nutter-repos-demo – Alex Ott May 01 '22 at 09:03
  • Am following the same github url for push the files into main. As I mentioned above I need to update the code into production under main branch. But I have only read permission, so am unable to write on main branch directly with cicd pipeline. And the error I shared is create repos on production by using databricks repos create - url repourl - path. Pls help me on this. I followed your github nutter repos. – Harish334363 May 01 '22 at 17:03
  • My tsk is to push the code into main branch under production repos. That what am not able to achieve. Even create repos is also not working with databricks repos create command as I share the error. Pls help me – Harish334363 May 01 '22 at 17:13
  • Maybe you don't have permissions to push into production environment? Without that you can't do anything – Alex Ott May 01 '22 at 17:15

0 Answers0