Documentation ¶
Index ¶
- Constants
- func Labels(sid sous.SourceID, rev string) map[string]string
- func NewBuildArtifact(imageName string, qstrs strpairs) *sous.BuildArtifact
- func NewBuildStrategySelector(ls logging.LogSink, rc docker_registry.Client) sous.Selector
- func SourceIDFromLabels(labels map[string]string) (sous.SourceID, error)
- type Args
- type ArrayArg
- type ArrayArgs
- type BuildTarget
- type Builder
- type Config
- type DBConfig
- type DockerfileBuildpack
- type File
- func (f *File) ADD(target string, files ...string)
- func (f *File) CMD(args ...string)
- func (f *File) COPY(target string, files ...string)
- func (f *File) ENTRYPOINT(args ...string)
- func (f *File) ENV(m map[string]string)
- func (f *File) LABEL(m map[string]string)
- func (f *File) RUN(args ...string)
- func (f File) String() string
- func (f *File) USER(username string)
- func (f *File) WORKDIR(path string)
- type Instruction
- type Instructions
- type KeyValueArgs
- type MultiImageRunSpec
- type NameCache
- func (nc *NameCache) GetArtifact(sid sous.SourceID) (*sous.BuildArtifact, error)
- func (nc *NameCache) GetCanonicalName(in string) (string, error)
- func (nc *NameCache) GetSourceID(a *sous.BuildArtifact) (sous.SourceID, error)
- func (nc *NameCache) ImageLabels(in string) (map[string]string, error)
- func (nc *NameCache) Insert(sid sous.SourceID, ba sous.BuildArtifact) error
- func (nc *NameCache) ListSourceIDs() ([]sous.SourceID, error)
- func (nc *NameCache) Warmup(r string) error
- type NoImageNameFound
- type NoSourceIDFound
- type NotModifiedErr
- type RunmountBuildpack
- type SingleArg
- type SpaceSeparatedArgs
- type SplitBuildpack
- type SplitImageRunSpec
Constants ¶
const ( DockerRepoLabel = "com.opentable.sous.repo_url" DockerPathLabel = "com.opentable.sous.repo_offset" DockerVersionLabel = "com.opentable.sous.version" DockerRevisionLabel = "com.opentable.sous.revision" )
const ( // AppVersionBuildArg is the name of a docker build argument used to inject // the version of the app being built. AppVersionBuildArg = "APP_VERSION" // AppRevisionBuildArg is the name of a docker build argument used to inject // the revision of the app being built. AppRevisionBuildArg = "APP_REVISION" )
const BuildCacheEnv = "BUILD_CACHE"
BuildCacheEnv is an environment variable a runmount image may set
const BuildOutEnv = "BUILD_OUT"
BuildOutEnv is the other environment variable a runmount image must set
const SOUS_RUN_IMAGE_SPEC = "SOUS_RUN_IMAGE_SPEC"
SOUS_RUN_IMAGE_SPEC is the env name that build containers must declare with the path to their runspec file.
Variables ¶
This section is empty.
Functions ¶
func Labels ¶
Labels computes a map of labels that should be applied to a container image that is built based on this SourceID.
func NewBuildArtifact ¶
func NewBuildArtifact(imageName string, qstrs strpairs) *sous.BuildArtifact
NewBuildArtifact creates a new sous.BuildArtifact representing a Docker image. XXX this should be removed in favor of sous.NewBuildArtifact
func NewBuildStrategySelector ¶ added in v1.0.1
NewBuildStrategySelector constructs a sous.Selector that uses docker build images as its strategies
func SourceIDFromLabels ¶
SourceIDFromLabels builds a SourceID from a map of labels, generally acquired from a Docker image.
Types ¶
type BuildTarget ¶
type BuildTarget interface { BuildImage() BuildContainer() }
BuildTarget represents a single target within a Build.
type Builder ¶
type Builder struct { ImageMapper sous.Inserter DockerRegistryHost string SourceShell, ScratchShell shell.Shell Pack sous.Buildpack // contains filtered or unexported fields }
Builder represents a single build of a project.
func NewBuilder ¶
func NewBuilder(nc sous.Inserter, drh string, sourceShell, scratchShell shell.Shell, ls logging.LogSink) (*Builder, error)
NewBuilder creates a new build using source code in the working directory of sourceShell, and using the working dir of scratchShell as temporary storage.
func (*Builder) ApplyMetadata ¶
ApplyMetadata implements sous.Labeller on Builder. It applies container metadata etc. to a container.
func (*Builder) RevisionTag ¶
RevisionTag computes an image tag from a SourceVersion's revision id
func (*Builder) VersionTag ¶
VersionTag computes an image tag from a SourceVersion's version
type Config ¶
type Config struct {
RegistryHost string `env:"SOUS_DOCKER_REGISTRY_HOST"`
}
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig builds a default configuration, which can be then overridden by client code.
type DBConfig ¶
type DBConfig struct {
Driver, Connection string
}
DBConfig is a database configuration for a NameCache.
type DockerfileBuildpack ¶
type DockerfileBuildpack struct {
// contains filtered or unexported fields
}
DockerfileBuildpack is a simple buildpack for building projects using their own Dockerfile.
func NewDockerfileBuildpack ¶
func NewDockerfileBuildpack(ls logging.LogSink) *DockerfileBuildpack
NewDockerfileBuildpack creates a Dockerfile buildpack
func (*DockerfileBuildpack) Build ¶
func (d *DockerfileBuildpack) Build(c *sous.BuildContext) (*sous.BuildResult, error)
Build implements Buildpack.Build
func (*DockerfileBuildpack) Detect ¶
func (d *DockerfileBuildpack) Detect(c *sous.BuildContext) (*sous.DetectResult, error)
Detect detects if c has a Dockerfile or not.
type File ¶
type File struct {
From, Maintainer string
Instructions Instructions
}
func (*File) ENTRYPOINT ¶
type Instruction ¶
func (Instruction) String ¶
func (i Instruction) String() string
type Instructions ¶
type Instructions []Instruction
func (*Instructions) Add ¶
func (is *Instructions) Add(name string, args Args)
func (Instructions) String ¶
func (is Instructions) String() string
type KeyValueArgs ¶
func (KeyValueArgs) Flatten ¶
func (kv KeyValueArgs) Flatten() []string
func (KeyValueArgs) String ¶
func (kv KeyValueArgs) String() string
type MultiImageRunSpec ¶ added in v1.0.1
type MultiImageRunSpec struct { *SplitImageRunSpec `json:",omitempty"` Images []SplitImageRunSpec `json:"images"` }
A MultiImageRunSpec is the JSON structure that build containers emit in order that their associated deploy containers can be assembled It *can* parse the same structure as SplitImageRunSpec, because there are a few builds that already use that format.
func (MultiImageRunSpec) Normalized ¶ added in v1.0.1
func (ms MultiImageRunSpec) Normalized() MultiImageRunSpec
Normalized returns a MultiImageRunSpec where all the SplitImageRunSpecs are in Images.
func (*MultiImageRunSpec) Validate ¶ added in v1.0.1
func (ms *MultiImageRunSpec) Validate() []sous.Flaw
Validate implements Flawed on MultiImageRunSpec
type NameCache ¶
type NameCache struct { sync.Mutex RegistryClient docker_registry.Client DB *sql.DB DockerRegistryHost string // contains filtered or unexported fields }
NameCache is a database for looking up SourceIDs based on Docker image names and vice versa.
func NewNameCache ¶
func NewNameCache(drh string, cl docker_registry.Client, ls logging.LogSink, db *sql.DB) (*NameCache, error)
NewNameCache builds a new name cache. XXX remove error return value
func (*NameCache) GetArtifact ¶
GetArtifact implements sous.Registry.GetArtifact.
func (*NameCache) GetCanonicalName ¶
GetCanonicalName returns the canonical name for an image given any known name
func (*NameCache) GetSourceID ¶
GetSourceID looks up the source ID for a given image name.
xxx consider un-exporting
func (*NameCache) ImageLabels ¶ added in v0.0.3
ImageLabels gets the labels for an image name.
func (*NameCache) Insert ¶ added in v0.0.3
Insert puts a given SourceID/image name pair into the name cache used by Builder at the moment to register after a build
func (*NameCache) ListSourceIDs ¶
ListSourceIDs lists all the known SourceIDs.
type NoImageNameFound ¶
type NoImageNameFound struct {
sous.SourceID
}
NoImageNameFound is returned when we cannot find an image name for a given SourceID.
func (NoImageNameFound) Error ¶
func (e NoImageNameFound) Error() string
type NoSourceIDFound ¶
type NoSourceIDFound struct {
// contains filtered or unexported fields
}
NoSourceIDFound is returned when we cannot find a SourceID for a given image name
func (NoSourceIDFound) Error ¶
func (e NoSourceIDFound) Error() string
type NotModifiedErr ¶
type NotModifiedErr struct{}
NotModifiedErr is returned when an HTTP server returns Not Modified in response to a conditional request
func (NotModifiedErr) Error ¶
func (e NotModifiedErr) Error() string
type RunmountBuildpack ¶ added in v1.0.1
type RunmountBuildpack struct {
// contains filtered or unexported fields
}
RunmountBuildpack builds a container, runs it seperately to use docker mounts for cache and output, and builds final deploy container
func NewRunmountBuildpack ¶ added in v1.0.1
func NewRunmountBuildpack(r docker_registry.Client, ls logging.LogSink) *RunmountBuildpack
NewRunmountBuildpack returns a new RunmountBuildpack
func (*RunmountBuildpack) Build ¶ added in v1.0.1
func (rmbp *RunmountBuildpack) Build(ctx *sous.BuildContext) (*sous.BuildResult, error)
Build implements Buildpack on RunmountBuildpack
func (*RunmountBuildpack) Detect ¶ added in v1.0.1
func (rmbp *RunmountBuildpack) Detect(ctx *sous.BuildContext) (*sous.DetectResult, error)
Detect implements Buildpack on SplitBuildpack
type SpaceSeparatedArgs ¶
type SpaceSeparatedArgs []string
func (SpaceSeparatedArgs) String ¶
func (s SpaceSeparatedArgs) String() string
type SplitBuildpack ¶ added in v1.0.1
type SplitBuildpack struct {
// contains filtered or unexported fields
}
A SplitBuildpack implements the pattern of using a build container and producing a separate deploy container
func NewSplitBuildpack ¶ added in v1.0.1
func NewSplitBuildpack(r docker_registry.Client, ls logging.LogSink) *SplitBuildpack
NewSplitBuildpack returns a new SplitBuildpack
func (*SplitBuildpack) Build ¶ added in v1.0.1
func (sbp *SplitBuildpack) Build(ctx *sous.BuildContext) (*sous.BuildResult, error)
Build implements Buildpack on SplitBuildpack
func (*SplitBuildpack) Detect ¶ added in v1.0.1
func (sbp *SplitBuildpack) Detect(ctx *sous.BuildContext) (*sous.DetectResult, error)
Detect implements Buildpack on SplitBuildpack
type SplitImageRunSpec ¶ added in v1.0.1
type SplitImageRunSpec struct { // Kind is used to denote that the image isn't a "normal" i.e. deployable // service image, but instead some other kind. Examples include "builder" or // "test" or "uploader" Kind string `json:"kind"` // Offset is the usual Sous offset: the path relative to the root of the // project that selects one of several services built from the same codebase. Offset string `json:"offset"` // Image describes the base of the deploy image. type should be "docker" and // from should be a suitable FROM image. Image sbmImage `json:"image"` // Files maps directories of built files in the build container to their // destination in the deploy container. Files []sbmInstall `json:"files"` // Exec describes the command to ultimately run in the deploy container - // essentially a Docker ENTRYPOINT Exec []string `json:"exec"` }
A SplitImageRunSpec is the JSON structure that describes an individual deploy container.
func (*SplitImageRunSpec) Validate ¶ added in v1.0.1
func (rs *SplitImageRunSpec) Validate() []sous.Flaw
Validate implements Flawed on SplitImageRunSpec
Source Files ¶
- builder.go
- buildutil.go
- cachemessages.go
- config.go
- docker_labels.go
- dockerfile_buildpack.go
- dockerfileinspector.go
- file.go
- image_mapping.go
- indexdatabase.go
- names.go
- runmount_builder.go
- runmount_buildpack.go
- selector.go
- splitcontainer_buildpack.go
- splitcontainer_runnablebuilder.go
- splitcontainer_runspec.go
- splitcontainer_splitbuilder.go
- templates.go
- templates_vfs.go