diff --git a/bundle/config/resources.go b/bundle/config/resources.go index 6728252b..3c72a1fb 100644 --- a/bundle/config/resources.go +++ b/bundle/config/resources.go @@ -4,6 +4,6 @@ import "github.com/databricks/bricks/bundle/config/resources" // Resources defines Databricks resources associated with the bundle. type Resources struct { - Jobs map[string]resources.Job `json:"jobs,omitempty"` + Workflows map[string]resources.Workflow `json:"workflows,omitempty"` Pipelines map[string]resources.Pipeline `json:"pipelines,omitempty"` } diff --git a/bundle/config/resources/job.go b/bundle/config/resources/workflow.go similarity index 85% rename from bundle/config/resources/job.go rename to bundle/config/resources/workflow.go index 17831de4..9b05a12b 100644 --- a/bundle/config/resources/job.go +++ b/bundle/config/resources/workflow.go @@ -2,7 +2,7 @@ package resources import "github.com/databricks/databricks-sdk-go/service/jobs" -type Job struct { +type Workflow struct { ID string `json:"id,omitempty"` *jobs.JobSettings diff --git a/bundle/config/root.go b/bundle/config/root.go index a8f673ad..469a2c41 100644 --- a/bundle/config/root.go +++ b/bundle/config/root.go @@ -36,7 +36,7 @@ type Root struct { Artifacts map[string]*Artifact `json:"artifacts,omitempty"` // Resources contains a description of all Databricks resources - // to deploy in this bundle (e.g. jobs, pipelines, etc.). + // to deploy in this bundle (e.g. workflows, pipelines, etc.). Resources Resources `json:"resources"` // Environments can be used to differentiate settings and resources between diff --git a/bundle/tests/include_default/my_first_job/resource.yml b/bundle/tests/include_default/my_first_job/resource.yml deleted file mode 100644 index c2be5a16..00000000 --- a/bundle/tests/include_default/my_first_job/resource.yml +++ /dev/null @@ -1,4 +0,0 @@ -resources: - jobs: - my_first_job: - id: 1 diff --git a/bundle/tests/include_default/my_first_workflow/resource.yml b/bundle/tests/include_default/my_first_workflow/resource.yml new file mode 100644 index 00000000..bc7273da --- /dev/null +++ b/bundle/tests/include_default/my_first_workflow/resource.yml @@ -0,0 +1,4 @@ +resources: + workflows: + my_first_workflow: + id: 1 diff --git a/bundle/tests/include_default/my_second_job/resource.yml b/bundle/tests/include_default/my_second_job/resource.yml deleted file mode 100644 index 2c28c462..00000000 --- a/bundle/tests/include_default/my_second_job/resource.yml +++ /dev/null @@ -1,4 +0,0 @@ -resources: - jobs: - my_second_job: - id: 2 diff --git a/bundle/tests/include_default/my_second_workflow/resource.yml b/bundle/tests/include_default/my_second_workflow/resource.yml new file mode 100644 index 00000000..5c210424 --- /dev/null +++ b/bundle/tests/include_default/my_second_workflow/resource.yml @@ -0,0 +1,4 @@ +resources: + workflows: + my_second_workflow: + id: 2 diff --git a/bundle/tests/include_default_test.go b/bundle/tests/include_default_test.go index 3ef0d8bb..6402efb9 100644 --- a/bundle/tests/include_default_test.go +++ b/bundle/tests/include_default_test.go @@ -11,10 +11,10 @@ import ( func TestIncludeDefault(t *testing.T) { b := load(t, "./include_default") - // Test that both jobs were loaded. - keys := maps.Keys(b.Config.Resources.Jobs) + // Test that both workflows were loaded. + keys := maps.Keys(b.Config.Resources.Workflows) sort.Strings(keys) - assert.Equal(t, []string{"my_first_job", "my_second_job"}, keys) - assert.Equal(t, "1", b.Config.Resources.Jobs["my_first_job"].ID) - assert.Equal(t, "2", b.Config.Resources.Jobs["my_second_job"].ID) + assert.Equal(t, []string{"my_first_workflow", "my_second_workflow"}, keys) + assert.Equal(t, "1", b.Config.Resources.Workflows["my_first_workflow"].ID) + assert.Equal(t, "2", b.Config.Resources.Workflows["my_second_workflow"].ID) } diff --git a/bundle/tests/include_override/this_file_isnt_included.yml b/bundle/tests/include_override/this_file_isnt_included.yml index c9ba1452..8518d825 100644 --- a/bundle/tests/include_override/this_file_isnt_included.yml +++ b/bundle/tests/include_override/this_file_isnt_included.yml @@ -1,4 +1,4 @@ resources: - jobs: - this_job_isnt_defined: + workflows: + this_workflow_isnt_defined: id: 1 diff --git a/bundle/tests/include_override_test.go b/bundle/tests/include_override_test.go index 0e18fab3..44b7940c 100644 --- a/bundle/tests/include_override_test.go +++ b/bundle/tests/include_override_test.go @@ -8,5 +8,5 @@ import ( func TestIncludeOverride(t *testing.T) { b := load(t, "./include_override") - assert.Empty(t, b.Config.Resources.Jobs) + assert.Empty(t, b.Config.Resources.Workflows) } diff --git a/bundle/tests/job_and_pipeline/bundle.yml b/bundle/tests/workflow_and_pipeline/bundle.yml similarity index 98% rename from bundle/tests/job_and_pipeline/bundle.yml rename to bundle/tests/workflow_and_pipeline/bundle.yml index f4a5719a..366a7e8e 100644 --- a/bundle/tests/job_and_pipeline/bundle.yml +++ b/bundle/tests/workflow_and_pipeline/bundle.yml @@ -29,7 +29,7 @@ environments: development: false photon: true - jobs: + workflows: pipeline_schedule: name: Daily refresh of production pipeline diff --git a/bundle/tests/job_and_pipeline_test.go b/bundle/tests/workflow_and_pipeline_test.go similarity index 76% rename from bundle/tests/job_and_pipeline_test.go rename to bundle/tests/workflow_and_pipeline_test.go index 677bed82..51d3a42f 100644 --- a/bundle/tests/job_and_pipeline_test.go +++ b/bundle/tests/workflow_and_pipeline_test.go @@ -8,8 +8,8 @@ import ( ) func TestJobAndPipelineDevelopment(t *testing.T) { - b := loadEnvironment(t, "./job_and_pipeline", "development") - assert.Len(t, b.Config.Resources.Jobs, 0) + b := loadEnvironment(t, "./workflow_and_pipeline", "development") + assert.Len(t, b.Config.Resources.Workflows, 0) assert.Len(t, b.Config.Resources.Pipelines, 1) p := b.Config.Resources.Pipelines["nyc_taxi_pipeline"] @@ -20,8 +20,8 @@ func TestJobAndPipelineDevelopment(t *testing.T) { } func TestJobAndPipelineStaging(t *testing.T) { - b := loadEnvironment(t, "./job_and_pipeline", "staging") - assert.Len(t, b.Config.Resources.Jobs, 0) + b := loadEnvironment(t, "./workflow_and_pipeline", "staging") + assert.Len(t, b.Config.Resources.Workflows, 0) assert.Len(t, b.Config.Resources.Pipelines, 1) p := b.Config.Resources.Pipelines["nyc_taxi_pipeline"] @@ -32,8 +32,8 @@ func TestJobAndPipelineStaging(t *testing.T) { } func TestJobAndPipelineProduction(t *testing.T) { - b := loadEnvironment(t, "./job_and_pipeline", "production") - assert.Len(t, b.Config.Resources.Jobs, 1) + b := loadEnvironment(t, "./workflow_and_pipeline", "production") + assert.Len(t, b.Config.Resources.Workflows, 1) assert.Len(t, b.Config.Resources.Pipelines, 1) p := b.Config.Resources.Pipelines["nyc_taxi_pipeline"] @@ -42,7 +42,7 @@ func TestJobAndPipelineProduction(t *testing.T) { assert.Equal(t, "./dlt/nyc_taxi_loader", p.Libraries[0].Notebook.Path) assert.Equal(t, "nyc_taxi_production", p.Target) - j := b.Config.Resources.Jobs["pipeline_schedule"] + j := b.Config.Resources.Workflows["pipeline_schedule"] assert.Equal(t, "Daily refresh of production pipeline", j.Name) require.Len(t, j.Tasks, 1) assert.NotEmpty(t, j.Tasks[0].PipelineTask.PipelineId) diff --git a/bundle/tests/yaml_anchors/bundle.yml b/bundle/tests/yaml_anchors/bundle.yml index 50718260..9f679053 100644 --- a/bundle/tests/yaml_anchors/bundle.yml +++ b/bundle/tests/yaml_anchors/bundle.yml @@ -2,8 +2,8 @@ bundle: name: yaml_anchors resources: - jobs: - my_job: + workflows: + my_workflow: _: &common_cluster spark_version: "10.4.x-scala2.12" tasks: diff --git a/bundle/tests/yaml_anchors_test.go b/bundle/tests/yaml_anchors_test.go index 95cec30a..9a4eb6be 100644 --- a/bundle/tests/yaml_anchors_test.go +++ b/bundle/tests/yaml_anchors_test.go @@ -9,9 +9,9 @@ import ( func TestYAMLAnchors(t *testing.T) { b := load(t, "./yaml_anchors") - assert.Len(t, b.Config.Resources.Jobs, 1) + assert.Len(t, b.Config.Resources.Workflows, 1) - j := b.Config.Resources.Jobs["my_job"] + j := b.Config.Resources.Workflows["my_workflow"] require.Len(t, j.Tasks, 2) t0 := j.Tasks[0]