Skip to content
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

Add configurable presets for name prefixes, tags, etc. #1490

Merged
merged 29 commits into from
Aug 19, 2024

Conversation

lennartkats-db
Copy link
Contributor

@lennartkats-db lennartkats-db commented Jun 12, 2024

Changes

This adds configurable transformations based on the transformations currently seen in mode: development.

Example databricks.yml showcasing how some transformations:

bundle:
  name: my_bundle

targets:
  dev:
    presets:
      prefix: "myprefix_"          # prefix all resource names with myprefix_
      pipelines_development: true  # set development to true by default for pipelines
      trigger_pause_status: PAUSED # set pause_status to PAUSED by default for all triggers and schedules
      jobs_max_concurrent_runs: 10 # set max_concurrent runs to 10 by default for all jobs
      tags:
        dev: true

Tests

  • Existing process_target_mode tests that were adapted to use this new code
  • Unit tests specific for the new mutator
  • Unit tests for config loading and merging
  • Manual e2e testing

@lennartkats-db lennartkats-db changed the title [WIP] Add configurable transformations for name prefixes, tags, etc. Add configurable transformations for name prefixes, tags, etc. Jun 12, 2024
@lennartkats-db lennartkats-db marked this pull request as ready for review June 12, 2024 16:16
@codecov-commenter
Copy link

codecov-commenter commented Jun 14, 2024

Codecov Report

Attention: Patch coverage is 75.00000% with 48 lines in your changes missing coverage. Please review.

Project coverage is 53.69%. Comparing base (e22dd8a) to head (4dc5f41).
Report is 142 commits behind head on main.

Files Patch % Lines
bundle/config/mutator/process_target_mode.go 68.57% 16 Missing and 6 partials ⚠️
bundle/config/mutator/apply_transforms.go 84.82% 12 Missing and 5 partials ⚠️
bundle/config/root.go 16.66% 4 Missing and 1 partial ⚠️
bundle/config/transforms.go 0.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1490      +/-   ##
==========================================
+ Coverage   52.25%   53.69%   +1.43%     
==========================================
  Files         317      353      +36     
  Lines       18004    20406    +2402     
==========================================
+ Hits         9408    10956    +1548     
- Misses       7903     8642     +739     
- Partials      693      808     +115     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

bundle/config/mutator/apply_transforms_test.go Outdated Show resolved Hide resolved
bundle/config/mutator/apply_transforms.go Outdated Show resolved Hide resolved
bundle/config/mutator/apply_transforms.go Outdated Show resolved Hide resolved
bundle/config/mutator/apply_transforms_test.go Outdated Show resolved Hide resolved
bundle/config/mutator/process_target_mode.go Outdated Show resolved Hide resolved
bundle/config/root.go Outdated Show resolved Hide resolved
@pietern
Copy link
Contributor

pietern commented Jun 18, 2024

Thanks, will be great to have this.

bundle/config/mutator/apply_transforms.go Outdated Show resolved Hide resolved
bundle/config/mutator/apply_transforms.go Outdated Show resolved Hide resolved
bundle/config/mutator/apply_transforms.go Outdated Show resolved Hide resolved
bundle/config/mutator/apply_transforms_test.go Outdated Show resolved Hide resolved
bundle/config/mutator/process_target_mode.go Outdated Show resolved Hide resolved
bundle/config/mutator/process_target_mode.go Show resolved Hide resolved
bundle/config/mutator/process_target_mode.go Outdated Show resolved Hide resolved
bundle/config/root.go Outdated Show resolved Hide resolved
bundle/config/transforms.go Outdated Show resolved Hide resolved
pietern added a commit that referenced this pull request Jun 21, 2024
This cherry-picks from #1490 to address an issue that came up in #1511.

The function `dyn.SetByPath` requires intermediate values to be present.
If they are not, it returns an error that it cannot index a map. This is not an
issue on main where the intermediate maps are always created, even if they are
not present in the dynamic configuration tree. As of #1511 we'll no longer
populate empty maps for empty structs if they are not explictly set (i.e. a
non-nil pointer). We can write a bool pointer to avoid this issue altogether.
github-merge-queue bot pushed a commit that referenced this pull request Jun 21, 2024
## Changes

This cherry-picks from #1490 to address an issue that came up in #1511.

