Skip to content

Commit 4ce207e

Browse files
authored
Adding new pipelines deploy command (#3107)
## Changes Adds `pipelines deploy` command with: - `--auto-approve` flag for non-interactive deployments - `--force-lock` flag to override deployment locks - `--var` flag for runtime variable substitution - `--verbose` flag for detailed output (VSCode integration) ## Why Enables direct pipeline deployment from CLI with safety controls and CI/CD support, eliminating need to switch tools for deployment workflows. ## Tests Added acceptance tests covering: - Auto-approve behavior for destructive operations - Force lock functionality and concurrent deployment handling - Variable substitution with special characters, unicode, and precedence rules - Error cases for undefined variables and invalid formats - Basic deployment and recreation scenarios All tests run against Terraform backend with proper cleanup.
1 parent 57678be commit 4ce207e

File tree

29 files changed

+305
-13
lines changed

29 files changed

+305
-13
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
bundle:
2+
name: test-pipeline-auto-approve
3+
4+
include:
5+
- "./*.yml"
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Local = true
2+
Cloud = false
3+
4+
[EnvMatrix]
5+
DATABRICKS_CLI_DEPLOYMENT = ["terraform"]
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
2+
>>> [PIPELINES] deploy
3+
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-pipeline-auto-approve/default/files...
4+
Deploying resources...
5+
Updating deployment state...
6+
Deployment complete!
7+
8+
=== Remove resources from configuration to test auto-approve
9+
>>> rm resources.yml
10+
11+
=== Try to redeploy without --auto-approve - should fail
12+
>>> errcode [PIPELINES] deploy
13+
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-pipeline-auto-approve/default/files...
14+
15+
This action will result in the deletion or recreation of the following DLT Pipelines along with the
16+
Streaming Tables (STs) and Materialized Views (MVs) managed by them. Recreating the Pipelines will
17+
restore the defined STs and MVs through full refresh. Note that recreation is necessary when pipeline
18+
properties such as the 'catalog' or 'storage' are changed:
19+
delete pipeline foo
20+
Error: the deployment requires destructive actions, but current console does not support prompting. Please specify --auto-approve if you would like to skip prompts and proceed
21+
22+
23+
Exit code: 1
24+
25+
=== Redeploy with --auto-approve - should succeed
26+
>>> [PIPELINES] deploy --auto-approve
27+
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-pipeline-auto-approve/default/files...
28+
29+
This action will result in the deletion or recreation of the following DLT Pipelines along with the
30+
Streaming Tables (STs) and Materialized Views (MVs) managed by them. Recreating the Pipelines will
31+
restore the defined STs and MVs through full refresh. Note that recreation is necessary when pipeline
32+
properties such as the 'catalog' or 'storage' are changed:
33+
delete pipeline foo
34+
Deploying resources...
35+
Updating deployment state...
36+
Deployment complete!
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
resources:
2+
pipelines:
3+
foo:
4+
name: test-pipeline
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
trace $PIPELINES deploy
2+
3+
title "Remove resources from configuration to test auto-approve"
4+
trace rm resources.yml
5+
6+
title "Try to redeploy without --auto-approve - should fail"
7+
trace errcode $PIPELINES deploy
8+
9+
title "Redeploy with --auto-approve - should succeed"
10+
trace $PIPELINES deploy --auto-approve
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
EnvMatrix.DATABRICKS_CLI_DEPLOYMENT = ["terraform"]
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
bundle:
2+
name: test-create-pipeline
3+
4+
resources:
5+
pipelines:
6+
foo:
7+
name: test-pipeline
8+
libraries:
9+
- notebook:
10+
path: ./nb.sql
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
-- Databricks notebook source
2+
select 1
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Local = true
2+
Cloud = false
3+
4+
[EnvMatrix]
5+
DATABRICKS_CLI_DEPLOYMENT = ["terraform"]
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
2+
>>> [PIPELINES] deploy
3+
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-create-pipeline/default/files...
4+
Deploying resources...
5+
Updating deployment state...
6+
Deployment complete!
7+
8+
>>> [CLI] pipelines get [UUID]
9+
{
10+
"spec": {
11+
"channel": "CURRENT",
12+
"deployment": {
13+
"kind": "BUNDLE",
14+
"metadata_file_path": "/Workspace/Users/[USERNAME]/.bundle/test-create-pipeline/default/state/metadata.json"
15+
},
16+
"edition": "ADVANCED",
17+
"id": "[UUID]",
18+
"libraries": [
19+
{
20+
"notebook": {
21+
"path": "/Workspace/Users/[USERNAME]/.bundle/test-create-pipeline/default/files/nb"
22+
}
23+
}
24+
],
25+
"name": "test-pipeline",
26+
"storage": "dbfs:/pipelines/[UUID]"
27+
}
28+
}

0 commit comments

Comments
 (0)