Skip to content

Commit 825ec29

Browse files
authored
pipelines: dry-run new command (#3218)
## Changes Dry run copied from cmd/pipelines/run.go that only validates run. ## Why We want to move the `bundle run --validate-only` flag from bundle/run.go to be a separate command as `pipelines dry-run`. This allows to add more flags in the future. ## Tests Acceptance tests in follow-up: #3219
1 parent f0faa1d commit 825ec29

File tree

18 files changed

+270
-0
lines changed

18 files changed

+270
-0
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
bundle:
2+
name: test-pipeline-run
3+
resources:
4+
pipelines:
5+
my_pipeline:
6+
name: test-pipeline
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", "direct-exp"]
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
2+
>>> [PIPELINES] deploy
3+
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-pipeline-run/default/files...
4+
Deploying resources...
5+
Updating deployment state...
6+
Deployment complete!
7+
8+
=== Dry running pipeline, should have validate_only set to true
9+
>>> [PIPELINES] dry-run my_pipeline
10+
Update URL: [DATABRICKS_URL]/#joblist/pipelines/[UUID]/updates/[UUID]
11+
12+
{
13+
"body": {
14+
"validate_only": true
15+
},
16+
"method": "POST",
17+
"path": "/api/2.0/pipelines/[UUID]/updates"
18+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
print_requests() {
2+
jq --sort-keys 'select(.method != "GET" and (.path | contains("/pipelines")))' < out.requests.txt
3+
rm out.requests.txt
4+
}
5+
6+
trace $PIPELINES deploy
7+
rm out.requests.txt
8+
title "Dry running pipeline, should have validate_only set to true"
9+
trace $PIPELINES dry-run my_pipeline
10+
print_requests
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
RecordRequests = true
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
bundle:
2+
name: test-pipeline-run-flags
3+
resources:
4+
pipelines:
5+
my_pipeline:
6+
name: test-pipeline-flags
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", "direct-exp"]
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
>>> [PIPELINES] deploy
3+
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-pipeline-run-flags/default/files...
4+
Deploying resources...
5+
Updating deployment state...
6+
Deployment complete!
7+
8+
=== Dry running pipeline with --no-wait flag
9+
>>> [PIPELINES] dry-run my_pipeline --no-wait
10+
Update URL: [DATABRICKS_URL]/#joblist/pipelines/[UUID]/updates/[UUID]
11+
12+
<EOL>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
trace $PIPELINES deploy
2+
title "Dry running pipeline with --no-wait flag"
3+
trace $PIPELINES dry-run my_pipeline --no-wait
4+
# This printf is here to fix the whitespace linter error (ensures exactly one newline at end)
5+
printf "<EOL>\n"
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
bundle:
2+
name: test-pipeline-run-flags
3+
resources:
4+
pipelines:
5+
my_pipeline:
6+
name: test-pipeline-flags

0 commit comments

Comments
 (0)