databricks-cli/libs
Andrew Nester 180dfc9a40
Added ability for deferred mutator execution (#380)
## Changes
Added `DeferredMutator` and `bundle.Defer` function which allows to
always execute some mutators either in the end of execution chain or
after error occurs in the middle of execution chain.

Usage as follows:

```
deferredMutator := bundle.Defer([]bundle.Mutator{
    lock.Acquire()
    transform.DoSomething(),
    //...
}, []bundle.Mutator{
    lock.Release(),
})
```
In such case `lock.Release()` will always be executed: either when all
operations above succeed or when any of them fails

## Tests
Before the change

```
andrew.nester@HFW9Y94129 multiples-tasks % bricks bundle deploy
Starting upload of bundle files
Uploaded bundle files at /Users/andrew.nester@databricks.com/.bundle/simple-task/development/files!

Error: terraform not initialized
andrew.nester@HFW9Y94129 multiples-tasks % bricks bundle deploy
Error: deploy lock acquired by andrew.nester@databricks.com at 2023-05-10 16:41:22.902659 +0200 CEST. Use --force to override

```

After the change
```
andrew.nester@HFW9Y94129 multiples-tasks % bricks bundle deploy 
Starting upload of bundle files
Uploaded bundle files at /Users/andrew.nester@databricks.com/.bundle/simple-task/development/files!

Error: terraform not initialized
andrew.nester@HFW9Y94129 multiples-tasks % bricks bundle deploy
Starting upload of bundle files
Uploaded bundle files at /Users/andrew.nester@databricks.com/.bundle/simple-task/development/files!

Error: terraform not initialized
```
2023-05-16 18:01:50 +02:00
..
auth Make `bricks auth` use `all-apis` scope (#304) 2023-04-05 10:18:13 +02:00
cmdio Added OpenAPI command coverage (#357) 2023-04-26 13:06:16 +02:00
databrickscfg Bump github.com/databricks/databricks-sdk-go from 0.5.0 to 0.6.0 (#299) 2023-04-03 21:33:21 +02:00
errs Added ability for deferred mutator execution (#380) 2023-05-16 18:01:50 +02:00
filer Path escape file path in filer interface (#254) 2023-03-17 17:42:35 +01:00
fileset Don't sync symlink folders (#205) 2023-02-15 17:02:54 +01:00
flags Added OpenAPI command coverage (#357) 2023-04-26 13:06:16 +02:00
git Add git config block to bundle config (#356) 2023-04-26 16:54:36 +02:00
locker Acquire lock prior to deploy (#270) 2023-03-22 16:37:26 +01:00
log Trim log source field to basename of file (#273) 2023-03-23 08:56:39 +01:00
notebook Error out if notebook file does not exist locally (#261) 2023-03-21 18:13:16 +01:00
sync Update to Go SDK v0.8.0 (#351) 2023-04-21 10:30:20 +02:00
terraform Add bundle destroy command (#300) 2023-04-06 12:54:58 +02:00
testfile Refactor and cover edge cases in sync integration tests (#160) 2023-01-10 13:16:30 +01:00