Skip to content

Commit 62ee5d5

Browse files
authored
Merge branch 'main' into simonfaltum/auth-positional-profile
2 parents eff50c4 + 720e2af commit 62ee5d5

File tree

144 files changed

+5840
-453
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

144 files changed

+5840
-453
lines changed

.github/actions/setup-build-environment/action.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,12 @@ runs:
3434
with:
3535
version: "0.8.9"
3636

37+
- name: Install Python versions for tests
38+
run: make install-pythons
39+
shell: bash
40+
3741
- name: Install ruff (Python linter and formatter)
3842
uses: astral-sh/ruff-action@4919ec5cf1f49eff0871dbcea0da843445b837e6 # v3.6.1
3943
with:
4044
version: "0.9.1"
4145
args: "--version"
42-
43-
- name: Pull external libraries
44-
run: |
45-
go mod download
46-
pip3 install wheel==0.45.1
47-
shell: bash

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM alpine:3.22 as builder
1+
FROM alpine:3.22@sha256:55ae5d250caebc548793f321534bc6a8ef1d116f334f18f4ada1b2daad3251b2 as builder
22

33
RUN ["apk", "add", "jq"]
44
RUN ["apk", "add", "bash"]
@@ -13,7 +13,7 @@ ARG ARCH
1313
RUN /build/docker/setup.sh
1414

1515
# Start from a fresh base image, to remove any build artifacts and scripts.
16-
FROM alpine:3.22
16+
FROM alpine:3.22@sha256:55ae5d250caebc548793f321534bc6a8ef1d116f334f18f4ada1b2daad3251b2
1717

1818
ENV DATABRICKS_TF_EXEC_PATH "/app/bin/terraform"
1919
ENV DATABRICKS_TF_CLI_CONFIG_FILE "/app/config/config.tfrc"

Makefile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ links:
7070
checks: tidy ws links
7171

7272

73+
.PHONY: install-pythons
74+
install-pythons:
75+
uv python install 3.9 3.10 3.11 3.12 3.13
76+
7377
# Run short unit and acceptance tests (testing.Short() is true).
7478
.PHONY: test
7579
test: test-unit test-acc
@@ -173,15 +177,15 @@ docs:
173177
INTEGRATION = go run -modfile=tools/go.mod ./tools/testrunner/main.go ${GO_TOOL} gotestsum --format github-actions --rerun-fails --jsonfile output.json --packages "./acceptance ./integration/..." -- -parallel 4 -timeout=2h
174178

175179
.PHONY: integration
176-
integration:
180+
integration: install-pythons
177181
$(INTEGRATION)
178182

179183
.PHONY: integration-short
180-
integration-short:
184+
integration-short: install-pythons
181185
DATABRICKS_TEST_SKIPLOCAL=1 VERBOSE_TEST=1 $(INTEGRATION) -short
182186

183187
.PHONY: dbr-integration
184-
dbr-integration:
188+
dbr-integration: install-pythons
185189
DBR_ENABLED=true go test -v -timeout 4h -run TestDbrAcceptance$$ ./acceptance
186190

187191
# DBR acceptance tests - run on Databricks Runtime using serverless compute

