Skip to content

Conversation

@KunalSachdev2005
Copy link

Fixes #4315

Changes

  • Added ConvertAlertToValueWithDefinition function to embed alert definition in YAML
  • Added --yaml flag to bundle generate alert command
  • When --yaml is used, alert definition is embedded directly in YAML config
  • When --yaml is not used, maintains existing behavior with separate .dbalert.json file
  • Added acceptance test for --yaml flag functionality

Why

This allows users to manage their entire alert configuration in a single YAML file instead of maintaining separate .dbalert.json files. It makes version control simpler (one file to track), leads to easier code reviews (all changes are in one place), and it makes it more convenient for users who prefer YAML over JSON.

Tests

  • Added acceptance test in acceptance/bundle/generate/alert_yaml/
  • Test skips in local mode (requires cloud credentials) - this is the same behavior as existing alert tests
  • Existing bundle generate alert test still passes (I verified backward compatibility)
  • Lint and build checks pass

Example Usage

Without --yaml (existing behavior):

databricks bundle generate alert --existing-id abc123

Creates: resources/alert.yml + src/alert.dbalert.json

With --yaml (new feature):

databricks bundle generate alert --existing-id abc123 --yaml

Creates: resources/alert.yml (with embedded definition)

- Add ConvertAlertToValueWithDefinition function to embed alert definition in YAML
- Add --yaml flag to bundle generate alert command
- When --yaml is used, alert definition is embedded directly in YAML config
- When --yaml is not used, maintains existing behavior with separate .dbalert.json file
- Add acceptance test for --yaml flag functionality

Fixes databricks#4315

Signed-off-by: Kunal Sachdev <kunalmgsachdev@gmail.com>
@github-actions
Copy link

An authorized user can trigger integration tests manually by following the instructions below:

Trigger:
go/deco-tests-run/cli

Inputs:

  • PR number: 4379
  • Commit SHA: 957a37350b671384c03ae54cf82f4f47517b8c84

Checks will be approved automatically on success.

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.

Add --yaml flag to the bundle generate alert command

1 participant