mirror of https://github.com/databricks/cli.git
Use allowlist for Git-related fields to include in metadata (#1187)
## Changes When new fields are added they should not automatically propagate to the bundle metadata. ## Tests Test passes.
This commit is contained in:
parent
b1b5ad8acd
commit
f7d1a5862d
|
@ -6,6 +6,7 @@ import (
|
|||
"path/filepath"
|
||||
|
||||
"github.com/databricks/cli/bundle"
|
||||
"github.com/databricks/cli/bundle/config"
|
||||
"github.com/databricks/cli/bundle/metadata"
|
||||
)
|
||||
|
||||
|
@ -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)
|
||||
|
|
|
@ -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{
|
||||
|
@ -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{
|
||||
|
|
Loading…
Reference in New Issue