Skip to content

Commit 474d3d0

Browse files
authored
fix glob pattern for impacted projects (#1989)
1 parent f89f081 commit 474d3d0

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

libs/digger_config/digger_config.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -866,11 +866,7 @@ func (c *DiggerConfig) GetModifiedProjects(changedFiles []string) ([]Project, ma
866866
includePatterns := project.IncludePatterns
867867
excludePatterns := project.ExcludePatterns
868868

869-
if !project.Terragrunt {
870-
includePatterns = append(includePatterns, filepath.Join(project.Dir, "**", "*"))
871-
} else {
872-
includePatterns = append(includePatterns, filepath.Join(project.Dir, "*"))
873-
}
869+
includePatterns = append(includePatterns, filepath.Join(project.Dir, "*"))
874870

875871
// all our patterns are the globale dir pattern + the include patterns specified by user
876872
if MatchIncludeExcludePatternsToFile(changedFile, includePatterns, excludePatterns) {

libs/digger_config/digger_config_test.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1267,6 +1267,23 @@ projects:
12671267
assert.Equal(t, false, dg.AllowDraftPRs)
12681268
}
12691269

1270+
func TestGetModifiedProjectsReturnsCorrectSourceMappingWithDotFile(t *testing.T) {
1271+
changedFiles := []string{"prod/main.tf", "dev/test/main.tf"}
1272+
projects := []Project{
1273+
Project{
1274+
Name: "dev",
1275+
Dir: ".",
1276+
},
1277+
}
1278+
c := DiggerConfig{
1279+
Projects: projects,
1280+
}
1281+
//expectedImpactingLocations := map[string]ProjectToSourceMapping{}
1282+
1283+
impactedProjects, _ := c.GetModifiedProjects(changedFiles)
1284+
assert.Equal(t, 0, len(impactedProjects))
1285+
}
1286+
12701287
func TestGetModifiedProjectsReturnsCorrectSourceMapping(t *testing.T) {
12711288
changedFiles := []string{"modules/bucket/main.tf", "dev/main.tf"}
12721289
projects := []Project{

0 commit comments

Comments
 (0)