Skip to content

Commit dddb1f6

Browse files
authored
Add Databricks CLI v0.286.0 as a nix module (CLOUD-3765) (#477)
2 parents 4110eba + f02ea59 commit dddb1f6

3 files changed

Lines changed: 103 additions & 1 deletion

File tree

flake.nix

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,10 @@
3131
fenix.overlays.default
3232
replit-rtld-loader.overlays.default
3333
];
34-
# replbox has an unfree license
34+
# replbox and databricks-cli have unfree licenses
3535
config.allowUnfreePredicate = pkg: builtins.elem (nixpkgs.lib.getName pkg) [
3636
"@replit/replbox"
37+
"databricks-cli"
3738
];
3839
};
3940

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
{ pkgs, lib, ... }:
2+
3+
let
4+
version = "0.286.0";
5+
databricks-cli = pkgs.buildGoModule {
6+
pname = "databricks-cli";
7+
inherit version;
8+
9+
src = pkgs.fetchFromGitHub {
10+
owner = "databricks";
11+
repo = "cli";
12+
rev = "v${version}";
13+
hash = "sha256-iCmxHjIYznqed6BMQKtuYHJNFPy+3XrNzSXfhtyzPJk=";
14+
};
15+
16+
vendorHash = "sha256-TNUI2VQVKnxTiKQg9Bj3qDK2w3oOjO0rdrtTlFIhTzA=";
17+
18+
excludedPackages = [
19+
"bundle/internal"
20+
"acceptance"
21+
"integration"
22+
"tools/testrunner"
23+
"tools/testmask"
24+
];
25+
26+
postPatch = ''
27+
substituteInPlace bundle/deploy/terraform/init_test.go \
28+
--replace-fail "cli/0.0.0-dev" "cli/${version}"
29+
'';
30+
31+
ldflags = [
32+
"-X github.com/databricks/cli/internal/build.buildVersion=${version}"
33+
];
34+
35+
postBuild = ''
36+
mv "$GOPATH/bin/cli" "$GOPATH/bin/databricks"
37+
'';
38+
39+
checkFlags =
40+
"-skip="
41+
+ (lib.concatStringsSep "|" [
42+
# Need network
43+
"TestConsistentDatabricksSdkVersion"
44+
"TestTerraformArchiveChecksums"
45+
"TestExpandPipelineGlobPaths"
46+
"TestRelativePathTranslationDefault"
47+
"TestRelativePathTranslationOverride"
48+
"TestWorkspaceVerifyProfileForHost"
49+
"TestWorkspaceVerifyProfileForHost/default_config_file_with_match"
50+
"TestWorkspaceResolveProfileFromHost"
51+
"TestWorkspaceResolveProfileFromHost/no_config_file"
52+
"TestBundleConfigureDefault"
53+
# Use uv venv which doesn't work with nix
54+
# https://github.com/astral-sh/uv/issues/4450
55+
"TestVenvSuccess"
56+
"TestPatchWheel"
57+
# Fails in nix sandbox due to missing home/cache directory
58+
"TestCacheDirEnvVar"
59+
]);
60+
61+
nativeCheckInputs = [
62+
pkgs.gitMinimal
63+
(pkgs.python3.withPackages (
64+
ps: with ps; [
65+
setuptools
66+
wheel
67+
]
68+
))
69+
];
70+
71+
preCheck = ''
72+
# Some tests depend on git and remote url
73+
git init
74+
git remote add origin https://github.com/databricks/cli.git
75+
'';
76+
77+
meta = {
78+
description = "Databricks CLI";
79+
mainProgram = "databricks";
80+
homepage = "https://github.com/databricks/cli";
81+
changelog = "https://github.com/databricks/cli/releases/tag/v${version}";
82+
license = lib.licenses.databricks;
83+
};
84+
};
85+
in
86+
{
87+
id = "databricks-cli";
88+
name = "Databricks CLI";
89+
description = ''
90+
The Databricks CLI is a command-line tool for interacting with
91+
Databricks. It provides commands to manage Databricks resources
92+
such as workspaces, jobs, clusters, libraries, and Databricks
93+
apps from the command line.
94+
'';
95+
displayVersion = version;
96+
97+
replit.packages = [
98+
databricks-cli
99+
];
100+
}

pkgs/modules/default.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ let
158158
})
159159
(import ./replit-rtld-loader)
160160
(import ./graphite-cli)
161+
(import ./databricks-cli)
161162
];
162163

163164
activeModules = listToAttrs (

0 commit comments

Comments
 (0)