Documentation ¶
Index ¶
- func NewDockerBuilder(b *basher.Basher) build.Builder
- type Cleanup
- type Docker
- func (d *Docker) AddGlobalEnvs(envs []string)
- func (d *Docker) Close() error
- func (d *Docker) Exec(ctx context.Context, currStage string, currStageStr string, env []string, ...) *pb.Result
- func (d *Docker) Execute(ctx context.Context, stage *pb.Stage, logout chan []byte, commitHash string) *pb.Result
- func (d *Docker) ExecuteIntegration(ctx context.Context, stage *pb.Stage, stgUtil *build.StageUtil, ...) *pb.Result
- func (d *Docker) GetContainerId() string
- func (d *Docker) Init(ctx context.Context, hash string, logout chan []byte) *pb.Result
- func (d *Docker) SetGlobalEnv(envs []string)
- func (d *Docker) Setup(ctx context.Context, logout chan []byte, dockerIdChan chan string, ...) (*pb.Result, string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Docker ¶
type Docker struct { Log io.ReadCloser ContainerId string DockerClient *client.Client *basher.Basher // contains filtered or unexported fields }
Docker provides an implementation of the Builder interface that utilizes docker for its building. It will start up a docker container, download code into it, add environment variables, and exec commands against it.
func CreateLivingDockerContainer ¶
func CreateLivingDockerContainer(t *testing.T, ctx context.Context, imageName string) (d *Docker, clean func(t *testing.T))
CreateLivingDockerContainer will:
- create a docker container with an image from imageName
- tar up the template directory and serve it on :3333 for testing so the container can download the templates we need
- return a cleanup function to defer in your tests
*assumes you have an internet connection and are running docker on linux or mac*
func (*Docker) AddGlobalEnvs ¶
func (*Docker) Exec ¶
func (d *Docker) Exec(ctx context.Context, currStage string, currStageStr string, env []string, cmds []string, logout chan []byte) *pb.Result
Exec runs the equivalent of `docker exec`, sending all the logs over logout. The result of the command will be returned in a result object
func (*Docker) Execute ¶
func (d *Docker) Execute(ctx context.Context, stage *pb.Stage, logout chan []byte, commitHash string) *pb.Result
Execute runs a command via Exec on the container, but it first will cd to the directory of the cloned repo
func (*Docker) ExecuteIntegration ¶
func (d *Docker) ExecuteIntegration(ctx context.Context, stage *pb.Stage, stgUtil *build.StageUtil, logout chan []byte) *pb.Result
ExecuteIntegration will basically run Execute but without the cd and run cmds because we are generating the scripts in the code
func (*Docker) GetContainerId ¶
func (*Docker) SetGlobalEnv ¶
func (*Docker) Setup ¶
func (d *Docker) Setup(ctx context.Context, logout chan []byte, dockerIdChan chan string, werk *pb.WerkerTask, rc cred.CVRemoteConfig, werkerPort string) (*pb.Result, string)
Setup pulls the docker image defined in the werk task, then creates a container using that image, sending the container id over the dockerIdChan.
It mounts the docker socket to allow for docker builds within the container. It then starts the container with the initial command of downloading all the ocelot related files and installing necessary packages, and attaches logout to the output so the logs can be stored with teh rest of the build logs