Documentation

Index

Constants

View Source
const (
	// ContainerInPath is the input path for fissile
	ContainerInPath = "/fissile-in"
	// ContainerOutPath is the output path for fissile
	ContainerOutPath = "/fissile-out"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrImageNotFound

type ErrImageNotFound string

    ErrImageNotFound is the error returned when an image is not found.

    func (ErrImageNotFound) Error

    func (e ErrImageNotFound) Error() string

    type FormattingWriter

    type FormattingWriter struct {
    	io.Writer
    	io.Closer
    	// contains filtered or unexported fields
    }

      FormattingWriter wraps an io.WriteCloser so lines can be individually formatted.

      func NewFormattingWriter

      func NewFormattingWriter(writer io.Writer, aColorizer StringFormatter) *FormattingWriter

        NewFormattingWriter - Get a FormattingWriter here. aColorizer can be nil

        func (*FormattingWriter) Close

        func (w *FormattingWriter) Close() error

          Close ensures the remaining data is written to the io.Writer

          func (*FormattingWriter) Write

          func (w *FormattingWriter) Write(data []byte) (int, error)

          type ImageManager

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

            ImageManager handles Docker images

            func NewImageManager

            func NewImageManager() (*ImageManager, error)

              NewImageManager creates an instance of ImageManager

              func (*ImageManager) BuildImage

              func (d *ImageManager) BuildImage(dockerfileDirPath, name string, stdoutWriter io.WriteCloser) error

                BuildImage builds a docker image using a directory that contains a Dockerfile

                func (*ImageManager) BuildImageFromCallback

                func (d *ImageManager) BuildImageFromCallback(name string, stdoutWriter io.Writer, callback func(*tar.Writer) error) error

                  BuildImageFromCallback builds a docker image by letting a callback populate a tar.Writer; the callback must write a Dockerfile into the tar stream (as well as any additional build context). If stdoutWriter implements io.Closer, it will be closed when done.

                  func (*ImageManager) CreateImage

                  func (d *ImageManager) CreateImage(containerID string, repository string, tag string, message string, cmd []string) (*dockerclient.Image, error)

                    CreateImage will create a Docker image

                    func (*ImageManager) FindBestImageWithLabels

                    func (d *ImageManager) FindBestImageWithLabels(baseImageName string, labels []string, mandatory []string) (string, map[string]string, error)

                      FindBestImageWithLabels finds the best image that has a given base image, and has as many of the given labels as possible. Returns the best matching image name, and all of the matched labels (and their values). Manadatory labels are labels an image must have to be considered as candidate.

                      func (*ImageManager) FindImage

                      func (d *ImageManager) FindImage(imageName string) (*dockerclient.Image, error)

                        FindImage will lookup an image in Docker

                        func (*ImageManager) HasImage

                        func (d *ImageManager) HasImage(imageName string) (bool, error)

                          HasImage determines if the given image already exists in Docker

                          func (*ImageManager) HasLabels

                          func (d *ImageManager) HasLabels(image *dockerclient.APIImages, labels map[string]struct{}) bool

                            HasLabels determines if all of the provided labels (keys of the map) are in the set of the image's labels. It returns true if so, and false otherwise.

                            func (*ImageManager) ListImages

                              ListImages will return a list of images matching the options

                              func (*ImageManager) RemoveContainer

                              func (d *ImageManager) RemoveContainer(containerID string) error

                                RemoveContainer will remove a container from Docker

                                func (*ImageManager) RemoveImage

                                func (d *ImageManager) RemoveImage(imageName string) error

                                  RemoveImage will remove an image from Docker's internal registry

                                  func (*ImageManager) RemoveVolumes

                                  func (d *ImageManager) RemoveVolumes(container *dockerclient.Container) error

                                    RemoveVolumes removes any temporary volumes associated with a container

                                    func (*ImageManager) RunInContainer

                                    func (d *ImageManager) RunInContainer(opts RunInContainerOpts) (int, *dockerclient.Container, error)

                                      RunInContainer will execute a set of commands within a running Docker container

                                      type RunInContainerOpts

                                      type RunInContainerOpts struct {
                                      	ContainerName string
                                      	ImageName     string
                                      	NetworkMode   string
                                      	EntryPoint    []string
                                      	Cmd           []string
                                      	// Mount points, src -> dest
                                      	// dest may be special values ContainerInPath, ContainerOutPath
                                      	Mounts map[string]string
                                      	// Create local volumes.  Volumes are destroyed unless KeepContainer is true
                                      	Volumes       map[string]map[string]string
                                      	KeepContainer bool
                                      	StdoutWriter  io.Writer
                                      	StderrWriter  io.Writer
                                      	// Directories to stream in/out of the container.
                                      	StreamIn  map[string]string
                                      	StreamOut map[string]string
                                      }

                                        RunInContainerOpts encapsulates the options to RunInContainer()

                                        type StringFormatter

                                        type StringFormatter func(line string) string

                                          StringFormatter is a formatting string function

                                          func ColoredBuildStringFunc

                                          func ColoredBuildStringFunc(buildName string) StringFormatter

                                            ColoredBuildStringFunc returns a formatting function for colorizing strings.

                                            Source Files