runcommand

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2024 License: GPL-3.0 Imports: 7 Imported by: 0

README

run_command Task

Description

The run_command task is designed to execute a specified shell command. This task is useful for integrating external scripts or commands into the testing workflow.

Configuration Parameters

  • allowed_to_fail: Determines the task's behavior in response to the command's exit status. If set to false, the task will not fail even if the command exits with a failure code. This is useful for commands where a non-zero exit status does not necessarily indicate a critical problem.

  • command: The command to be executed, along with its arguments. This should be provided as an array, where the first element is the command and subsequent elements are the arguments. For example, to list files in the current directory with detailed information, you would use ["ls", "-la", "."].

Defaults

Default settings for the run_command task:

- name: run_command
  config:
    allowed_to_fail: false
    command: []

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TaskName       = "run_command"
	TaskDescriptor = &types.TaskDescriptor{
		Name:        TaskName,
		Description: "Runs a shell command.",
		Config:      DefaultConfig(),
		NewTask:     NewTask,
	}
)

Functions

func NewTask

func NewTask(ctx *types.TaskContext, options *types.TaskOptions) (types.Task, error)

Types

type Config

type Config struct {
	AllowedToFail bool     `yaml:"allowed_to_fail" json:"allowed_to_fail"`
	Command       []string `yaml:"command" json:"command"`
}

func DefaultConfig

func DefaultConfig() Config

func (*Config) Validate

func (c *Config) Validate() error

type Task

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

func (*Task) Config

func (t *Task) Config() interface{}

func (*Task) Execute

func (t *Task) Execute(ctx context.Context) error

func (*Task) LoadConfig

func (t *Task) LoadConfig() error

func (*Task) Timeout

func (t *Task) Timeout() time.Duration

Jump to

Keyboard shortcuts

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