feat: implement app-json-is-valid plugin trigger

This commit is contained in:
Jose Diaz-Gonzalez committed 2025-06-19 02:20:02 -04:00
1 parent ed851fe399
commit 4ae9cca6f1
9 files changed
+87 -49

No files matched your search

+20
View File
@@ -4,6 +4,7 @@ import (
"errors"
"fmt"
appjson "github.com/dokku/dokku/plugins/app-json"
"github.com/dokku/dokku/plugins/common"
)
@@ -23,6 +24,25 @@ func TriggerCronGetProperty(appName string, key string) error {
return nil
}
// TriggerAppJSONIsValid validates the cron entries for a given app
func TriggerAppJSONIsValid(appName string, appJSONPath string) error {
if !common.FileExists(appJSONPath) {
return nil
}
appJSON, err := appjson.ReadAppJSON(appJSONPath)
if err != nil {
return err
}
_, err = FetchCronEntries(FetchCronEntriesInput{AppName: appName, AppJSON: &appJSON})
if err != nil {
return err
}
return nil
}
// TriggerInstall runs the install step for the cron plugin
func TriggerInstall() error {
if err := common.PropertySetup("cron"); err != nil {