Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use allowlist for Git-related fields to include in metadata #1187

Merged
merged 1 commit into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions bundle/deploy/metadata/compute.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"path/filepath"

"github.com/databricks/cli/bundle"
"github.com/databricks/cli/bundle/config"
"github.com/databricks/cli/bundle/metadata"
)

Expand All @@ -25,8 +26,13 @@ func (m *compute) Apply(_ context.Context, b *bundle.Bundle) error {
Config: metadata.Config{},
}

// Set git details in metadata
b.Metadata.Config.Bundle.Git = b.Config.Bundle.Git
// Set Git details in metadata
b.Metadata.Config.Bundle.Git = config.Git{
Branch: b.Config.Bundle.Git.Branch,
OriginURL: b.Config.Bundle.Git.OriginURL,
Commit: b.Config.Bundle.Git.Commit,
BundleRootPath: b.Config.Bundle.Git.BundleRootPath,
}

// Set job config paths in metadata
jobsMetadata := make(map[string]*metadata.Job)
Expand Down
4 changes: 4 additions & 0 deletions bundle/deploy/metadata/compute_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ func TestComputeMetadataMutator(t *testing.T) {
OriginURL: "www.host.com",
Commit: "abcd",
BundleRootPath: "a/b/c/d",
Inferred: true,
},
},
Resources: config.Resources{
Expand Down Expand Up @@ -76,6 +77,9 @@ func TestComputeMetadataMutator(t *testing.T) {
OriginURL: "www.host.com",
Commit: "abcd",
BundleRootPath: "a/b/c/d",

// Test that this field doesn't carry over into the metadata.
Inferred: false,
},
},
Resources: metadata.Resources{
Expand Down
Loading