2023-12-19 07:38:52 +00:00
|
|
|
package metadata
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
|
|
|
"github.com/databricks/cli/bundle"
|
2024-03-25 14:18:47 +00:00
|
|
|
"github.com/databricks/cli/libs/diag"
|
2023-12-19 07:38:52 +00:00
|
|
|
"github.com/databricks/databricks-sdk-go/service/jobs"
|
|
|
|
)
|
|
|
|
|
|
|
|
type annotateJobs struct{}
|
|
|
|
|
|
|
|
func AnnotateJobs() bundle.Mutator {
|
|
|
|
return &annotateJobs{}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *annotateJobs) Name() string {
|
|
|
|
return "metadata.AnnotateJobs"
|
|
|
|
}
|
|
|
|
|
2024-03-25 14:18:47 +00:00
|
|
|
func (m *annotateJobs) Apply(_ context.Context, b *bundle.Bundle) diag.Diagnostics {
|
2023-12-19 07:38:52 +00:00
|
|
|
for _, job := range b.Config.Resources.Jobs {
|
|
|
|
if job.JobSettings == nil {
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
|
|
|
|
job.JobSettings.Deployment = &jobs.JobDeployment{
|
|
|
|
Kind: jobs.JobDeploymentKindBundle,
|
2024-05-01 08:37:03 +00:00
|
|
|
MetadataFilePath: metadataFilePath(b),
|
2023-12-19 07:38:52 +00:00
|
|
|
}
|
2024-04-03 10:39:53 +00:00
|
|
|
job.JobSettings.EditMode = jobs.JobEditModeUiLocked
|
2023-12-19 07:38:52 +00:00
|
|
|
job.JobSettings.Format = jobs.FormatMultiTask
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|