databricks-cli/bundle/config
Andrew Nester 83443bae8d
Make resource and artifact paths in bundle config relative to config folder (#708)
# Warning: breaking change

## Changes
Instead of having paths in bundle config files be relative to bundle
root even if the config file is nested, this PR makes such paths
relative to the folder where the config is located.

When bundle is initialised, these paths will be transformed to relative
paths based on bundle root. For example,
we have file structure like this
```
- mybundle
| - bundle.yml
| - subfolder
| -- resource.yml
| -- my.whl
```

Previously, we had to reference `my.whl` in resource.yml like this,
which was confusing because resource.yml is in the same subfolder
```
sync:
  include:
    - ./subfolder/*.whl
...
tasks:
  - task_key: name
    libraries:
      - whl: ./subfolder/my.whl
...
```

After the change we can reference it like this (which is in line with
the current behaviour for notebooks)

```
sync:
  include:
    - ./*.whl
...
tasks:
  - task_key: name
    libraries:
      - whl: ./my.whl
...
```

## Tests
Existing `translate_path_tests` successfully passed after refactoring.

Added a couple of uses cases for `Libraries` paths.

Added a bundle config tests with include config and sync section

---------

Co-authored-by: Pieter Noordhuis <pieter.noordhuis@databricks.com>
2023-09-04 09:55:01 +00:00
..
interpolation Upgraded Go version to 1.21 (#664) 2023-08-15 13:50:40 +00:00
mutator Make resource and artifact paths in bundle config relative to config folder (#708) 2023-09-04 09:55:01 +00:00
paths Make resource and artifact paths in bundle config relative to config folder (#708) 2023-09-04 09:55:01 +00:00
resources Make resource and artifact paths in bundle config relative to config folder (#708) 2023-09-04 09:55:01 +00:00
testdata First look for databricks.yml before falling back to bundle.yml (#580) 2023-07-18 12:16:34 +02:00
variable Renamed `environments` to `targets` in bundle configuration (#670) 2023-08-17 15:22:32 +00:00
artifact.go Make resource and artifact paths in bundle config relative to config folder (#708) 2023-09-04 09:55:01 +00:00
bundle.go Renamed `environments` to `targets` in bundle configuration (#670) 2023-08-17 15:22:32 +00:00
git.go Add validation for Git settings in bundles (#578) 2023-07-30 12:44:33 +00:00
lock.go Acquire lock prior to deploy (#270) 2023-03-22 16:37:26 +01:00
lock_test.go Acquire lock prior to deploy (#270) 2023-03-22 16:37:26 +01:00
resources.go Renamed `environments` to `targets` in bundle configuration (#670) 2023-08-17 15:22:32 +00:00
resources_test.go Make resource and artifact paths in bundle config relative to config folder (#708) 2023-09-04 09:55:01 +00:00
root.go Make resource and artifact paths in bundle config relative to config folder (#708) 2023-09-04 09:55:01 +00:00
root_test.go Renamed `environments` to `targets` in bundle configuration (#670) 2023-08-17 15:22:32 +00:00
sync.go Make resource and artifact paths in bundle config relative to config folder (#708) 2023-09-04 09:55:01 +00:00
target.go Make resource and artifact paths in bundle config relative to config folder (#708) 2023-09-04 09:55:01 +00:00
workspace.go Renamed `environments` to `targets` in bundle configuration (#670) 2023-08-17 15:22:32 +00:00