Run Scala/SBT via Databricks Connect from Azure Pipelines

 1- task: UsePythonVersion@0
 2  displayName: 'Use Python 3.7'
 3  inputs:
 4    versionSpec: 3.7
 5
 6- script: |
 7      pip install -U databricks-connect==7.3.8
 8  displayName: 'Install Databricks Connect'
 9
10- script: |
11      echo "y
12      <host>
13      <token>
14      <cluster_id>
15      <org_id>
16      <port>" | databricks-connect configure
17displayName: 'Configure DBConnect'
18
19# this is important - run dbc get-jar-dir, and set the value back to az pipeline variable
20- script: |
21      jd=`databricks-connect get-jar-dir`
22      echo "##vso[task.setvariable variable=dbcJarDir]$jd"
23  displayName: 'Get DBC Jar Dir'
24  
25# important - pass jar dir as env variable to SBT
26- task: CmdLine@2
27  inputs:
28    script: sbt run
29  env:
30    dbcJarDir: '$(dbcJarDir)'

And here is how SBT picks up DBC jar dir:

build.sbt:

1// ...
2
3// configure Databricks Connect
4val dbcJarDir = sys.env.getOrElse("dbcJarDir", "")
5unmanagedBase := new java.io.File(dbcJarDir)
6
7// ...

Have feedback or questions? Feel free to email me.