Skip to content

Commit 38efedc

Browse files
authored
Remove bundle.git.inferred (#2258)
The only use case for it was to emit a warning and based on the discussion here https://github.com/databricks/cli/pull/2213/files#r1933558087 the warning it not useful and logging that with reduced severity is also not useful.
1 parent c3a6e11 commit 38efedc

File tree

9 files changed

+8
-34
lines changed

9 files changed

+8
-34
lines changed

acceptance/bundle/git-permerror/output.txt

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ Error: unable to load repository specific gitconfig: open config: permission den
2121

2222
Exit code: 1
2323
{
24-
"bundle_root_path": ".",
25-
"inferred": true
24+
"bundle_root_path": "."
2625
}
2726

2827
>>> withdir subdir/a/b $CLI bundle validate -o json
@@ -31,8 +30,7 @@ Error: unable to load repository specific gitconfig: open config: permission den
3130

3231
Exit code: 1
3332
{
34-
"bundle_root_path": ".",
35-
"inferred": true
33+
"bundle_root_path": "."
3634
}
3735

3836

@@ -42,14 +40,12 @@ Exit code: 1
4240

4341
>>> $CLI bundle validate -o json
4442
{
45-
"bundle_root_path": ".",
46-
"inferred": true
43+
"bundle_root_path": "."
4744
}
4845

4946
>>> withdir subdir/a/b $CLI bundle validate -o json
5047
{
51-
"bundle_root_path": ".",
52-
"inferred": true
48+
"bundle_root_path": "."
5349
}
5450

5551

@@ -63,8 +59,7 @@ Error: unable to load repository specific gitconfig: open config: permission den
6359

6460
Exit code: 1
6561
{
66-
"bundle_root_path": ".",
67-
"inferred": true
62+
"bundle_root_path": "."
6863
}
6964

7065
>>> withdir subdir/a/b $CLI bundle validate -o json
@@ -73,6 +68,5 @@ Error: unable to load repository specific gitconfig: open config: permission den
7368

7469
Exit code: 1
7570
{
76-
"bundle_root_path": ".",
77-
"inferred": true
71+
"bundle_root_path": "."
7872
}

acceptance/bundle/variables/prepend-workspace-var/output.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
"bundle": {
44
"environment": "dev",
55
"git": {
6-
"bundle_root_path": ".",
7-
"inferred": true
6+
"bundle_root_path": "."
87
},
98
"target": "dev",
109
"terraform": {

bundle/config/git.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@ type Git struct {
88
// Path to bundle root relative to the git repository root.
99
BundleRootPath string `json:"bundle_root_path,omitempty" bundle:"readonly"`
1010

11-
// Inferred is set to true if the Git details were inferred and weren't set explicitly
12-
Inferred bool `json:"inferred,omitempty" bundle:"readonly"`
13-
1411
// The actual branch according to Git (may be different from the configured branch)
1512
ActualBranch string `json:"actual_branch,omitempty" bundle:"readonly"`
1613
}

bundle/config/mutator/load_git_details.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ func (m *loadGitDetails) Apply(ctx context.Context, b *bundle.Bundle) diag.Diagn
4040
b.Config.Bundle.Git.ActualBranch = info.CurrentBranch
4141
if b.Config.Bundle.Git.Branch == "" {
4242
// Only load branch if there's no user defined value
43-
b.Config.Bundle.Git.Inferred = true
4443
b.Config.Bundle.Git.Branch = info.CurrentBranch
4544
}
4645

bundle/config/mutator/process_target_mode.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,6 @@ func findNonUserPath(b *bundle.Bundle) string {
135135
}
136136

137137
func validateProductionMode(ctx context.Context, b *bundle.Bundle, isPrincipalUsed bool) diag.Diagnostics {
138-
if b.Config.Bundle.Git.Inferred {
139-
env := b.Config.Bundle.Target
140-
log.Warnf(ctx, "target with 'mode: production' should specify an explicit 'targets.%s.git' configuration", env)
141-
}
142-
143138
r := b.Config.Resources
144139
for i := range r.Pipelines {
145140
if r.Pipelines[i].Development {

bundle/deploy/metadata/compute_test.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ func TestComputeMetadataMutator(t *testing.T) {
3131
OriginURL: "www.host.com",
3232
Commit: "abcd",
3333
BundleRootPath: "a/b/c/d",
34-
Inferred: true,
3534
},
3635
},
3736
Resources: config.Resources{
@@ -72,9 +71,6 @@ func TestComputeMetadataMutator(t *testing.T) {
7271
OriginURL: "www.host.com",
7372
Commit: "abcd",
7473
BundleRootPath: "a/b/c/d",
75-
76-
// Test that this field doesn't carry over into the metadata.
77-
Inferred: false,
7874
},
7975
},
8076
Resources: metadata.Resources{

bundle/tests/environment_git_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,13 @@ import (
1313
func TestGitAutoLoadWithEnvironment(t *testing.T) {
1414
b := load(t, "./environments_autoload_git")
1515
bundle.Apply(context.Background(), b, mutator.LoadGitDetails())
16-
assert.True(t, b.Config.Bundle.Git.Inferred)
1716
validUrl := strings.Contains(b.Config.Bundle.Git.OriginURL, "/cli") || strings.Contains(b.Config.Bundle.Git.OriginURL, "/bricks")
1817
assert.True(t, validUrl, "Expected URL to contain '/cli' or '/bricks', got %s", b.Config.Bundle.Git.OriginURL)
1918
}
2019

2120
func TestGitManuallySetBranchWithEnvironment(t *testing.T) {
2221
b := loadTarget(t, "./environments_autoload_git", "production")
2322
bundle.Apply(context.Background(), b, mutator.LoadGitDetails())
24-
assert.False(t, b.Config.Bundle.Git.Inferred)
2523
assert.Equal(t, "main", b.Config.Bundle.Git.Branch)
2624
validUrl := strings.Contains(b.Config.Bundle.Git.OriginURL, "/cli") || strings.Contains(b.Config.Bundle.Git.OriginURL, "/bricks")
2725
assert.True(t, validUrl, "Expected URL to contain '/cli' or '/bricks', got %s", b.Config.Bundle.Git.OriginURL)

bundle/tests/git_test.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,13 @@ import (
1414
func TestGitAutoLoad(t *testing.T) {
1515
b := load(t, "./autoload_git")
1616
bundle.Apply(context.Background(), b, mutator.LoadGitDetails())
17-
assert.True(t, b.Config.Bundle.Git.Inferred)
1817
validUrl := strings.Contains(b.Config.Bundle.Git.OriginURL, "/cli") || strings.Contains(b.Config.Bundle.Git.OriginURL, "/bricks")
1918
assert.True(t, validUrl, "Expected URL to contain '/cli' or '/bricks', got %s", b.Config.Bundle.Git.OriginURL)
2019
}
2120

2221
func TestGitManuallySetBranch(t *testing.T) {
2322
b := loadTarget(t, "./autoload_git", "production")
2423
bundle.Apply(context.Background(), b, mutator.LoadGitDetails())
25-
assert.False(t, b.Config.Bundle.Git.Inferred)
2624
assert.Equal(t, "main", b.Config.Bundle.Git.Branch)
2725
validUrl := strings.Contains(b.Config.Bundle.Git.OriginURL, "/cli") || strings.Contains(b.Config.Bundle.Git.OriginURL, "/bricks")
2826
assert.True(t, validUrl, "Expected URL to contain '/cli' or '/bricks', got %s", b.Config.Bundle.Git.OriginURL)
@@ -36,7 +34,6 @@ func TestGitBundleBranchValidation(t *testing.T) {
3634

3735
b := load(t, "./git_branch_validation")
3836
bundle.Apply(context.Background(), b, mutator.LoadGitDetails())
39-
assert.False(t, b.Config.Bundle.Git.Inferred)
4037
assert.Equal(t, "feature-a", b.Config.Bundle.Git.Branch)
4138
assert.Equal(t, "feature-b", b.Config.Bundle.Git.ActualBranch)
4239

integration/bundle/testdata/default_python/bundle_summary.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
"exec_path": "/tmp/.../terraform"
88
},
99
"git": {
10-
"bundle_root_path": ".",
11-
"inferred": true
10+
"bundle_root_path": "."
1211
},
1312
"mode": "development",
1413
"deployment": {

0 commit comments

Comments
 (0)