images

package
v0.9.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 7, 2023 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultBuildTimeout = 1 * time.Hour

Functions

This section is empty.

Types

type Batch

type Batch interface {
	Completed(envname, name string) (bool, error)
	Started(envname, name string) bool
	Done() bool
	Stop()
}

Batch describes a BuildBatch object

type BuildBatch

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

func (*BuildBatch) Completed

func (b *BuildBatch) Completed(envname, name string) (bool, error)

Completed returns if build for repo has completed along with outcome

func (*BuildBatch) Done

func (b *BuildBatch) Done() bool

Done returns whether all builds in the batch have completed

func (*BuildBatch) Started

func (b *BuildBatch) Started(envname, name string) bool

func (*BuildBatch) Stop

func (b *BuildBatch) Stop()

Stop aborts any running builds in the batch and cleans up orphaned resources

type BuildOptions

type BuildOptions struct {
	// Relative path to Dockerfile within build context
	DockerfilePath string
	// key-value pairs for optional build arguments
	BuildArgs map[string]string
}

BuildOptions models optional image build options

type Builder

type Builder interface {
	StartBuilds(ctx context.Context, envname string, rc *models.RepoConfig) (Batch, error)
}

Builder describes an object that builds a set of container images

type BuilderBackend

type BuilderBackend interface {
	BuildImage(ctx context.Context, envName, depName, githubRepo, imageRepo, ref string, ops BuildOptions) error
}

BuilderBackend describes the object that actually does image builds

type DockerBuilderBackend

type DockerBuilderBackend struct {
	DC    DockerClient
	RC    ghclient.RepoClient
	DL    persistence.DataLayer
	Auths map[string]types.AuthConfig
	Push  bool
}

DockerBuilderBackend builds images using a Docker Engine

func (*DockerBuilderBackend) BuildImage

func (dbb *DockerBuilderBackend) BuildImage(ctx context.Context, envName, depName, githubRepo, imageRepo, ref string, ops BuildOptions) error

BuildImage synchronously builds and optionally pushes the image using the Docker Engine, returning when the build completes.

type DockerClient

type DockerClient interface {
	ImageBuild(ctx context.Context, buildContext io.Reader, options types.ImageBuildOptions) (types.ImageBuildResponse, error)
	ImagePush(ctx context.Context, image string, options types.ImagePushOptions) (io.ReadCloser, error)
}

type FakeBuildBatch

type FakeBuildBatch struct {
	BatchCompletedFunc func(envname, title string) (bool, error)
	BatchStartedFunc   func(envname, title string) bool
	BatchDoneFunc      func() bool
	BatchStopFunc      func()
}

func (*FakeBuildBatch) Completed

func (fbb *FakeBuildBatch) Completed(envname, title string) (bool, error)

func (*FakeBuildBatch) Done

func (fbb *FakeBuildBatch) Done() bool

func (*FakeBuildBatch) Started

func (fbb *FakeBuildBatch) Started(envname, title string) bool

func (*FakeBuildBatch) Stop

func (fbb *FakeBuildBatch) Stop()

type FakeImageBuilder

type FakeImageBuilder struct {
	// CompletedFunc is a function that is called when Completed() is invoked
	BatchCompletedFunc func(envname, title string) (bool, error)
	BatchStartedFunc   func(envname, title string) bool
	BatchDoneFunc      func() bool
	BatchStopFunc      func()
}

FakeImageBuilder satisfies the Builder interface but does nothing

func (*FakeImageBuilder) StartBuilds

func (fib *FakeImageBuilder) StartBuilds(ctx context.Context, envname string, rc *models.RepoConfig) (Batch, error)

type Furan2BuilderBackend added in v0.9.2

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

func NewFuran2BuilderBackend added in v0.9.2

func NewFuran2BuilderBackend(addr, apikey string, ghappInstID int64, skipVerifyTLS bool, dl persistence.DataLayer, rac ghclient.RepoAppClient, mc metrics.Collector) (*Furan2BuilderBackend, error)

func (*Furan2BuilderBackend) BuildImage added in v0.9.2

func (fib *Furan2BuilderBackend) BuildImage(ctx context.Context, envName, depName, githubRepo, imageRepo, ref string, ops BuildOptions) error

BuildImage synchronously builds the image using Furan, returning when the build completes.

type FuranBuilderBackend

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

func NewFuranBuilderBackend

func NewFuranBuilderBackend(addrs []string, dl persistence.DataLayer, mc metrics.Collector, logout io.Writer, datadogServiceNamePrefix string) (*FuranBuilderBackend, error)

func (*FuranBuilderBackend) BuildImage

func (fib *FuranBuilderBackend) BuildImage(ctx context.Context, envName, depName, githubRepo, imageRepo, ref string, ops BuildOptions) error

BuildImage synchronously builds the image using Furan, returning when the build completes.

type ImageBuilder

type ImageBuilder struct {
	Backend      BuilderBackend
	BuildTimeout time.Duration
	DL           persistence.DataLayer
	MC           metrics.Collector
}

ImageBuilder is an object that builds images using imageBuilderBackend it is intended to be a singleton instance shared among multiple concurrent environment creation procedures. Consequently, build IDs contain the name of the environment to avoid collisions

func (*ImageBuilder) StartBuilds

func (b *ImageBuilder) StartBuilds(ctx context.Context, envname string, rc *models.RepoConfig) (Batch, error)

StartBuilds begins asynchronously building all container images according to rm, pushing to image repositories specified in rc.

type NoneBackend

type NoneBackend struct {
}

NoneBackend satisfies BuilderBackend and does nothing

func (*NoneBackend) BuildImage

func (nb *NoneBackend) BuildImage(ctx context.Context, envName, depName, githubRepo, imageRepo, ref string, ops BuildOptions) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL