From 70e8c1470b9572732a73ae6f50bd71b732621832 Mon Sep 17 00:00:00 2001 From: Andres Garcia Date: Thu, 22 Oct 2026 00:04:02 +0000 Subject: [PATCH 1/3] Add Git source job example Co-authored-by: omnigent --- knowledge_base/job_git_source/.gitignore | 1 + knowledge_base/job_git_source/README.md | 49 +++++++++++++++++++ knowledge_base/job_git_source/databricks.yml | 31 ++++++++++++ .../job_git_source/resources/job.yml | 13 +++++ knowledge_base/job_git_source/src/.gitkeep | 1 + 5 files changed, 95 insertions(+) create mode 100644 knowledge_base/job_git_source/.gitignore create mode 100644 knowledge_base/job_git_source/README.md create mode 100644 knowledge_base/job_git_source/databricks.yml create mode 100644 knowledge_base/job_git_source/resources/job.yml create mode 100644 knowledge_base/job_git_source/src/.gitkeep diff --git a/knowledge_base/job_git_source/.gitignore b/knowledge_base/job_git_source/.gitignore new file mode 100644 index 00000000..15bcc6dd --- /dev/null +++ b/knowledge_base/job_git_source/.gitignore @@ -0,0 +1 @@ +.databricks diff --git a/knowledge_base/job_git_source/README.md b/knowledge_base/job_git_source/README.md new file mode 100644 index 00000000..4cb86d03 --- /dev/null +++ b/knowledge_base/job_git_source/README.md @@ -0,0 +1,49 @@ +# Job with Git source + +This Declarative Automation Bundles example runs a notebook directly from a public Git repository. +See the [Git source documentation](https://docs.databricks.com/aws/en/jobs/how-to/use-git-with-jobs) for supported providers and tasks. + +| Source | Behavior | +| --- | --- | +| Git source | The job checks out the configured repository and branch at run time. | +| Synced source | The bundle uploads local files to the workspace during deployment. | + +## Prerequisites + +* Install Databricks CLI v1.20.0 or above. +* Configure the `dabs-examples` authentication profile. +* Use a workspace that supports serverless jobs. + +## Usage + +1. Validate the development target. + + ```sh + databricks bundle validate -t dev --profile dabs-examples + ``` + +2. Deploy and run the job. + + ```sh + databricks bundle deploy -t dev --profile dabs-examples + databricks bundle run -t dev git_source --profile dabs-examples + ``` + +3. Override a Git setting when needed. + + ```sh + databricks bundle deploy -t dev --var git_branch=main --profile dabs-examples + ``` + +4. Remove the development deployment. + + ```sh + databricks bundle destroy -t dev --auto-approve --profile dabs-examples + ``` + +5. Deploy production from the `main` branch, then remove it. + + ```sh + databricks bundle deploy -t prod --profile dabs-examples + databricks bundle destroy -t prod --auto-approve --profile dabs-examples + ``` diff --git a/knowledge_base/job_git_source/databricks.yml b/knowledge_base/job_git_source/databricks.yml new file mode 100644 index 00000000..9380ff18 --- /dev/null +++ b/knowledge_base/job_git_source/databricks.yml @@ -0,0 +1,31 @@ +bundle: + name: job_git_source + databricks_cli_version: ">= 1.20.0" + +include: + - resources/*.yml + +variables: + git_url: + description: Git repository URL for the job source. + default: https://github.com/databricks/bundle-examples + git_provider: + description: Git provider for the job source. + default: gitHub + git_branch: + description: Git branch for the job source. + default: main + +targets: + dev: + default: true + mode: development + workspace: + root_path: /Workspace/bundle-examples/${bundle.name}/${bundle.target}/${workspace.current_user.short_name} + prod: + mode: production + bundle: + git: + branch: main + workspace: + root_path: /Workspace/bundle-examples/${bundle.name}/${bundle.target} diff --git a/knowledge_base/job_git_source/resources/job.yml b/knowledge_base/job_git_source/resources/job.yml new file mode 100644 index 00000000..c95ad4ba --- /dev/null +++ b/knowledge_base/job_git_source/resources/job.yml @@ -0,0 +1,13 @@ +resources: + jobs: + git_source: + name: Job with Git source + git_source: + git_url: ${var.git_url} + git_provider: ${var.git_provider} + git_branch: ${var.git_branch} + tasks: + - task_key: hello + notebook_task: + notebook_path: knowledge_base/development_cluster/src/hello.py + source: GIT diff --git a/knowledge_base/job_git_source/src/.gitkeep b/knowledge_base/job_git_source/src/.gitkeep new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/knowledge_base/job_git_source/src/.gitkeep @@ -0,0 +1 @@ + From dff7796f385c2df81aaf9876b8403209dbb0ebe4 Mon Sep 17 00:00:00 2001 From: Andres Garcia Date: Thu, 22 Oct 2026 00:10:10 +0000 Subject: [PATCH 2/3] Configure serverless Git source job Co-authored-by: omnigent --- knowledge_base/job_git_source/README.md | 23 +++++++++++-------- .../resources/{job.yml => git_source.job.yml} | 5 ++++ 2 files changed, 19 insertions(+), 9 deletions(-) rename knowledge_base/job_git_source/resources/{job.yml => git_source.job.yml} (71%) diff --git a/knowledge_base/job_git_source/README.md b/knowledge_base/job_git_source/README.md index 4cb86d03..8cb6c4f8 100644 --- a/knowledge_base/job_git_source/README.md +++ b/knowledge_base/job_git_source/README.md @@ -11,7 +11,7 @@ See the [Git source documentation](https://docs.databricks.com/aws/en/jobs/how-t ## Prerequisites * Install Databricks CLI v1.20.0 or above. -* Configure the `dabs-examples` authentication profile. +* Configure Databricks CLI authentication. * Use a workspace that supports serverless jobs. ## Usage @@ -19,31 +19,36 @@ See the [Git source documentation](https://docs.databricks.com/aws/en/jobs/how-t 1. Validate the development target. ```sh - databricks bundle validate -t dev --profile dabs-examples + databricks bundle validate -t dev ``` 2. Deploy and run the job. ```sh - databricks bundle deploy -t dev --profile dabs-examples - databricks bundle run -t dev git_source --profile dabs-examples + databricks bundle deploy -t dev + databricks bundle run -t dev git_source ``` 3. Override a Git setting when needed. ```sh - databricks bundle deploy -t dev --var git_branch=main --profile dabs-examples + databricks bundle deploy -t dev --var git_branch=main ``` 4. Remove the development deployment. ```sh - databricks bundle destroy -t dev --auto-approve --profile dabs-examples + databricks bundle destroy -t dev --auto-approve ``` -5. Deploy production from the `main` branch, then remove it. +5. Deploy production from the `main` branch. ```sh - databricks bundle deploy -t prod --profile dabs-examples - databricks bundle destroy -t prod --auto-approve --profile dabs-examples + databricks bundle deploy -t prod + ``` + +6. Remove the production deployment. + + ```sh + databricks bundle destroy -t prod --auto-approve ``` diff --git a/knowledge_base/job_git_source/resources/job.yml b/knowledge_base/job_git_source/resources/git_source.job.yml similarity index 71% rename from knowledge_base/job_git_source/resources/job.yml rename to knowledge_base/job_git_source/resources/git_source.job.yml index c95ad4ba..8168a59a 100644 --- a/knowledge_base/job_git_source/resources/job.yml +++ b/knowledge_base/job_git_source/resources/git_source.job.yml @@ -8,6 +8,11 @@ resources: git_branch: ${var.git_branch} tasks: - task_key: hello + environment_key: default notebook_task: notebook_path: knowledge_base/development_cluster/src/hello.py source: GIT + environments: + - environment_key: default + spec: + environment_version: "4" From d299da6cb078780ca15d35103044e8dddcc126dd Mon Sep 17 00:00:00 2001 From: Andres Garcia Date: Thu, 22 Oct 2026 02:35:28 +0000 Subject: [PATCH 3/3] Update Git source serverless environment Co-authored-by: omnigent --- knowledge_base/job_git_source/resources/git_source.job.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/knowledge_base/job_git_source/resources/git_source.job.yml b/knowledge_base/job_git_source/resources/git_source.job.yml index 8168a59a..604089dd 100644 --- a/knowledge_base/job_git_source/resources/git_source.job.yml +++ b/knowledge_base/job_git_source/resources/git_source.job.yml @@ -15,4 +15,4 @@ resources: environments: - environment_key: default spec: - environment_version: "4" + environment_version: "6"