@@ -68,7 +68,7 @@ func (d *AppSetDirectory) ProcessApp(app v1alpha1.ApplicationSet) {
68
68
// e.g. changeList = ["/appset/httpdump/httpdump.yaml", "/app/testapp/values.yaml"]
69
69
// if the changed file is application set file, return it.
70
70
71
- func (d * AppSetDirectory ) FindAppsBasedOnChangeList (changeList []string , targetBranch string , repo * git.Repo ) []v1alpha1.ApplicationSet {
71
+ func (d * AppSetDirectory ) FindAppsBasedOnChangeList (changeList []string , repo * git.Repo ) []v1alpha1.ApplicationSet {
72
72
log .Debug ().Str ("type" , "applicationsets" ).Msgf ("checking %d changes" , len (changeList ))
73
73
74
74
appsSet := make (map [string ]struct {})
@@ -97,53 +97,21 @@ func (d *AppSetDirectory) FindAppsBasedOnChangeList(changeList []string, targetB
97
97
continue
98
98
}
99
99
100
- if ! appSetShouldInclude (appSet , targetBranch ) {
101
- log .Debug ().Msgf ("target revision of %s is %s and does not match '%s'" , appSet , appSetGetTargetRevision (appSet ), targetBranch )
102
- continue
103
- }
104
-
105
100
// Store the unique ApplicationSet
106
101
if _ , exists := appsSet [appSet .Name ]; ! exists {
107
102
appsSet [appSet .Name ] = struct {}{}
108
103
appSets = append (appSets , * appSet )
109
104
}
110
105
}
111
106
112
- log .Debug ().Str ("source" , "appset_directory" ).Msgf ("matched %d files into %d appset" , len (changeList ), len (appsSet ))
107
+ log .Debug ().Str ("source" , "appset_directory" ).Msgf ("matched %d files into %d appset" , len (changeList ), len (appSets ))
113
108
return appSets
114
109
}
115
110
116
- func appSetGetTargetRevision (app * v1alpha1.ApplicationSet ) string {
117
- return app .Spec .Template .Spec .GetSource ().TargetRevision
118
- }
119
-
120
111
func appSetGetSourcePath (app * v1alpha1.ApplicationSet ) string {
121
112
return app .Spec .Template .Spec .GetSource ().Path
122
113
}
123
114
124
- func appSetShouldInclude (app * v1alpha1.ApplicationSet , targetBranch string ) bool {
125
- targetRevision := appSetGetTargetRevision (app )
126
- if targetRevision == "" {
127
- return true
128
- }
129
-
130
- if targetRevision == targetBranch {
131
- return true
132
- }
133
-
134
- if targetRevision == "HEAD" {
135
- if targetBranch == "main" {
136
- return true
137
- }
138
-
139
- if targetBranch == "master" {
140
- return true
141
- }
142
- }
143
-
144
- return false
145
- }
146
-
147
115
func (d * AppSetDirectory ) GetAppSets (filter func (stub v1alpha1.ApplicationSet ) bool ) []v1alpha1.ApplicationSet {
148
116
var result []v1alpha1.ApplicationSet
149
117
for _ , value := range d .appSetsMap {
0 commit comments