Movatterモバイル変換


[0]ホーム

URL:


agentscripts

package
v2.23.0Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2025 License:AGPL-3.0Imports:24Imported by:0

Details

Repository

github.com/coder/coder

Links

Documentation

Index

Constants

This section is empty.

Variables

View Source
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

typeExecuteOptionadded inv2.16.0

type ExecuteOptionint

ExecuteOption describes what scripts we want to execute.

const (ExecuteAllScriptsExecuteOption =iotaExecuteStartScriptsExecutePostStartScriptsExecuteStopScriptsExecuteCronScripts)

ExecuteOption enums.

typeInitOptionadded inv2.21.0

type InitOption func(*Runner)

InitOption describes an option for the runner initialization.

funcWithPostStartScriptsadded 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}

funcNew

func New(optsOptions) *Runner

New creates a runner for the provided scripts.

func (*Runner)Close

func (r *Runner) Close()error

func (*Runner)DataDiradded inv2.9.0

func (r *Runner) DataDir()string

DataDir returns the directory where scripts data is stored.

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)RegisterMetricsadded inv2.5.1

func (r *Runner) RegisterMetrics(regprometheus.Registerer)

func (*Runner)ScriptBinDiradded inv2.9.0

func (r *Runner) ScriptBinDir()string

ScriptBinDir returns the directory where scripts can store executablebinaries.

func (*Runner)StartCron

func (r *Runner) StartCron()

StartCron starts the cron scheduler.This is done async to allow for the caller to execute scripts prior.

typeScriptLoggeradded inv2.9.0

type ScriptLogger interface {Send(ctxcontext.Context, log ...agentsdk.Log)errorFlush(context.Context)error}

Source Files

View all Source files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp