Commit Graph

1774 Commits

Author SHA1 Message Date
Shreyas Goenka 96ade4eee6
merge 2025-02-21 15:55:30 +01:00
shreyas-goenka ddcfac5069
Add library for spawning a daemon (#2354)
## Changes
This PR adds a library for spawning a daemon process. Our needs are
different from those of a typical daemon process in that we want to
handle being orphaned gracefully. This is because, in the vast majority
of telemetry use cases, the main CLI process (i.e., the parent process)
will exit before the telemetry process has a chance to finish uploading
the logs.

To achieve this we "detach" the child process from the parent process,
which requires different flags for UNIX vs. non-unix systems.

Here are the properties that we want to ensure for our telemetry
child/daemon processes:
1. They do not block the parent process. 
Reason: The main CLI process should not be blocked on the telemetry
child process.
2. The child can read from stdin. The parent can write to stdin. 
Reason: Telemetry logs will be passed to the child process via stdin.
3. Output logs do not leak from the child process.
    Reason: Telemetry logs should not be visible to users of the CLI.

## Tests
Unit test
2025-02-21 13:49:47 +00:00
Shreyas Goenka 18748f7879
rename 2025-02-18 17:26:16 +01:00
Ilya Kuznetsov 874a05a27b
Add escaping for links and headers in docsgen (#2330)
## Changes

To avoid build warnings and errors in docs build we need to escape
symbols that are treated as syntax elements

## Tests
<!-- How is this tested? -->
2025-02-18 16:12:49 +00:00
Shreyas Goenka 3cfeb640e1
add skip functionality 2025-02-18 16:47:47 +01:00
Shreyas Goenka a98993abfc
- 2025-02-18 16:35:14 +01:00
Shreyas Goenka 520f06905b
use daemon 2025-02-18 16:30:50 +01:00
Shreyas Goenka f48fbb950b
merge daemon 2025-02-18 16:06:24 +01:00
Shreyas Goenka 8a0b359f8f
Merge remote-tracking branch 'origin' into async-logger-clean 2025-02-18 16:04:50 +01:00
Shreyas Goenka 12f1fbdece
- 2025-02-18 15:02:56 +01:00
Shreyas Goenka 86428dab79
- 2025-02-18 15:02:37 +01:00
Shreyas Goenka f504343774
- 2025-02-18 14:59:54 +01:00
Shreyas Goenka dfd26e37ae
- 2025-02-18 14:59:29 +01:00
Shreyas Goenka c59b11f7c1
- 2025-02-18 14:52:25 +01:00
Shreyas Goenka 608f0ad94f
- 2025-02-18 14:51:03 +01:00
Shreyas Goenka 8eb454da14
- 2025-02-18 14:50:02 +01:00
Shreyas Goenka f6bd82d68f
add readme 2025-02-18 14:49:24 +01:00
Shreyas Goenka e649fc056b
- 2025-02-18 14:34:13 +01:00
Shreyas Goenka 75f3008b66
- 2025-02-18 14:33:41 +01:00
Shreyas Goenka 11af4ba964
delay closing output log file 2025-02-18 14:32:16 +01:00
Shreyas Goenka 6f63e14cb7
- 2025-02-18 14:26:56 +01:00
Shreyas Goenka f6a02237cf
extend timeout to 1 minute 2025-02-18 14:13:01 +01:00
Shreyas Goenka 50308f25a1
- 2025-02-18 13:17:14 +01:00
Shreyas Goenka b130787318
- 2025-02-18 13:16:35 +01:00
Shreyas Goenka a4009ed6fa
use script to wait 2025-02-18 13:14:29 +01:00
Shreyas Goenka 07141ba7ad
skip wait test on windows 2025-02-18 10:44:10 +01:00
Shreyas Goenka 403c1b2a0c
- 2025-02-17 23:02:17 +01:00
Shreyas Goenka a9ccc3285b
-' 2025-02-17 19:48:58 +01:00
Shreyas Goenka 2c7126991b
- 2025-02-17 19:39:18 +01:00
Shreyas Goenka ecbbee1bb3
more test 2025-02-17 19:38:33 +01:00
Shreyas Goenka 42c526f40f
- 2025-02-17 19:28:20 +01:00
Shreyas Goenka 3c4443c13f
cleanup 2025-02-17 19:27:53 +01:00
Shreyas Goenka e970a129af
- 2025-02-17 19:26:06 +01:00
Shreyas Goenka d15ff75f3b
- 2025-02-17 19:24:51 +01:00
Shreyas Goenka de6ebdb44e
Merge remote-tracking branch 'origin' into daemon-library 2025-02-17 19:24:31 +01:00
Shreyas Goenka 533e7be51b
- 2025-02-17 19:24:11 +01:00
Shreyas Goenka 6148681ed1
implement 2025-02-17 19:23:02 +01:00
Lennart Kats (databricks) bc30d44097
Provide instructions for testing in the default-python template (#2355)
## Changes
Adds instructions for testing to the default-python template.

## Tests
- Unit & acceptance tests.
2025-02-17 12:38:03 +00:00
Denis Bilenko c0a56a93fb
acc: add a helper to diff with replacements (#2352)
## Changes

diff.py is like "diff -r -U2" but it applies replacements first to the
argument.

This allows comparing different output files and directories but ignore
differences that are going to be replaced by placeholders.

This is useful for tests that record large amount of files, specifically
"bundle init" with standard templates. In those tests, changing one
parameter results in a small diff so recording the full directory is not
helpful, because it's hard to see what changed there. I'm using it in
implementation of serverless mode for templates that need it: #2348 The
serverless templates are slightly different from classic, capturing the
diff helps to see exactly where.

Related small changes:
- Add [TESTROOT] replacement for absolute path to acceptance directory
in git repo.
- Add $TESTDIR env var for absolute path to a given test in git repo.

## Tests
- New test acceptance/selftest/diff to test the helper.
- Via #2348 which makes use of this feature.
2025-02-14 11:02:12 +00:00
Shreyas Goenka d86ccf6b49
Add library for spawning a daemon 2025-02-13 19:00:13 +01:00
Denis Bilenko 2d09636611
acc: do not show diff for missing output file (#2350)
It's not interesting since it just dumps what is in the repo. This is
especially annoying with bundle/templates tests with a lot of files.
2025-02-13 07:31:04 +00:00
Denis Bilenko fac9bcf1af
acc: Set X-Databricks-Org-Id on scim/v2/Me endpoint (#2349)
This is needed for b.WorkspaceClient().CurrentWorkspaceID(ctx) which is
used by initialize_urls.go mutator ("bundle summary") #2316

It also also needed for to call serverless detection endpoint #2348

Builds on top of #2338
2025-02-13 07:26:22 +00:00
Pieter Noordhuis a20894b1f2
[Release] Release v0.241.2 (#2346)
This is a bugfix release to address an issue where jobs with tasks with
a
libraries section with PyPI packages could not be deployed.

Bundles:
* Revert changes related to basename check for local libraries
([#2345](https://github.com/databricks/cli/pull/2345)).
2025-02-12 20:21:48 +01:00
Pieter Noordhuis 96302c7415
Revert changes related to basename check for local libraries (#2345)
## Changes

These changes break the use of non-local libraries (such as PyPI
libraries).

This reverts the set so we can cut a patch release and take a closer
look later.

Original PRs are #2297 and #2341.

Issue reported in #2343.

## Tests

Manually confirmed that a bundle with PyPI package in libraries now
deploys fine.
2025-02-12 20:05:49 +01:00
Andrew Nester 9c90984688
[Release] Release v0.241.1 (#2342)
Bundles:
* Fix for regression deploying resources with PyPi and Maven library
types ([#2341](https://github.com/databricks/cli/pull/2341)).
2025-02-12 17:17:38 +01:00
Andrew Nester ac439f8c1a
Fix for regression deploying resources with PyPi and Maven library types (#2341)
## Changes

The CheckForSameNameLibraries mutator incorrectly assumed all resource
libraries define libraries as paths of the `string` type, but some
libraries, such as PyPi and Maven, define them as objects.

This PR addresses this issue. It was introduced in #2297.

## Tests

Added regression test.
2025-02-12 17:14:30 +01:00
Andrew Nester 1dadc794f5
[Release] Release v0.241.0 (#2340)
Bundles:
* Added support to generate Git based jobs
([#2304](https://github.com/databricks/cli/pull/2304)).
* Added support for run_as in pipelines
([#2287](https://github.com/databricks/cli/pull/2287)).
* Raise an error when there are multiple local libraries with the same
basename used ([#2297](https://github.com/databricks/cli/pull/2297)).
* Fix env variable for AzureCli local config
([#2248](https://github.com/databricks/cli/pull/2248)).
* Accept JSON files in includes section
([#2265](https://github.com/databricks/cli/pull/2265)).
* Always print warnings and errors; clean up format
([#2213](https://github.com/databricks/cli/pull/2213))

API Changes:
 * Added `databricks account budget-policy` command group.
 * Added `databricks lakeview-embedded` command group.
 * Added `databricks query-execution` command group.
 * Added `databricks account enable-ip-access-lists` command group.
 * Added `databricks redash-config` command group.

OpenAPI commit c72c58f97b950fcb924a90ef164bcb10cfcd5ece (2025-02-03)
Dependency updates:
* Upgrade to TF provider 1.65.1
([#2328](https://github.com/databricks/cli/pull/2328)).
* Bump github.com/hashicorp/terraform-exec from 0.21.0 to 0.22.0
([#2237](https://github.com/databricks/cli/pull/2237)).
* Bump github.com/spf13/pflag from 1.0.5 to 1.0.6
([#2281](https://github.com/databricks/cli/pull/2281)).
* Bump github.com/databricks/databricks-sdk-go from 0.56.1 to 0.57.0
([#2321](https://github.com/databricks/cli/pull/2321)).
* Bump golang.org/x/oauth2 from 0.25.0 to 0.26.0
([#2322](https://github.com/databricks/cli/pull/2322)).
* Bump golang.org/x/term from 0.28.0 to 0.29.0
([#2325](https://github.com/databricks/cli/pull/2325)).
* Bump golang.org/x/text from 0.21.0 to 0.22.0
([#2323](https://github.com/databricks/cli/pull/2323)).
* Bump golang.org/x/mod from 0.22.0 to 0.23.0
([#2324](https://github.com/databricks/cli/pull/2324)).
2025-02-12 15:29:23 +01:00
Denis Bilenko 4034766c93
acc: Simplify writing handlers; support headers in responses (#2338)
## Changes

Handlers now receive testserver.Request and return any which could be
- string or []byte (returns it as is but sets content-type to json or
plain text depending on content)
- struct (encodes it as json and sets content-type to json)
- testserver.Response (full control over status and headers)

Note if testserver.Response is returned from the handler, it's Body
attribute can still be an object. In that case, it'll be serialized and
appropriate content-type header will be added.

The config is now using the same testserver.Response struct, the same
logic applies both configured responses and responses returned from
handlers.

As a result, one can set headers both in Golang handlers and in
test.toml.

This also fixes a bug with RecordRequest not seeing the body if it was
already consumed by the handler.

## Tests
- Existing rests. 
- acceptance/selftest/server is extended to set response header.
2025-02-12 13:00:57 +00:00
Denis Bilenko bfde3585b9
acc: Fix priority of stubs in test.toml (#2339)
## Changes
Reverse the order of stubs to match expectation (leaf configuration
takes precedence over parent configuration).
Follow up to #2334 .

## Tests
acceptance/selftest/server is extended with duplicate handler
2025-02-12 11:45:01 +00:00
Shreyas Goenka f98369d9e9
- 2025-02-11 17:58:15 +01:00