builder

package
v0.0.0-...-f4be871 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrBuildNotFound = errors.New("build not found")

Functions

This section is empty.

Types

type BuildResult

type BuildResult struct {
	ImageName string `json:"image_name"`
	ImageTag  string `json:"image_tag"`
}

type BuildStatus

type BuildStatus int
const (
	StatusPending BuildStatus = iota + 1
	StatusBuilding
	StatusSucceeded
	StatusFailed
)

func (BuildStatus) String

func (status BuildStatus) String() string

type BuildStatusData

type BuildStatusData struct {
	Status       BuildStatus `json:"status"`
	StatusString string      `json:"status_string"`
	ErrorMsg     string      `json:"error"`
	StartTime    time.Time   `json:"start_time"`
	EndTime      time.Time   `json:"end_time"`
	Logs         string      `json:"logs"`
}

func (BuildStatusData) MarshalBinary

func (d BuildStatusData) MarshalBinary() ([]byte, error)

func (*BuildStatusData) UnmarshalBinary

func (d *BuildStatusData) UnmarshalBinary(data []byte) error

type Builder

type Builder struct {
	Queue *redisqueue.Queue
	// contains filtered or unexported fields
}

func NewBuilder

func NewBuilder(redisClient *redis.Client, logger *zap.Logger) *Builder

func (*Builder) AddToBuildQueue

func (b *Builder) AddToBuildQueue(opts BuilderOptions) (BuildResult, error)

func (*Builder) Close

func (b *Builder) Close() error

func (*Builder) GetBuildStatus

func (b *Builder) GetBuildStatus(imageName string) (BuildStatusData, error)

func (*Builder) SetBuildStatus

func (b *Builder) SetBuildStatus(imageName string, data BuildStatusData) error

func (*Builder) Start

func (b *Builder) Start()

Start starts the builder worker where it dequeues the build requests from the queue and builds the images using Kaniko and pushes them to the registry

func (*Builder) UpdateBuildStatus

func (b *Builder) UpdateBuildStatus(imageName string, data BuildStatusData) error

type BuilderOptions

type BuilderOptions struct {
	DockerfilePath string       `json:"dockerfile_path"`
	Git            GitOptions   `json:"git_options"`
	CustomPlatform string       `json:"custom_platform"`
	Image          ImageOptions `json:"image"`
	BuildArgs      []string     `json:"build_args"`
}

func (BuilderOptions) MarshalBinary

func (b BuilderOptions) MarshalBinary() ([]byte, error)

func (*BuilderOptions) UnmarshalBinary

func (b *BuilderOptions) UnmarshalBinary(data []byte) error

type CatchLogsHook

type CatchLogsHook struct {
	Logs *bytes.Buffer
	// contains filtered or unexported fields
}

func NewCatchLogsHook

func NewCatchLogsHook() *CatchLogsHook

func (*CatchLogsHook) Fire

func (h *CatchLogsHook) Fire(entry *logrus.Entry) error

Fire is triggered when a log event is fired

func (*CatchLogsHook) Levels

func (h *CatchLogsHook) Levels() []logrus.Level

func (*CatchLogsHook) StreamNewLogs

func (h *CatchLogsHook) StreamNewLogs() (chan string, func())

StreamNewLogs continuously streams new logs since the last read position

type GitOptions

type GitOptions struct {
	URL               string `json:"url"`
	Branch            string `json:"branch"`
	SingleBranch      bool   `json:"single_branch"`
	RecurseSubmodules bool   `json:"recurse_submodules"`
}

type ImageOptions

type ImageOptions struct {
	Prefix string `json:"prefix"`
	Name   string `json:"name"`
	Tag    string `json:"tag"`

	// TODO: add support for multiple destinations with credentials for future
	Destination string `json:"destination"` // Where to push the image
}

type Kaniko

type Kaniko struct{}

func (*Kaniko) DoBuild

func (k *Kaniko) DoBuild(opts *config.KanikoOptions) (v1.Image, error)

func (*Kaniko) DoPush

func (k *Kaniko) DoPush(image v1.Image, opts *config.KanikoOptions) error

func (*Kaniko) GetBuildContext

func (k *Kaniko) GetBuildContext(srcContext string, opts buildcontext.BuildOptions) (buildcontext.BuildContext, error)

type KanikoInterface

type KanikoInterface interface {
	GetBuildContext(srcContext string, opts buildcontext.BuildOptions) (buildcontext.BuildContext, error)
	DoBuild(opts *config.KanikoOptions) (v1.Image, error)
	DoPush(image v1.Image, opts *config.KanikoOptions) error
}

Jump to

Keyboard shortcuts

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