The function `dyn.SetByPath` requires intermediate values to be present.
If they are not, it returns an error that it cannot index a map. This is
not an issue on main, where the intermediate maps are always created,
even if they are not present in the dynamic configuration tree. As of
#1511, we'll no longer populate empty maps for empty structs if they are
not explicitly set (i.e., a non-nil pointer). This change writes a bool
pointer to avoid this issue altogether.

## Tests

Unit tests pass.
@lennartkats-db lennartkats-db force-pushed the cp-mutator-settings branch 2 times, most recently from c001314 to 40f3bb4 Compare July 19, 2024 19:39
@lennartkats-db
Copy link
Contributor Author

@pietern PTAL, I took another pass here

.vscode/settings.json Outdated Show resolved Hide resolved
bundle/config/mutator/apply_presets_test.go Outdated Show resolved Hide resolved
bundle/config/mutator/process_target_mode.go Show resolved Hide resolved
bundle/config/mutator/process_target_mode.go Show resolved Hide resolved
bundle/tests/presets_test.go Show resolved Hide resolved
@lennartkats-db lennartkats-db requested a review from pietern August 14, 2024 15:00
@lennartkats-db
Copy link
Contributor Author

lennartkats-db commented Aug 16, 2024

When ready, I'd like to first merge #1590. cc @pietern

@lennartkats-db lennartkats-db added this pull request to the merge queue Aug 19, 2024
Merged via the queue into databricks:main with commit 78d0ac5 Aug 19, 2024
5 checks passed
@lennartkats-db lennartkats-db deleted the cp-mutator-settings branch August 19, 2024 18:26
github-merge-queue bot pushed a commit that referenced this pull request Aug 21, 2024
## Changes
In #1490 we regressed and started
using the development mode prefix for UC schemas regardless of the mode
of the bundle target.

This PR fixes the regression and adds a regression test

## Tests
Failing integration tests pass now.
andrewnester added a commit that referenced this pull request Aug 21, 2024
CLI:
 * Added filtering flags for cluster list commands ([#1703](#1703)).

Bundles:
 * Remove reference to "dbt" in the default-sql template ([#1696](#1696)).
 * Pause continuous pipelines when 'mode: development' is used ([#1590](#1590)).
 * Add configurable presets for name prefixes, tags, etc. ([#1490](#1490)).
 * Report all empty resources present in error diagnostic ([#1685](#1685)).
 * Improves detection of PyPI package names in environment dependencies ([#1699](#1699)).
 * [DAB] Add support for requirements libraries in Job Tasks ([#1543](#1543)).
 * Add paths field to bundle sync configuration ([#1694](#1694)).

Internal:
 * Add `import` option for PyDABs ([#1693](#1693)).
 * Make fileset take optional list of paths to list ([#1684](#1684)).
 * Pass through paths argument to libs/sync ([#1689](#1689)).
 * Correctly mark package names with versions as remote libraries ([#1697](#1697)).
 * Share test initializer in common helper function ([#1695](#1695)).
 * Make `pydabs/venv_path` optional ([#1687](#1687)).
 * Use API mocks for duplicate path errors in workspace files extensions client ([#1690](#1690)).
 * Fix prefix preset used for UC schemas ([#1704](#1704)).
github-merge-queue bot pushed a commit that referenced this pull request Aug 22, 2024
CLI:
* Added filtering flags for cluster list commands
([#1703](#1703)).

Bundles:
* Remove reference to "dbt" in the default-sql template
([#1696](#1696)).
* Pause continuous pipelines when 'mode: development' is used
([#1590](#1590)).
* Add configurable presets for name prefixes, tags, etc.
([#1490](#1490)).
* Report all empty resources present in error diagnostic
([#1685](#1685)).
* Improves detection of PyPI package names in environment dependencies
([#1699](#1699)).
* [DAB] Add support for requirements libraries in Job Tasks
([#1543](#1543)).
* Add paths field to bundle sync configuration
([#1694](#1694)).

Internal:
* Add `import` option for PyDABs
([#1693](#1693)).
* Make fileset take optional list of paths to list
([#1684](#1684)).
* Pass through paths argument to libs/sync
([#1689](#1689)).
* Correctly mark package names with versions as remote libraries
([#1697](#1697)).
* Share test initializer in common helper function
([#1695](#1695)).
* Make `pydabs/venv_path` optional
([#1687](#1687)).
* Use API mocks for duplicate path errors in workspace files extensions
client ([#1690](#1690)).
* Fix prefix preset used for UC schemas
([#1704](#1704)).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants