Commit Graph

105 Commits

Author SHA1 Message Date
Ilya Kuznetsov 33bd3b81cb
fix: Typo 2025-01-15 16:50:24 +01:00
Ilya Kuznetsov e5497f75b8
fix: Move templates to separate files 2025-01-15 16:48:07 +01:00
Ilya Kuznetsov 1b73105457
fix: Split annotations/main.go in 2 files 2025-01-15 16:26:19 +01:00
Ilya Kuznetsov c74ab7566f
fix: Stage output changes 2025-01-15 16:23:45 +01:00
Ilya Kuznetsov 14b2c86d61
fix: Add `vendor` step to `make docs` 2025-01-15 16:21:45 +01:00
Ilya Kuznetsov 1e41e6140d
fix: Apps fixes after merge 2025-01-14 12:59:44 +01:00
Ilya Kuznetsov f684afe452
Merge branch 'main' of github.com:databricks/cli into feat/config-reference-doc-autogen 2025-01-14 11:52:44 +01:00
Andrew Nester 913e10a037
Added support for Databricks Apps in DABs (#1928)
## Changes
Now it's possible to configure new `app` resource in bundle and point it
to the custom `source_code_path` location where Databricks App code is
defined.

On `databricks bundle deploy` DABs will create an app. All consecutive
`databricks bundle deploy` execution will update an existing app if
there are any updated

On `databricks bundle run <my_app>` DABs will execute app deployment. If
the app is not started yet, it will start the app first.

### Bundle configuration

```
bundle:
  name: apps

variables:
  my_job_id:
    description: "ID of job to run app"
    lookup:
      job: "My Job"
  databricks_name:
    description: "Name for app user"
  additional_flags:
    description: "Additional flags to run command app"
    default: ""
  my_app_config:
    type: complex
    description: "Configuration for my Databricks App"
    default:
      command:
        - flask
        - --app
        - hello
        - run
        - ${var.additional_flags}
      env:
        - name: DATABRICKS_NAME
          value: ${var.databricks_name}

resources:
  apps:
    my_app:
      name: "anester-app" # required and has to be unique
      description: "My App"
      source_code_path: ./app # required and points to location of app code
      config: ${var.my_app_config}
      resources:
        - name: "my-job"
          description: "A job for app to be able to run"
          job:
            id: ${var.my_job_id}
            permission: "CAN_MANAGE_RUN"
      permissions:
        - user_name: "foo@bar.com"
          level: "CAN_VIEW"
        - service_principal_name: "my_sp"
          level: "CAN_MANAGE"

targets:
  dev:
    variables:
      databricks_name: "Andrew (from dev)"
      additional_flags: --debug
  
  prod:
    variables:
      databricks_name: "Andrew (from prod)"
```

### Execution
1. `databricks bundle deploy -t dev`
2. `databricks bundle run my_app -t dev`

**If app is started**
```
✓ Getting the status of the app my-app
✓ App is in RUNNING state
✓ Preparing source code for new app deployment.
✓ Deployment is pending
✓ Starting app with command: flask --app hello run --debug
✓ App started successfully
You can access the app at <app-url>
```

**If app is not started**
```
✓ Getting the status of the app my-app
✓ App is in UNAVAILABLE state
✓ Starting the app my-app
✓ App is starting...
....
✓ App is starting...
✓ App is started!
✓ Preparing source code for new app deployment.
✓ Downloading source code from /Workspace/Users/...
✓ Starting app with command: flask --app hello run --debug
✓ App started successfully
You can access the app at <app-url>
```

## Tests
Added unit and config tests + manual test.

```
--- PASS: TestAccDeployBundleWithApp (404.59s)
PASS
coverage: 36.8% of statements in ./...
ok      github.com/databricks/cli/internal/bundle       405.035s        coverage: 36.8% of statements in ./...
```
2025-01-13 16:43:48 +00:00
Ilya Kuznetsov 2591172370 fix: Circular types 2025-01-13 15:55:49 +01:00
Ilya Kuznetsov 3e0d2324b5
fix: Allow empty fields 2025-01-13 15:28:41 +01:00
Ilya Kuznetsov ad81e1f0af fix: Few links updates 2025-01-13 15:16:47 +01:00
Ilya Kuznetsov 5fb4fa000b fix: Add field-name for some properties 2025-01-10 21:01:15 +01:00
Ilya Kuznetsov fd88e4c97a fix: Use markdown from original pages 2025-01-10 20:35:44 +01:00
Ilya Kuznetsov 90cafad8c8 fix: Allow nodes with only description 2025-01-10 19:57:02 +01:00
Ilya Kuznetsov 880a4cf49e
fix: Few extra links 2025-01-10 19:29:16 +01:00
Ilya Kuznetsov 0bd7b524db
fix: Invalid refrences 2025-01-10 19:26:45 +01:00
Ilya Kuznetsov ee5db187c0
fix: Move logic to separate fiels 2025-01-10 18:33:58 +01:00
Ilya Kuznetsov 4b01f6b1bc
fix: Add links 2025-01-10 18:09:18 +01:00
Ilya Kuznetsov 151a6f86dd
fix: Multiple links 2025-01-10 17:51:22 +01:00
Ilya Kuznetsov 1fbec371e5
fix: Link 2025-01-10 17:47:06 +01:00
Ilya Kuznetsov d5d433e9d7
fix: More descriptions 2025-01-10 16:37:22 +01:00
Ilya Kuznetsov 954ef76fe9
Merge branch 'main' of github.com:databricks/cli into feat/config-reference-doc-autogen 2025-01-10 16:07:13 +01:00
Ilya Kuznetsov bad77bd358
fix: Sync annotations 2025-01-10 16:01:52 +01:00
Ilya Kuznetsov 6c5268aaaa fix: Missing array types 2025-01-10 12:52:20 +01:00
Ilya Kuznetsov f9278c2b4d docs: Add override for volume spec 2025-01-08 16:11:58 +01:00
Ilya Kuznetsov c355fbfcb2 fix: Description of root types with additional properties 2025-01-08 16:11:35 +01:00
Gleb Kanterov 02c7df39f6
Add 'experimental/python' support (#2052)
## Changes
Add `experimental/python` section replacing `experimental/pydabs`.

Add 2 new mutators into existing pipeline:
- `ApplyPythonMutator(load_resources)` - loads resources from Python
code
- `ApplyPythonMutator(apply_mutators)` - transforms existing resources
defined in Python/YAML

Example:
```yaml
experimental:
  python:
    resources:
    - "resources:load_resources"
    mutators:
    - "mutators:add_email_notifications"
```

## Tests
Unit tests and manually

---------

Co-authored-by: Pieter Noordhuis <pieter.noordhuis@databricks.com>
2025-01-08 09:29:45 +00:00
Ilya Kuznetsov fe6ba76b7d fix: Styling 2025-01-07 16:52:01 +01:00
Ilya Kuznetsov c6703c1363 fix: Updated styles 2025-01-03 13:52:59 +01:00
Denis Bilenko 39d1e8093f
Enable intrange linter and apply autofix (#2069)
New construct in Go1.22+ for integer iteration:
https://github.com/ckaznocha/intrange?tab=readme-ov-file#intrange
2025-01-03 09:25:07 +00:00
Ilya Kuznetsov 2aadfcbcb2
feat: Support for resources 2025-01-02 18:24:18 +01:00
Ilya Kuznetsov 541c3e3fb5
feat: More explicit type for arrays 2025-01-02 16:56:36 +01:00
Ilya Kuznetsov 460a4558e0
chore: Extract annotation package 2025-01-02 16:40:06 +01:00
Ilya Kuznetsov 820dd5f34c
feat: Add examples to the docs 2025-01-02 16:13:24 +01:00
Denis Bilenko 0b80784df7
Enable testifylint and fix the issues (#2065)
## Changes
- Enable new linter: testifylint.
- Apply fixes with --fix.
- Fix remaining issues (mostly with aider).

There were 2 cases we --fix did the wrong thing - this seems to a be a
bug in linter: https://github.com/Antonboom/testifylint/issues/210

Nonetheless, I kept that check enabled, it seems useful, just need to be
fixed manually after autofix.

## Tests
Existing tests
2025-01-02 12:03:41 +01:00
Ilya Kuznetsov 793bf2b995
fix: Empty schema fields in OpenAPI spec (#2045)
## Changes

1. Removes default yaml-fields during schema generation, caused by [this
PR](https://github.com/databricks/cli/pull/2032) (current yaml package
can't read `json` annotations in struct fields)
2. Addresses missing annotations for fields from OpenAPI spec, which are
named differently in go SDK
3. Adds filtering for annotations.yaml to include only CLI package
fields
4. Implements alphabetical sort for yaml keys to avoid unnecessary diff
in PRs

## Tests

Manually tested
2024-12-23 12:08:01 +00:00
Ilya Kuznetsov 40c4b3a40a
Merge branch 'main' of github.com:databricks/cli into feat/config-reference-doc-autogen 2024-12-23 12:25:29 +01:00
Denis Bilenko dd9f59837e
Upgrade go to 1.23.4 (#2038)
## Changes
`git grep -l 1.23.2 | xargs -n 1 sed -i '' 's/1.23.2/1.23.4/'`

## Tests
Existing tests
2024-12-20 09:21:36 +00:00
Pieter Noordhuis 965a3fcd53
Remove dependency on ghodss/yaml (#2032)
## Changes

I noticed that #1957 took a dep on this library even though we no longer
need it. This change removes the dep and cleans up other (unused) uses
of the library. We originally relied on this library to deserialize
bundle configuration and JSON payloads to non-bundle CLI commands.

Relevant commits:
* The YAML flag was added to support apps (very early), and is not
longer used: e408b701
* First use for bundle configuration loading: e47fa619
* Switch bundle configuration loading to use `libs/dyn`: 87dd46a3

## Tests

The build works without the dependency.
2024-12-19 08:23:05 +00:00
Ilya Kuznetsov 64fa2bfcb7 fix: Small readme 2024-12-18 21:49:42 +01:00
Ilya Kuznetsov 10e0d276c8
fix: Remove extra headings 2024-12-18 21:12:44 +01:00
Ilya Kuznetsov cfa2be3c35
fix: Remove openAPI docs 2024-12-18 20:53:38 +01:00
Ilya Kuznetsov fe4c6b8a68
fix: Styling issues 2024-12-18 19:59:08 +01:00
Ilya Kuznetsov e27cc9a686 fix: Custom table markup changes 2024-12-18 19:20:13 +01:00
Ilya Kuznetsov 8c58d485b5
tmp: Documentation autogeneration script 2024-12-18 17:07:09 +01:00
Andrew Nester e3b256e753
Upgrade TF provider to 1.62.0 (#2030)
## Changes
* Added support for `IsSingleNode`, `Kind` and `UseMlRuntime` for
clusters
* Added support for `CleanRoomsNotebookTask`
* `DaysOfWeek` for pipeline restart window is now a list
2024-12-18 14:03:08 +00:00
Andrew Nester 59f0859e00
Upgrade Go SDK to 0.54.0 (#2029)
## Changes

* Added
[a.AccountFederationPolicy](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/oauth2#AccountFederationPolicyAPI)
account-level service and
[a.ServicePrincipalFederationPolicy](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/oauth2#ServicePrincipalFederationPolicyAPI)
account-level service.
* Added `IsSingleNode`, `Kind` and `UseMlRuntime` fields for Cluster
commands.
* Added `UpdateParameterSyntax` field for
[dashboards.MigrateDashboardRequest](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/dashboards#MigrateDashboardRequest).
2024-12-18 12:43:27 +00:00
Ilya Kuznetsov 042c8d88c6
Custom annotations for bundle-specific JSON schema fields (#1957)
## Changes

Adds annotations to json-schema for fields which are not covered by
OpenAPI spec.

Custom descriptions were copy-pasted from documentation PR which is
still WIP so descriptions for some fields are missing

Further improvements:
* documentation autogen based on json-schema
* fix missing descriptions

## Tests

This script is not part of CLI package so I didn't test all corner
cases. Few high-level tests were added to be sure that schema
annotations is in sync with actual config

---------

Co-authored-by: Pieter Noordhuis <pieter.noordhuis@databricks.com>
2024-12-18 10:19:14 +00:00
dependabot[bot] d929ea3eef
Bump golang.org/x/crypto from 0.30.0 to 0.31.0 in /bundle/internal/tf/codegen (#2005)
Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from
0.30.0 to 0.31.0.
<details>
<summary>Commits</summary>
<ul>
<li><a
href="b4f1988a35"><code>b4f1988</code></a>
ssh: make the public key cache a 1-entry FIFO cache</li>
<li>See full diff in <a
href="https://github.com/golang/crypto/compare/v0.30.0...v0.31.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=golang.org/x/crypto&package-manager=go_modules&previous-version=0.30.0&new-version=0.31.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the
[Security Alerts
page](https://github.com/databricks/cli/network/alerts).

</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-16 08:55:33 +01:00
Andrew Nester 58dfa70e50
Upgrade TF provider to 1.61.0 (#2011)
## Changes
Upgraded to TF provider 1.61.0

### New Features and Improvements
- Added databricks_app resource and data source
(https://github.com/databricks/terraform-provider-databricks/pull/4099).
- Added databricks_credentials resource and data source
2024-12-13 15:55:49 +00:00