allow glob expresion in pipeline config for labels

This commit is contained in:
6543 2024-03-26 11:02:00 +01:00
parent 5197af3ddc
commit 43ada66dde

View file

@ -15,6 +15,9 @@
package grpc package grpc
import ( import (
"github.com/bmatcuk/doublestar/v4"
"github.com/rs/zerolog/log"
"go.woodpecker-ci.org/woodpecker/v2/pipeline/rpc" "go.woodpecker-ci.org/woodpecker/v2/pipeline/rpc"
"go.woodpecker-ci.org/woodpecker/v2/server/model" "go.woodpecker-ci.org/woodpecker/v2/server/model"
"go.woodpecker-ci.org/woodpecker/v2/server/queue" "go.woodpecker-ci.org/woodpecker/v2/server/queue"
@ -39,9 +42,11 @@ func createFilterFunc(agentFilter rpc.Filter) queue.FilterFn {
continue continue
} }
if taskLabelValue != agentLabelValue { match, err := doublestar.Match(taskLabelValue, agentLabelValue)
return false if err != nil {
log.Error().Err(err).Msg("got unexpected error while try to match task and agent lable value")
} }
return match
} }
return true return true
} }