Documentation
¶
Index ¶
- Constants
- Variables
- func AllowBinCI(ctx context.Context) context.Context
- func IsBinCIAllowed(ctx context.Context) bool
- func WithTTY(ctx context.Context) context.Context
- type DatabaseConnection
- type DockerExecutor
- func (d *DockerExecutor) AdminAPIClient(ctx context.Context) (*adminSdk.Client, error)
- func (d *DockerExecutor) AvailableLogFiles(ctx context.Context) ([]LogFile, error)
- func (d *DockerExecutor) ComposerCommand(ctx context.Context, args ...string) *Process
- func (d *DockerExecutor) ConsoleCommand(ctx context.Context, args ...string) *Process
- func (d *DockerExecutor) DatabaseConnection(ctx context.Context) (*DatabaseConnection, error)
- func (d *DockerExecutor) EnvironmentStatus(ctx context.Context) (bool, error)
- func (d *DockerExecutor) GetLog(ctx context.Context, file string, lines int, follow bool, w io.Writer) error
- func (d *DockerExecutor) NPMCommand(ctx context.Context, args ...string) *Process
- func (d *DockerExecutor) NormalizePath(hostPath string) string
- func (d *DockerExecutor) PHPCommand(ctx context.Context, args ...string) *Process
- func (d *DockerExecutor) ShopConfig() *shop.Config
- func (d *DockerExecutor) StartEnvironment(ctx context.Context) error
- func (d *DockerExecutor) StopEnvironment(ctx context.Context, opts StopOptions) error
- func (d *DockerExecutor) Type() string
- func (d *DockerExecutor) WithEnv(env map[string]string) Executor
- func (d *DockerExecutor) WithRelDir(relDir string) Executor
- type Executor
- type LocalExecutor
- func (l *LocalExecutor) AdminAPIClient(ctx context.Context) (*adminSdk.Client, error)
- func (l *LocalExecutor) AvailableLogFiles(_ context.Context) ([]LogFile, error)
- func (l *LocalExecutor) ComposerCommand(ctx context.Context, args ...string) *Process
- func (l *LocalExecutor) ConsoleCommand(ctx context.Context, args ...string) *Process
- func (l *LocalExecutor) DatabaseConnection(_ context.Context) (*DatabaseConnection, error)
- func (l *LocalExecutor) EnvironmentStatus(_ context.Context) (bool, error)
- func (l *LocalExecutor) GetLog(ctx context.Context, file string, lines int, follow bool, w io.Writer) error
- func (l *LocalExecutor) NPMCommand(ctx context.Context, args ...string) *Process
- func (l *LocalExecutor) NormalizePath(hostPath string) string
- func (l *LocalExecutor) PHPCommand(ctx context.Context, args ...string) *Process
- func (l *LocalExecutor) ShopConfig() *shop.Config
- func (l *LocalExecutor) StartEnvironment(_ context.Context) error
- func (l *LocalExecutor) StopEnvironment(_ context.Context, _ StopOptions) error
- func (l *LocalExecutor) Type() string
- func (l *LocalExecutor) WithEnv(env map[string]string) Executor
- func (l *LocalExecutor) WithRelDir(relDir string) Executor
- type LogFile
- type Process
- func (p *Process) CombinedOutput() ([]byte, error)
- func (p *Process) Output() ([]byte, error)
- func (p *Process) Run() error
- func (p *Process) RunWithOutput(w io.Writer) error
- func (p *Process) Start() error
- func (p *Process) StartCombined() (io.ReadCloser, error)
- func (p *Process) StderrPipe() (io.ReadCloser, error)
- func (p *Process) StdoutPipe() (io.ReadCloser, error)
- func (p *Process) Stop(ctx context.Context) error
- func (p *Process) Wait() error
- type SSHExecutor
- func (s *SSHExecutor) AdminAPIClient(ctx context.Context) (*adminSdk.Client, error)
- func (s *SSHExecutor) AvailableLogFiles(ctx context.Context) ([]LogFile, error)
- func (s *SSHExecutor) ComposerCommand(ctx context.Context, args ...string) *Process
- func (s *SSHExecutor) ConsoleCommand(ctx context.Context, args ...string) *Process
- func (s *SSHExecutor) DatabaseConnection(ctx context.Context) (*DatabaseConnection, error)
- func (s *SSHExecutor) EnvironmentStatus(_ context.Context) (bool, error)
- func (s *SSHExecutor) GetLog(ctx context.Context, file string, lines int, follow bool, w io.Writer) error
- func (s *SSHExecutor) NPMCommand(ctx context.Context, args ...string) *Process
- func (s *SSHExecutor) NormalizePath(hostPath string) string
- func (s *SSHExecutor) PHPCommand(ctx context.Context, args ...string) *Process
- func (s *SSHExecutor) ShopConfig() *shop.Config
- func (s *SSHExecutor) StartEnvironment(_ context.Context) error
- func (s *SSHExecutor) StopEnvironment(_ context.Context, _ StopOptions) error
- func (s *SSHExecutor) Type() string
- func (s *SSHExecutor) WithEnv(env map[string]string) Executor
- func (s *SSHExecutor) WithRelDir(relDir string) Executor
- type StopOptions
- type SymfonyCLIExecutor
- func (s *SymfonyCLIExecutor) AdminAPIClient(ctx context.Context) (*adminSdk.Client, error)
- func (s *SymfonyCLIExecutor) AvailableLogFiles(_ context.Context) ([]LogFile, error)
- func (s *SymfonyCLIExecutor) ComposerCommand(ctx context.Context, args ...string) *Process
- func (s *SymfonyCLIExecutor) ConsoleCommand(ctx context.Context, args ...string) *Process
- func (s *SymfonyCLIExecutor) DatabaseConnection(_ context.Context) (*DatabaseConnection, error)
- func (s *SymfonyCLIExecutor) EnvironmentStatus(_ context.Context) (bool, error)
- func (s *SymfonyCLIExecutor) GetLog(ctx context.Context, file string, lines int, follow bool, w io.Writer) error
- func (s *SymfonyCLIExecutor) NPMCommand(ctx context.Context, args ...string) *Process
- func (s *SymfonyCLIExecutor) NormalizePath(hostPath string) string
- func (s *SymfonyCLIExecutor) PHPCommand(ctx context.Context, args ...string) *Process
- func (s *SymfonyCLIExecutor) ShopConfig() *shop.Config
- func (s *SymfonyCLIExecutor) StartEnvironment(_ context.Context) error
- func (s *SymfonyCLIExecutor) StopEnvironment(_ context.Context, _ StopOptions) error
- func (s *SymfonyCLIExecutor) Type() string
- func (s *SymfonyCLIExecutor) WithEnv(env map[string]string) Executor
- func (s *SymfonyCLIExecutor) WithRelDir(relDir string) Executor
Constants ¶
const ( TypeDocker = "docker" TypeLocal = "local" TypeSSH = "ssh" TypeSymfonyCLI = "symfony-cli" )
Variables ¶
var ErrNotSupported = errors.New("operation not supported by this executor")
Functions ¶
func IsBinCIAllowed ¶
Types ¶
type DatabaseConnection ¶
type DatabaseConnection struct {
Host string
Port string
Username string
Password string
Database string
// contains filtered or unexported fields
}
DatabaseConnection describes how to reach the project database from the host machine.
func (*DatabaseConnection) Addr ¶
func (c *DatabaseConnection) Addr() string
Addr returns the host:port address of the database.
func (*DatabaseConnection) MySQLConfig ¶
func (c *DatabaseConnection) MySQLConfig() *mysql.Config
MySQLConfig translates the credentials into a driver configuration.
type DockerExecutor ¶
type DockerExecutor struct {
// contains filtered or unexported fields
}
func (*DockerExecutor) AdminAPIClient ¶
func (*DockerExecutor) AvailableLogFiles ¶
func (d *DockerExecutor) AvailableLogFiles(ctx context.Context) ([]LogFile, error)
func (*DockerExecutor) ComposerCommand ¶
func (d *DockerExecutor) ComposerCommand(ctx context.Context, args ...string) *Process
func (*DockerExecutor) ConsoleCommand ¶
func (d *DockerExecutor) ConsoleCommand(ctx context.Context, args ...string) *Process
func (*DockerExecutor) DatabaseConnection ¶
func (d *DockerExecutor) DatabaseConnection(ctx context.Context) (*DatabaseConnection, error)
DatabaseConnection resolves the database credentials as seen inside the compose network and translates the service host to the port published on the host machine.
func (*DockerExecutor) EnvironmentStatus ¶
func (d *DockerExecutor) EnvironmentStatus(ctx context.Context) (bool, error)
func (*DockerExecutor) NPMCommand ¶
func (d *DockerExecutor) NPMCommand(ctx context.Context, args ...string) *Process
func (*DockerExecutor) NormalizePath ¶
func (d *DockerExecutor) NormalizePath(hostPath string) string
func (*DockerExecutor) PHPCommand ¶
func (d *DockerExecutor) PHPCommand(ctx context.Context, args ...string) *Process
func (*DockerExecutor) ShopConfig ¶
func (d *DockerExecutor) ShopConfig() *shop.Config
func (*DockerExecutor) StartEnvironment ¶
func (d *DockerExecutor) StartEnvironment(ctx context.Context) error
func (*DockerExecutor) StopEnvironment ¶
func (d *DockerExecutor) StopEnvironment(ctx context.Context, opts StopOptions) error
func (*DockerExecutor) Type ¶
func (d *DockerExecutor) Type() string
func (*DockerExecutor) WithRelDir ¶
func (d *DockerExecutor) WithRelDir(relDir string) Executor
type Executor ¶
type Executor interface {
ConsoleCommand(ctx context.Context, args ...string) *Process
ComposerCommand(ctx context.Context, args ...string) *Process
PHPCommand(ctx context.Context, args ...string) *Process
NPMCommand(ctx context.Context, args ...string) *Process
// AvailableLogFiles lists the .log files in the project's var/log
// directory, most recently modified first.
AvailableLogFiles(ctx context.Context) ([]LogFile, error)
// GetLog streams the last lines of a var/log file to w, following new
// output when follow is true. It blocks until the stream ends or ctx is
// cancelled; cancellation (e.g. Ctrl-C while following) is not an error.
GetLog(ctx context.Context, file string, lines int, follow bool, w io.Writer) error
NormalizePath(hostPath string) string
Type() string
WithEnv(env map[string]string) Executor
WithRelDir(relDir string) Executor
StartEnvironment(ctx context.Context) error
StopEnvironment(ctx context.Context, opts StopOptions) error
EnvironmentStatus(ctx context.Context) (bool, error)
AdminAPIClient(ctx context.Context) (*adminSdk.Client, error)
// ShopConfig returns the project config with the selected environment's
// url and admin_api applied.
ShopConfig() *shop.Config
// DatabaseConnection returns credentials to reach the project database
// from the host machine.
DatabaseConnection(ctx context.Context) (*DatabaseConnection, error)
}
func NewLocalWithConfig ¶
func NewLocalWithConfig(projectRoot string, cfg *shop.EnvironmentConfig, shopCfg *shop.Config) Executor
NewLocalWithConfig returns a local executor for the given project root and project configuration.
type LocalExecutor ¶
type LocalExecutor struct {
// contains filtered or unexported fields
}
func (*LocalExecutor) AdminAPIClient ¶
func (*LocalExecutor) AvailableLogFiles ¶
func (l *LocalExecutor) AvailableLogFiles(_ context.Context) ([]LogFile, error)
func (*LocalExecutor) ComposerCommand ¶
func (l *LocalExecutor) ComposerCommand(ctx context.Context, args ...string) *Process
func (*LocalExecutor) ConsoleCommand ¶
func (l *LocalExecutor) ConsoleCommand(ctx context.Context, args ...string) *Process
func (*LocalExecutor) DatabaseConnection ¶
func (l *LocalExecutor) DatabaseConnection(_ context.Context) (*DatabaseConnection, error)
func (*LocalExecutor) EnvironmentStatus ¶
func (l *LocalExecutor) EnvironmentStatus(_ context.Context) (bool, error)
func (*LocalExecutor) NPMCommand ¶
func (l *LocalExecutor) NPMCommand(ctx context.Context, args ...string) *Process
func (*LocalExecutor) NormalizePath ¶
func (l *LocalExecutor) NormalizePath(hostPath string) string
func (*LocalExecutor) PHPCommand ¶
func (l *LocalExecutor) PHPCommand(ctx context.Context, args ...string) *Process
func (*LocalExecutor) ShopConfig ¶
func (l *LocalExecutor) ShopConfig() *shop.Config
func (*LocalExecutor) StartEnvironment ¶
func (l *LocalExecutor) StartEnvironment(_ context.Context) error
func (*LocalExecutor) StopEnvironment ¶
func (l *LocalExecutor) StopEnvironment(_ context.Context, _ StopOptions) error
func (*LocalExecutor) Type ¶
func (l *LocalExecutor) Type() string
func (*LocalExecutor) WithRelDir ¶
func (l *LocalExecutor) WithRelDir(relDir string) Executor
type Process ¶
func (*Process) CombinedOutput ¶
func (*Process) RunWithOutput ¶
RunWithOutput runs the command and streams its combined stdout/stderr to w.
func (*Process) StartCombined ¶
func (p *Process) StartCombined() (io.ReadCloser, error)
StartCombined starts the command with its stdout and stderr merged into a single reader. Unlike RunWithOutput it does not block, and the returned reader reaches EOF once the process (and the read end of the pipe) is done, so a reader does not hang when the process is signaled to stop.
func (*Process) StderrPipe ¶
func (p *Process) StderrPipe() (io.ReadCloser, error)
func (*Process) StdoutPipe ¶
func (p *Process) StdoutPipe() (io.ReadCloser, error)
type SSHExecutor ¶
type SSHExecutor struct {
// contains filtered or unexported fields
}
SSHExecutor runs commands against a Shopware project on a remote host over SSH. Every invocation is a one-shot ssh call; repeated calls are cheap because they share a multiplexed master connection (ControlMaster / ControlPersist), so the TCP and authentication handshake happens only once.
func (*SSHExecutor) AdminAPIClient ¶
func (*SSHExecutor) AvailableLogFiles ¶
func (s *SSHExecutor) AvailableLogFiles(ctx context.Context) ([]LogFile, error)
func (*SSHExecutor) ComposerCommand ¶
func (s *SSHExecutor) ComposerCommand(ctx context.Context, args ...string) *Process
func (*SSHExecutor) ConsoleCommand ¶
func (s *SSHExecutor) ConsoleCommand(ctx context.Context, args ...string) *Process
func (*SSHExecutor) DatabaseConnection ¶
func (s *SSHExecutor) DatabaseConnection(ctx context.Context) (*DatabaseConnection, error)
DatabaseConnection resolves the database credentials from the remote project and routes the connection through the SSH host: the resolved host:port lives in the remote network, so the mysql driver is pointed at a registered dialer network that forwards each connection with `ssh -W`. Every MySQL connection spawns its own channel on the multiplexed SSH connection, so no persistent tunnel process has to be managed. When the database host is "localhost", PHP would connect through a unix socket, so the configured socket path is resolved on the remote host and forwarded instead of a TCP port.
func (*SSHExecutor) EnvironmentStatus ¶
func (s *SSHExecutor) EnvironmentStatus(_ context.Context) (bool, error)
func (*SSHExecutor) NPMCommand ¶
func (s *SSHExecutor) NPMCommand(ctx context.Context, args ...string) *Process
func (*SSHExecutor) NormalizePath ¶
func (s *SSHExecutor) NormalizePath(hostPath string) string
NormalizePath translates a path below the local project root into the project directory on the remote host, mirroring the Docker executor. Paths outside the project root (or all paths when no project root is known) are returned unchanged.
func (*SSHExecutor) PHPCommand ¶
func (s *SSHExecutor) PHPCommand(ctx context.Context, args ...string) *Process
func (*SSHExecutor) ShopConfig ¶
func (s *SSHExecutor) ShopConfig() *shop.Config
func (*SSHExecutor) StartEnvironment ¶
func (s *SSHExecutor) StartEnvironment(_ context.Context) error
func (*SSHExecutor) StopEnvironment ¶
func (s *SSHExecutor) StopEnvironment(_ context.Context, _ StopOptions) error
func (*SSHExecutor) Type ¶
func (s *SSHExecutor) Type() string
func (*SSHExecutor) WithRelDir ¶
func (s *SSHExecutor) WithRelDir(relDir string) Executor
type StopOptions ¶
type StopOptions struct {
// RemoveVolumes also removes the named volumes declared in the compose
// file, deleting all data stored in them.
RemoveVolumes bool
}
StopOptions configures how the development environment is stopped.
type SymfonyCLIExecutor ¶
type SymfonyCLIExecutor struct {
BinaryPath string
// contains filtered or unexported fields
}
func (*SymfonyCLIExecutor) AdminAPIClient ¶
func (*SymfonyCLIExecutor) AvailableLogFiles ¶
func (s *SymfonyCLIExecutor) AvailableLogFiles(_ context.Context) ([]LogFile, error)
func (*SymfonyCLIExecutor) ComposerCommand ¶
func (s *SymfonyCLIExecutor) ComposerCommand(ctx context.Context, args ...string) *Process
func (*SymfonyCLIExecutor) ConsoleCommand ¶
func (s *SymfonyCLIExecutor) ConsoleCommand(ctx context.Context, args ...string) *Process
func (*SymfonyCLIExecutor) DatabaseConnection ¶
func (s *SymfonyCLIExecutor) DatabaseConnection(_ context.Context) (*DatabaseConnection, error)
func (*SymfonyCLIExecutor) EnvironmentStatus ¶
func (s *SymfonyCLIExecutor) EnvironmentStatus(_ context.Context) (bool, error)
func (*SymfonyCLIExecutor) NPMCommand ¶
func (s *SymfonyCLIExecutor) NPMCommand(ctx context.Context, args ...string) *Process
func (*SymfonyCLIExecutor) NormalizePath ¶
func (s *SymfonyCLIExecutor) NormalizePath(hostPath string) string
func (*SymfonyCLIExecutor) PHPCommand ¶
func (s *SymfonyCLIExecutor) PHPCommand(ctx context.Context, args ...string) *Process
func (*SymfonyCLIExecutor) ShopConfig ¶
func (s *SymfonyCLIExecutor) ShopConfig() *shop.Config
func (*SymfonyCLIExecutor) StartEnvironment ¶
func (s *SymfonyCLIExecutor) StartEnvironment(_ context.Context) error
func (*SymfonyCLIExecutor) StopEnvironment ¶
func (s *SymfonyCLIExecutor) StopEnvironment(_ context.Context, _ StopOptions) error
func (*SymfonyCLIExecutor) Type ¶
func (s *SymfonyCLIExecutor) Type() string
func (*SymfonyCLIExecutor) WithEnv ¶
func (s *SymfonyCLIExecutor) WithEnv(env map[string]string) Executor
func (*SymfonyCLIExecutor) WithRelDir ¶
func (s *SymfonyCLIExecutor) WithRelDir(relDir string) Executor