Skip to content

Commit

Permalink
remove paths.Paths from artifacts as well
Browse files Browse the repository at this point in the history
  • Loading branch information
shreyas-goenka committed Aug 12, 2024
1 parent 2ad2c45 commit de37e2f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
19 changes: 13 additions & 6 deletions bundle/artifacts/prepare.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,27 @@ func (m *prepare) Apply(ctx context.Context, b *bundle.Bundle) diag.Diagnostics
return diag.Errorf("artifact doesn't exist: %s", m.name)
}

// If artifact path is not provided, use bundle root dir
if artifact.Path == "" {
artifact.Path = b.RootPath
}

// TODO: Do we even need implict dyn value in convert to_typed anymore?
// worth asking in the PR.

// TODO: Is this change covered by unit tessts?
l := b.Config.GetLocation("artifacts.%s.")
dirPath := filepath.Dir(l.File)

// Check if source paths are absolute, if not, make them absolute
for k := range artifact.Files {
f := &artifact.Files[k]
if !filepath.IsAbs(f.Source) {
dirPath := filepath.Dir(artifact.DynamicValue.Location().File)
f.Source = filepath.Join(dirPath, f.Source)
}
}

// If artifact path is not provided, use bundle root dir
if artifact.Path == "" {
artifact.Path = b.RootPath
}

// Check if artifact path is absolute, if not, make it absolute
if !filepath.IsAbs(artifact.Path) {
dirPath := filepath.Dir(artifact.DynamicValue.Location().File)
artifact.Path = filepath.Join(dirPath, artifact.Path)
Expand Down
4 changes: 0 additions & 4 deletions bundle/config/resources/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,13 @@ import (
"context"
"strconv"

"github.com/databricks/cli/libs/dyn"
"github.com/databricks/cli/libs/log"
"github.com/databricks/databricks-sdk-go"
"github.com/databricks/databricks-sdk-go/marshal"
"github.com/databricks/databricks-sdk-go/service/jobs"
)

type Job struct {
// Dynamic value representation of the resource.
DynamicValue dyn.Value

ID string `json:"id,omitempty" bundle:"readonly"`
Permissions []Permission `json:"permissions,omitempty"`
ModifiedStatus ModifiedStatus `json:"modified_status,omitempty" bundle:"internal"`
Expand Down

0 comments on commit de37e2f

Please sign in to comment.