Skip to content

Commit 47ef49c

Browse files
authored
pipelines deploy: oss acceptance test for yaml file (#3313)
## Changes Add acceptance test for raising an error for oss pipeline YAML files. Follows #3312
1 parent 6b2ba62 commit 47ef49c

File tree

6 files changed

+34
-0
lines changed

6 files changed

+34
-0
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-oss-warning
3+
4+
include:
5+
- ./*.yml
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
definitions:
2+
- glob:
3+
include: transformations/**/*.py
4+
- glob:
5+
include: transformations/**/*.sql
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: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
2+
=== Fail to deploy OSS Spark pipelines-formatted YAML file
3+
>>> musterr [PIPELINES] deploy
4+
Warning: unknown field: definitions
5+
in oss-pipeline.yml:1:1
6+
7+
Error: oss-pipeline.yml seems to be formatted for open-source Spark Declarative Pipelines.
8+
Pipelines CLI currently only supports Lakeflow Declarative Pipelines development.
9+
To see an example of a supported pipelines template, create a new Pipelines CLI project with "pipelines init".
10+
11+
Exit code (musterr): 1
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
title "Fail to deploy OSS Spark pipelines-formatted YAML file"
2+
trace musterr $PIPELINES deploy

libs/cmdio/render.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,9 +395,11 @@ func fancyJSON(v any) ([]byte, error) {
395395
}
396396

397397
const errorTemplate = `{{ "Error" | red }}: {{ .Summary }}
398+
{{- if and .Paths (ne (index .Paths 0).String "") }}
398399
{{- range $index, $element := .Paths }}
399400
{{ if eq $index 0 }}at {{else}} {{ end}}{{ $element.String | green }}
400401
{{- end }}
402+
{{- end }}
401403
{{- range $index, $element := .Locations }}
402404
{{ if eq $index 0 }}in {{else}} {{ end}}{{ $element.String | cyan }}
403405
{{- end }}
@@ -409,9 +411,11 @@ const errorTemplate = `{{ "Error" | red }}: {{ .Summary }}
409411
`
410412

411413
const warningTemplate = `{{ "Warning" | yellow }}: {{ .Summary }}
414+
{{- if and .Paths (ne (index .Paths 0).String "") }}
412415
{{- range $index, $element := .Paths }}
413416
{{ if eq $index 0 }}at {{else}} {{ end}}{{ $element.String | green }}
414417
{{- end }}
418+
{{- end }}
415419
{{- range $index, $element := .Locations }}
416420
{{ if eq $index 0 }}in {{else}} {{ end}}{{ $element.String | cyan }}
417421
{{- end }}
@@ -423,9 +427,11 @@ const warningTemplate = `{{ "Warning" | yellow }}: {{ .Summary }}
423427
`
424428

425429
const recommendationTemplate = `{{ "Recommendation" | blue }}: {{ .Summary }}
430+
{{- if and .Paths (ne (index .Paths 0).String "") }}
426431
{{- range $index, $element := .Paths }}
427432
{{ if eq $index 0 }}at {{else}} {{ end}}{{ $element.String | green }}
428433
{{- end }}
434+
{{- end }}
429435
{{- range $index, $element := .Locations }}
430436
{{ if eq $index 0 }}in {{else}} {{ end}}{{ $element.String | cyan }}
431437
{{- end }}

0 commit comments

Comments
 (0)