Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DockerVolumeWorkspaceImage = "sourcegraph/src-batch-change-volume-workspace"
DockerVolumeWorkspaceImage is the Docker image we'll run our unzip and git commands in. This needs to match the name defined in .github/workflows/docker.yml.
Functions ¶
func NewCreator ¶
Types ¶
type Creator ¶
type Creator interface {
// Create creates a new workspace for the given repository and archive file.
Create(ctx context.Context, repo *graphql.Repository, steps []batcheslib.Step, archive repozip.Archive) (Workspace, error)
}
Creator implementations are used to create workspaces, which manage per-changeset persistent storage when executing batch change steps and are responsible for ultimately generating a diff.
type CreatorType ¶
type CreatorType int
const ( CreatorTypeBind CreatorType = iota CreatorTypeVolume )
func BestCreatorType ¶
BestCreatorType determines the correct workspace creator type to use based on the environment and batch change to be executed.
type Workspace ¶
type Workspace interface {
// DockerRunOpts provides the options that should be given to `docker run`
// in order to use this workspace. Generally, this will be a set of mount
// options.
DockerRunOpts(ctx context.Context, target string) ([]string, error)
// WorkDir allows workspaces to specify the working directory that should be
// used when running Docker. If no specific working directory is needed,
// then the function should return nil.
WorkDir() *string
// Close is called once, after all steps have been executed and the diff has
// been calculated and stored outside the workspace. Implementations should
// delete the workspace when Close is called.
Close(ctx context.Context) error
// Diff should return the total diff for the workspace. This may be called
// multiple times in the life of a workspace.
Diff(ctx context.Context) ([]byte, error)
// ApplyDiff applies the given diff to the current workspace. Used when replaying
// a cache entry onto the workspace.
ApplyDiff(ctx context.Context, diff []byte) error
}
Workspace implementations manage per-changeset storage when executing batch change steps.
Click to show internal directories.
Click to hide internal directories.