diff --git a/CHANGELOG.md b/CHANGELOG.md index cb4cc6532..be1dba96f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ _Bug fixes_ * Pipeline output attributes are now validated ([#239](https://github.com/turbot/pipe-fittings/issues/239)). * Pipeline param default value data type is now validated against the specified type ([#262](https://github.com/turbot/pipe-fittings/issues/262)). * Removed titles when merging multiple error messages ([#263](https://github.com/turbot/pipe-fittings/issues/263)). +* Scheduled triggers should be refreshed when the mod file has changed. ## v0.2.3 [2024-02-13] diff --git a/internal/es/estest/test_suite_mod/triggers/scheduled.fp b/internal/es/estest/test_suite_mod/triggers/scheduled.fp new file mode 100644 index 000000000..8620c7b98 --- /dev/null +++ b/internal/es/estest/test_suite_mod/triggers/scheduled.fp @@ -0,0 +1,28 @@ +trigger "schedule" "every_minute" { + enabled = false + schedule = "* * * * *" + pipeline = pipeline.two_params + + args = { + param_one = "joe" + } +} + + +pipeline "two_params" { + param "param_one" { + default = "default value for param one" + } + + param "param_two" { + default = "default value for param two" + } + + output "one" { + value = param.param_one + } + + output "two" { + value = param.param_two + } +} \ No newline at end of file diff --git a/internal/trigger/index.go b/internal/trigger/index.go index 21519e6cb..d0fcaa8e8 100644 --- a/internal/trigger/index.go +++ b/internal/trigger/index.go @@ -10,6 +10,7 @@ import ( "github.com/hashicorp/hcl/v2" "github.com/spf13/viper" + "github.com/turbot/flowpipe/internal/es/db" "github.com/turbot/flowpipe/internal/es/event" "github.com/turbot/flowpipe/internal/es/handler" "github.com/turbot/flowpipe/internal/fqueue" @@ -92,7 +93,13 @@ func (tr *TriggerRunnerBase) Run() { return } - pipelineArgs, diags := tr.Trigger.GetArgs(evalContext) + latestTrigger, err := db.GetTrigger(tr.Trigger.Name()) + if err != nil { + slog.Error("Error getting latest trigger", "trigger", tr.Trigger.Name(), "error", err) + return + } + + pipelineArgs, diags := latestTrigger.GetArgs(evalContext) if diags.HasErrors() { slog.Error("Error getting trigger args", "trigger", tr.Trigger.Name(), "errors", diags)