task

package
v0.0.0-...-8478a25 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: BSD-2-Clause-Patent Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Certs

type Certs struct {
	Public  []byte `json:"public"`
	Private []byte `json:"private"`
	CA      []byte `json:"ca"`
}

Certs provides tls certificates.

type Executable

type Executable struct {
	Arch string `json:"arch"`
	Os   string `json:"os"`
	Url  string `json:"url"`
}

Executable provides the url to download a custom binary task executable file, given the operating system and architecture

type ExecutableConfig

type ExecutableConfig struct {
	Executables []Executable `json:"executables"`
}

ExecutableConfig provides the details to download a custom binary task executable file, for all supported operating systems and architectures

type Forward

type Forward struct {
	Address  string `json:"string"`
	Insecure bool   `json:"insecure"`
	Certs    Certs  `json:"certs"`
}

Forward provides instructions for forward a task to another runner node in the network.

type Handler

type Handler interface {
	Handle(context.Context, *Request) Response
}

A Handler handles task execution.

type HandlerFunc

type HandlerFunc func(context.Context, *Request) Response

The HandlerFunc type is an adapter to allow the use of ordinary functions as task handlers.

func (HandlerFunc) Handle

func (f HandlerFunc) Handle(ctx context.Context, req *Request) Response

Handle calls f.

type Logger

type Logger struct {
	Address        string `json:"address"`
	Insecure       bool   `json:"insecure"`
	Token          string `json:"token"`
	Key            string `json:"key"`
	Account        string `json:"account"`
	IndirectUpload bool   `json:"indirect_upload"`
}

Logger provides instructions for logging the output of a task execution.

type Repository

type Repository struct {
	Clone    string `json:"clone"`
	Ref      string `json:"ref"`
	Sha      string `json:"sha"`
	Download string `json:"download"`
}

Repository provides the repository used for custom task execution.

type Request

type Request struct {
	// Task provides the current task.
	Task *Task `json:"task"`

	// Tasks provides the previous task
	// execution results.
	Tasks []*Task `json:"secrets"`

	// Secrets provides the names and values of secrets
	// that are available to the task execution.
	Secrets []*common.Secret `json:"-"`

	// Account provides the account identifier.
	Account string `json:"account"`

	// ID provides a unique identifier to track the status of the request.
	ID string `json:"id"`

	// Logger is available to the task execution to write log output.
	Logger io.Writer `json:"-"`
}

Request defines a task request.

type Response

type Response interface {
	// Body gets the response body.
	Body() []byte

	// Error gets the response error.
	Error() error
}

Response is a response interface.

func Error

func Error(err error) Response

Error creates an error response.

func Errorf

func Errorf(format string, a ...any) Response

Errorf creates an error response.

func Respond

func Respond(v any) Response

Respond creates a response.

type Result

type Result struct {
	Err     error
	Secrets map[string]string
	Outputs map[string]string
	Data    []byte
}

Result provides task results.

func (*Result) Body

func (r *Result) Body() []byte

Body gets the response body.

func (*Result) Error

func (r *Result) Error() error

Error gets the response error.

type Router

type Router struct {
	// contains filtered or unexported fields
}

Router routes task execution requests to the appropriate handler.

func NewRouter

func NewRouter() *Router

func (*Router) Handle

func (h *Router) Handle(ctx context.Context, req *Request) Response

Handle routes the task request to a handler.

func (*Router) NotFound

func (h *Router) NotFound(handler Handler)

NotFound adds a handler to response whenver a route cannot be found.

func (*Router) NotFoundFunc

func (h *Router) NotFoundFunc(handler HandlerFunc)

NotFoundFunc adds a handler to response whenver a route cannot be found.

func (*Router) Register

func (h *Router) Register(name string, handler Handler)

Register registers the Handler to the router.

func (*Router) RegisterFunc

func (h *Router) RegisterFunc(name string, handler HandlerFunc)

RegisterFunc registers the HandlerFunc to the router.

func (*Router) ResolveExpressions

func (h *Router) ResolveExpressions(ctx context.Context, secrets []*common.Secret, taskData []byte) ([]byte, error)

func (*Router) ResolveSecrets

func (h *Router) ResolveSecrets(ctx context.Context, tasks []*Task) ([]*common.Secret, error)

func (*Router) Use

func (h *Router) Use(fn func(Handler) Handler)

Use adds the middleware onto the router stack.

type Task

type Task struct {
	// ID provides a unique task identifier.
	ID string `json:"id"`

	// Type provides the task type.
	Type string `json:"type"`

	// Data provides task execution data.
	Data []byte `json:"data"`

	// Driver provides the execution driver used to
	// execute the task.
	Driver string `json:"driver"`

	// Config provides the execution driver configuration.
	Config []byte `json:"config"`

	// Forward provides instructions for forwarding
	// the task to another runner node in the network.
	Forward *Forward `json:"forward"`

	// Logger provides instructions on where to log the output.
	Logger *Logger `json:"logger"`
}

Directories

Path Synopsis
Package cloner provides support for cloning git repositories.
Package cloner provides support for cloning git repositories.
cgi

Jump to

Keyboard shortcuts

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