|
1 | 1 | { pkgs, lib, ... }: |
2 | 2 |
|
3 | 3 | let |
4 | | - version = "0.286.0"; |
| 4 | + # Replit fork of databricks/cli. Adds --concurrency and --retry-timeout |
| 5 | + # flags to `databricks sync`. Based on upstream v0.299.0 + 51 commits. |
| 6 | + # Source: https://github.com/replit/databricks-cli |
| 7 | + upstreamVersion = "0.299.0"; |
| 8 | + rev = "d7dc3939c9eaa05464fa5f3dd13a8dceef4b9597"; |
| 9 | + version = "${upstreamVersion}-replit-${builtins.substring 0 8 rev}"; |
5 | 10 | databricks-cli = pkgs.buildGoModule { |
6 | 11 | pname = "databricks-cli"; |
7 | 12 | inherit version; |
8 | 13 |
|
9 | 14 | src = pkgs.fetchFromGitHub { |
10 | | - owner = "databricks"; |
11 | | - repo = "cli"; |
12 | | - rev = "v${version}"; |
13 | | - hash = "sha256-iCmxHjIYznqed6BMQKtuYHJNFPy+3XrNzSXfhtyzPJk="; |
| 15 | + owner = "replit"; |
| 16 | + repo = "databricks-cli"; |
| 17 | + inherit rev; |
| 18 | + hash = "sha256-mrsxKw9pIgP14SBQH4+OAGpBPfKINtVACXMR7qEhfLY="; |
14 | 19 | }; |
15 | 20 |
|
16 | | - vendorHash = "sha256-TNUI2VQVKnxTiKQg9Bj3qDK2w3oOjO0rdrtTlFIhTzA="; |
| 21 | + vendorHash = "sha256-IcKEzXfmReVCUzMyPC3Y2BRXWwGoB8Gdd3y5p6FtxI0="; |
17 | 22 |
|
18 | 23 | excludedPackages = [ |
19 | 24 | "bundle/internal" |
|
36 | 41 | mv "$GOPATH/bin/cli" "$GOPATH/bin/databricks" |
37 | 42 | ''; |
38 | 43 |
|
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 | | - ]); |
| 44 | + # Tests in v0.299.0 added a config-init host metadata resolver that makes |
| 45 | + # an HTTP call to /.well-known/databricks-config. Tests that pass fake |
| 46 | + # hosts (e.g. https://foo.test, https://www.host1.test) hang in the nix |
| 47 | + # sandbox until the 10-minute Go test timeout because DNS lookups fail |
| 48 | + # but the SDK retry layer keeps trying for 5 minutes. Skip whole packages |
| 49 | + # that exercise this path; the rest of the test suite still runs. |
| 50 | + checkPhase = '' |
| 51 | + runHook preCheck |
| 52 | +
|
| 53 | + # Tests excluded from the nix sandbox build: |
| 54 | + # - acceptance, integration, labs project, internal/build need a real |
| 55 | + # CLI binary or workspace; mirrored from upstream's nix package. |
| 56 | + # These are excluded as prefixes (entire trees). |
| 57 | + # - The exact packages listed below exercise the SDK's host-metadata |
| 58 | + # resolver (added in v0.299.0) with fake hosts (.test, etc.); the |
| 59 | + # resolver's HTTP retry loop hangs in the nix sandbox where DNS |
| 60 | + # lookups fail slowly, until the 10-minute Go test timeout fires. |
| 61 | + excludePrefixes='^github\.com/databricks/cli/(acceptance|integration|cmd/labs/project|internal/build)(/.*)?$' |
| 62 | + excludeExact='^github\.com/databricks/cli/(bundle|bundle/config|bundle/config/validate|bundle/configsync|bundle/deploy/terraform|bundle/run|cmd/api|cmd/apps|cmd/auth|cmd/experimental|cmd/root|experimental/postgres/cmd|libs/apps/prompt|libs/auth|libs/cmdctx|libs/databrickscfg|libs/databrickscfg/profile|libs/template|libs/workspaceurls)$' |
| 63 | +
|
| 64 | + pkgs=$(go list ./... | grep -Ev "$excludePrefixes" | grep -Ev "$excludeExact") |
| 65 | +
|
| 66 | + go test -p $NIX_BUILD_CORES \ |
| 67 | + -skip='TestVenvSuccess|TestPatchWheel|TestCacheDirEnvVar' \ |
| 68 | + $pkgs |
| 69 | +
|
| 70 | + runHook postCheck |
| 71 | + ''; |
60 | 72 |
|
61 | 73 | nativeCheckInputs = [ |
62 | 74 | pkgs.gitMinimal |
|
77 | 89 | meta = { |
78 | 90 | description = "Databricks CLI"; |
79 | 91 | mainProgram = "databricks"; |
80 | | - homepage = "https://github.com/databricks/cli"; |
81 | | - changelog = "https://github.com/databricks/cli/releases/tag/v${version}"; |
| 92 | + homepage = "https://github.com/replit/databricks-cli"; |
| 93 | + changelog = "https://github.com/databricks/cli/releases/tag/v${upstreamVersion}"; |
82 | 94 | license = lib.licenses.databricks; |
83 | 95 | }; |
84 | 96 | }; |
|
0 commit comments