agentscripts
packageThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
Documentation¶
Index¶
- Variables
- type ExecuteOption
- type InitOption
- type Options
- type Runner
- func (r *Runner) Close() error
- func (r *Runner) DataDir() string
- func (r *Runner) Execute(ctx context.Context, option ExecuteOption) error
- func (r *Runner) Init(scripts []codersdk.WorkspaceAgentScript, scriptCompleted ScriptCompletedFunc, ...) error
- func (r *Runner) RegisterMetrics(reg prometheus.Registerer)
- func (r *Runner) ScriptBinDir() string
- func (r *Runner) StartCron()
- type ScriptCompletedFunc
- type ScriptLogger
Constants¶
This section is empty.
Variables¶
var (// ErrTimeout is returned when a script times out.ErrTimeout =xerrors.New("script timed out")// ErrOutputPipesOpen is returned when a script exits leaving the output// pipe(s) (stdout, stderr) open. This happens because we set WaitDelay on// the command, which gives us two things://// 1. The ability to ensure that a script exits (this is important for e.g.// blocking login, and avoiding doing so indefinitely)// 2. Improved command cancellation on timeoutErrOutputPipesOpen =xerrors.New("script exited without closing output pipes"))
Functions¶
This section is empty.
Types¶
typeExecuteOption¶added inv2.16.0
type ExecuteOptionint
ExecuteOption describes what scripts we want to execute.
const (ExecuteAllScriptsExecuteOption =iotaExecuteStartScriptsExecutePostStartScriptsExecuteStopScriptsExecuteCronScripts)
ExecuteOption enums.
typeInitOption¶added inv2.21.0
type InitOption func(*Runner)
InitOption describes an option for the runner initialization.
funcWithPostStartScripts¶added inv2.21.0
func WithPostStartScripts(scripts ...codersdk.WorkspaceAgentScript)InitOption
WithPostStartScripts adds scripts that should be run after the workspacestart scripts but before the workspace is marked as started.
typeOptions¶
type Options struct {DataDirBasestringLogDirstringLoggerslog.LoggerSSHServer *agentssh.ServerFilesystemafero.FsGetScriptLogger func(logSourceIDuuid.UUID)ScriptLogger}
Options are a set of options for the runner.
typeRunner¶
type Runner struct {Options// contains filtered or unexported fields}
func (*Runner)Execute¶
func (r *Runner) Execute(ctxcontext.Context, optionExecuteOption)error
Execute runs a set of scripts according to a filter.
func (*Runner)Init¶
func (r *Runner) Init(scripts []codersdk.WorkspaceAgentScript, scriptCompletedScriptCompletedFunc, opts ...InitOption)error
Init initializes the runner with the provided scripts.It also schedules any scripts that have a schedule.This function must be called before Execute.
func (*Runner)RegisterMetrics¶added inv2.5.1
func (r *Runner) RegisterMetrics(regprometheus.Registerer)
func (*Runner)ScriptBinDir¶added inv2.9.0
ScriptBinDir returns the directory where scripts can store executablebinaries.
typeScriptCompletedFunc¶added inv2.16.0
type ScriptCompletedFunc func(context.Context, *proto.WorkspaceAgentScriptCompletedRequest) (*proto.WorkspaceAgentScriptCompletedResponse,error)