Documentation ¶
Index ¶
- Constants
- Variables
- func GetDatabase(cfg *DBConfig) (*sql.DB, error)
- func InMemoryConnection(base string) string
- func Labels(sid sous.SourceID) map[string]string
- func NewBuildArtifact(imageName string, qstrs strpairs) *sous.BuildArtifact
- 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 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) GroomDatabase() error
- func (nc *NameCache) ListSourceIDs() ([]sous.SourceID, error)
- func (nc *NameCache) Warmup(r string) error
- type NoImageNameFound
- type NoSourceIDFound
- type NotModifiedErr
- type SingleArg
- type SpaceSeparatedArgs
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 InMemory = "file:dummy.db?mode=memory&cache=shared"
InMemory configures SQLite to use an in-memory database The dummy file allows multiple goroutines see the same in-memory DB
Variables ¶
var (
// Log is an alias to sous.Log
Log = sous.Log
)
Functions ¶
func GetDatabase ¶
GetDatabase initialises a new database for a NameCache.
func InMemoryConnection ¶
InMemoryConnection builds a connection string based on a base name This is mostly useful for testing, so that we can have separate cache DBs per test
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.
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 *NameCache DockerRegistryHost string SourceShell, ScratchShell shell.Shell Pack sous.Buildpack }
Builder represents a single build of a project.
func NewBuilder ¶
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 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"` // DatabaseDriver is the name of the driver to use for local // persistence. DatabaseDriver string `env:"SOUS_DOCKER_DB_DRIVER"` // DatabaseConnection is the database connection string for local // persistence. DatabaseConnection string `env:"SOUS_DOCKER_DB_CONN"` }
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 { }
DockerfileBuildpack is a simple buildpack for building projects using their own Dockerfile.
func NewDockerfileBuildpack ¶
func NewDockerfileBuildpack() *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)
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 NameCache ¶
type NameCache struct { RegistryClient docker_registry.Client DB *sql.DB }
NameCache is a database for looking up SourceIDs based on Docker image names and vice versa.
func NewNameCache ¶
func NewNameCache(cl docker_registry.Client, db *sql.DB) *NameCache
NewNameCache builds a new name cache
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
func (*NameCache) GroomDatabase ¶ added in v0.0.2
GroomDatabase ensures that the database to back the cache is the correct schema
func (*NameCache) ListSourceIDs ¶
ListSourceIDs implements Registry
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 SpaceSeparatedArgs ¶
type SpaceSeparatedArgs []string
func (SpaceSeparatedArgs) String ¶
func (s SpaceSeparatedArgs) String() string