container

package
v0.0.0-...-4c964c4 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2025 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func GetGitspaceContainerName

func GetGitspaceContainerName(config types.GitspaceConfig) string

func GetUserHomeDir

func GetUserHomeDir(userIdentifier string) string

Types

type EmbeddedDockerOrchestrator

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

func (*EmbeddedDockerOrchestrator) CreateAndStartGitspace

func (e *EmbeddedDockerOrchestrator) CreateAndStartGitspace(
	ctx context.Context,
	gitspaceConfig types.GitspaceConfig,
	infra types.Infrastructure,
	resolvedRepoDetails scm.ResolvedDetails,
	defaultBaseImage string,
	ideService ide.IDE,
) (*StartResponse, error)

CreateAndStartGitspace starts an exited container and starts a new container if the container is removed. If the container is newly created, it clones the code, sets up the IDE and executes the postCreateCommand. It returns the container ID, name and ports used. It returns an error if the container is not running, exited or removed.

func (*EmbeddedDockerOrchestrator) Status

Status is NOOP for EmbeddedDockerOrchestrator as the docker host is verified by the infra provisioner.

func (*EmbeddedDockerOrchestrator) StopAndRemoveGitspace

func (e *EmbeddedDockerOrchestrator) StopAndRemoveGitspace(
	ctx context.Context,
	gitspaceConfig types.GitspaceConfig,
	infra types.Infrastructure,
) error

StopAndRemoveGitspace stops the container if not stopped and removes it. If the container is already removed, it returns.

func (*EmbeddedDockerOrchestrator) StopGitspace

func (e *EmbeddedDockerOrchestrator) StopGitspace(
	ctx context.Context,
	gitspaceConfig types.GitspaceConfig,
	infra types.Infrastructure,
) error

StopGitspace stops a container. If it is removed, it returns an error.

func (*EmbeddedDockerOrchestrator) StreamLogs

type Orchestrator

type Orchestrator interface {
	// CreateAndStartGitspace starts an exited container and starts a new container if the container is removed.
	// If the container is newly created, it clones the code, sets up the IDE and executes the postCreateCommand.
	// It returns the container ID, name and ports used.
	CreateAndStartGitspace(
		ctx context.Context,
		gitspaceConfig types.GitspaceConfig,
		infra types.Infrastructure,
		resolvedDetails scm.ResolvedDetails,
		defaultBaseImage string,
		ideService ide.IDE,
	) (*StartResponse, error)

	// StopGitspace stops the gitspace container.
	StopGitspace(ctx context.Context, config types.GitspaceConfig, infra types.Infrastructure) error

	// StopAndRemoveGitspace stops and removes the gitspace container.
	StopAndRemoveGitspace(ctx context.Context, config types.GitspaceConfig, infra types.Infrastructure) error

	// Status checks if the infra is reachable and ready to orchestrate containers.
	Status(ctx context.Context, infra types.Infrastructure) error

	// StreamLogs is used to fetch gitspace's start/stop logs from the container orchestrator.
	StreamLogs(ctx context.Context, gitspaceConfig types.GitspaceConfig, infra types.Infrastructure) (string, error)
}

func NewEmbeddedDockerOrchestrator

func NewEmbeddedDockerOrchestrator(
	dockerClientFactory *infraprovider.DockerClientFactory,
	statefulLogger *logutil.StatefulLogger,
	gitService git.Service,
	userService user.Service,
) Orchestrator

func ProvideEmbeddedDockerOrchestrator

func ProvideEmbeddedDockerOrchestrator(
	dockerClientFactory *infraprovider.DockerClientFactory,
	statefulLogger *logutil.StatefulLogger,
	gitService git.Service,
	userService user.Service,
) Orchestrator

type StartResponse

type StartResponse struct {
	ContainerID      string
	ContainerName    string
	PublishedPorts   map[int]string
	AbsoluteRepoPath string
}

Jump to

Keyboard shortcuts

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