chore: standardize on cron task vs any other naming
This commit is contained in:
@@ -36,7 +36,7 @@ A cron task takes the following properties:
|
||||
- `command`: A command to be run within the built app image. Specified commands can also be `Procfile` entries.
|
||||
- `schedule`: A [cron-compatible](https://en.wikipedia.org/wiki/Cron#Overview) scheduling definition upon which to run the command. Seconds are generally not supported.
|
||||
|
||||
Zero or more cron commands can be specified per app. Cron tasks are validated after the build artifact is created but before the app is deployed, and the cron schedule is updated during the post-deploy phase.
|
||||
Zero or more cron tasks can be specified per app. Cron tasks are validated after the build artifact is created but before the app is deployed, and the cron schedule is updated during the post-deploy phase.
|
||||
|
||||
See the [app.json location documentation](/docs/advanced-usage/deployment-tasks.md#changing-the-appjson-location) for more information on where to place your `app.json` file.
|
||||
|
||||
|
||||
@@ -25,8 +25,8 @@ var (
|
||||
|
||||
// AppJSON is a struct that represents an app.json file as understood by Dokku
|
||||
type AppJSON struct {
|
||||
// Cron is a list of cron commands to execute
|
||||
Cron []CronCommand `json:"cron"`
|
||||
// Cron is a list of cron tasks to execute
|
||||
Cron []CronTask `json:"cron"`
|
||||
|
||||
// Formation is a map of process types to scale
|
||||
Formation map[string]Formation `json:"formation"`
|
||||
@@ -50,8 +50,8 @@ type AppJSON struct {
|
||||
} `json:"scripts"`
|
||||
}
|
||||
|
||||
// CronCommand is a struct that represents a single cron command from an app.json file
|
||||
type CronCommand struct {
|
||||
// CronTask is a struct that represents a single cron task from an app.json file
|
||||
type CronTask struct {
|
||||
// Command is the command to execute
|
||||
Command string `json:"command"`
|
||||
|
||||
|
||||
@@ -27,18 +27,18 @@ var (
|
||||
}
|
||||
)
|
||||
|
||||
// TemplateCommand is a struct that represents a cron command
|
||||
// TemplateCommand is a struct that represents a cron task
|
||||
type TemplateCommand struct {
|
||||
// ID is a unique identifier for the cron command
|
||||
// ID is a unique identifier for the cron task
|
||||
ID string `json:"id"`
|
||||
|
||||
// App is the app the cron command belongs to
|
||||
// App is the app the cron task belongs to
|
||||
App string `json:"app,omitempty"`
|
||||
|
||||
// Command is the command to run
|
||||
Command string `json:"command"`
|
||||
|
||||
// Global is whether the cron command is global
|
||||
// Global is whether the cron task is global
|
||||
Global bool `json:"global,omitempty"`
|
||||
|
||||
// Schedule is the cron schedule
|
||||
@@ -50,7 +50,7 @@ type TemplateCommand struct {
|
||||
// LogFile is the log file to write to
|
||||
LogFile string `json:"-"`
|
||||
|
||||
// Maintenance is whether the cron command is in maintenance mode
|
||||
// Maintenance is whether the cron task is in maintenance mode
|
||||
Maintenance bool `json:"maintenance"`
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ type FetchCronTasksInput struct {
|
||||
WarnToFailure bool
|
||||
}
|
||||
|
||||
// FetchCronTasks returns a list of cron commands for a given app
|
||||
// FetchCronTasks returns a list of cron tasks for a given app
|
||||
func FetchCronTasks(input FetchCronTasksInput) ([]TemplateCommand, error) {
|
||||
appName := input.AppName
|
||||
commands := []TemplateCommand{}
|
||||
@@ -95,10 +95,10 @@ func FetchCronTasks(input FetchCronTasksInput) ([]TemplateCommand, error) {
|
||||
for i, c := range input.AppJSON.Cron {
|
||||
if c.Command == "" {
|
||||
if input.WarnToFailure {
|
||||
return commands, fmt.Errorf("Missing cron command for app %s (index %d)", appName, i)
|
||||
return commands, fmt.Errorf("Missing cron task command for app %s (index %d)", appName, i)
|
||||
}
|
||||
|
||||
common.LogWarn(fmt.Sprintf("Missing cron command for app %s (index %d)", appName, i))
|
||||
common.LogWarn(fmt.Sprintf("Missing cron task command for app %s (index %d)", appName, i))
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ func FetchCronTasks(input FetchCronTasksInput) ([]TemplateCommand, error) {
|
||||
return commands, nil
|
||||
}
|
||||
|
||||
// FetchGlobalCronTasks returns a list of global cron commands
|
||||
// FetchGlobalCronTasks returns a list of global cron tasks
|
||||
// This function should only be used for the cron:list --global command
|
||||
// and not internally by the cron plugin
|
||||
func FetchGlobalCronTasks() ([]TemplateCommand, error) {
|
||||
@@ -167,6 +167,6 @@ func FetchGlobalCronTasks() ([]TemplateCommand, error) {
|
||||
}
|
||||
|
||||
// GenerateCommandID creates a unique ID for a given app/command/schedule combination
|
||||
func GenerateCommandID(appName string, c appjson.CronCommand) string {
|
||||
func GenerateCommandID(appName string, c appjson.CronTask) string {
|
||||
return base36.EncodeToStringLc([]byte(appName + "===" + c.Command + "===" + c.Schedule))
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ func CommandReport(appName string, format string, infoFlag string) error {
|
||||
return ReportSingleApp(appName, format, infoFlag)
|
||||
}
|
||||
|
||||
// CommandRun executes a cron command on the fly
|
||||
// CommandRun executes a cron task on the fly
|
||||
func CommandRun(appName string, cronID string, detached bool) error {
|
||||
if err := common.VerifyAppName(appName); err != nil {
|
||||
return err
|
||||
|
||||
@@ -630,7 +630,7 @@ func TriggerSchedulerDeploy(scheduler string, appName string, imageTag string) e
|
||||
|
||||
words, err := shellquote.Split(cronTask.Command)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error parsing cron command: %w", err)
|
||||
return fmt.Errorf("Error parsing cron task command: %w", err)
|
||||
}
|
||||
|
||||
processResources, err := getProcessResources(appName, cronTask.ID)
|
||||
|
||||
Reference in New Issue
Block a user