NEXT_CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
* engine/direct: Fix 400 error when deploying grants with ALL_PRIVILEGES ([#4801](https://github.com/databricks/cli/pull/4801))
1313
* Deduplicate grant entries with duplicate principals or privileges during initialization ([#4801](https://github.com/databricks/cli/pull/4801))
1414
* engine/direct: Fix unwanted recreation of secret scopes when scope_backend_type is not set ([#4834](https://github.com/databricks/cli/pull/4834))
15+
* engine/direct: Fix bind and unbind for non-Terraform resources ([#4850](https://github.com/databricks/cli/pull/4850))
16+
* engine/direct: Fix deploying removed principals ([#4824](https://github.com/databricks/cli/pull/4824))
1517

1618
### Dependency updates
1719

acceptance/bin/gron.py

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/usr/bin/env python3
2+
import argparse
23
import json
34
import sys
45
from pathlib import Path
@@ -7,7 +8,7 @@
78
from print_requests import read_json_many
89

910

10-
def gron(obj, path="json"):
11+
def gron(obj, path="json", noindex=False):
1112
"""Flatten JSON into greppable assignments.
1213
1314
The path parameter defaults to "json" to match the original gron tool,
@@ -26,6 +27,10 @@ def gron(obj, path="json"):
2627
json.items[0] = "apple";
2728
json.items[1] = "banana";
2829
30+
>>> gron({"items": ["apple", "banana"]}, noindex=True)
31+
json.items[] = "apple";
32+
json.items[] = "banana";
33+
2934
>>> gron({"tasks": [{"libraries": [{"whl": "file.whl"}]}]})
3035
json.tasks[0].libraries[0].whl = "file.whl";
3136
@@ -38,31 +43,34 @@ def gron(obj, path="json"):
3843
print(f"{path} = {{}};")
3944
else:
4045
for key in obj:
41-
gron(obj[key], f"{path}.{key}")
46+
gron(obj[key], f"{path}.{key}", noindex=noindex)
4247
elif isinstance(obj, list):
4348
if not obj:
4449
print(f"{path} = [];")
4550
else:
4651
for i, item in enumerate(obj):
47-
gron(item, f"{path}[{i}]")
52+
index = "[]" if noindex else f"[{i}]"
53+
gron(item, f"{path}{index}", noindex=noindex)
4854
else:
4955
print(f"{path} = {json.dumps(obj)};")
5056

5157

5258
def main():
53-
if len(sys.argv) > 1:
54-
with open(sys.argv[1]) as f:
55-
content = f.read()
56-
data = read_json_many(content)
57-
if len(data) == 1:
58-
data = data[0]
59+
parser = argparse.ArgumentParser()
60+
parser.add_argument("--noindex", action="store_true")
61+
parser.add_argument("file", nargs="?")
62+
args = parser.parse_args()
63+
64+
if args.file:
65+
content = Path(args.file).read_text()
5966
else:
6067
content = sys.stdin.read()
61-
data = read_json_many(content)
62-
if len(data) == 1:
63-
data = data[0]
6468

65-
gron(data)
69+
data = read_json_many(content)
70+
if len(data) == 1:
71+
data = data[0]
72+
73+
gron(data, noindex=args.noindex)
6674

6775

6876
if __name__ == "__main__":
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
bundle:
2+
name: test-bundle-$UNIQUE_NAME
3+
4+
resources:
5+
catalogs:
6+
foo:
7+
name: test-catalog-$UNIQUE_NAME
8+
comment: This is a test catalog

acceptance/bundle/deployment/bind/catalog/out.test.toml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
2+
>>> [CLI] catalogs create test-catalog-[UNIQUE_NAME]
3+
{
4+
"comment": null,
5+
"name": "test-catalog-[UNIQUE_NAME]"
6+
}
7+
8+
>>> [CLI] bundle deployment bind foo test-catalog-[UNIQUE_NAME] --auto-approve
9+
Updating deployment state...
10+
Successfully bound catalog with an id 'test-catalog-[UNIQUE_NAME]'
11+
Run 'bundle deploy' to deploy changes to your workspace
12+
13+
=== Deploy bundle
14+
>>> [CLI] bundle deploy --force-lock --auto-approve
15+
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQUE_NAME]/default/files...
16+
Deploying resources...
17+
Updating deployment state...
18+
Deployment complete!
19+
20+
>>> [CLI] catalogs get test-catalog-[UNIQUE_NAME]
21+
{
22+
"comment": "This is a test catalog",
23+
"name": "test-catalog-[UNIQUE_NAME]"
24+
}
25+
26+
=== Unbind catalog
27+
>>> [CLI] bundle deployment unbind foo
28+
Updating deployment state...
29+
30+
=== Destroy bundle
31+
>>> [CLI] bundle destroy --auto-approve
32+
All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQUE_NAME]/default
33+
34+
Deleting files...
35+
Destroy complete!
36+
37+
=== Read the pre-defined catalog again (expecting it still exists):
38+
>>> [CLI] catalogs get test-catalog-[UNIQUE_NAME]
39+
{
40+
"comment": "This is a test catalog",
41+
"name": "test-catalog-[UNIQUE_NAME]"
42+
}
43+
44+
=== Test cleanup
45+
>>> [CLI] catalogs delete test-catalog-[UNIQUE_NAME] --force
46+
0
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
cleanup() {
2+
title "Test cleanup"
3+
trace $CLI catalogs delete "test-catalog-$UNIQUE_NAME" --force
4+
echo $?
5+
}
6+
trap cleanup EXIT
7+
8+
envsubst < databricks.yml.tmpl > databricks.yml
9+
10+
trace $CLI catalogs create "test-catalog-$UNIQUE_NAME" | jq '{comment, name}'
11+
12+
trace $CLI bundle deployment bind foo "test-catalog-$UNIQUE_NAME" --auto-approve
13+
14+
title "Deploy bundle"
15+
trace $CLI bundle deploy --force-lock --auto-approve
16+
17+
trace $CLI catalogs get "test-catalog-$UNIQUE_NAME" | jq '{comment, name}'
18+
19+
title "Unbind catalog"
20+
trace $CLI bundle deployment unbind foo
21+
22+
title "Destroy bundle"
23+
trace $CLI bundle destroy --auto-approve
24+
25+
title "Read the pre-defined catalog again (expecting it still exists): "
26+
trace $CLI catalogs get "test-catalog-$UNIQUE_NAME" | jq '{comment, name}'
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Local = true
2+
Cloud = true
3+
RequiresUnityCatalog = true
4+
5+
Ignore = [
6+
".databricks",
7+
"databricks.yml",
8+
]
9+
10+
[EnvMatrix]
11+
DATABRICKS_BUNDLE_ENGINE = ["direct"]

0 commit comments

Comments
 (0)