pluginsubtask

package
v1.31.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 25, 2024 License: BSD-3-Clause Imports: 15 Imported by: 0

README

subtask Plugin

This plugin creates a new task. A step based on this type of action will remain incomplete until the subtask is fully DONE.

Configuration

Fields Description
template the name of a task template, as accepted through µTask's API
input a map of named values, as accepted on µTask's API
json_input a JSON string passed as input to the subtask template
resolver_usernames a string containing a JSON array of additional resolver users for the subtask
resolver_groups a string containing a JSON array of additional resolver groups for the subtask
watcher_usernames a string containing a JSON array of additional watcher users for the subtask
watcher_groups a string containing a JSON array of additional watcher groups for the subtask
delay a duration indicating if subtask execution needs to be delayed, expects Golang time.Duration format (5s, 1m, ...)

Example

An action of type subtask requires the following kind of configuration:

action:
  type: subtask
  configuration:
    # a template that must already be registered on this instance of µTask
    template: another-task-template
    # valid input, as defined by the referred template
    input:
      foo: bar
    # optionally, a list of users which are authorized to resolve this specific task
    resolver_usernames: '["authorizedUser"]'
    resolver_groups: '["authorizedGroup"]'
    watcher_usernames: '["authorizedUser"]'
    watcher_groups: '["authorizedGroup"]'
    delay: 10m

Requirements

None.

Return

Output
Name Description
id The public identifier of the task
state The state of the task
result The result of the task
resolver_username The username of the resolver of the task
requester_username The username ot the requester of the task

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Plugin = taskplugin.New("subtask", "0.1", exec,
		taskplugin.WithConfig(validConfig, SubtaskConfig{}),
		taskplugin.WithContextFunc(ctx),
	)
)

the subtask plugin spawns a new µTask task, given a template and inputs an extra parameter is accepted, not available on API resolver usernames can be dynamically set for the task

Functions

This section is empty.

Types

type SubtaskConfig

type SubtaskConfig struct {
	Template          string                 `json:"template"`
	Input             map[string]interface{} `json:"input"`
	JsonInput         string                 `json:"json_input,omitempty"`
	ResolverUsernames string                 `json:"resolver_usernames"`
	ResolverGroups    string                 `json:"resolver_groups"`
	WatcherUsernames  string                 `json:"watcher_usernames"`
	WatcherGroups     string                 `json:"watcher_groups"`
	Delay             *string                `json:"delay"`
	Tags              map[string]string      `json:"tags"`
}

SubtaskConfig is the necessary configuration to spawn a new task

type SubtaskContext

type SubtaskContext struct {
	ParentTaskID      string `json:"parent_task_id"`
	TaskID            string `json:"task_id"`
	RequesterUsername string `json:"requester_username"`
	RequesterGroups   string `json:"requester_groups"`
}

SubtaskContext is the metadata inherited from the "parent" task"

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL