-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added support for experimental scripts section #632
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
I've given it a try, and it worked for "databricks bundle deploy". I've found a few issues:
|
@kanterov Build is not part of |
) | ||
|
||
func DefaultMutators() []bundle.Mutator { | ||
return []bundle.Mutator{ | ||
scripts.Execute(config.ScriptPreInit), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: this is not where this hook should be executed in the non-experimental version.
Before executing anything, we'd need to have already done:
- target selection,
- variable interpolation,
- confirmed that our workspace is configured correctly.
Then to pick up new configuration (e.g. resources) from these scripts, we'd need a different mechanism. For example, we could set an environment variable DATABRICKS_BUNDLE_RESOURCES
to some temporary file path that the script can write to, and we subsequently load + merge.
Given that this will be empty/a no-op for regular usage, I'm OK merging this and addressing this later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree with the above. Let's merge at current version as an experimental and iterate over it
Bundles: * Use enums for default python template ([#765](#765)). * Make bundle deploy work if no resources are defined ([#767](#767)). * Added support for experimental scripts section ([#632](#632)). * Error when unknown keys are encounters during template execution ([#766](#766)). * Fall back to full Git clone if shallow clone is not supported ([#775](#775)). * Enable environment overrides for job tasks ([#779](#779)). * Increase timeout waiting for job run to 1 day ([#786](#786)). Internal: * Update Go SDK to v0.19.3 (unreleased) ([#778](#778)).
Bundles: * Use enums for default python template ([#765](#765)). * Make bundle deploy work if no resources are defined ([#767](#767)). * Added support for experimental scripts section ([#632](#632)). * Error when unknown keys are encounters during template execution ([#766](#766)). * Fall back to full Git clone if shallow clone is not supported ([#775](#775)). * Enable environment overrides for job tasks ([#779](#779)). * Increase timeout waiting for job run to 1 day ([#786](#786)). Internal: * Update Go SDK to v0.19.3 (unreleased) ([#778](#778)).
## Changes Added support for experimental scripts section It allows execution of arbitrary bash commands during certain bundle lifecycle steps. ## Tests Example of configuration ```yaml bundle: name: wheel-task workspace: host: *** experimental: scripts: prebuild: | echo 'Prebuild 1' echo 'Prebuild 2' postbuild: "echo 'Postbuild 1' && echo 'Postbuild 2'" predeploy: | echo 'Checking go version...' go version postdeploy: | echo 'Checking python version...' python --version resources: jobs: test_job: name: "[${bundle.environment}] My Wheel Job" tasks: - task_key: TestTask existing_cluster_id: "***" python_wheel_task: package_name: "my_test_code" entry_point: "run" libraries: - whl: ./dist/*.whl ``` Output ```bash andrew.nester@HFW9Y94129 wheel % databricks bundle deploy artifacts.whl.AutoDetect: Detecting Python wheel project... artifacts.whl.AutoDetect: Found Python wheel project at /Users/andrew.nester/dabs/wheel 'Prebuild 1' 'Prebuild 2' artifacts.whl.Build(my_test_code): Building... artifacts.whl.Build(my_test_code): Build succeeded 'Postbuild 1' 'Postbuild 2' 'Checking go version...' go version go1.19.9 darwin/arm64 Starting upload of bundle files Uploaded bundle files at /Users/andrew.nester@databricks.com/.bundle/wheel-task/default/files! artifacts.Upload(my_test_code-0.0.0a0-py3-none-any.whl): Uploading... artifacts.Upload(my_test_code-0.0.0a0-py3-none-any.whl): Upload succeeded Starting resource deployment Resource deployment completed! 'Checking python version...' Python 2.7.18 ```
Bundles: * Use enums for default python template ([#765](#765)). * Make bundle deploy work if no resources are defined ([#767](#767)). * Added support for experimental scripts section ([#632](#632)). * Error when unknown keys are encounters during template execution ([#766](#766)). * Fall back to full Git clone if shallow clone is not supported ([#775](#775)). * Enable environment overrides for job tasks ([#779](#779)). * Increase timeout waiting for job run to 1 day ([#786](#786)). Internal: * Update Go SDK to v0.19.3 (unreleased) ([#778](#778)).
Changes
Added support for experimental scripts section
It allows execution of arbitrary bash commands during certain bundle lifecycle steps.
Tests
Example of configuration
Output