From cc7776922c549fdc8723f7c524d0b6461d8d8cb6 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 16 Sep 2024 01:16:44 +0000 Subject: [PATCH] fix(deps): update github.com/cilium/hive digest to 51fb911 Signed-off-by: renovate[bot] --- cmapisrv-mock/go.mod | 2 +- cmapisrv-mock/go.sum | 4 +-- .../vendor/github.com/cilium/hive/.gitignore | 26 +++++++++++++++++++ .../vendor/github.com/cilium/hive/hive.go | 2 +- .../vendor/github.com/cilium/hive/job/job.go | 11 ++++++++ .../github.com/cilium/hive/job/observer.go | 9 ++++--- .../github.com/cilium/hive/job/oneshot.go | 8 ++++-- .../github.com/cilium/hive/job/timer.go | 8 ++++-- cmapisrv-mock/vendor/modules.txt | 2 +- 9 files changed, 60 insertions(+), 12 deletions(-) create mode 100644 cmapisrv-mock/vendor/github.com/cilium/hive/.gitignore diff --git a/cmapisrv-mock/go.mod b/cmapisrv-mock/go.mod index eb425bf9..a6773c28 100644 --- a/cmapisrv-mock/go.mod +++ b/cmapisrv-mock/go.mod @@ -4,7 +4,7 @@ go 1.23.0 require ( github.com/cilium/cilium v1.16.1 - github.com/cilium/hive v0.0.0-20240826173949-af1b4bf1ab98 + github.com/cilium/hive v0.0.0-20240911195218-51fb911e7dad github.com/dustinkirkland/golang-petname v0.0.0-20240428194347-eebcea082ee0 github.com/sirupsen/logrus v1.9.3 github.com/spf13/cobra v1.8.1 diff --git a/cmapisrv-mock/go.sum b/cmapisrv-mock/go.sum index 0ac519ad..5dec320f 100644 --- a/cmapisrv-mock/go.sum +++ b/cmapisrv-mock/go.sum @@ -31,8 +31,8 @@ github.com/cilium/cilium v1.16.1 h1:7FiLrRJbO3d/RE423FUN0GxhrFDQBYRwr1veHN7uBys= github.com/cilium/cilium v1.16.1/go.mod h1:SIurqFNFBU9/sQTPC9tvrOktAMDnQOGPBCSYtsnjxp4= github.com/cilium/ebpf v0.15.0 h1:7NxJhNiBT3NG8pZJ3c+yfrVdHY8ScgKD27sScgjLMMk= github.com/cilium/ebpf v0.15.0/go.mod h1:DHp1WyrLeiBh19Cf/tfiSMhqheEiK8fXFZ4No0P1Hso= -github.com/cilium/hive v0.0.0-20240826173949-af1b4bf1ab98 h1:zT2AR4uNmwehfHgphnafWaERkCR6c3WWE/IcU7nzg40= -github.com/cilium/hive v0.0.0-20240826173949-af1b4bf1ab98/go.mod h1:6tW1eCwSq8Wz8IVtpZE0MemoCWSrEOUa8aLKotmBRCo= +github.com/cilium/hive v0.0.0-20240911195218-51fb911e7dad h1:VemjLI/ObKOTTxBoDME5pjYqNpoq4MzxvdUVBEoUFDk= +github.com/cilium/hive v0.0.0-20240911195218-51fb911e7dad/go.mod h1:6tW1eCwSq8Wz8IVtpZE0MemoCWSrEOUa8aLKotmBRCo= github.com/cilium/proxy v0.0.0-20240418093727-2c7164c53e26 h1:wzm/nEkcMO6oGSySoqe3/bMcF1sxrxI2ByidN3gg30A= github.com/cilium/proxy v0.0.0-20240418093727-2c7164c53e26/go.mod h1:jzAmtWhlyR3kx+AwYdQvGM04lmHwsWhq1ySfAVpY/SA= github.com/cilium/statedb v0.2.4 h1:jCyXGcsiXgpJSfpfRRGKd+TD3U1teeDtOnqCyErsHsI= diff --git a/cmapisrv-mock/vendor/github.com/cilium/hive/.gitignore b/cmapisrv-mock/vendor/github.com/cilium/hive/.gitignore new file mode 100644 index 00000000..63403c7e --- /dev/null +++ b/cmapisrv-mock/vendor/github.com/cilium/hive/.gitignore @@ -0,0 +1,26 @@ +# Compiled Object files, Static and Dynamic libs (Shared Objects) +*.o +*.a +*.so +*.so.* +*.d + +# Folders +_obj +_test +_build/ + +# Architecture specific extensions/prefixes +*.exe +*.test +*.prof + +.DS_Store +.idea/ +.vscode/* +!.vscode/launch.json +!.vscode/extensions.json +*.plist + +*_bash_completion +*.swo diff --git a/cmapisrv-mock/vendor/github.com/cilium/hive/hive.go b/cmapisrv-mock/vendor/github.com/cilium/hive/hive.go index 2cf6dddd..34e17b60 100644 --- a/cmapisrv-mock/vendor/github.com/cilium/hive/hive.go +++ b/cmapisrv-mock/vendor/github.com/cilium/hive/hive.go @@ -125,7 +125,7 @@ func New(cells ...cell.Cell) *Hive { func NewWithOptions(opts Options, cells ...cell.Cell) *Hive { h := &Hive{ opts: opts, - container: dig.New(), + container: dig.New(dig.DeferAcyclicVerification()), cells: cells, viper: viper.New(), flags: pflag.NewFlagSet("", pflag.ContinueOnError), diff --git a/cmapisrv-mock/vendor/github.com/cilium/hive/job/job.go b/cmapisrv-mock/vendor/github.com/cilium/hive/job/job.go index 2f146053..e061402d 100644 --- a/cmapisrv-mock/vendor/github.com/cilium/hive/job/job.go +++ b/cmapisrv-mock/vendor/github.com/cilium/hive/job/job.go @@ -5,7 +5,9 @@ package job import ( "context" + "fmt" "log/slog" + "regexp" "runtime/pprof" "sync" @@ -229,3 +231,12 @@ type scopedGroup struct { func (sg *scopedGroup) Add(jobs ...Job) { sg.group.add(sg.health, jobs...) } + +var nameRegex = regexp.MustCompile(`^[a-z][a-z0-9_\-]{0,100}$`) + +func validateName(name string) error { + if !nameRegex.MatchString(name) { + return fmt.Errorf("invalid job name: %q, expected to match %q", name, nameRegex) + } + return nil +} diff --git a/cmapisrv-mock/vendor/github.com/cilium/hive/job/observer.go b/cmapisrv-mock/vendor/github.com/cilium/hive/job/observer.go index ada2679c..7fe68ba5 100644 --- a/cmapisrv-mock/vendor/github.com/cilium/hive/job/observer.go +++ b/cmapisrv-mock/vendor/github.com/cilium/hive/job/observer.go @@ -16,10 +16,13 @@ import ( "github.com/cilium/stream" ) -// AddObserver adds an observer job to the group. Observer jobs invoke the given `fn` for each item observed on -// `observable`. If the `observable` completes, the job stops. The context given to the observable is also canceled -// once the group stops. +// Observer jobs invoke the given `fn` for each item observed on `observable`. +// The Observer name must match regex "^[a-z][a-z0-9_\\-]{0,100}$". If the `observable` completes, the job stops. +// The context given to the observable is also canceled once the group stops. func Observer[T any](name string, fn ObserverFunc[T], observable stream.Observable[T], opts ...observerOpt[T]) Job { + if err := validateName(name); err != nil { + panic(err) + } if fn == nil { panic("`fn` must not be nil") } diff --git a/cmapisrv-mock/vendor/github.com/cilium/hive/job/oneshot.go b/cmapisrv-mock/vendor/github.com/cilium/hive/job/oneshot.go index fdc2099c..6d67c393 100644 --- a/cmapisrv-mock/vendor/github.com/cilium/hive/job/oneshot.go +++ b/cmapisrv-mock/vendor/github.com/cilium/hive/job/oneshot.go @@ -14,14 +14,18 @@ import ( "github.com/cilium/hive/internal" ) -// OneShot creates a "one shot" job which can be added to a Group. The function passed to a one shot job is invoked -// once at startup. It can live for the entire lifetime of the group or exit early depending on its task. +// OneShot creates a "one shot" job which can be added to a Group. +// The OneShot job name must match regex "^[a-z][a-z0-9_\\-]{0,100}$". The function passed is invoked once at startup. +// It can live for the entire lifetime of the group or exit early depending on its task. // If it returns an error, it can optionally be retried if the WithRetry option. If retries are not configured or // all retries failed as well, a shutdown of the hive can be triggered by specifying the WithShutdown option. // // The given function is expected to exit as soon as the context given to it expires, this is especially important for // blocking or long running jobs. func OneShot(name string, fn OneShotFunc, opts ...jobOneShotOpt) Job { + if err := validateName(name); err != nil { + panic(err) + } if fn == nil { panic("`fn` must not be nil") } diff --git a/cmapisrv-mock/vendor/github.com/cilium/hive/job/timer.go b/cmapisrv-mock/vendor/github.com/cilium/hive/job/timer.go index 41c5c311..01a14a4e 100644 --- a/cmapisrv-mock/vendor/github.com/cilium/hive/job/timer.go +++ b/cmapisrv-mock/vendor/github.com/cilium/hive/job/timer.go @@ -14,8 +14,9 @@ import ( "github.com/cilium/hive/internal" ) -// Timer creates a timer job which can be added to a Group. Timer jobs invoke the given function at the specified -// interval. Timer jobs are particularly useful to implement periodic syncs and cleanup actions. +// Timer creates a timer job which can be added to a Group. +// The Timer job name must match regex "^[a-z][a-z0-9_\\-]{0,100}$". The function passed is invoked at the specified interval. +// Timer jobs are particularly useful to implement periodic syncs and cleanup actions. // Timer jobs can optionally be triggered by an external Trigger with the WithTrigger option. // This trigger can for example be passed between cells or between jobs in the same cell to allow for an additional // invocation of the function. @@ -25,6 +26,9 @@ import ( // expires. This is especially important for long running functions. The signal created by a Trigger is coalesced so // multiple calls to trigger before the invocation takes place can result in just a single invocation. func Timer(name string, fn TimerFunc, interval time.Duration, opts ...timerOpt) Job { + if err := validateName(name); err != nil { + panic(err) + } if fn == nil { panic("`fn` must not be nil") } diff --git a/cmapisrv-mock/vendor/modules.txt b/cmapisrv-mock/vendor/modules.txt index f8793133..e2a96f7f 100644 --- a/cmapisrv-mock/vendor/modules.txt +++ b/cmapisrv-mock/vendor/modules.txt @@ -124,7 +124,7 @@ github.com/cilium/ebpf/internal/sysenc github.com/cilium/ebpf/internal/tracefs github.com/cilium/ebpf/internal/unix github.com/cilium/ebpf/link -# github.com/cilium/hive v0.0.0-20240826173949-af1b4bf1ab98 +# github.com/cilium/hive v0.0.0-20240911195218-51fb911e7dad ## explicit; go 1.21.3 github.com/cilium/hive github.com/cilium/hive/cell