2022-11-18 09:57:31 +00:00
|
|
|
package config
|
|
|
|
|
2022-12-15 16:30:33 +00:00
|
|
|
type Terraform struct {
|
|
|
|
ExecPath string `json:"exec_path"`
|
|
|
|
}
|
|
|
|
|
2022-11-18 09:57:31 +00:00
|
|
|
type Bundle struct {
|
2023-02-17 01:49:39 +00:00
|
|
|
Name string `json:"name"`
|
2022-11-18 09:57:31 +00:00
|
|
|
|
|
|
|
// TODO
|
|
|
|
// Default cluster to run commands on (Python, Scala).
|
|
|
|
// DefaultCluster string `json:"default_cluster,omitempty"`
|
|
|
|
|
|
|
|
// TODO
|
|
|
|
// Default warehouse to run SQL on.
|
|
|
|
// DefaultWarehouse string `json:"default_warehouse,omitempty"`
|
2022-11-28 09:10:13 +00:00
|
|
|
|
2023-08-17 15:22:32 +00:00
|
|
|
// Target is set by the mutator that selects the target.
|
|
|
|
Target string `json:"target,omitempty" bundle:"readonly"`
|
|
|
|
|
2024-10-12 09:54:05 +00:00
|
|
|
// TargetConfig stores a snapshot of the target configuration when it was selected by SelectTarget.
|
|
|
|
TargetConfig *Target `json:"target_config,omitempty" bundle:"internal"`
|
|
|
|
|
2023-08-17 15:22:32 +00:00
|
|
|
// DEPRECATED. Left for backward compatibility with Target
|
2023-04-04 10:16:07 +00:00
|
|
|
Environment string `json:"environment,omitempty" bundle:"readonly"`
|
2022-12-15 16:30:33 +00:00
|
|
|
|
|
|
|
// Terraform holds configuration related to Terraform.
|
|
|
|
// For example, where to find the binary, which version to use, etc.
|
2023-04-04 10:16:07 +00:00
|
|
|
Terraform *Terraform `json:"terraform,omitempty" bundle:"readonly"`
|
2023-03-22 15:37:26 +00:00
|
|
|
|
2023-07-30 12:44:33 +00:00
|
|
|
// Force-override Git branch validation.
|
Persist deployment metadata in WSFS (#845)
## Changes
This PR introduces a metadata struct that stores a subset of bundle
configuration that we wish to expose to other Databricks services that
wish to integrate with bundles.
This metadata file is uploaded to a file
`${bundle.workspace.state_path}/metadata.json` in the WSFS destination
of the bundle deployment.
Documentation for emitted metadata fields:
* `version`: Version for the metadata file schema
* `config.bundle.git.branch`: Name of the git branch the bundle was
deployed from.
* `config.bundle.git.origin_url`: URL for git remote "origin"
* `config.bundle.git.bundle_root_path`: Relative path of the bundle root
from the root of the git repository. Is set to "." if they are the same.
* `config.bundle.git.commit`: SHA-1 commit hash of the exact commit this
bundle was deployed from. Note, the deployment might not exactly match
this commit version if there are changes that have not been committed to
git at deploy time,
* `file_path`: Path in workspace where we sync bundle files to.
* `resources.jobs.[job-ref].id`: Id of the job
* `resources.jobs.[job-ref].relative_path`: Relative path of the yaml
config file from the bundle root where this job was defined.
Example metadata object when bundle root and git root are the same:
```json
{
"version": 1,
"config": {
"bundle": {
"lock": {},
"git": {
"branch": "master",
"origin_url": "www.host.com",
"commit": "7af8e5d3f5dceffff9295d42d21606ccf056dce0",
"bundle_root_path": "."
}
},
"workspace": {
"file_path": "/Users/shreyas.goenka@databricks.com/.bundle/pipeline-progress/default/files"
},
"resources": {
"jobs": {
"bar": {
"id": "245921165354846",
"relative_path": "databricks.yml"
}
}
},
"sync": {}
}
}
```
Example metadata when the git root is one level above the bundle repo:
```json
{
"version": 1,
"config": {
"bundle": {
"lock": {},
"git": {
"branch": "dev-branch",
"origin_url": "www.my-repo.com",
"commit": "3db46ef750998952b00a2b3e7991e31787e4b98b",
"bundle_root_path": "pipeline-progress"
}
},
"workspace": {
"file_path": "/Users/shreyas.goenka@databricks.com/.bundle/pipeline-progress/default/files"
},
"resources": {
"jobs": {
"bar": {
"id": "245921165354846",
"relative_path": "databricks.yml"
}
}
},
"sync": {}
}
}
```
This unblocks integration to the jobs break glass UI for bundles.
## Tests
Unit tests and integration tests.
2023-10-27 12:55:43 +00:00
|
|
|
Force bool `json:"force,omitempty" bundle:"readonly"`
|
2023-07-30 12:44:33 +00:00
|
|
|
|
2023-04-26 14:54:36 +00:00
|
|
|
// Contains Git information like current commit, current branch and
|
|
|
|
// origin url. Automatically loaded by reading .git directory if not specified
|
2023-05-01 12:34:12 +00:00
|
|
|
Git Git `json:"git,omitempty"`
|
2023-07-12 06:51:54 +00:00
|
|
|
|
2023-08-17 15:22:32 +00:00
|
|
|
// Determines the mode of the target.
|
2023-07-12 06:51:54 +00:00
|
|
|
// For example, 'mode: development' can be used for deployments for
|
|
|
|
// development purposes.
|
2023-08-17 15:22:32 +00:00
|
|
|
// Annotated readonly as this should be set at the target level.
|
2023-07-12 06:51:54 +00:00
|
|
|
Mode Mode `json:"mode,omitempty" bundle:"readonly"`
|
|
|
|
|
2024-09-23 10:42:34 +00:00
|
|
|
// DEPRECATED: Overrides the compute used for jobs and other supported assets.
|
|
|
|
ComputeId string `json:"compute_id,omitempty"`
|
|
|
|
|
|
|
|
// Overrides the cluster used for jobs and other supported assets.
|
|
|
|
ClusterId string `json:"cluster_id,omitempty"`
|
2024-02-07 11:17:17 +00:00
|
|
|
|
|
|
|
// Deployment section specifies deployment related configuration for bundle
|
2024-03-27 13:37:59 +00:00
|
|
|
Deployment Deployment `json:"deployment,omitempty"`
|
2024-04-02 12:55:21 +00:00
|
|
|
|
|
|
|
// Databricks CLI version constraints required to run the bundle.
|
|
|
|
DatabricksCliVersion string `json:"databricks_cli_version,omitempty"`
|
2022-11-18 09:57:31 +00:00
|
|
|
}
|