mirror of https://github.com/databricks/cli.git
Compare commits
No commits in common. "8053e9c4e48501e1b5476f2cbb329a14a6e0b897" and "e57cbf1273a43fb6042e4a33634f1ffd10c08dea" have entirely different histories.
8053e9c4e4
...
e57cbf1273
|
@ -17,6 +17,7 @@ import (
|
||||||
"github.com/databricks/cli/bundle/env"
|
"github.com/databricks/cli/bundle/env"
|
||||||
"github.com/databricks/cli/bundle/metadata"
|
"github.com/databricks/cli/bundle/metadata"
|
||||||
"github.com/databricks/cli/libs/fileset"
|
"github.com/databricks/cli/libs/fileset"
|
||||||
|
"github.com/databricks/cli/libs/git"
|
||||||
"github.com/databricks/cli/libs/locker"
|
"github.com/databricks/cli/libs/locker"
|
||||||
"github.com/databricks/cli/libs/log"
|
"github.com/databricks/cli/libs/log"
|
||||||
"github.com/databricks/cli/libs/tags"
|
"github.com/databricks/cli/libs/tags"
|
||||||
|
@ -222,6 +223,15 @@ func (b *Bundle) GetSyncIncludePatterns(ctx context.Context) ([]string, error) {
|
||||||
return append(b.Config.Sync.Include, filepath.ToSlash(filepath.Join(internalDirRel, "*.*"))), nil
|
return append(b.Config.Sync.Include, filepath.ToSlash(filepath.Join(internalDirRel, "*.*"))), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (b *Bundle) GitRepository() (*git.Repository, error) {
|
||||||
|
_, err := vfs.FindLeafInTree(b.BundleRoot, ".git")
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("unable to locate repository root: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return git.NewRepository(b.BundleRoot)
|
||||||
|
}
|
||||||
|
|
||||||
// AuthEnv returns a map with environment variables and their values
|
// AuthEnv returns a map with environment variables and their values
|
||||||
// derived from the workspace client configuration that was resolved
|
// derived from the workspace client configuration that was resolved
|
||||||
// in the context of this bundle.
|
// in the context of this bundle.
|
||||||
|
|
|
@ -41,9 +41,6 @@ type ConfigResource interface {
|
||||||
|
|
||||||
// InitializeURL initializes the URL field of the resource.
|
// InitializeURL initializes the URL field of the resource.
|
||||||
InitializeURL(baseURL url.URL)
|
InitializeURL(baseURL url.URL)
|
||||||
|
|
||||||
// IsNil returns true if the resource is nil, for example, when it was removed from the bundle.
|
|
||||||
IsNil() bool
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ResourceGroup represents a group of resources of the same type.
|
// ResourceGroup represents a group of resources of the same type.
|
||||||
|
@ -60,9 +57,6 @@ func collectResourceMap[T ConfigResource](
|
||||||
) ResourceGroup {
|
) ResourceGroup {
|
||||||
resources := make(map[string]ConfigResource)
|
resources := make(map[string]ConfigResource)
|
||||||
for key, resource := range input {
|
for key, resource := range input {
|
||||||
if resource.IsNil() {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
resources[key] = resource
|
resources[key] = resource
|
||||||
}
|
}
|
||||||
return ResourceGroup{
|
return ResourceGroup{
|
||||||
|
|
|
@ -56,7 +56,3 @@ func (s *Cluster) GetName() string {
|
||||||
func (s *Cluster) GetURL() string {
|
func (s *Cluster) GetURL() string {
|
||||||
return s.URL
|
return s.URL
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Cluster) IsNil() bool {
|
|
||||||
return s.ClusterSpec == nil
|
|
||||||
}
|
|
||||||
|
|
|
@ -79,7 +79,3 @@ func (r *Dashboard) GetName() string {
|
||||||
func (r *Dashboard) GetURL() string {
|
func (r *Dashboard) GetURL() string {
|
||||||
return r.URL
|
return r.URL
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *Dashboard) IsNil() bool {
|
|
||||||
return r.Dashboard == nil
|
|
||||||
}
|
|
||||||
|
|
|
@ -63,7 +63,3 @@ func (j *Job) GetName() string {
|
||||||
func (j *Job) GetURL() string {
|
func (j *Job) GetURL() string {
|
||||||
return j.URL
|
return j.URL
|
||||||
}
|
}
|
||||||
|
|
||||||
func (j *Job) IsNil() bool {
|
|
||||||
return j.JobSettings == nil
|
|
||||||
}
|
|
||||||
|
|
|
@ -58,7 +58,3 @@ func (s *MlflowExperiment) GetName() string {
|
||||||
func (s *MlflowExperiment) GetURL() string {
|
func (s *MlflowExperiment) GetURL() string {
|
||||||
return s.URL
|
return s.URL
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *MlflowExperiment) IsNil() bool {
|
|
||||||
return s.Experiment == nil
|
|
||||||
}
|
|
||||||
|
|
|
@ -58,7 +58,3 @@ func (s *MlflowModel) GetName() string {
|
||||||
func (s *MlflowModel) GetURL() string {
|
func (s *MlflowModel) GetURL() string {
|
||||||
return s.URL
|
return s.URL
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *MlflowModel) IsNil() bool {
|
|
||||||
return s.Model == nil
|
|
||||||
}
|
|
||||||
|
|
|
@ -66,7 +66,3 @@ func (s *ModelServingEndpoint) GetName() string {
|
||||||
func (s *ModelServingEndpoint) GetURL() string {
|
func (s *ModelServingEndpoint) GetURL() string {
|
||||||
return s.URL
|
return s.URL
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *ModelServingEndpoint) IsNil() bool {
|
|
||||||
return s.CreateServingEndpoint == nil
|
|
||||||
}
|
|
||||||
|
|
|
@ -58,7 +58,3 @@ func (p *Pipeline) GetName() string {
|
||||||
func (s *Pipeline) GetURL() string {
|
func (s *Pipeline) GetURL() string {
|
||||||
return s.URL
|
return s.URL
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Pipeline) IsNil() bool {
|
|
||||||
return s.PipelineSpec == nil
|
|
||||||
}
|
|
||||||
|
|
|
@ -62,7 +62,3 @@ func (s *QualityMonitor) GetName() string {
|
||||||
func (s *QualityMonitor) GetURL() string {
|
func (s *QualityMonitor) GetURL() string {
|
||||||
return s.URL
|
return s.URL
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *QualityMonitor) IsNil() bool {
|
|
||||||
return s.CreateMonitor == nil
|
|
||||||
}
|
|
||||||
|
|
|
@ -68,7 +68,3 @@ func (s *RegisteredModel) GetName() string {
|
||||||
func (s *RegisteredModel) GetURL() string {
|
func (s *RegisteredModel) GetURL() string {
|
||||||
return s.URL
|
return s.URL
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *RegisteredModel) IsNil() bool {
|
|
||||||
return s.CreateRegisteredModelRequest == nil
|
|
||||||
}
|
|
||||||
|
|
|
@ -56,7 +56,3 @@ func (s *Schema) UnmarshalJSON(b []byte) error {
|
||||||
func (s Schema) MarshalJSON() ([]byte, error) {
|
func (s Schema) MarshalJSON() ([]byte, error) {
|
||||||
return marshal.Marshal(s)
|
return marshal.Marshal(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Schema) IsNil() bool {
|
|
||||||
return s.CreateSchema == nil
|
|
||||||
}
|
|
||||||
|
|
|
@ -519,10 +519,6 @@ func TestRenderSummary(t *testing.T) {
|
||||||
URL: "https://url2",
|
URL: "https://url2",
|
||||||
JobSettings: &jobs.JobSettings{Name: "job2-name"},
|
JobSettings: &jobs.JobSettings{Name: "job2-name"},
|
||||||
},
|
},
|
||||||
"job3": {
|
|
||||||
ID: "3",
|
|
||||||
URL: "https://url3", // This emulates deleted job
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
Pipelines: map[string]*resources.Pipeline{
|
Pipelines: map[string]*resources.Pipeline{
|
||||||
"pipeline2": {
|
"pipeline2": {
|
||||||
|
|
|
@ -6,8 +6,6 @@ import (
|
||||||
"github.com/databricks/cli/bundle"
|
"github.com/databricks/cli/bundle"
|
||||||
"github.com/databricks/cli/bundle/config"
|
"github.com/databricks/cli/bundle/config"
|
||||||
"github.com/databricks/cli/bundle/config/resources"
|
"github.com/databricks/cli/bundle/config/resources"
|
||||||
"github.com/databricks/databricks-sdk-go/service/jobs"
|
|
||||||
"github.com/databricks/databricks-sdk-go/service/pipelines"
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -16,17 +14,11 @@ func TestCompletions_SkipDuplicates(t *testing.T) {
|
||||||
Config: config.Root{
|
Config: config.Root{
|
||||||
Resources: config.Resources{
|
Resources: config.Resources{
|
||||||
Jobs: map[string]*resources.Job{
|
Jobs: map[string]*resources.Job{
|
||||||
"foo": {
|
"foo": {},
|
||||||
JobSettings: &jobs.JobSettings{},
|
"bar": {},
|
||||||
},
|
|
||||||
"bar": {
|
|
||||||
JobSettings: &jobs.JobSettings{},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
Pipelines: map[string]*resources.Pipeline{
|
Pipelines: map[string]*resources.Pipeline{
|
||||||
"foo": {
|
"foo": {},
|
||||||
PipelineSpec: &pipelines.PipelineSpec{},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -44,14 +36,10 @@ func TestCompletions_Filter(t *testing.T) {
|
||||||
Config: config.Root{
|
Config: config.Root{
|
||||||
Resources: config.Resources{
|
Resources: config.Resources{
|
||||||
Jobs: map[string]*resources.Job{
|
Jobs: map[string]*resources.Job{
|
||||||
"foo": {
|
"foo": {},
|
||||||
JobSettings: &jobs.JobSettings{},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
Pipelines: map[string]*resources.Pipeline{
|
Pipelines: map[string]*resources.Pipeline{
|
||||||
"bar": {
|
"bar": {},
|
||||||
PipelineSpec: &pipelines.PipelineSpec{},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -7,7 +7,6 @@ import (
|
||||||
"github.com/databricks/cli/bundle/config"
|
"github.com/databricks/cli/bundle/config"
|
||||||
"github.com/databricks/cli/bundle/config/resources"
|
"github.com/databricks/cli/bundle/config/resources"
|
||||||
"github.com/databricks/databricks-sdk-go/service/jobs"
|
"github.com/databricks/databricks-sdk-go/service/jobs"
|
||||||
"github.com/databricks/databricks-sdk-go/service/pipelines"
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
@ -29,12 +28,8 @@ func TestLookup_NotFound(t *testing.T) {
|
||||||
Config: config.Root{
|
Config: config.Root{
|
||||||
Resources: config.Resources{
|
Resources: config.Resources{
|
||||||
Jobs: map[string]*resources.Job{
|
Jobs: map[string]*resources.Job{
|
||||||
"foo": {
|
"foo": {},
|
||||||
JobSettings: &jobs.JobSettings{},
|
"bar": {},
|
||||||
},
|
|
||||||
"bar": {
|
|
||||||
JobSettings: &jobs.JobSettings{},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -50,14 +45,10 @@ func TestLookup_MultipleFound(t *testing.T) {
|
||||||
Config: config.Root{
|
Config: config.Root{
|
||||||
Resources: config.Resources{
|
Resources: config.Resources{
|
||||||
Jobs: map[string]*resources.Job{
|
Jobs: map[string]*resources.Job{
|
||||||
"foo": {
|
"foo": {},
|
||||||
JobSettings: &jobs.JobSettings{},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
Pipelines: map[string]*resources.Pipeline{
|
Pipelines: map[string]*resources.Pipeline{
|
||||||
"foo": {
|
"foo": {},
|
||||||
PipelineSpec: &pipelines.PipelineSpec{},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -101,14 +92,10 @@ func TestLookup_NominalWithFilters(t *testing.T) {
|
||||||
Config: config.Root{
|
Config: config.Root{
|
||||||
Resources: config.Resources{
|
Resources: config.Resources{
|
||||||
Jobs: map[string]*resources.Job{
|
Jobs: map[string]*resources.Job{
|
||||||
"foo": {
|
"foo": {},
|
||||||
JobSettings: &jobs.JobSettings{},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
Pipelines: map[string]*resources.Pipeline{
|
Pipelines: map[string]*resources.Pipeline{
|
||||||
"bar": {
|
"bar": {},
|
||||||
PipelineSpec: &pipelines.PipelineSpec{},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue