Skip to content
This repository was archived by the owner on Mar 21, 2025. It is now read-only.
Open
Show file tree
Hide file tree
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
6 changes: 6 additions & 0 deletions internal/manager/receive.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,12 @@ func anyPatternMatches(s string, patterns []string) bool {
return true
}

// Treat a single star as a special case, matching everything.
// See https://github.com/opendevstack/ods-pipeline/issues/691
if patterns[0] == "*" {
return true
}

for _, pattern := range patterns {
if matched, err := path.Match(pattern, s); matched && err == nil {
return true
Expand Down
12 changes: 12 additions & 0 deletions internal/manager/receive_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,18 @@ func TestIdentifyPipelineConfig(t *testing.T) {
wantPipelineIndex: 0,
wantTriggerIndex: 0,
},
"branch push - pipeline with one trigger with * constraint": {
pInfo: PipelineInfo{ChangeRefType: "BRANCH", GitRef: "feature/foo"},
odsConfig: config.ODS{
Pipelines: []config.Pipeline{
{Triggers: []config.Trigger{
{Branches: []string{"*"}},
}},
},
},
wantPipelineIndex: 0,
wantTriggerIndex: 0,
},
"branch push - pipeline with one trigger with matching branch constraint upper case": {
pInfo: PipelineInfo{ChangeRefType: "BRANCH", GitRef: "feature/FOO-123-hello-world"},
odsConfig: config.ODS{
Expand Down