Skip to content
Open
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
27 changes: 14 additions & 13 deletions pkg/appdir/app_directory.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,23 +116,24 @@ func getSourcePath(app v1alpha1.Application) string {
}

func shouldInclude(app v1alpha1.Application, targetBranch string) bool {
targetRevision := getTargetRevision(app)
if targetRevision == "" {
return true
}

if targetRevision == targetBranch {
return true
}

if targetRevision == "HEAD" {
if targetBranch == "main" {
// Consider every source: a multi-source Application whose values live in a
// git source (targetRevision=<branch>) must be included even when the first
// source is a versioned Helm chart (targetRevision=<chart version>).
// getTargetRevision(app) only reads app.Spec.GetSource() == Sources[0], so
// "chart-first" multi-source apps were incorrectly excluded from PR checks.
for _, source := range getSources(app) {
Comment on lines 118 to +124
targetRevision := source.TargetRevision
Comment on lines +124 to +125
if targetRevision == "" {
return true
}

if targetBranch == "master" {
if targetRevision == targetBranch {
return true
}
if targetRevision == "HEAD" {
if targetBranch == "main" || targetBranch == "master" {
return true
}
}
}

return false
Expand Down
Loading